Example #1
0
        public static void ReadCharactersData(Packet packet, params object[] idx)
        {
            packet.ReadPackedGuid128("Guid", idx);

            packet.ReadUInt64("GuildClubMemberID", idx);

            packet.ReadByte("ListPosition", idx);
            var race  = packet.ReadByteE <Race>("RaceID", idx);
            var klass = packet.ReadByteE <Class>("ClassID", idx);

            packet.ReadByteE <Gender>("SexID", idx);
            packet.ReadByte("SkinID", idx);
            packet.ReadByte("FaceID", idx);
            packet.ReadByte("HairStyle", idx);
            packet.ReadByte("HairColor", idx);
            packet.ReadByte("FacialHairStyle", idx);

            for (uint j = 0; j < 3; ++j)
            {
                packet.ReadByte("CustomDisplay", idx, j);
            }

            packet.ReadByte("ExperienceLevel", idx);
            var zone  = packet.ReadInt32 <ZoneId>("ZoneID", idx);
            var mapId = packet.ReadInt32 <MapId>("MapID", idx);

            var pos = packet.ReadVector3("PreloadPos", idx);

            packet.ReadPackedGuid128("GuildGUID", idx);

            packet.ReadUInt32("Flags", idx);
            packet.ReadUInt32("Flags2", idx);
            packet.ReadUInt32("Flags3", idx);
            packet.ReadUInt32("PetCreatureDisplayID", idx);
            packet.ReadUInt32("PetExperienceLevel", idx);
            packet.ReadUInt32("PetCreatureFamilyID", idx);

            for (uint j = 0; j < 2; ++j)
            {
                packet.ReadInt32("ProfessionIDs", idx, j);
            }

            for (uint j = 0; j < 23; ++j)
            {
                packet.ReadUInt32("DisplayID", idx, "VisualItems", j);
                packet.ReadUInt32("DisplayEnchantID", idx, "VisualItems", j);
                packet.ReadByteE <InventoryType>("InvType", idx, "VisualItems", j);
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V8_2_5_31921))
                {
                    packet.ReadByte("Subclass", idx, "VisualItems", j);
                }
            }

            packet.ReadTime("LastPlayedTime", idx);

            packet.ReadInt16("SpecID", idx);
            packet.ReadInt32("Unknown703", idx);
            packet.ReadInt32("InterfaceVersion", idx);
            packet.ReadUInt32("Flags4", idx);
            var unknown830lengths = new uint[packet.ReadUInt32()];

            packet.ResetBitReader();

            var nameLength = packet.ReadBits("Character Name Length", 6, idx);
            var firstLogin = packet.ReadBit("FirstLogin", idx);

            packet.ReadBit("BoostInProgress", idx);
            packet.ReadBits("UnkWod61x", 5, idx);

            for (var j = 0; j < unknown830lengths.Length; ++j)
            {
                unknown830lengths[j] = packet.ReadBits(6);
            }

            for (var j = 0; j < unknown830lengths.Length; ++j)
            {
                if (unknown830lengths[j] > 1)
                {
                    packet.ReadDynamicString("Unknown830", unknown830lengths[j], idx);
                }
            }

            packet.ReadWoWString("Character Name", nameLength, idx);

            if (firstLogin)
            {
                PlayerCreateInfo startPos = new PlayerCreateInfo {
                    Race = race, Class = klass, Map = (uint)mapId, Zone = (uint)zone, Position = pos, Orientation = 0
                };
                Storage.StartPositions.Add(startPos, packet.TimeSpan);
            }
        }
Example #2
0
        public static void HandleCharEnum(Packet packet)
        {
            packet.ReadBit("Unk bit");

            var unkCounter = packet.ReadBits("Unk Counter", 21);
            var count      = packet.ReadBits("Char count", 16);

            var charGuids   = new byte[count][];
            var guildGuids  = new byte[count][];
            var firstLogins = new bool[count];
            var nameLenghts = new uint[count];

            for (int c = 0; c < count; ++c)
            {
                charGuids[c]  = new byte[8];
                guildGuids[c] = new byte[8];

                guildGuids[c][4] = packet.ReadBit();
                charGuids[c][0]  = packet.ReadBit();
                charGuids[c][3]  = packet.ReadBit();
                charGuids[c][6]  = packet.ReadBit();
                guildGuids[c][1] = packet.ReadBit();
                charGuids[c][1]  = packet.ReadBit();
                guildGuids[c][2] = packet.ReadBit();
                guildGuids[c][3] = packet.ReadBit();
                firstLogins[c]   = packet.ReadBit();
                charGuids[c][2]  = packet.ReadBit();
                guildGuids[c][0] = packet.ReadBit();
                guildGuids[c][7] = packet.ReadBit();
                nameLenghts[c]   = packet.ReadBits(6);
                packet.ReadBit("Unkt Bit");
                guildGuids[c][6] = packet.ReadBit();
                charGuids[c][4]  = packet.ReadBit();
                guildGuids[c][5] = packet.ReadBit();
                charGuids[c][5]  = packet.ReadBit();
                charGuids[c][7]  = packet.ReadBit();
            }

            packet.ResetBitReader();

            for (int c = 0; c < count; ++c)
            {
                var pos = new Vector3();

                packet.ReadByte("Face", c);

                packet.ReadXORByte(guildGuids[c], 7);

                var race = packet.ReadByteE <Race>("Race", c);

                packet.ReadXORByte(charGuids[c], 5);
                packet.ReadXORByte(guildGuids[c], 2);
                packet.ReadXORByte(charGuids[c], 6);

                packet.ReadInt32E <CharacterFlag>("CharacterFlag", c);
                var zone = packet.ReadUInt32 <ZoneId>("Zone Id", c);

                packet.ReadXORByte(guildGuids[c], 3);

                packet.ReadInt32("Pet Level", c);      // v4+112
                packet.ReadInt32("Pet Display ID", c); //v4+108
                packet.ReadUInt32("Unk 1", c);
                packet.ReadUInt32("Unk 2", c);

                packet.ReadXORByte(charGuids[c], 3);
                packet.ReadXORByte(charGuids[c], 0);

                packet.ReadByte("Facial Hair", c);
                packet.ReadByteE <Gender>("Gender", c);

                packet.ReadXORByte(guildGuids[c], 0);

                packet.ReadByte("HairStyle", c);
                var level = packet.ReadByte("Level", c);

                for (int j = 0; j < 23; ++j)
                {
                    packet.ReadInt32("Item DisplayID", c, j);
                    packet.ReadInt32("Item EnchantID", c, j);
                    packet.ReadByteE <InventoryType>("Item InventoryType", c, j);
                }

                pos.Z = packet.ReadSingle();

                packet.ReadXORByte(guildGuids[c], 1);

                pos.Y = packet.ReadSingle();
                packet.ReadByte("Skin", c);
                packet.ReadByte("List Order", c); //v4+57

                packet.ReadXORByte(guildGuids[c], 5);
                packet.ReadXORByte(charGuids[c], 1);

                packet.ReadUInt32("Unk 3", c);
                pos.X = packet.ReadSingle();
                var name  = packet.ReadWoWString("Name", (int)nameLenghts[c], c);
                var mapId = packet.ReadInt32("Map", c);
                packet.ReadInt32("Pet Family", c); // v4+116
                packet.ReadByte("Hair Color", c);
                var klass = packet.ReadByteE <Class>("Class", c);

                packet.ReadXORByte(guildGuids[c], 4);
                packet.ReadXORByte(charGuids[c], 2);

                packet.ReadUInt32E <CustomizationFlag>("CustomizationFlag", c);

                packet.ReadXORByte(charGuids[c], 7);
                packet.ReadXORByte(guildGuids[c], 6);
                packet.ReadXORByte(charGuids[c], 4);

                var playerGuid = new WowGuid64(BitConverter.ToUInt64(charGuids[c], 0));

                packet.AddValue("Position", pos, c);
                packet.WriteGuid("Character GUID", charGuids[c], c);
                packet.WriteGuid("Guild GUID", guildGuids[c], c);

                if (firstLogins[c])
                {
                    PlayerCreateInfo startPos = new PlayerCreateInfo {
                        Race = race, Class = klass, Map = (uint)mapId, Zone = zone, Position = pos, Orientation = 0
                    };
                    Storage.StartPositions.Add(startPos, packet.TimeSpan);
                }

                var playerInfo = new Player {
                    Race = race, Class = klass, Name = name, FirstLogin = firstLogins[c], Level = level
                };
                if (Storage.Objects.ContainsKey(playerGuid))
                {
                    Storage.Objects[playerGuid] = new Tuple <WoWObject, TimeSpan?>(playerInfo, packet.TimeSpan);
                }
                else
                {
                    Storage.Objects.Add(playerGuid, playerInfo, packet.TimeSpan);
                }
                StoreGetters.AddName(playerGuid, name);
            }

            for (var i = 0; i < unkCounter; ++i)
            {
                packet.ReadUInt32("Unk int", i);
                packet.ReadByte("Unk byte", i);
            }
        }
        public static void ReadCharactersData(Packet packet, params object[] idx)
        {
            packet.ReadPackedGuid128("Guid", idx);

            packet.ReadByte("ListPosition", idx);
            var race  = packet.ReadByteE <Race>("RaceID", idx);
            var klass = packet.ReadByteE <Class>("ClassID", idx);

            packet.ReadByte("SexID", idx);
            packet.ReadByte("SkinID", idx);
            packet.ReadByte("FaceID", idx);
            packet.ReadByte("HairStyle", idx);
            packet.ReadByte("HairColor", idx);
            packet.ReadByte("FacialHairStyle", idx);
            packet.ReadByte("ExperienceLevel", idx);
            var zone  = packet.ReadUInt32 <ZoneId>("ZoneID", idx);
            var mapId = packet.ReadUInt32 <MapId>("MapID", idx);

            var pos = packet.ReadVector3("PreloadPos", idx);

            packet.ReadPackedGuid128("GuildGUID", idx);

            packet.ReadUInt32("Flags", idx);
            packet.ReadUInt32("Flags2", idx);
            packet.ReadUInt32("Flags3", idx);
            packet.ReadUInt32("PetCreatureDisplayID", idx);
            packet.ReadUInt32("PetExperienceLevel", idx);
            packet.ReadUInt32("PetCreatureFamilyID", idx);

            for (uint j = 0; j < 2; ++j)
            {
                packet.ReadUInt32("ProfessionIDs", idx, j);
            }

            for (uint j = 0; j < 23; ++j)
            {
                packet.ReadUInt32("InventoryItem DisplayID", idx, j);
                packet.ReadUInt32("InventoryItem DisplayEnchantID", idx, j);
                packet.ReadByteE <InventoryType>("InventoryItem InvType", idx, j);
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_4_21315))
            {
                packet.ReadTime("LastPlayedTime", idx);
            }

            packet.ResetBitReader();
            var nameLength = packet.ReadBits("Character Name Length", 6, idx);
            var firstLogin = packet.ReadBit("FirstLogin", idx);

            packet.ReadBit("BoostInProgress", idx);

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_1_0_19678))
            {
                packet.ReadBits("Unk Bits141", 5, idx);
            }

            packet.ReadWoWString("Character Name", nameLength, idx);

            if (firstLogin)
            {
                PlayerCreateInfo startPos = new PlayerCreateInfo {
                    Race = race, Class = klass, Map = mapId, Zone = zone, Position = pos, Orientation = 0
                };
                Storage.StartPositions.Add(startPos, packet.TimeSpan);
            }
        }
        public static void ReadCharactersListEntry(Packet packet, params object[] idx)
        {
            packet.ReadPackedGuid128("Guid", idx);

            packet.ReadUInt64("GuildClubMemberID", idx);

            packet.ReadByte("ListPosition", idx);
            var race   = packet.ReadByteE <Race>("RaceID", idx);
            var @class = packet.ReadByteE <Class>("ClassID", idx);

            packet.ReadByteE <Gender>("SexID", idx);
            var customizationCount = packet.ReadUInt32();

            packet.ReadByte("ExperienceLevel", idx);
            var zone  = packet.ReadInt32 <ZoneId>("ZoneID", idx);
            var mapId = packet.ReadInt32 <MapId>("MapID", idx);

            var pos = packet.ReadVector3("PreloadPos", idx);

            packet.ReadPackedGuid128("GuildGUID", idx);

            packet.ReadUInt32("Flags", idx);
            packet.ReadUInt32("Flags2", idx);
            packet.ReadUInt32("Flags3", idx);
            packet.ReadUInt32("PetCreatureDisplayID", idx);
            packet.ReadUInt32("PetExperienceLevel", idx);
            packet.ReadUInt32("PetCreatureFamilyID", idx);

            for (uint j = 0; j < 2; ++j)
            {
                packet.ReadInt32("ProfessionIDs", idx, j);
            }

            for (uint j = 0; j < 23; ++j)
            {
                packet.ReadUInt32("DisplayID", idx, "VisualItems", j);
                packet.ReadUInt32("DisplayEnchantID", idx, "VisualItems", j);
                packet.ReadInt32("ItemModifiedAppearanceID", idx, "VisualItems", j);
                packet.ReadByteE <InventoryType>("InvType", idx, "VisualItems", j);
                packet.ReadByte("Subclass", idx, "VisualItems", j);
            }

            packet.ReadTime("LastPlayedTime", idx);

            packet.ReadInt16("SpecID", idx);
            packet.ReadInt32("Unknown703", idx);
            packet.ReadInt32("InterfaceVersion", idx);
            packet.ReadUInt32("Flags4", idx);
            var mailSenderLengths = new uint[packet.ReadUInt32()];
            var mailSenderTypes   = ClientVersion.AddedInVersion(ClientVersionBuild.V9_0_2_36639) ? new uint[packet.ReadUInt32()] : Array.Empty <uint>();

            packet.ReadUInt32("OverrideSelectScreenFileDataID", idx);

            for (var j = 0u; j < customizationCount; ++j)
            {
                ReadChrCustomizationChoice(packet, idx, "Customizations", j);
            }

            for (var j = 0; j < mailSenderTypes.Length; ++j)
            {
                packet.ReadUInt32("MailSenderType", idx, j);
            }

            packet.ResetBitReader();

            var nameLength = packet.ReadBits("Character Name Length", 6, idx);
            var firstLogin = packet.ReadBit("FirstLogin", idx);

            packet.ReadBit("BoostInProgress", idx);
            packet.ReadBits("UnkWod61x", 5, idx);

            for (var j = 0; j < mailSenderLengths.Length; ++j)
            {
                mailSenderLengths[j] = packet.ReadBits(6);
            }

            for (var j = 0; j < mailSenderLengths.Length; ++j)
            {
                if (mailSenderLengths[j] > 1)
                {
                    packet.ReadDynamicString("MailSender", mailSenderLengths[j], idx);
                }
            }

            packet.ReadWoWString("Character Name", nameLength, idx);

            if (firstLogin)
            {
                PlayerCreateInfo startPos = new PlayerCreateInfo {
                    Race = race, Class = @class, Map = (uint)mapId, Zone = (uint)zone, Position = pos, Orientation = 0
                };
                Storage.StartPositions.Add(startPos, packet.TimeSpan);
            }
        }