当前位置: 首页>>代码示例>>C#>>正文


C# Guid.GetEntry方法代码示例

本文整理汇总了C#中WowPacketParser.Misc.Guid.GetEntry方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.GetEntry方法的具体用法?C# Guid.GetEntry怎么用?C# Guid.GetEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WowPacketParser.Misc.Guid的用法示例。


在下文中一共展示了Guid.GetEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckFilter

        public static bool CheckFilter(Guid guid)
        {
            var result = true;

            if (guid.HasEntry())
                result = CheckFilter(Utilities.ObjectTypeToStore(guid.GetObjectType()), (int)guid.GetEntry());

            return result;
        }
开发者ID:Asdcrew,项目名称:WowPacketParser,代码行数:9,代码来源:Filters.cs

示例2: HandlePetNameQuery

        public static void HandlePetNameQuery(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];

            guid2[1] = packet.ReadBit();
            guid1[5] = packet.ReadBit();
            guid2[3] = packet.ReadBit();
            guid1[0] = packet.ReadBit();
            guid1[3] = packet.ReadBit();
            guid2[4] = packet.ReadBit();
            guid1[1] = packet.ReadBit();
            guid1[4] = packet.ReadBit();
            guid2[0] = packet.ReadBit();
            guid2[7] = packet.ReadBit();
            guid1[6] = packet.ReadBit();
            guid1[7] = packet.ReadBit();
            guid1[2] = packet.ReadBit();
            guid2[5] = packet.ReadBit();
            guid2[2] = packet.ReadBit();
            guid2[6] = packet.ReadBit();

            packet.ReadXORByte(guid1, 1);
            packet.ReadXORByte(guid2, 5);
            packet.ReadXORByte(guid1, 5);
            packet.ReadXORByte(guid1, 4);
            packet.ReadXORByte(guid2, 1);
            packet.ReadXORByte(guid2, 7);
            packet.ReadXORByte(guid1, 7);
            packet.ReadXORByte(guid2, 4);
            packet.ReadXORByte(guid2, 2);
            packet.ReadXORByte(guid2, 0);
            packet.ReadXORByte(guid2, 6);
            packet.ReadXORByte(guid1, 6);
            packet.ReadXORByte(guid1, 0);
            packet.ReadXORByte(guid1, 3);
            packet.ReadXORByte(guid1, 2);
            packet.ReadXORByte(guid2, 3);

            packet.WriteGuid("Pet Guid", guid1);
            packet.WriteGuid("Pet Number", guid2);

            var PetGuid = new Guid(BitConverter.ToUInt64(guid1, 0));
            var PetNumberGuid = new Guid(BitConverter.ToUInt64(guid2, 0));
            var PetNumber = PetNumberGuid.GetEntry().ToString(CultureInfo.InvariantCulture); // Not sure about this.

            // Store temporary name from Pet Number GUID (will be retrieved as uint64 in SMSG_PET_NAME_QUERY_RESPONSE)
            StoreGetters.AddName(PetGuid, PetNumber);
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:49,代码来源:PetHandler.cs

示例3: HandleVendorInventoryList422

        public static void HandleVendorInventoryList422(Packet packet)
        {
            var npcVendor = new NpcVendor();
            var flags = packet.ReadEnum<UnknownFlags>("Unk Flags", TypeCode.Byte);

            ulong tmp = 0;

            if (flags.HasFlag(UnknownFlags.Unk5))
                tmp += ReadByte(ref packet, 2);

            var itemCount = packet.ReadUInt32("Item Count");

            if (flags.HasFlag(UnknownFlags.Unk8))
                tmp += ReadByte(ref packet, 5);

            if (flags.HasFlag(UnknownFlags.Unk2)) // Flag?
                tmp += ReadByte(ref packet, 0);

            if (flags.HasFlag(UnknownFlags.Unk3)) // Flag?
                tmp += ReadByte(ref packet, 1);

            if (flags.HasFlag(UnknownFlags.Unk6)) // Flag?
                ReadByte(ref packet, 3);

            if (flags.HasFlag(UnknownFlags.Unk1))
                tmp += ReadByte(ref packet, 4);

            if (flags.HasFlag(UnknownFlags.Unk7)) // Flag?
                tmp += ReadByte(ref packet, 7);

            if (!flags.HasFlag(UnknownFlags.Unk4)) // Flag?
                tmp += ReadByte(ref packet, 6);

            var guid = new Guid(tmp);
            packet.Writer.WriteLine("GUID: " + guid);

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (var i = 0; i < itemCount; i++)
            {
                var vendorItem = new VendorItem();

                packet.ReadInt32("Max Durability", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);
                vendorItem.ItemId = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Item ID", i);
                packet.ReadInt32("Unk Int32 1", i);
                packet.ReadInt32("Display ID", i);
                vendorItem.MaxCount = packet.ReadInt32("Max Count", i);
                vendorItem.BuyCount = packet.ReadUInt32("Buy Count", i);
                vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);
                packet.ReadInt32("Unk Int32 2", i);
                packet.ReadInt32("Price", i);

                npcVendor.VendorItems.Add(vendorItem);
            }

            Stuffing.NpcVendors.TryAdd(guid.GetEntry(), npcVendor);
        }
开发者ID:Supabad,项目名称:WowPacketParser,代码行数:57,代码来源:NpcHandler.cs

示例4: HandleVendorInventoryList

        public static void HandleVendorInventoryList(Packet packet)
        {
            var npcVendor = new NpcVendor();

            var guid = new byte[8];

            guid[5] = packet.ReadBit();
            var itemCount = packet.ReadBits(18);
            guid[0] = packet.ReadBit();
            guid[2] = packet.ReadBit();

            var hasExtendedCost = new bool[itemCount];
            var hasCondition = new bool[itemCount];

            for (int i = 0; i < itemCount; ++i)
            {
                packet.ReadBit("Unk bit", i);
                hasExtendedCost[i] = !packet.ReadBit();
                hasCondition[i] = !packet.ReadBit();
            }

            packet.StartBitStream(guid, 3, 7, 1, 6, 4);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 1);

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (int i = 0; i < itemCount; ++i)
            {
                var vendorItem = new VendorItem();

                var maxCount = packet.ReadInt32("Max Count", i);
                vendorItem.Type = packet.ReadUInt32("Type", i); // 1 - item, 2 - currency

                if (hasCondition[i])
                    packet.ReadInt32("Condition ID", i);

                packet.ReadInt32("Max Durability", i);
                packet.ReadInt32("Item Upgrade ID", i);
                packet.ReadInt32("Price", i);
                packet.ReadInt32("Display ID", i);
                vendorItem.ItemId = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Item ID", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);

                if (hasExtendedCost[i])
                    vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);

                var buyCount = packet.ReadUInt32("Buy Count", i);

                vendorItem.MaxCount = maxCount == -1 ? 0 : maxCount; // TDB
                if (vendorItem.Type == 2)
                    vendorItem.MaxCount = (int)buyCount;

                npcVendor.VendorItems.Add(vendorItem);
            }

            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 7);
            packet.ReadXORByte(guid, 4);
            packet.ReadByte("Byte10");
            packet.ReadXORByte(guid, 0);
            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 3);

            packet.WriteGuid("Guid", guid);

            var vendorGUID = new Guid(BitConverter.ToUInt64(guid, 0));
            Storage.NpcVendors.Add(vendorGUID.GetEntry(), npcVendor, packet.TimeSpan);
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:68,代码来源:NpcHandler.cs

示例5: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var guid = new byte[8];
            uint[] titleLen;
            uint[] OptionTextLen;
            uint[] BoxTextLen;

            var menuId = packet.ReadUInt32("Menu Id");
            packet.ReadUInt32("Friendship Faction");
            var textId = packet.ReadUInt32("Text Id");
            packet.StartBitStream(guid, 0, 1);
            var AmountOfOptions = packet.ReadBits("Amount of Options", 20);
            packet.StartBitStream(guid, 6, 7);

            OptionTextLen = new uint[AmountOfOptions];
            BoxTextLen = new uint[AmountOfOptions];
            for (var i = 0; i < AmountOfOptions; ++i)
            {
                OptionTextLen[i] = packet.ReadBits(12);
                BoxTextLen[i] = packet.ReadBits(12);
            }
            packet.StartBitStream(guid, 4, 3, 2);

            var questgossips = packet.ReadBits("Amount of Quest gossips", 19);

            titleLen = new uint[questgossips];
            for (var i = 0; i < questgossips; ++i)
            {
                titleLen[i] = packet.ReadBits(9);
                packet.ReadBit("Change Icon", i);
            }
            guid[5] = packet.ReadBit();
            packet.ResetBitReader();

            for (var i = 0; i < questgossips; i++)
            {
                packet.ReadEnum<QuestFlags2>("Flags 2", TypeCode.UInt32, i);
                packet.ReadUInt32("Icon", i);
                packet.ReadWoWString("Title", titleLen[i], i);
                packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32, i);
                packet.ReadInt32("Level", i);
                packet.ReadEntryWithName<UInt32>(StoreNameType.Quest, "Quest ID", i);
            }

            var gossip = new Gossip();

            gossip.GossipOptions = new List<GossipOption>((int)AmountOfOptions);
            for (var i = 0; i < AmountOfOptions; ++i)
            {
                var gossipOption = new GossipOption
                {
                    RequiredMoney = packet.ReadUInt32("Required money", i),
                    Index = packet.ReadUInt32("Index", i),
                    BoxText = packet.ReadWoWString("Box Text", BoxTextLen[i], i),
                    Box = packet.ReadBoolean("Box", i),
                    OptionText = packet.ReadWoWString("Text", OptionTextLen[i], i),
                    OptionIcon = packet.ReadEnum<GossipOptionIcon>("Icon", TypeCode.Byte, i),
                };

                gossip.GossipOptions.Add(gossipOption);
            }

            packet.ParseBitStream(guid, 3, 4, 7, 2, 1, 6, 0, 5);
            packet.WriteGuid("GUID", guid);

            var GUID = new Guid(BitConverter.ToUInt64(guid, 0));
            gossip.ObjectType = GUID.GetObjectType();
            gossip.ObjectEntry = GUID.GetEntry();

            if (Storage.Gossips.ContainsKey(Tuple.Create(menuId, textId)))
            {
                var oldGossipOptions = Storage.Gossips[Tuple.Create(menuId, textId)];
                if (oldGossipOptions != null)
                {
                    foreach (var gossipOptions in gossip.GossipOptions)
                        oldGossipOptions.Item1.GossipOptions.Add(gossipOptions);
                }
            }
            else
                Storage.Gossips.Add(Tuple.Create(menuId, textId), gossip, packet.TimeSpan);

            packet.AddSniffData(StoreNameType.Gossip, (int)menuId, GUID.GetEntry().ToString(CultureInfo.InvariantCulture));
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:83,代码来源:NpcHandler.cs

示例6: HandleVendorInventoryList

        public static void HandleVendorInventoryList(Packet packet)
        {
            var npcVendor = new NpcVendor();

            var guid = new byte[8];

            guid[5] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[1] = packet.ReadBit();
            guid[3] = packet.ReadBit();
            guid[6] = packet.ReadBit();

            var itemCount = packet.ReadBits(18);

            var unkBit = new uint[itemCount];
            var hasExtendedCost = new bool[itemCount];
            var hasCondition = new bool[itemCount];

            for (var i = 0; i < itemCount; ++i)
            {
                unkBit[i] = packet.ReadBit();
                hasExtendedCost[i] = !packet.ReadBit(); // +44
                hasCondition[i] = !packet.ReadBit(); // +36
            }

            guid[4] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[2] = packet.ReadBit();

            packet.ReadByte("Byte10");

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (var i = 0; i < itemCount; ++i)
            {
                var vendorItem = new VendorItem();

                packet.WriteLine("[{0}] unkBit: {1}", i, unkBit[i]);

                packet.ReadInt32("Max Durability", i);   // +16
                packet.ReadInt32("Price", i);   // +20
                vendorItem.Type = packet.ReadUInt32("Type", i);    // +4
                var maxCount = packet.ReadInt32("Max Count", i);     // +24
                packet.ReadInt32("Display ID", i);    // +12
                var buyCount = packet.ReadUInt32("Buy Count", i);    // +28

                vendorItem.ItemId = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Item ID", i);   // +8

                if (hasExtendedCost[i])
                    vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);    // +36

                packet.ReadInt32("Item Upgrade ID", i);   // +32

                if (hasCondition[i])
                    packet.ReadInt32("Condition ID", i);    // +40

                vendorItem.Slot = packet.ReadUInt32("Item Position", i);    // +0

                npcVendor.VendorItems.Add(vendorItem);
            }

            packet.ParseBitStream(guid, 3, 7, 0, 6, 2, 1, 4, 5);

            packet.WriteGuid("Guid", guid);

            var vendorGUID = new Guid(BitConverter.ToUInt64(guid, 0));
            Storage.NpcVendors.Add(vendorGUID.GetEntry(), npcVendor, packet.TimeSpan);
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:67,代码来源:NpcHandler.cs

示例7: HandleServerTrainerList

        public static void HandleServerTrainerList(Packet packet)
        {
            var npcTrainer = new NpcTrainer();

            var count = packet.ReadBits("Count", 19);

            var guid = new byte[8];

            guid[3] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[1] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            var size = packet.ReadBits("Title size", 11);
            guid[6] = packet.ReadBit();
            guid[4] = packet.ReadBit();

            //npcTrainer.Type = packet.ReadEnum<TrainerType>("Type", TypeCode.Int32);

            packet.ReadXORByte(guid, 3);

            npcTrainer.TrainerSpells = new List<TrainerSpell>((Int32)count);

            for (var i = 0; i < count; ++i)
            {
                var trainerSpell = new TrainerSpell();

                packet.ReadEnum<TrainerSpellState>("State", TypeCode.Byte, i);

                trainerSpell.Spell = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Spell ID", i);

                trainerSpell.RequiredSkill = packet.ReadUInt32("Required Skill", i);
                trainerSpell.Cost = packet.ReadUInt32("Cost", i);
                packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Chain Spell ID", i, 0);
                packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Chain Spell ID", i, 1);
                packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Chain Spell ID", i, 2);
                trainerSpell.RequiredLevel = packet.ReadByte("Required Level", i);
                trainerSpell.RequiredSkillLevel = packet.ReadUInt32("Required Skill Level", i);

                npcTrainer.TrainerSpells.Add(trainerSpell);
            }

            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 0);

            npcTrainer.Title = packet.ReadWoWString("Title", size);
            npcTrainer.Type = packet.ReadEnum<TrainerType>("Type", TypeCode.Int32);

            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 4);
            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 7);

            packet.ReadInt32("unk1");

            var guiD = new Guid(BitConverter.ToUInt64(guid, 0));

            Storage.NpcTrainers.Add(guiD.GetEntry(), npcTrainer, packet.TimeSpan);
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:61,代码来源:NpcHandler.cs

示例8: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
        {
            var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
            packet.WriteLine("Pos: " + packet.Position);
            packet.ResetBitReader();
            var moves = ReadMovementUpdateBlock548(ref packet, guid, index);
            packet.WriteLine("Pos: " + packet.Position);
            packet.ResetBitReader();
            var updates = CoreParsers.UpdateHandler.ReadValuesUpdateBlock(ref packet, objType, index, true);

            WoWObject obj;
            switch (objType)
            {
                case ObjectType.Unit:
                    obj = new Unit();
                    break;
                case ObjectType.GameObject:
                    obj = new GameObject();
                    break;
                case ObjectType.Item:
                    obj = new Item();
                    break;
                case ObjectType.Player:
                    obj = new Player();
                    break;
                default:
                    obj = new WoWObject();
                    break;
            }

            obj.Type = objType;
            obj.Movement = moves;
            obj.UpdateFields = updates;
            obj.Map = map;
            obj.Area = CoreParsers.WorldStateHandler.CurrentAreaId;
            obj.PhaseMask = (uint)CoreParsers.MovementHandler.CurrentPhaseMask;

            // If this is the second time we see the same object (same guid,
            // same position) update its phasemask
            if (Storage.Objects.ContainsKey(guid))
            {
                var existObj = Storage.Objects[guid].Item1;
                CoreParsers.UpdateHandler.ProcessExistingObject(ref existObj, obj, guid); // can't do "ref Storage.Objects[guid].Item1 directly
            }
            else
                Storage.Objects.Add(guid, obj, packet.TimeSpan);

            if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
                packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
        }
开发者ID:nelegalno,项目名称:WowPacketParser,代码行数:50,代码来源:UpdateHandler.cs

示例9: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
        {
            var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
            var moves = ReadMovementUpdateBlock(ref packet, guid, index);
            var updates = ReadValuesUpdateBlock(ref packet, objType, index);

            WoWObject obj;
            switch (objType)
            {
                case ObjectType.Unit:       obj = new Unit(); break;
                case ObjectType.GameObject: obj = new GameObject(); break;
                case ObjectType.Item:       obj = new Item(); break;
                case ObjectType.Player:     obj = new Player(); break;
                default:                    obj = new WoWObject(); break;
            }

            obj.Type = objType;
            obj.Movement = moves;
            obj.UpdateFields = updates;
            obj.Map = map;
            obj.Area = WorldStateHandler.CurrentAreaId;
            obj.PhaseMask = (uint) MovementHandler.CurrentPhaseMask;

            Storage.Objects.TryAdd(guid, obj);

            if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
                packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:28,代码来源:UpdateHandler.cs

示例10: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
        {
            var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
            var moves = ReadMovementUpdateBlock(ref packet, guid, index);
            var updates = ReadValuesUpdateBlock(ref packet, objType, index);

            var obj = new WoWObject {Type = objType, Movement = moves, UpdateFields = updates, Map = map, Area = WorldStateHandler.CurrentAreaId, PhaseMask = (uint) MovementHandler.CurrentPhaseMask};
            packet.SniffFileInfo.Stuffing.Objects.TryAdd(guid, obj);

            if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
                packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
        }
开发者ID:LegacyCorporation,项目名称:LegacyPacketParser,代码行数:12,代码来源:UpdateHandler.cs

示例11: HandleServerTrainerList

        public static void HandleServerTrainerList(Packet packet)
        {
            var guid = new byte[8];
            var npcTrainer = new NpcTrainer();

            guid[0] = packet.ReadBit();
            var count = (int)packet.ReadBits("Count", 19);
            packet.StartBitStream(guid, 2, 6);
            var titleLen = packet.ReadBits(11);
            packet.StartBitStream(guid, 3, 7, 1, 4, 5);
            packet.ResetBitReader();

            npcTrainer.TrainerSpells = new List<TrainerSpell>(count);
            for (var i = 0; i < count; ++i)
            {
                var trainerSpell = new TrainerSpell();
                trainerSpell.RequiredSkill = packet.ReadUInt32("Required Skill", i);
                trainerSpell.RequiredSkillLevel = packet.ReadUInt32("Required Skill Level", i);
                trainerSpell.Cost = packet.ReadUInt32("Cost", i);

                trainerSpell.RequiredLevel = packet.ReadByte("Required Level", i);
                packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Required Spell ID", i);
                packet.ReadInt32("Profession Dialog", i);
                packet.ReadInt32("Profession Button", i);

                trainerSpell.Spell = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Spell ID", i);
                packet.ReadEnum<TrainerSpellState>("State", TypeCode.Byte, i);

                npcTrainer.TrainerSpells.Add(trainerSpell);
            }

            packet.ReadXORBytes(guid, 3, 2);
            npcTrainer.Title = packet.ReadWoWString("Title", titleLen);
            packet.ReadXORBytes(guid, 7, 6, 4, 1, 0, 5);

            npcTrainer.Type = packet.ReadEnum<TrainerType>("Type", TypeCode.Int32);
            packet.ReadInt32("Unk Int32"); // Same unk exists in CMSG_TRAINER_BUY_SPELL

            packet.WriteGuid("GUID", guid);
            var GUID = new Guid(BitConverter.ToUInt64(guid, 0));
            Storage.NpcTrainers.Add(GUID.GetEntry(), npcTrainer, packet.TimeSpan);
        }
开发者ID:Wirtoz,项目名称:WowPacketParser,代码行数:42,代码来源:NpcHandler.cs

示例12: HandleServerChatMessage


//.........这里部分代码省略.........
            packet.StartBitStream(SenderGUID, 2, 4, 0, 6, 1, 3, 5, 7);

            packet.ReadBit(); // fake bit

            packet.StartBitStream(GroupGUID, 6, 0, 4, 1, 2, 3, 7, 5);

            var hasPrefix = !packet.ReadBit();
            var bit1494 = packet.ReadBit();
            var hasRealmId = !packet.ReadBit();
            var bit1490 = !packet.ReadBit();

            int senderName = 0;
            if (hasSender)
                senderName = (int)packet.ReadBits(11);

            packet.ReadBit(); // fake bit

            packet.StartBitStream(ReceiverGUID, 4, 0, 6, 7, 5, 1, 3, 2);

            int prefixLen = 0;
            if (hasPrefix)
                prefixLen = (int)packet.ReadBits(5);

            var hasReceiver = !packet.ReadBit();
            var bit148C = !packet.ReadBit();

            int textLen = 0;
            if (hasText)
                textLen = (int)packet.ReadBits(12);

            var hasLang = !packet.ReadBit();

            int countBits148C = 0;
            if (bit148C)
                countBits148C = (int)packet.ReadBits(9);

            packet.ReadBit(); // fake bit

            int receiverLen = 0;
            if (hasReceiver)
                receiverLen = (int)packet.ReadBits(11);

            packet.StartBitStream(GuildGUID, 0, 2, 1, 4, 6, 7, 5, 3);

            var hasChannel = !packet.ReadBit();

            int channelLen = 0;
            if (hasChannel)
            {
                channelLen = (int)packet.ReadBits(7);
                packet.ReadWoWString("Channel Name", channelLen);
            }

            if (hasSender)
                text.Comment = packet.ReadWoWString("Sender Name", senderName);

            packet.ParseBitStream(GroupGUID, 6, 7, 1, 2, 4, 3, 0, 5);

            packet.ParseBitStream(ReceiverGUID, 0, 4, 1, 3, 5, 7, 2, 6);

            text.Type = (ChatMessageType)packet.ReadEnum<ChatMessageType540>("Chat type", TypeCode.Byte);

            packet.ParseBitStream(SenderGUID, 7, 6, 5, 4, 0, 2, 1, 3);

            if (hasPrefix)
                packet.ReadWoWString("Addon Message Prefix", prefixLen);

            if (hasRealmId)
                packet.ReadInt32("Realm Id");

            packet.ParseBitStream(GuildGUID, 1, 0, 3, 7, 6, 5, 2, 4);

            if (hasReceiver)
                packet.ReadWoWString("Receiver Name", receiverLen);

            if (hasAchi)
                packet.ReadInt32("Achievement");

            if (hasLang)
                text.Language = packet.ReadEnum<Language>("Language", TypeCode.Byte);

            if (hasText)
                text.Text = packet.ReadWoWString("Text", textLen);

            if (bit1490)
                packet.ReadSingle("Float1490");

            packet.WriteGuid("SenderGUID", SenderGUID);
            packet.WriteGuid("ReceiverGUID", ReceiverGUID);
            packet.WriteGuid("GuildGUID", GuildGUID);
            packet.WriteGuid("GroupGUID", GroupGUID);

            uint entry = 0;
            var guid = new Guid(BitConverter.ToUInt64(SenderGUID, 0));
            if (guid.GetObjectType() == ObjectType.Unit)
                entry = guid.GetEntry();

            if (entry != 0)
                Storage.CreatureTexts.Add(entry, text, packet.TimeSpan);
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:101,代码来源:ChatHandler.cs

示例13: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var guid = new byte[8];
            uint[] QuestTitleLength;
            uint[] OptionsMessageLength;
            uint[] BoxMessageLength;

            guid[7] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            guid[1] = packet.ReadBit();

            var QuestsCount = packet.ReadBits("Quests Count", 19);

            guid[0] = packet.ReadBit();
            guid[4] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            guid[3] = packet.ReadBit();

            var OptionsCount = packet.ReadBits("Gossip Options Count", 20);

            OptionsMessageLength = new uint[OptionsCount];
            BoxMessageLength = new uint[OptionsCount];
            for (var i = 0; i < OptionsCount; ++i)
            {
                BoxMessageLength[i] = packet.ReadBits(12);
                OptionsMessageLength[i] = packet.ReadBits(12);
            }

            QuestTitleLength = new uint[QuestsCount];
            for (var i = 0; i < QuestsCount; ++i)
            {
                packet.ReadBit("Quest Icon Change", i);
                QuestTitleLength[i] = packet.ReadBits(9);
            }

            for (var i = 0; i < QuestsCount; i++)
            {
                packet.ReadEnum<QuestFlags2>("Quest Special Flags", TypeCode.UInt32, i);
                packet.ReadEntryWithName<UInt32>(StoreNameType.Quest, "Quest Id", i);
                packet.ReadUInt32("Quest Level", i);
                packet.ReadUInt32("Quest Icon", i);
                packet.ReadEnum<QuestFlags>("Quest Flags", TypeCode.UInt32, i);
                packet.ReadWoWString("Quest Titles", QuestTitleLength[i], i);
            }

            packet.ReadXORByte(guid, 6);

            var ObjectGossip = new Gossip();
            ObjectGossip.GossipOptions = new List<GossipOption>((int)OptionsCount);
            for (var i = 0; i < OptionsCount; ++i)
            {
                var gossipMenuOption = new GossipOption
                {
                    RequiredMoney = packet.ReadUInt32("Message Box Required Money", i),
                    OptionText = packet.ReadWoWString("Gossip Option Text", OptionsMessageLength[i], i),
                    Index = packet.ReadUInt32("Gossip Option Index", i),
                    OptionIcon = packet.ReadEnum<GossipOptionIcon>("Gossip Option Icon", TypeCode.Byte, i),
                    BoxText = packet.ReadWoWString("Message Box Text", BoxMessageLength[i], i),
                    Box = packet.ReadBoolean("Message Box Coded", i), // True if it has a password.
                };

                ObjectGossip.GossipOptions.Add(gossipMenuOption);
            }

            packet.ReadXORByte(guid, 2);

            var GossipMenuTextId = packet.ReadUInt32("Gossip Menu Text Id");

            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 5);

            var GossipMenuId = packet.ReadUInt32("Gossip Menu Id");
            packet.ReadUInt32("Friendly Faction Id");

            packet.ReadXORByte(guid, 4);
            packet.ReadXORByte(guid, 7);
            packet.ReadXORByte(guid, 3);
            packet.ReadXORByte(guid, 0);

            packet.WriteGuid("Object Guid", guid);

            var ObjectGuid = new Guid(BitConverter.ToUInt64(guid, 0));
            ObjectGossip.ObjectEntry = ObjectGuid.GetEntry();
            ObjectGossip.ObjectType = ObjectGuid.GetObjectType();

            if (ObjectGuid.GetObjectType() == ObjectType.Unit)
                if (Storage.Objects.ContainsKey(ObjectGuid))
                    ((Unit)Storage.Objects[ObjectGuid].Item1).GossipId = GossipMenuId;

            Storage.Gossips.Add(Tuple.Create(GossipMenuId, GossipMenuTextId), ObjectGossip, packet.TimeSpan);
            packet.AddSniffData(StoreNameType.Gossip, (int)GossipMenuId, ObjectGuid.GetEntry().ToString(CultureInfo.InvariantCulture));
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:93,代码来源:NpcHandler.cs

示例14: HandleVendorInventoryList422

        public static void HandleVendorInventoryList422(Packet packet)
        {
            var npcVendor = new NpcVendor();

            var guidBytes = packet.StartBitStream(5, 6, 1, 2, 3, 0, 7, 4);

            packet.ReadXORByte(guidBytes, 2);
            packet.ReadXORByte(guidBytes, 3);

            var itemCount = packet.ReadUInt32("Item Count");

            packet.ReadXORByte(guidBytes, 5);
            packet.ReadXORByte(guidBytes, 0);
            packet.ReadXORByte(guidBytes, 1);

            packet.ReadByte("Unk Byte");

            packet.ReadXORByte(guidBytes, 4);
            packet.ReadXORByte(guidBytes, 7);
            packet.ReadXORByte(guidBytes, 6);

            var guid = new Guid(BitConverter.ToUInt64(guidBytes, 0));
            packet.WriteLine("GUID: {0}", guid);

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (var i = 0; i < itemCount; i++)
            {
                var vendorItem = new VendorItem();

                packet.ReadInt32("Max Durability", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);
                vendorItem.ItemId = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Item ID", i);
                packet.ReadInt32("Unk Int32 1", i);
                packet.ReadInt32("Display ID", i);
                var maxCount = packet.ReadInt32("Max Count", i);
                vendorItem.MaxCount = maxCount == -1 ? 0 : maxCount; // TDB
                packet.ReadUInt32("Buy Count", i);
                vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);
                packet.ReadInt32("Unk Int32 2", i);
                packet.ReadInt32("Price", i);

                // where's the vendorItem.Type (1/2)?

                npcVendor.VendorItems.Add(vendorItem);
            }

            Storage.NpcVendors.Add(guid.GetEntry(), npcVendor, packet.TimeSpan);
        }
开发者ID:RazorCore,项目名称:WowPacketParser,代码行数:48,代码来源:NpcHandler.cs

示例15: HandleVendorInventoryList422

        public static void HandleVendorInventoryList422(Packet packet)
        {
            var npcVendor = new NpcVendor();

            var bits = new bool[8];
            for (int c = 7; c >= 0; c--)
                bits[c] = packet.ReadBit();

            var bytes = new byte[8];

            // Data - real
            // E7| 30 64 26 |A0| EE F0 31 = F1 30 31 EF 00 00 27 65
            //                               7  6  5  4  3  2  1  0
            // (E7 = 11100111)

            // If there is any error, change bytes[3] to 2 and bytes[2] to 3

            var itemCount = packet.ReadUInt32("Item Count");

            if (bits[7]) bytes[5] = (byte)(packet.ReadByte() ^ 1);
            if (bits[6]) bytes[0] = (byte)(packet.ReadByte() ^ 1);
            if (bits[5]) bytes[1] = (byte)(packet.ReadByte() ^ 1);
            if (bits[4]) bytes[3] = (byte)(packet.ReadByte() ^ 1);

            packet.ReadByte("Unk Byte");

            if (bits[3]) bytes[2] = (byte)(packet.ReadByte() ^ 1);
            if (bits[2]) bytes[4] = (byte)(packet.ReadByte() ^ 1);
            if (bits[1]) bytes[7] = (byte)(packet.ReadByte() ^ 1);
            if (bits[0]) bytes[6] = (byte)(packet.ReadByte() ^ 1);

            var guid = new Guid(BitConverter.ToUInt64(bytes, 0));
            packet.Writer.WriteLine("GUID: {0}", guid);

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (var i = 0; i < itemCount; i++)
            {
                var vendorItem = new VendorItem();

                packet.ReadInt32("Max Durability", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);
                vendorItem.ItemId = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Item ID", i);
                packet.ReadInt32("Unk Int32 1", i);
                packet.ReadInt32("Display ID", i);
                vendorItem.MaxCount = packet.ReadInt32("Max Count", i);
                vendorItem.BuyCount = packet.ReadUInt32("Buy Count", i);
                vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);
                packet.ReadInt32("Unk Int32 2", i);
                packet.ReadInt32("Price", i);

                npcVendor.VendorItems.Add(vendorItem);
            }

            Stuffing.NpcVendors.TryAdd(guid.GetEntry(), npcVendor);
        }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:55,代码来源:NpcHandler.cs


注:本文中的WowPacketParser.Misc.Guid.GetEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。