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


C# WowGuid.GetEntry方法代码示例

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


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

示例1: CheckFilter

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

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

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

示例2: TestGetEntry

        public void TestGetEntry()
        {
            var guid1 = new WowGuid(0xF130005C0500105F);
            var guid2 = new WowGuid(0x600000002B2D7C9);
            var guid3 = new WowGuid(0);

            Assert.AreEqual(0x5C05, guid1.GetEntry());
            Assert.AreEqual(0, guid2.GetEntry());
            Assert.AreEqual(0, guid3.GetEntry());
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:10,代码来源:GuidTest.cs

示例3: 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:samaelsacred,项目名称:WowPacketParser,代码行数:49,代码来源:PetHandler.cs

示例4: ReadMovementUpdateBlock


//.........这里部分代码省略.........

                            packet.ReadBits("FilterFlags", 2, index);
                        }

                        for (var i = 0; i < pointsCount; ++i)
                            packet.ReadVector3("Points", index, i);
                    }
                }
            }

            if (hasMovementTransport) // 456
            {
                moveInfo.TransportGuid = packet.ReadPackedGuid128("TransportGUID", index);
                moveInfo.TransportOffset = packet.ReadVector4("TransportPosition", index);
                var seat = packet.ReadByte("VehicleSeatIndex", index);
                packet.ReadUInt32("MoveTime", index);

                packet.ResetBitReader();

                var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", index);
                var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", index);

                if (hasPrevMoveTime)
                    packet.ReadUInt32("PrevMoveTime", index);

                if (hasVehicleRecID)
                    packet.ReadInt32("VehicleRecID", index);

                if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                    guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                {
                    var vehicleAccessory = new VehicleTemplateAccessory
                    {
                        AccessoryEntry = guid.GetEntry(),
                        SeatId = seat
                    };
                    Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                }
            }

            if (hasStationaryPosition) // 480
            {
                moveInfo.Position = packet.ReadVector3();
                moveInfo.Orientation = packet.ReadSingle();

                packet.AddValue("Stationary Position", moveInfo.Position, index);
                packet.AddValue("Stationary Orientation", moveInfo.Orientation, index);
            }

            if (hasCombatVictim) // 504
                packet.ReadPackedGuid128("CombatVictim Guid", index);

            if (hasServerTime) // 516
                packet.ReadUInt32("ServerTime", index);

            if (hasVehicleCreate) // 528
            {
                moveInfo.VehicleId = packet.ReadUInt32("RecID", index);
                packet.ReadSingle("InitialRawFacing", index);
            }

            if (hasAnimKitCreate) // 538
            {
                packet.ReadUInt16("AiID", index);
                packet.ReadUInt16("MovementID", index);
                packet.ReadUInt16("MeleeID", index);
开发者ID:Gooyeth,项目名称:WowPacketParser,代码行数:67,代码来源:UpdateHandler.cs

示例5: HandleVendorInventoryList

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

            var guid = new byte[8];

            guid[4] = packet.ReadBit();
            var itemCount = packet.ReadBits(18);
            var hasCondition = new bool[itemCount];
            var hasExtendedCost = new bool[itemCount];

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

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

            packet.ReadXORByte(guid, 3);

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (int i = 0; i < itemCount; ++i)
            {
                var vendorItem = new VendorItem();
                packet.ReadInt32("Max Durability", i);
                vendorItem.Type = packet.ReadUInt32("Type", i); // 1 - item, 2 - currency
                var buyCount = packet.ReadUInt32("Buy Count", i);

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

                packet.ReadInt32("Price", i);
                vendorItem.ItemId = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Item ID", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);

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

                var maxCount = packet.ReadInt32("Max Count", i);
                packet.ReadInt32("Item Upgrade ID", i);
                packet.ReadInt32("Display ID", i);

                npcVendor.VendorItems.Add(vendorItem);
            }

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

            packet.WriteGuid("Guid", guid);

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

示例6: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var gossip = new Gossip();

            var guidBytes = new byte[8];

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

            var questgossips = packet.ReadBits(19);

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

            var amountOfOptions = packet.ReadBits(20);

            var boxTextLen = new uint[amountOfOptions];
            var optionTextLen = new uint[amountOfOptions];
            for (var i = 0; i < amountOfOptions; ++i)
            {
                boxTextLen[i] = packet.ReadBits(12);
                optionTextLen[i] = packet.ReadBits(12);
            }

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

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

            packet.ReadXORByte(guidBytes, 6);

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

                gossip.GossipOptions.Add(gossipOption);
            }

            packet.ReadXORByte(guidBytes, 2);

            var textId = packet.ReadUInt32("Text Id");

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

            var menuId = packet.ReadUInt32("Menu Id");
            packet.ReadUInt32("Friendship Faction");

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

            packet.WriteGuid("Guid", guidBytes);

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

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

            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);

//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:NpcHandler.cs

示例7: HandleVendorInventoryList

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

            var guidBytes = new byte[8];

            guidBytes[4] = packet.ReadBit();

            var itemCount = packet.ReadBits("Item Count", 18);

            var hasExtendedCost = new bool[itemCount];
            var hasCondition = new bool[itemCount];
            var hasCondition2 = new bool[itemCount];
            for (int i = 0; i < itemCount; ++i)
            {
                hasCondition[i] = !packet.ReadBit();
                hasCondition2[i] = !packet.ReadBit();
                hasExtendedCost[i] = !packet.ReadBit();
            }

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

            packet.ReadXORByte(guidBytes, 3);

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

                //packet.ReadInt32("Max Durability", i);
                packet.ReadInt32("Unk1", i);
                vendorItem.Type = packet.ReadUInt32("Type", i); // 1 - item, 2 - currency
                var buyCount = packet.ReadUInt32("Buy Count", i);
                if (hasExtendedCost[i])
                    vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);
                packet.ReadInt32("Price", i);
                vendorItem.ItemId = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Item ID", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);
                packet.ReadInt32("LeftInStock", i);
                packet.ReadInt32("Unk2", i);
                packet.ReadInt32("Display ID", i);
                /*if (hasCondition[i])
                    packet.ReadInt32("Condition ID", i);
                var maxCount = packet.ReadInt32("Max Count", i);
                vendorItem.MaxCount = maxCount == -1 ? 0 : maxCount; // TDB

                if (vendorItem.Type == 2)
                    vendorItem.MaxCount = (int)buyCount;*/

                npcVendor.VendorItems.Add(vendorItem);
            }

            packet.ReadXORByte(guidBytes, 6);
            packet.ReadXORByte(guidBytes, 0);
            packet.ReadXORByte(guidBytes, 2);
            packet.ReadXORByte(guidBytes, 5);

            packet.ReadByte("rawItemCount");

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

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

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

示例8: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(Packet packet, WowGuid guid, uint map, object index)
        {
            var objType = packet.ReadByteE<ObjectType>("Object Type", index);
            var moves = ReadMovementUpdateBlock(packet, guid, index);
            var updates = CoreParsers.UpdateHandler.ReadValuesUpdateBlock(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;
            obj.Phases = new HashSet<ushort>(CoreParsers.MovementHandler.ActivePhases);

            // 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:Oboltys,项目名称:WowPacketParser,代码行数:47,代码来源:UpdateHandler.cs

示例9: ReadMovementUpdateBlock


//.........这里部分代码省略.........

                    packet.ReadUInt32("Time Fallen", index);
                    packet.ReadSingle("Fall Start Velocity", index);
                }

                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 5);
                    var seat = packet.ReadByte("Transport Seat", index);
                    packet.ReadXORByte(transportGuid, 2);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    packet.ReadXORBytes(transportGuid, 4, 7);
                    if (hasTransportTime2)
                        packet.ReadUInt32("Transport Time 2", index);

                    packet.ReadUInt32("Transport Time", index);
                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    packet.ReadXORBytes(transportGuid, 3, 6);
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 0);
                    if (hasTransportTime3)
                        packet.ReadUInt32("Transport Time 3", index);
                    packet.ReadXORByte(transportGuid, 1);
                    moveInfo.TransportOffset.Z = packet.ReadSingle();

                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        var vehicleAccessory = new VehicleTemplateAccessory();
                        vehicleAccessory.AccessoryEntry = guid.GetEntry();
                        vehicleAccessory.SeatId = seat;
                        Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                    }
                }

                packet.ReadXORByte(guid1, 5);

                if (hasTimestamp)
                    packet.ReadUInt32("Time", index);

                for (var i = 0; i < bits90; ++i)
                    packet.ReadInt32("Int8C", index, i);

                if (bitA0)
                    packet.ReadInt32("Int98", index);

                packet.ReadXORByte(guid1, 1);
                packet.ReadSingle("FloatB0", index);
                packet.ReadSingle("FloatC0", index);
                packet.ReadXORByte(guid1, 6);
                packet.ReadSingle("FloatC4", index);

                for (var i = 0; i < bits160; ++i)
                {
                    packet.ReadSingle("Float16C+3", index, i);
                    packet.ReadSingle("Float16C+5", index, i);
                    packet.ReadSingle("Float16C+1", index, i);
                    packet.ReadInt32("Int16C+0", index, i);
                    packet.ReadInt32("Int16C+4", index, i);
                    packet.ReadSingle("Float16C+2", index, i);
                }
开发者ID:Oboltys,项目名称:WowPacketParser,代码行数:66,代码来源:UpdateHandler.cs

示例10: ReadMovementUpdateBlock434


//.........这里部分代码省略.........
                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 5);
                    packet.ReadXORByte(transportGuid, 7);

                    packet.ReadUInt32("Transport Time", index);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    if (hasTransportTime2)
                        packet.ReadUInt32("Transport Time 2", index);

                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 3);

                    moveInfo.TransportOffset.Z = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 0);

                    if (hasTransportTime3)
                        packet.ReadUInt32("Transport Time 3", index);

                    var seat = packet.ReadSByte("Transport Seat", index);
                    packet.ReadXORByte(transportGuid, 1);
                    packet.ReadXORByte(transportGuid, 6);
                    packet.ReadXORByte(transportGuid, 2);
                    packet.ReadXORByte(transportGuid, 4);
                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        var vehicleAccessory = new VehicleTemplateAccessory();
                        vehicleAccessory.AccessoryEntry = guid.GetEntry();
                        vehicleAccessory.SeatId = seat;
                        Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                    }
                }

                moveInfo.Position.X = packet.ReadSingle();
                packet.ReadSingle("Pitch Speed", index);
                packet.ReadXORByte(guid2, 3);
                packet.ReadXORByte(guid2, 0);

                packet.ReadSingle("Swim Speed", index);
                moveInfo.Position.Y = packet.ReadSingle();
                packet.ReadXORByte(guid2, 7);
                packet.ReadXORByte(guid2, 1);
                packet.ReadXORByte(guid2, 2);

                moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f;
                if (hasTimestamp)
                    packet.ReadUInt32("Time", index);

                packet.ReadSingle("FlyBack Speed", index);
                packet.ReadXORByte(guid2, 6);

                packet.ReadSingle("Turn Speed", index);
                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle();

                moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f;
                if (hasPitch)
                    packet.ReadSingle("Pitch", index);

                packet.ReadSingle("Fly Speed", index);
开发者ID:Oboltys,项目名称:WowPacketParser,代码行数:67,代码来源:UpdateHandler.cs

示例11: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var gossip = new Gossip();

            var guid = new byte[8];

            uint[] titleLen;
            uint[] BoxTextLen;
            uint[] OptionTextLen;

            var questgossips = packet.ReadBits(19);

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

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

            var AmountOfOptions = packet.ReadBits(20);

            guid[6] = packet.ReadBit();
            guid[2] = packet.ReadBit();

            BoxTextLen = new uint[AmountOfOptions];
            OptionTextLen = new uint[AmountOfOptions];
            for (var i = 0; i < AmountOfOptions; ++i)
            {
                BoxTextLen[i] = packet.ReadBits(12);
                OptionTextLen[i] = packet.ReadBits(12);
            }

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

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

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

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

                gossip.GossipOptions.Add(gossipOption);
            }

            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 3);
            var menuId = packet.ReadUInt32("Menu Id");
            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 4);
            packet.ReadUInt32("Friendship Faction");
            packet.ReadXORByte(guid, 7);
            var textId = packet.ReadUInt32("Text Id");

            packet.WriteGuid("Guid", guid);

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

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

            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);
//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:NpcHandler.cs

示例12: ReadMovementUpdateBlock


//.........这里部分代码省略.........

                    moveInfo.Position.Y = packet.ReadSingle();
                    moveInfo.Position.Z = packet.ReadSingle();
                    packet.ReadInt32("Spline Id", index);
                    moveInfo.Position.X = packet.ReadSingle();
                }

                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 4);
                    moveInfo.TransportOffset.Z = packet.ReadSingle();
                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    packet.ReadUInt32("Transport Time", index);
                    var seat = packet.ReadByte("Transport Seat", index);
                    packet.ReadXORBytes(transportGuid, 3, 1, 6);
                    if (hasTransportTime2)
                        packet.ReadUInt32("Transport Time 2", index);

                    packet.ReadXORByte(transportGuid, 5);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORBytes(transportGuid, 2, 0, 7);
                    if (hasTransportTime3)
                        packet.ReadUInt32("Transport Time 3", index);

                    moveInfo.TransportGuid = new WowGuid(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Unit)
                    {
                        var vehicleAccessory = new VehicleTemplateAccessory();
                        vehicleAccessory.AccessoryEntry = guid.GetEntry();
                        vehicleAccessory.SeatId = seat;
                        Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                    }
                }

                packet.ReadXORBytes(guid1, 2, 1);
                packet.ReadSingle("RunBack Speed", index);
                packet.ReadSingle("Fly Speed", index);
                packet.ReadXORBytes(guid1, 0, 3);
                packet.ReadSingle("SwimBack Speed", index);
                if (hasFallData)
                {
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Jump Sin", index);
                        packet.ReadSingle("Jump Velocity", index);
                        packet.ReadSingle("Jump Cos", index);
                    }
                    packet.ReadSingle("Fall Start Velocity", index);
                    packet.ReadUInt32("Time Fallen", index);
                }

                packet.ReadSingle("Turn Speed", index);
                packet.ReadXORByte(guid1, 5);
                moveInfo.Position.Z = packet.ReadSingle();
                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle();

                packet.ReadXORByte(guid1, 6);
                if (hasSplineElevation)
                    packet.ReadSingle("Spline Elevation", index);
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:66,代码来源:UpdateHandler.cs

示例13: ReadMovementUpdateBlock548


//.........这里部分代码省略.........
                {
                    packet.ReadXORByte(transportGuid, 7); // 55
                    moveInfo.TransportOffset.X = packet.ReadSingle(); // 56

                    if (hasTransportTime3) // 92
                        packet.ReadUInt32("Transport Time 3", index); // 88

                    moveInfo.TransportOffset.O = packet.ReadSingle(); // 68
                    moveInfo.TransportOffset.Y = packet.ReadSingle(); // 60
                    packet.ReadXORByte(transportGuid, 4); // 52
                    packet.ReadXORByte(transportGuid, 1); // 49
                    packet.ReadXORByte(transportGuid, 3); // 51
                    moveInfo.TransportOffset.Z = packet.ReadSingle(); // 64
                    packet.ReadXORByte(transportGuid, 5); // 53

                    if (hasTransportTime2) // 84
                        packet.ReadUInt32("Transport Time 2", index); // 80

                    packet.ReadXORByte(transportGuid, 0); // 48
                    var seat = packet.ReadSByte("Transport Seat", index); // 72
                    packet.ReadXORByte(transportGuid, 6); // 54
                    packet.ReadXORByte(transportGuid, 2); // 50
                    packet.ReadUInt32("Transport Time", index); // 76

                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory
                        {
                            Entry = moveInfo.TransportGuid.GetEntry(),
                            AccessoryEntry = guid.GetEntry(),
                            SeatId = seat
                        };

                        Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan);
                    }
                }

                packet.ReadXORByte(guid1, 4); // 12

                for (var i = 0; i < loopcnt; i++ ) // 352
                {
                    packet.ReadSingle("Single364", index); // 364
                    packet.ReadSingle("Single368", index); // 368
                    packet.ReadSingle("Single360", index); // 360
                    packet.ReadInt32("Int356", index); // 356
                    packet.ReadInt32("Int372", index); // 372
                    packet.ReadSingle("Single376", index); // 376
                }

                if (moveInfo.HasSplineData) // 344
                {
                    if (bit336) // 336
                    {
                        packet.ReadUInt32("Spline Time", index); // 232
                        packet.ReadSingle("Spline Duration Multiplier Next", index); // 244

                        if (hasSplineUnkPart) // 304
                        {
                            for (var i = 0; i < unk284count; i++ )
                            {
                                packet.ReadSingle("unk292", index, i); // 292
开发者ID:ChipLeo,项目名称:WowPacketParser,代码行数:67,代码来源:UpdateHandler.cs

示例14: HandleMessageChat

        public static void HandleMessageChat(Packet packet)
        {
            var text = new CreatureText();
            uint entry = 0;

            //text.Language = packet.ReadEnum<Language>("Language", TypeCode.Int32);

            var hasSenderName = !packet.ReadBit("!hasSenderName");
            packet.ReadBit("unk5272");
            var SenderLen = 0u;
            if (hasSenderName)
                SenderLen = packet.ReadBits("SenderLen", 11);

            packet.ReadBit("!unk48*4");
            // unk52*4 = 0;
            var hasChannelName = !packet.ReadBit("!hasChannelName");
            packet.ReadBit("unk5273*4");
            var has1494 = !packet.ReadBit("!unk1494h"); // dword ptr [esi+1494h] = ("has unk1494h") ? 0 : ds:dword_D26EA8
            var chatTag = !packet.ReadBit("!chatTag"); // 5264*2
            var hasRealmID1 = !packet.ReadBit("!hasRealmID1"); // 56

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

            if (chatTag)
                packet.ReadBits("chatTag", 9); // 5264*2

            packet.ReadBit("!unk40*4");
            // unk44*4 = 0
            var guid3 = packet.StartBitStream(7, 6, 1, 4, 0, 2, 3, 5);
            packet.ReadBit("!unk24*4");
            // unk28*4 = 0
            var hasLanguage = !packet.ReadBit("!hasLanguage"); // 17
            var hasPrefix = !packet.ReadBit("!hasPrefix");

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

            var hasAchievementID = !packet.ReadBit("!hasAchievementID"); // 5260*4
            var hasMessage = !packet.ReadBit("!hasMessage"); // 2259

            var ChannelLen = 0u;
            if (hasChannelName)
                ChannelLen = packet.ReadBits("ChannelLen", 7); // 2134

            var MessageLen = 0u;
            if (hasMessage)
                MessageLen = packet.ReadBits("MessageLen", 12);

            var hasReceiverName = !packet.ReadBit("!hasReceiverName"); // 1089

            var PrefixLen = 0u;
            if (hasPrefix)
                PrefixLen = packet.ReadBits("PrefixLen", 5); // 2114*4

            var hasRealmID2 = !packet.ReadBit("!hasRealmID2"); // 60

            var ReceiverLen = 0u;
            if (hasReceiverName)
                ReceiverLen = packet.ReadBits("ReceiverLen", 11);

            packet.ReadBit("!unk32*4");
            // unk36 = 0

            var guid2 = packet.StartBitStream(2, 5, 7, 4, 0, 1, 3, 6);
            packet.ParseBitStream(guid2, 4, 5, 7, 3, 2, 6, 0, 1);
            packet.WriteGuid("Guid2", guid2);

            if (hasChannelName)
                packet.ReadWoWString("ChannelName", ChannelLen);

            if (hasPrefix)
                packet.ReadWoWString("Prefix", PrefixLen);

            if (has1494)
                packet.ReadSingle("unk1494");

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

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

            if (unitGuid.GetObjectType() == ObjectType.Unit)
                entry = unitGuid.GetEntry();

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

            if (hasAchievementID)
                packet.ReadUInt32("AchievementID");

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

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

            if (hasLanguage)
                packet.ReadByte("Language");

            if (hasRealmID2)
                packet.ReadInt32("RealmID2"); // 60

//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:ChatHandler.cs

示例15: 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.ReadEntry<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:samaelsacred,项目名称:WowPacketParser,代码行数:93,代码来源:NpcHandler.cs


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