本文整理汇总了C#中System.IO.PacketReader.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadUInt32方法的具体用法?C# PacketReader.ReadUInt32怎么用?C# PacketReader.ReadUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCompressedGump
private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
{
p.MoveToData();
uint sender = p.ReadUInt32();
uint id = p.ReadUInt32();
if (id == responseID)
_responseSender = sender;
if (id != compressedID)
return;
p.Seek(19, SeekOrigin.Begin);
p.Seek(p.ReadInt32(), SeekOrigin.Current);
int lines = p.ReadInt32(), cLen = p.ReadInt32(), dLen = p.ReadInt32();
if (cLen < 5)
return;
byte[] buffer = new byte[dLen];
ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
string afk = string.Empty;
for (int i = 0, pos = 0; i < lines; i++)
{
int strLen = (buffer[pos++] << 8) | buffer[pos++];
string str = Encoding.BigEndianUnicode.GetString(buffer, pos, strLen * 2);
int index = str.IndexOf('>');
if (index != -1 && index < str.Length - 1)
afk += str[index + 1].ToString().ToUpper().Normalize(NormalizationForm.FormD)[0];
pos += strLen * 2;
}
afk = afk.Trim();
if (afk.Length == 5 && _responseSender != 0)
{
/*ClientCommunication.SendToClient(new CloseGump(responseID));
WorldEx.SendToServer(new GumpResponse(responseSender, responseID, 0x310, new int[0], new[] { new GumpTextEntry(0x310, afk) }));
responseSender = 0;*/
WorldEx.OverHeadMessage(afk);
}
}
示例2: OnHuedEffect
private static void OnHuedEffect(PacketReader p, PacketHandlerEventArgs args)
{
byte type = p.ReadByte();
Serial src = p.ReadUInt32();
Serial dest = p.ReadUInt32();
ItemID itemID = p.ReadUInt16();
p.Seek(10, SeekOrigin.Current);
byte speed = p.ReadByte();
byte count = p.ReadByte();
p.ReadUInt32();
uint hue = p.ReadUInt32();
uint mode = p.ReadUInt32();
Handle(huedEffect, args, type, src, dest, itemID, speed, count, hue, mode);
}
示例3: ClientDoubleClick
private static void ClientDoubleClick(PacketReader p, PacketHandlerEventArgs args)
{
Serial serial = p.ReadUInt32();
if (items.ContainsKey(serial))
{
args.Block = true;
WorldEx.SendToServer(new DoubleClick(items[serial].List.Last()));
}
else
args.Block = PacketHandler.ProcessViewers(clientDoubleClick, p);
}
示例4: HandlePacket
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
if (context.Character == null)
return;
var reader = new PacketReader(data, position, size);
reader.BaseStream.Seek(0xC, SeekOrigin.Begin);
var channel = reader.ReadUInt32();
var message = reader.ReadUtf16(0x9D3F, 0x44);
if (message.StartsWith(PolarisApp.Config.CommandPrefix))
{
var valid = false;
// Iterate commands
foreach (var command in PolarisApp.ConsoleSystem.Commands)
{
var full = message.Substring(1); // Strip the command chars
var args = full.Split(' ');
if (command.Names.Any(name => args[0].ToLower() == name.ToLower()))
{
command.Run(args, args.Length, full, context);
valid = true;
Logger.WriteCommand(null, "[CMD] {0} issued command {1}", context.User.Username, full);
}
if (valid)
break;
}
if (!valid)
Logger.WriteClient(context, "[CMD] {0} - Command not found", message.Split(' ')[0].Trim('\r'));
}
else
{
Logger.Write("[CHT] <{0}> <{1}>", context.Character.Name, message);
var writer = new PacketWriter();
writer.WritePlayerHeader((uint) context.User.PlayerId);
writer.Write(channel);
writer.WriteUtf16(message, 0x9D3F, 0x44);
data = writer.ToArray();
foreach (var c in Server.Instance.Clients)
{
if (c.Character == null || c.CurrentZone != context.CurrentZone)
continue;
c.SendPacket(0x07, 0x00, 0x44, data);
}
}
}
示例5: OnCompressedGump
private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
{
p.Seek(7, SeekOrigin.Begin);
if (p.ReadUInt32() != 0x1105B263)
return;
p.Seek(19, SeekOrigin.Begin);
p.Seek(p.ReadInt32() + 4, SeekOrigin.Current);
int cLen = p.ReadInt32(), dLen = p.ReadInt32();
byte[] buffer = new byte[dLen];
ZLib.uncompress(buffer, ref dLen, p.CopyBytes(p.Position, cLen - 4), cLen - 4);
int strLen = (buffer[0] << 8) | buffer[1];
string[] str = Encoding.BigEndianUnicode.GetString(buffer, 2, strLen * 2).Split(',');
string[] lat = str[0].Split('°');
int yLat = int.Parse(lat[0]);
int yMins = int.Parse(lat[1].Split('\'')[0]);
bool ySouth = lat[1][lat[1].Length - 1] == 'S';
string[] lon = str[1].Split('°');
int xLong = int.Parse(lon[0]);
int xMins = int.Parse(lon[1].Split('\'')[0]);
bool xEast = lon[1][lon[1].Length - 1] == 'E';
const int xWidth = 5120;
const int yHeight = 4096;
const int xCenter = 1323;
const int yCenter = 1624;
double absLong = xLong + ((double)xMins / 60);
double absLat = yLat + ((double)yMins / 60);
if (!xEast)
absLong = 360.0 - absLong;
if (!ySouth)
absLat = 360.0 - absLat;
int x = xCenter + (int)((absLong * xWidth) / 360);
int y = yCenter + (int)((absLat * yHeight) / 360);
if (x < 0)
x += xWidth;
else if (x >= xWidth)
x -= xWidth;
if (y < 0)
y += yHeight;
else if (y >= yHeight)
y -= yHeight;
onGump(x, y);
}
示例6: EquipmentUpdate
private static void EquipmentUpdate( PacketReader p )
{
Serial serial = p.ReadUInt32();
Item i = World.FindItem( serial );
if ( i == null )
{
World.AddItem( i=new Item( serial ) );
Item.UpdateContainers();
}
if ( World.Player != null && World.Player.Holding == i )
World.Player.Holding = null;
ushort iid = p.ReadUInt16();
i.ItemID = (ushort)(iid + p.ReadSByte()); // signed, itemID offset
i.Layer = p.ReadByte();
Serial ser = p.ReadUInt32();// cont must be set after hue (for counters)
i.Hue = p.ReadUInt16();
i.Container = ser;
}
示例7: HandlePacket
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
PacketReader reader = new PacketReader(data);
reader.ReadUInt64(); // Skip 8 bytes
if(reader.ReadUInt32() != 0x10)
{
Logger.WriteWarning("[WRN] Packet 0x3 0x34's first value was not 0x10! Investigate.");
}
uint partOfLobby = reader.ReadUInt32();
PSOLocation destination;
if(partOfLobby == 0) // Gate area
{
destination = new PSOLocation(0f, 1f, 0f, 0f, -0.22f, 2.4f, 198.75f);
}
else // Shop area
{
destination = new PSOLocation(0f, 1f, 0f, 20f, 0.20f, 1.23f, -175.25f);
}
Map lobbyMap = ZoneManager.Instance.MapFromInstance("lobby", "lobby");
lobbyMap.SpawnClient(context, destination, "lobby");
}
示例8: EquipRequest
private static void EquipRequest( PacketReader p, PacketHandlerEventArgs args )
{
Serial iser = p.ReadUInt32(); // item being dropped serial
Layer layer = (Layer)p.ReadByte();
Serial mser = p.ReadUInt32();
Item item = World.FindItem( iser );
if ( MacroManager.AcceptActions )
{
if ( layer == Layer.Invalid || layer > Layer.LastValid )
{
if ( item != null )
{
layer = item.Layer;
if ( layer == Layer.Invalid || layer > Layer.LastValid )
layer = (Layer)item.ItemID.ItemData.Quality;
}
}
if ( layer > Layer.Invalid && layer <= Layer.LastUserValid )
MacroManager.Action( new DropAction( mser, Point3D.Zero, layer ) );
}
if ( item == null )
return;
Mobile m = World.FindMobile( mser );
if ( m == null )
return;
if ( Config.GetBool( "QueueActions" ) )
args.Block = DragDropManager.Drop( item, m, layer );
}
示例9: DeathAnimation
private static void DeathAnimation( PacketReader p, PacketHandlerEventArgs args )
{
Serial killed = p.ReadUInt32();
if ( Config.GetBool( "AutoCap" ) )
{
Mobile m = World.FindMobile( killed );
if ( m != null && ( ( m.Body >= 0x0190 && m.Body <= 0x0193 ) || ( m.Body >= 0x025D && m.Body <= 0x0260 ) ) && Utility.Distance( World.Player.Position, m.Position ) <= 12 )
ScreenCapManager.DeathCapture();
}
}
示例10: CompressedGump
private static void CompressedGump( PacketReader p, PacketHandlerEventArgs args )
{
if ( World.Player != null )
{
World.Player.CurrentGumpS = p.ReadUInt32();
World.Player.CurrentGumpI = p.ReadUInt32();
}
/*try
{
int x = p.ReadInt32(), y = p.ReadInt32();
string layout = p.GetCompressedReader().ReadString();
int numStrings = p.ReadInt32();
if ( numStrings < 0 || numStrings > 256 )
numStrings = 0;
ArrayList strings = new ArrayList( numStrings );
PacketReader pComp = p.GetCompressedReader();
int len = 0;
while ( !pComp.AtEnd && (len=pComp.ReadInt16()) > 0 )
strings.Add( pComp.ReadUnicodeString( len ) );
}
catch
{
}*/
if ( Macros.MacroManager.AcceptActions && MacroManager.Action( new WaitForGumpAction( World.Player.CurrentGumpI ) ) )
args.Block = true;
// ZIPPY REV 80
// ClientCommunication.ForwardPacket( p.Pointer, p.Length );
}
示例11: ClientGumpResponse
private static void ClientGumpResponse( PacketReader p, PacketHandlerEventArgs args )
{
if ( World.Player == null )
return;
Serial ser = p.ReadUInt32();
uint tid = p.ReadUInt32();
int bid = p.ReadInt32();
World.Player.HasGump = false;
int sc = p.ReadInt32();
if ( sc < 0 || sc > 2000 )
return;
int[] switches = new int[sc];
for(int i=0;i<sc;i++)
switches[i] = p.ReadInt32();
int ec = p.ReadInt32();
if ( ec < 0 || ec > 2000 )
return;
GumpTextEntry[] entries = new GumpTextEntry[ec];
for(int i=0;i<ec;i++)
{
ushort id = p.ReadUInt16();
ushort len = p.ReadUInt16();
if ( len >= 240 )
return;
string text = p.ReadUnicodeStringSafe( len );
entries[i] = new GumpTextEntry( id, text );
}
if ( Macros.MacroManager.AcceptActions )
MacroManager.Action( new GumpResponseAction( bid, switches, entries ) );
}
示例12: ClientDoubleClick
private static void ClientDoubleClick( PacketReader p, PacketHandlerEventArgs args )
{
Serial ser = p.ReadUInt32();
if ( Config.GetBool( "BlockDismount" ) && World.Player != null && ser == World.Player.Serial && World.Player.Warmode && World.Player.GetItemOnLayer( Layer.Mount ) != null )
{ // mount layer = 0x19
World.Player.SendMessage( LocString.DismountBlocked );
args.Block = true;
return;
}
if ( Config.GetBool( "QueueActions" ) )
args.Block = !PlayerData.DoubleClick( ser, false );
if ( Macros.MacroManager.AcceptActions )
{
ushort gfx = 0;
if ( ser.IsItem )
{
Item i = World.FindItem( ser );
if ( i != null )
gfx = i.ItemID;
}
else
{
Mobile m = World.FindMobile( ser );
if ( m != null )
gfx = m.Body;
}
if ( gfx != 0 )
MacroManager.Action( new DoubleClickAction( ser, gfx ) );
}
}
示例13: WorldItem
private static void WorldItem( PacketReader p, PacketHandlerEventArgs args )
{
Item item;
uint serial = p.ReadUInt32();
item = World.FindItem( serial&0x7FFFFFFF );
bool isNew = false;
if ( item == null )
{
World.AddItem( item=new Item( serial&0x7FFFFFFF ) );
isNew = true;
}
else
{
item.CancelRemove();
}
if ( !DragDropManager.EndHolding( serial ) )
return;
item.Container = null;
Counter.Uncount( item );
ushort itemID = p.ReadUInt16();
item.ItemID = (ushort)(itemID&0x7FFF);
if ( (serial & 0x80000000) != 0 )
item.Amount = p.ReadUInt16();
else
item.Amount = 1;
if ( (itemID & 0x8000) != 0 )
item.ItemID = (ushort)(item.ItemID + p.ReadSByte());
ushort x = p.ReadUInt16();
ushort y = p.ReadUInt16();
if ( (x & 0x8000) != 0 )
item.Direction = p.ReadByte();
else
item.Direction = 0;
short z = p.ReadSByte();
item.Position = new Point3D( x&0x7FFF, y&0x3FFF, z );
if ( ( y & 0x8000 ) != 0 )
item.Hue = p.ReadUInt16();
else
item.Hue = 0;
byte flags = 0;
if ( ( y & 0x4000 ) != 0 )
flags = p.ReadByte();
item.ProcessPacketFlags( flags );
if ( isNew && World.Player != null )
{
if ( item.ItemID == 0x2006 )// corpse itemid = 0x2006
{
if ( Config.GetBool( "ShowCorpseNames" ) )
ClientCommunication.SendToServer( new SingleClick( item ) );
if ( Config.GetBool( "AutoOpenCorpses" ) && Utility.InRange( item.Position, World.Player.Position, Config.GetInt( "CorpseRange" ) ) && World.Player != null && World.Player.Visible )
PlayerData.DoubleClick( item ) ;
}
else if ( item.IsMulti )
{
ClientCommunication.PostAddMulti( item.ItemID, item.Position );
}
else
{
ScavengerAgent s = ScavengerAgent.Instance;
int dist = Utility.Distance( item.GetWorldPosition(), World.Player.Position );
if ( !World.Player.IsGhost && World.Player.Visible && dist <= 2 && s.Enabled && item.Movable )
s.Scavenge( item );
}
}
Item.UpdateContainers();
}
示例14: OnPartyMessage
private static void OnPartyMessage( PacketReader p, PacketHandlerEventArgs args )
{
switch ( p.ReadByte() )
{
case 0x01: // List
{
m_Party.Clear();
int count = p.ReadByte();
for(int i=0;i<count;i++)
{
Serial s = p.ReadUInt32();
if ( World.Player == null || s != World.Player.Serial )
m_Party.Add( s );
}
break;
}
case 0x02: // Remove Member/Re-list
{
m_Party.Clear();
int count = p.ReadByte();
Serial remSerial = p.ReadUInt32(); // the serial of who was removed
if ( World.Player != null )
{
Mobile rem = World.FindMobile( remSerial );
if ( rem != null && !Utility.InRange( World.Player.Position, rem.Position, World.Player.VisRange ) )
rem.Remove();
}
for(int i=0;i<count;i++)
{
Serial s = p.ReadUInt32();
if ( World.Player == null || s != World.Player.Serial )
m_Party.Add( s );
}
break;
}
case 0x03: // text message
case 0x04: // 3 = private, 4 = public
{
//Serial from = p.ReadUInt32();
//string text = p.ReadUnicodeStringSafe();
break;
}
case 0x07: // party invite
{
//Serial leader = p.ReadUInt32();
PartyLeader = p.ReadUInt32();
if ( m_PartyDeclineTimer == null )
m_PartyDeclineTimer = Timer.DelayedCallback( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( PartyAutoDecline ) );
m_PartyDeclineTimer.Start();
break;
}
}
if (Engine.MainWindow.MapWindow != null)
Engine.MainWindow.MapWindow.UpdateMap();
}
示例15: NewMobileStatus
private static void NewMobileStatus( PacketReader p, PacketHandlerEventArgs args )
{
Mobile m = World.FindMobile( (Serial)p.ReadUInt32() );
if ( m == null )
return;
UseNewStatus = true;
// 00 01
p.ReadUInt16();
// 00 01 Poison
// 00 02 Yellow Health Bar
ushort id = p.ReadUInt16();
// 00 Off
// 01 On
// For Poison: Poison Level + 1
byte flag = p.ReadByte();
if ( id == 1 ) {
bool wasPoisoned = m.Poisoned;
m.Poisoned = ( flag != 0 );
if ( m == World.Player && wasPoisoned != m.Poisoned )
ClientCommunication.RequestTitlebarUpdate();
}
}