本文整理汇总了C#中Assistant.PacketHandlerEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PacketHandlerEventArgs类的具体用法?C# PacketHandlerEventArgs怎么用?C# PacketHandlerEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PacketHandlerEventArgs类属于Assistant命名空间,在下文中一共展示了PacketHandlerEventArgs类的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: AsciiSpeech
public static void AsciiSpeech( Packet p, PacketHandlerEventArgs args )
{
// 0, 1, 2
Serial serial = p.ReadUInt32(); // 3, 4, 5, 6
ushort body = p.ReadUInt16(); // 7, 8
MessageType type = (MessageType)p.ReadByte(); // 9
ushort hue = p.ReadUInt16(); // 10, 11
ushort font = p.ReadUInt16();
string name = p.ReadStringSafe( 30 );
string text = p.ReadStringSafe();
if ( World.Player != null && serial == Serial.Zero && body == 0 && type == MessageType.Regular && hue == 0xFFFF && font == 0xFFFF && name == "SYSTEM" )
{
args.Block = true;
p.Seek( 3, SeekOrigin.Begin );
p.WriteAsciiFixed( "", (int)p.Length-3 );
ClientCommunication.DoFeatures( World.Player.Features ) ;
}
else
{
HandleSpeech( p, args, serial, body, type, hue, font, "A", name, text );
if ( !serial.IsValid )
BandageTimer.OnAsciiMessage( text );
}
}
示例3: OnFilter
public override void OnFilter( PacketReader p, PacketHandlerEventArgs args )
{
if ( args.Block )
return;
// 0, 1, 2
Serial serial = p.ReadUInt32(); // 3, 4, 5, 6
ushort body = p.ReadUInt16(); // 7, 8
MessageType type = (MessageType)p.ReadByte(); // 9
if ( type != m_Type )
return;
ushort hue = p.ReadUInt16(); // 10, 11
ushort font = p.ReadUInt16();
string name = p.ReadStringSafe( 30 );
string text = p.ReadStringSafe();
for(int i=0;i<m_Strings.Length;i++)
{
if ( text.IndexOf( m_Strings[i] ) != -1 )
{
args.Block = true;
return;
}
}
}
示例4: OnFilter
public override void OnFilter( PacketReader p, PacketHandlerEventArgs args )
{
uint serial = p.ReadUInt32();
ushort itemID = p.ReadUInt16();
if ( (serial & 0x80000000) != 0 )
p.ReadUInt16(); // amount
if ( (itemID & 0x8000) != 0 )
itemID = (ushort)((itemID&0x7FFF) + p.ReadSByte()); // itemID offset
ushort x = p.ReadUInt16();
ushort y = p.ReadUInt16();
if ( (x & 0x8000) != 0 )
p.ReadByte(); // direction
short z = p.ReadSByte();
if ( ( y & 0x8000 ) != 0 )
p.ReadUInt16(); // hue
bool visable = true;
if ( ( y & 0x4000 ) != 0 )
{
int flags = p.ReadByte();
visable = ( (flags&0x80) == 0 );
}
if ( IsStaffItem( itemID ) || !visable )
args.Block = true;
}
示例5: Handle
private static void Handle(Delegate del, PacketHandlerEventArgs args, params object[] parameters)
{
if (del != null)
foreach (Delegate d in del.GetInvocationList())
{
bool? result = (bool?)d.Method.Invoke(d.Target, parameters);
if (result.HasValue)
args.Block = result.Value;
}
}
示例6: OnASCIIMessage
private static void OnASCIIMessage(PacketReader p, PacketHandlerEventArgs args)
{
Serial serial = p.ReadUInt32();
ItemID graphic = p.ReadUInt16();
byte type = p.ReadByte();
ushort hue = p.ReadUInt16();
ushort font = p.ReadUInt16();
string name = p.ReadStringSafe(30);
string msg = p.ReadStringSafe().Trim();
Handle(asciiMessage, args, serial, graphic, type, hue, font, string.Empty, name, msg);
}
示例7: OnMessageLocalizedAffix
private static void OnMessageLocalizedAffix(PacketReader p, PacketHandlerEventArgs args)
{
Serial serial = p.ReadUInt32();
ItemID graphic = p.ReadUInt16();
byte type = p.ReadByte();
ushort hue = p.ReadUInt16();
ushort font = p.ReadUInt16();
int num = p.ReadInt32();
string name = p.ReadStringSafe(30);
Handle(localizedMessage, args, serial, graphic, type, hue, font, num, name, string.Empty);
}
示例8: OnCompressedGump
private static void OnCompressedGump(PacketReader p, PacketHandlerEventArgs e)
{
p.MoveToData();
uint sender = p.ReadUInt32();
uint id = p.ReadUInt32();
if (id == gumpID)
{
responseID = sender;
e.Block = enabled;
}
}
示例9: 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);
}
示例10: 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);
}
示例11: OnGumpResponse
private static void OnGumpResponse(Packet p, PacketHandlerEventArgs args)
{
p.ReadUInt32();
if (p.ReadUInt32() != gumpID)
return;
uint buttonID = p.ReadUInt32();
if ((buttonID - 2) % 6 == 0)
{
p.Seek(-4, SeekOrigin.Current);
p.Write(buttonID + (uint)ConfigEx.GetElement(TeleportType.Default, "RuneBook"));
}
}
示例12: ContainerContentUpdate2
private static void ContainerContentUpdate2(Packet p, PacketHandlerEventArgs args)
{
Serial serial = p.ReadUInt32();
Item item = World.FindItem(serial);
if (item != null && item.Container == World.Player.Backpack && item.IsContainer)
{
if (containers.ContainsKey(serial))
containers[serial] = item;
else
containers.Add(serial, item);
}
}
示例13: OnLocalizedMessage
private static void OnLocalizedMessage(PacketReader p, PacketHandlerEventArgs args)
{
Serial serial = p.ReadUInt32();
ItemID graphic = p.ReadUInt16();
byte type = p.ReadByte();
ushort hue = p.ReadUInt16();
ushort font = p.ReadUInt16();
int num = p.ReadInt32();
string name = p.ReadStringSafe(30);
string arguments = p.ReadUnicodeStringBE(((p.Length - 1) - p.Position) / 2);
Handle(localizedMessage, args, serial, graphic, type, hue, font, num, name, arguments);
}
示例14: OnFilter
public override void OnFilter( PacketReader p, PacketHandlerEventArgs args )
{
if ( ClientCommunication.AllowBit( FeatureBit.LightFilter ) )
{
args.Block = true;
if ( World.Player != null )
{
World.Player.LocalLightLevel = 0;
World.Player.GlobalLightLevel = 0;
}
}
}
示例15: 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);
}