當前位置: 首頁>>代碼示例>>C#>>正文


C# Packet.CanRead方法代碼示例

本文整理匯總了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);
                }
            }
        }
開發者ID:hodobaj,項目名稱:StrawberryTools,代碼行數:31,代碼來源:SpellHandler.cs

示例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);
        }
開發者ID:Oboltys,項目名稱:WowPacketParser,代碼行數:29,代碼來源:ContactHandler.cs

示例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);
        }
開發者ID:samaelsacred,項目名稱:WowPacketParser,代碼行數:29,代碼來源:ContactHandler.cs

示例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);
                }
            }
        }
開發者ID:horn,項目名稱:WowPacketParser,代碼行數:35,代碼來源:SpellHandler.cs

示例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++);
 }
開發者ID:Supabad,項目名稱:WowPacketParser,代碼行數:9,代碼來源:TaxiHandler.cs

示例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");
        }
開發者ID:Machiavell1,項目名稱:WowPacketParser,代碼行數:9,代碼來源:NpcHandler.cs

示例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");
        }
開發者ID:skypeak,項目名稱:WowPacketParser_SkyFire,代碼行數:10,代碼來源:BattlegroundHandler.cs

示例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");
        }
開發者ID:Asdcrew,項目名稱:WowPacketParser,代碼行數:10,代碼來源:BattlegroundHandler.cs

示例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)
        }
開發者ID:Supabad,項目名稱:WowPacketParser,代碼行數:10,代碼來源:SpellHandler.cs

示例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");
            }
        }
開發者ID:Kinzcool,項目名稱:WowPacketParser,代碼行數:51,代碼來源:TalentHandler.cs

示例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;
            }
        }
開發者ID:Chaplain,項目名稱:WowPacketParser,代碼行數:16,代碼來源:PetHandler.cs

示例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;
            }
        }
開發者ID:samaelsacred,項目名稱:WowPacketParser,代碼行數:16,代碼來源:PetHandler.cs

示例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;
            }
        }
開發者ID:Oboltys,項目名稱:WowPacketParser,代碼行數:16,代碼來源:PetHandler.cs

示例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");
            }
        }
開發者ID:rodrigoalv,項目名稱:WowPacketParser,代碼行數:18,代碼來源:TalentHandler.cs

示例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)
            }
        }
開發者ID:Asdcrew,項目名稱:WowPacketParser,代碼行數:20,代碼來源:SpellHandler.cs


注:本文中的WowPacketParser.Misc.Packet.CanRead方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。