本文整理汇总了C#中WowPacketParser.Misc.Packet.CanRead方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.CanRead方法的具体用法?C# Packet.CanRead怎么用?C# Packet.CanRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WowPacketParser.Misc.Packet
的用法示例。
在下文中一共展示了Packet.CanRead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleAuraUpdate
public static void HandleAuraUpdate(Packet packet)
{
var guid = packet.ReadPackedGuid("GUID");
var auras = new List<Aura>();
while (packet.CanRead())
{
var aura = ReadAuraUpdateBlock(ref packet);
auras.Add(aura);
}
// This only works if the parser saw UPDATE_OBJECT before this packet
if (Storage.Objects.ContainsKey(guid))
{
var unit = Storage.Objects[guid] as Unit;
if (unit != null)
{
// If this is the first packet that sends auras
// (hopefully at spawn time) add it to the "Auras" field,
// if not create another row of auras in AddedAuras
// (similar to ChangedUpdateFields)
if (unit.Auras == null)
unit.Auras = auras;
else if (unit.AddedAuras == null)
unit.AddedAuras = new List<List<Aura>> { auras };
else
unit.AddedAuras.Add(auras);
}
}
}
示例2: HandleContactList
public static void HandleContactList(Packet packet)
{
packet.ReadInt32E<ContactListFlag>("List Flags");
var count = packet.ReadInt32("Count");
for (var i = 0; i < count; i++)
{
packet.ReadGuid("GUID");
packet.ReadInt32("Realm Id");
packet.ReadInt32("Realm Id");
var flag = packet.ReadInt32E<ContactEntryFlag>("Flags");
packet.ReadCString("Note");
if (!flag.HasAnyFlag(ContactEntryFlag.Friend))
continue;
var status = packet.ReadByteE<ContactStatus>("Status");
if (status == 0) // required any flag
continue;
packet.ReadInt32<AreaId>("Area");
packet.ReadInt32("Level");
packet.ReadInt32E<Class>("Class");
}
// still needed?
if (packet.CanRead())
CoreParsers.WardenHandler.ReadCheatCheckDecryptionBlock(packet);
}
示例3: HandleContactList
public static void HandleContactList(Packet packet)
{
packet.ReadEnum<ContactListFlag>("List Flags", TypeCode.Int32);
var count = packet.ReadInt32("Count");
for (var i = 0; i < count; i++)
{
packet.ReadGuid("GUID");
packet.ReadInt32("Unk int1");
packet.ReadInt32("Unk int2");
var flag = packet.ReadEnum<ContactEntryFlag>("Flags", TypeCode.Int32);
packet.ReadCString("Note");
if (!flag.HasAnyFlag(ContactEntryFlag.Friend))
continue;
var status = packet.ReadEnum<ContactStatus>("Status", TypeCode.Byte);
if (status == 0) // required any flag
continue;
packet.ReadEntry<Int32>(StoreNameType.Area, "Area");
packet.ReadInt32("Level");
packet.ReadEnum<Class>("Class", TypeCode.Int32);
}
// still needed?
if (packet.CanRead())
CoreParsers.WardenHandler.ReadCheatCheckDecryptionBlock(ref packet);
}
示例4: HandleAuraUpdate
public static void HandleAuraUpdate(Packet packet)
{
var guid = packet.ReadPackedGuid("GUID");
var i = 0;
var auras = new List<Aura>();
while (packet.CanRead())
{
Aura aura;
if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_0_5_16048))
aura = ReadAuraUpdateBlock505(packet, i++);
else
aura = ReadAuraUpdateBlock(packet, i++);
if (aura != null)
auras.Add(aura);
}
// This only works if the parser saw UPDATE_OBJECT before this packet
if (Storage.Objects.ContainsKey(guid))
{
var unit = Storage.Objects[guid].Item1 as Unit;
if (unit != null)
{
// If this is the first packet that sends auras
// (hopefully at spawn time) add it to the "Auras" field,
// if not create another row of auras in AddedAuras
// (similar to ChangedUpdateFields)
if (unit.Auras == null)
unit.Auras = auras;
else
unit.AddedAuras.Add(auras);
}
}
}
示例5: HandleShowTaxiNodes
public static void HandleShowTaxiNodes(Packet packet)
{
packet.ReadUInt32("Unk UInt32 1");
packet.ReadGuid("GUID");
packet.ReadUInt32("Node ID");
var i = 0;
while (packet.CanRead())
packet.ReadUInt32("NodeMask", i++);
}
示例6: HandleNpcGossipSelectOption
public static void HandleNpcGossipSelectOption(Packet packet)
{
packet.ReadGuid("GUID");
packet.ReadUInt32("Menu Id");
packet.ReadUInt32("Gossip Id");
if (packet.CanRead()) // if ( byte_F3777C[v3] & 1 )
packet.ReadCString("Box Text");
}
示例7: HandleArenaTeamEvent
public static void HandleArenaTeamEvent(Packet packet)
{
packet.ReadEnum<ArenaEvent>("Event", TypeCode.Byte);
var count = packet.ReadByte("Count");
for (var i = 0; i < count; ++i)
packet.ReadCString("Param", i);
if (packet.CanRead())
packet.ReadGuid("GUID");
}
示例8: HandleArenaTeamEvent
public static void HandleArenaTeamEvent(Packet packet)
{
packet.ReadByte("Event"); // FIXME: Use enum
var count = packet.ReadByte("Count");
for (var i = 0; i < count; ++i)
packet.ReadCString("Param", i);
if (packet.CanRead())
packet.ReadGuid("GUID");
}
示例9: HandleAuraUpdate
public static void HandleAuraUpdate(Packet packet)
{
packet.ReadPackedGuid("GUID");
/*var aura = new Aura(); */
while (packet.CanRead())
/*aura =*/
ReadAuraUpdateBlock(ref packet);
// TODO: Add this aura to a list of objects (searching by guid)
}
示例10: HandleInspectTalent
public static void HandleInspectTalent(Packet packet)
{
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6a_13623))
packet.ReadGuid("GUID");
else
packet.ReadPackedGuid("GUID");
if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_INSPECT_TALENT))
ReadTalentInfo(ref packet);
var slotMask = packet.ReadUInt32("Slot Mask");
var slot = 0;
while (slotMask > 0)
{
if ((slotMask & 0x1) > 0)
{
var name = "[" + (EquipmentSlotType)slot + "] ";
packet.ReadEntryWithName<UInt32>(StoreNameType.Item, name + "Item Entry");
var enchantMask = packet.ReadUInt16();
if (enchantMask > 0)
{
var enchantName = name + "Item Enchantments: ";
while (enchantMask > 0)
{
if ((enchantMask & 0x1) > 0)
{
enchantName += packet.ReadUInt16();
if (enchantMask > 1)
enchantName += ", ";
}
enchantMask >>= 1;
}
packet.WriteLine(enchantName);
}
packet.ReadUInt16(name + "Unk Uint16");
packet.ReadPackedGuid(name + "Creator GUID");
packet.ReadUInt32(name + "Unk Uint32");
}
++slot;
slotMask >>= 1;
}
if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_INSPECT_TALENT)
&& packet.CanRead()) // otherwise it would fail for players without a guild
{
packet.ReadGuid("Guild GUID");
packet.ReadUInt32("Guild Level");
packet.ReadUInt64("Guild Xp");
packet.ReadUInt32("Guild Members");
}
}
示例11: HandlePetActionFeedback
public static void HandlePetActionFeedback(Packet packet)
{
var state = packet.ReadEnum<PetFeedback>("Pet state", TypeCode.Byte);
switch (state)
{
case PetFeedback.NothingToAttack:
if (ClientVersion.AddedInVersion(ClientType.Cataclysm) || packet.CanRead())
packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Spell ID");
break;
case PetFeedback.CantAttackTarget:
if (ClientVersion.AddedInVersion(ClientType.Cataclysm))
packet.ReadInt32("Unk int32");
break;
}
}
示例12: HandlePetActionFeedback
public static void HandlePetActionFeedback(Packet packet)
{
var state = packet.ReadEnum<PetFeedback>("Pet state", TypeCode.Byte);
switch (state)
{
case PetFeedback.NothingToAttack:
if (ClientVersion.AddedInVersion(ClientType.Cataclysm) || packet.CanRead())
packet.ReadEntry<Int32>(StoreNameType.Spell, "Spell ID");
break;
case PetFeedback.CantAttackTarget:
if (ClientVersion.AddedInVersion(ClientType.Cataclysm))
packet.ReadEntry<Int32>(StoreNameType.Spell, "Spell ID"); // sub_8ADA60 2nd parameter is SpellID, check sub_8B22C0
break;
}
}
示例13: HandlePetActionFeedback
public static void HandlePetActionFeedback(Packet packet)
{
var state = packet.ReadByteE<PetFeedback>("Response");
switch (state)
{
case PetFeedback.NothingToAttack:
if (ClientVersion.AddedInVersion(ClientType.Cataclysm) || packet.CanRead())
packet.ReadInt32<SpellId>("SpellID");
break;
case PetFeedback.CantAttackTarget:
if (ClientVersion.AddedInVersion(ClientType.Cataclysm))
packet.ReadInt32<SpellId>("SpellID"); // sub_8ADA60 2nd parameter is SpellID, check sub_8B22C0
break;
}
}
示例14: HandleInspectTalent
public static void HandleInspectTalent(Packet packet)
{
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6a_13623))
packet.ReadGuid("GUID");
else
packet.ReadPackedGuid("GUID");
ReadTalentInfo(ref packet);
ReadInspectPart(ref packet);
if (packet.CanRead()) // otherwise it would fail for players without a guild
{
packet.ReadGuid("Guild GUID");
packet.ReadUInt32("Guild Level");
packet.ReadUInt64("Guild Xp");
packet.ReadUInt32("Guild Members");
}
}
示例15: HandleAuraUpdate
public static void HandleAuraUpdate(Packet packet)
{
Guid guid = packet.ReadPackedGuid("GUID");
/*Aura aura = null; */
while (packet.CanRead())
{
/*aura =*/
Aura aura = ReadAuraUpdateBlock(ref packet);
if (aura != null && guid.HasEntry() && guid.GetObjectType() == ObjectType.Unit)
{
if (packet.SniffFileInfo.Stuffing.auraPackets.ContainsKey(guid))
packet.SniffFileInfo.Stuffing.auraPackets[guid].auraPackets.Enqueue(new AuraPacket(packet.Time, packet.Number, aura));
else
packet.SniffFileInfo.Stuffing.auraPackets.TryAdd(guid, new AuraPackets(new AuraPacket(packet.Time, packet.Number, aura)));
}
// TODO: Add this aura to a list of objects (searching by guid)
}
}