Ejemplo n.º 1
0
        public static void HandlePhaseShift422(Packet packet)
        {
            var GuidFlag = packet.ReadEnum<BitMask>("Guid Mask Flags",TypeCode.Byte);

            if (GuidFlag.HasFlag(BitMask.Byte0))
                packet.ReadGuidByte(0);

            if (GuidFlag.HasFlag(BitMask.Byte4))
                packet.ReadGuidByte(4);// packet.ReadByte("Unk Byte 3");

            var CountOfBytes1 = packet.ReadUInt32("Count of bytes 1");
            byte[] bytes1 = null;

            if (CountOfBytes1 > 0)
            {
                packet.ReadUInt16("Map Swap 1"); // Map that is currently being loaded
                bytes1 = packet.ReadBytes((int)CountOfBytes1 - 2);
            }

            if (GuidFlag.HasFlag(BitMask.Byte3))
                packet.ReadGuidByte(3);// packet.ReadByte("Unk Byte 4");

            packet.ReadUInt32("Flag? "); // this is 0, 4 or 8, if 8 then its normal world

            if (GuidFlag.HasFlag(BitMask.Byte2))
                packet.ReadGuidByte(2);// packet.ReadByte("Unk Byte 5"); // flag Unk4

            var CountOfBytes2 = packet.ReadUInt32("Count of bytes 2");
            byte[] bytes2 = null;

            if (CountOfBytes2 > 0)
            {
                CurrentPhaseMask = packet.ReadUInt16("Current PhaseMask");
                bytes2 = packet.ReadBytes((int)CountOfBytes2 - 2);
            }

            if (!GuidFlag.HasFlag(BitMask.Byte2))
                packet.ReadGuidByte(6);// packet.ReadByte("Unk Byte 6");

            var CountOfBytes3 = packet.ReadUInt32("Count of bytes 3");
            byte[] bytes3 = null;

            if (CountOfBytes3 > 0)
            {
                packet.ReadUInt16("Map Swap 2");
                bytes3 = packet.ReadBytes((int)CountOfBytes3 - 2);
            }

            if (GuidFlag.HasFlag(BitMask.Byte7))
                packet.ReadGuidByte(7);// packet.ReadByte("Unk Byte 7");

            var CountOfBytes4 = packet.ReadUInt32("Count of bytes 4");
            byte[] bytes4 = null;

            if (CountOfBytes4 > 0)
            {
                packet.ReadUInt16("Map Swap 3"); // Should always match 'Map Swap 1'
                bytes4 = packet.ReadBytes((int)CountOfBytes4 - 2);
            }

            if (GuidFlag.HasFlag(BitMask.Byte1))
                packet.ReadGuidByte(1);// packet.ReadByte("Unk Byte 8");

            if (GuidFlag.HasFlag(BitMask.Byte5))
                packet.ReadGuidByte(5);// packet.ReadByte("Unk Byte 9");

            packet.Writer.WriteLine("Guid: " + packet.ReadBitstreamedGuid().ToString());
        }
Ejemplo n.º 2
0
        public static void HandleVendorInventoryList422(Packet packet)
        {
            var npcVendor = new NpcVendor();

            var flags = packet.ReadEnum<BitMask>("GUID Byte Mask", TypeCode.Byte);

            if (flags.HasAnyFlag(BitMask.Byte2))
                packet.ReadGuidByte(2);

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

            if (flags.HasAnyFlag(BitMask.Byte5))
                packet.ReadGuidByte(5);

            if (flags.HasAnyFlag(BitMask.Byte0)) // Flag?
                packet.ReadGuidByte(0);

            if (flags.HasAnyFlag(BitMask.Byte1)) // Flag?
                packet.ReadGuidByte(1);

            if (flags.HasAnyFlag(BitMask.Byte3)) // Flag?
                packet.ReadGuidByte(3);

            if (flags.HasAnyFlag(BitMask.Byte4))
                packet.ReadGuidByte(4);

            if (flags.HasAnyFlag(BitMask.Byte7)) // Flag?
                packet.ReadGuidByte(7);

            if (!flags.HasAnyFlag(BitMask.Byte2)) // Flag?
                packet.ReadGuidByte(6);

            var guid = packet.ReadBitstreamedGuid();
            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);
        }