상속: IDataModel
예제 #1
0
        public static void HandleCharEnum(Packet packet)
        {
            packet.ReadBit("Success");
            packet.ReadBit("IsDeletedCharacters");
            var charsCount = packet.ReadUInt32("Characters Count");
            var restrictionsCount = packet.ReadUInt32("FactionChangeRestrictionsCount");

            for (uint i = 0; i < charsCount; ++i)
            {
                packet.ReadPackedGuid128("Guid", i);

                packet.ReadByte("ListPosition", i);
                var race = packet.ReadByteE<Race>("RaceID", i);
                var klass = packet.ReadByteE<Class>("ClassID", i);
                packet.ReadByte("SexID", i);
                packet.ReadByte("SkinID", i);
                packet.ReadByte("FaceID", i);
                packet.ReadByte("HairStyle", i);
                packet.ReadByte("HairColor", i);
                packet.ReadByte("FacialHairStyle", i);
                packet.ReadByte("ExperienceLevel", i);
                var zone = packet.ReadUInt32("ZoneID", i);
                var mapId = packet.ReadUInt32("MapID", i);

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

                packet.ReadPackedGuid128("GuildGUID", i);

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

                packet.ReadUInt32("ProfessionIDs", i, 0);
                packet.ReadUInt32("ProfessionIDs", i, 1);

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

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_4_21315))
                    packet.ReadTime("LastPlayedTime", i);

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

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

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

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

            for (var i = 0; i < restrictionsCount; ++i)
            {
                packet.ReadUInt32("FactionChangeRestriction Mask", i);
                packet.ReadByte("FactionChangeRestriction RaceID", 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);

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

            packet.ReadByte("ExperienceLevel", idx);
            var zone = packet.ReadUInt32("ZoneID", idx);
            var mapId = packet.ReadUInt32("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);
            }

            packet.ReadTime("LastPlayedTime", idx);

            packet.ReadUInt16("SpecID", idx);
            packet.ReadUInt32("Unknown703", idx);
            packet.ReadUInt32("Flags4", idx);

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

            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);
            }
        }
예제 #3
0
        public static void HandleCharEnum(Packet packet)
        {
            // ����� �� ���������, ���� ����������� ���� ������
            var unkCounter = packet.ReadBits("Unk Counter", 21);//[DW5]
            var count = packet.ReadBits("Char count", 16);//[DW9]

            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();
                guildGuids[c][3] = packet.ReadBit();
                charGuids[c][3] = packet.ReadBit();
                charGuids[c][7] = packet.ReadBit();
                packet.ReadBit("unk bit 124", c); //124
                firstLogins[c] = packet.ReadBit(); //108
                charGuids[c][6] = packet.ReadBit();
                guildGuids[c][6] = packet.ReadBit();
                nameLenghts[c] = packet.ReadBits(6);
                charGuids[c][1] = packet.ReadBit();
                guildGuids[c][1] = packet.ReadBit();
                guildGuids[c][0] = packet.ReadBit();
                charGuids[c][4] = packet.ReadBit();
                guildGuids[c][7] = packet.ReadBit();
                charGuids[c][2] = packet.ReadBit();
                charGuids[c][5] = packet.ReadBit();
                guildGuids[c][2] = packet.ReadBit();
                guildGuids[c][5] = packet.ReadBit();
            }//+=416

            //packet.ResetBitReader();
            packet.ReadBit("UnkB16");

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

                packet.ReadInt32("DW132", c);
                packet.ReadXORByte(charGuids[c], 1);//1
                packet.ReadByte("Slot", c); //57
                packet.ReadByte("Hair Style", c); //63
                packet.ReadXORByte(guildGuids[c], 2);//90
                packet.ReadXORByte(guildGuids[c], 0);//88
                packet.ReadXORByte(guildGuids[c], 6);//94
                var name = packet.ReadWoWString("Name", (int)nameLenghts[c], c);
                packet.ReadXORByte(guildGuids[c], 3);//91
                pos.X = packet.ReadSingle("Position X", c); //4Ch
                packet.ReadInt32("DW104", c);
                packet.ReadByte("Face", c); //62
                var klass = packet.ReadByteE<Class>("Class", c); //59
                packet.ReadXORByte(guildGuids[c], 5); //93

                for (var itm = 0; itm < 23; itm++)
                {
                    packet.ReadInt32("Item EnchantID", c, itm); //140 prolly need to replace those 2
                    packet.ReadByteE<InventoryType>("Item InventoryType", c, itm); //144
                    packet.ReadInt32("Item DisplayID", c, itm); //136
                }

                packet.ReadUInt32E<CustomizationFlag>("CustomizationFlag", c); //100
                packet.ReadXORByte(charGuids[c], 3); //3
                packet.ReadXORByte(charGuids[c], 5); //5
                packet.ReadInt32("PetFamily", c); //120
                packet.ReadXORByte(guildGuids[c], 4); //92
                var mapId = packet.ReadUInt32("Map", c); //72
                var race = packet.ReadByteE<Race>("Race", c); //58
                packet.ReadByte("Skin", c); //61
                packet.ReadXORByte(guildGuids[c], 1); //89
                var level = packet.ReadByte("Level", c); //66
                packet.ReadXORByte(charGuids[c], 0); //0
                packet.ReadXORByte(charGuids[c], 2); //2
                packet.ReadByte("Hair Color", c); //64
                packet.ReadByteE<Gender>("Gender", c); //60
                packet.ReadByte("Facial Hair", c); //65
                packet.ReadInt32("Pet Level", c); //116
                packet.ReadXORByte(charGuids[c], 4); //4
                packet.ReadXORByte(charGuids[c], 7); //7
                pos.Y = packet.ReadSingle("Position Y", c); //50h
                packet.ReadInt32("Pet DisplayID", c); //112
                packet.ReadInt32("DW128", c);
                packet.ReadXORByte(charGuids[c], 6); //6
                packet.ReadInt32E<CharacterFlag>("CharacterFlag", c); //96
                var zone = packet.ReadUInt32<ZoneId>("Zone Id", c); //68
                packet.ReadXORByte(guildGuids[c], 7); //95
                pos.Z = packet.ReadSingle("Position Z", c); //54h

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

                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.IsEmpty() && 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.ReadByte("Unk byte", i); // char_table+28+i*8
                packet.ReadUInt32("Unk int", i); // char_table+24+i*8
            }
        }
예제 #4
0
        public static void HandleCharEnum510(Packet packet)
        {
            var unkCounter = packet.ReadBits("Unk Counter", 23);
            var count = packet.ReadBits("Char count", 17);

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

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

            packet.ReadBit("Unk bit");
            packet.ResetBitReader();

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

                packet.ReadInt32E<CharacterFlag>("CharacterFlag", c);
                packet.ReadInt32("Pet Family", c);
                pos.Z = packet.ReadSingle("Position Z", c);
                packet.ReadXORByte(charGuids[c], 7);
                packet.ReadXORByte(guildGuids[c], 6);

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

                pos.X = packet.ReadSingle("Position X", c);
                var klass = packet.ReadByteE<Class>("Class", c);
                packet.ReadXORByte(charGuids[c], 5);
                pos.Y = packet.ReadSingle("Position Y", c);
                packet.ReadXORByte(guildGuids[c], 3);
                packet.ReadXORByte(charGuids[c], 6);
                packet.ReadInt32("Pet Level", c);
                packet.ReadInt32("Pet Display ID", c);
                packet.ReadXORByte(charGuids[c], 2);
                packet.ReadXORByte(charGuids[c], 1);
                packet.ReadByte("Hair Color", c);
                packet.ReadByte("Facial Hair", c);
                packet.ReadXORByte(guildGuids[c], 2);
                var zone = packet.ReadUInt32<ZoneId>("Zone Id", c);
                packet.ReadByte("List Order", c);
                packet.ReadXORByte(charGuids[c], 0);
                packet.ReadXORByte(guildGuids[c], 1);
                packet.ReadByte("Skin", c);
                packet.ReadXORByte(charGuids[c], 4);
                packet.ReadXORByte(guildGuids[c], 5);
                var name = packet.ReadWoWString("Name", (int)nameLenghts[c], c);
                packet.ReadXORByte(guildGuids[c], 0);
                var level = packet.ReadByte("Level", c);
                packet.ReadXORByte(charGuids[c], 3);
                packet.ReadXORByte(guildGuids[c], 7);
                packet.ReadByte("Hair Style", c);
                packet.ReadXORByte(guildGuids[c], 4);
                packet.ReadByteE<Gender>("Gender", c);
                var mapId = packet.ReadInt32<MapId>("Map Id", c);
                packet.ReadUInt32E<CustomizationFlag>("CustomizationFlag", c);
                var race = packet.ReadByteE<Race>("Race", c);
                packet.ReadByte("Face", c);

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

                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.ReadByte("Unk byte", i);
                packet.ReadUInt32("Unk int", i);
            }
        }
예제 #5
0
        public static void HandleCharEnum(Packet packet)
        {
            var count = packet.ReadByte("Count");

            for (var i = 0; i < count; i++)
            {
                var guid = packet.ReadGuid("GUID");
                var name = packet.ReadCString("Name");
                StoreGetters.AddName(guid, name);
                var race = packet.ReadByteE<Race>("Race");
                var klass = packet.ReadByteE<Class>("Class");
                packet.ReadByteE<Gender>("Gender");

                packet.ReadByte("Skin");
                packet.ReadByte("Face");
                packet.ReadByte("Hair Style");
                packet.ReadByte("Hair Color");
                packet.ReadByte("Facial Hair");

                var level = packet.ReadByte("Level");
                var zone = packet.ReadUInt32<ZoneId>("Zone Id");
                var mapId = packet.ReadInt32<MapId>("Map Id");

                var pos = packet.ReadVector3("Position");
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_3_13329))
                    packet.ReadGuid("Guild GUID");
                else
                    packet.ReadInt32("Guild Id");
                packet.ReadInt32E<CharacterFlag>("Character Flags");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
                    packet.ReadInt32E<CustomizationFlag>("Customization Flags");

                var firstLogin = packet.ReadBool("First Login");
                packet.ReadInt32("Pet Display Id");
                packet.ReadInt32("Pet Level");
                packet.ReadInt32E<CreatureFamily>("Pet Family");

                for (var j = 0; j < 19; j++)
                {
                    packet.ReadInt32("Equip Display Id");
                    packet.ReadByteE<InventoryType>("Equip Inventory Type");
                    packet.ReadInt32("Equip Aura Id");
                }

                int bagCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3_11685) ? 4 : 1;
                for (var j = 0; j < bagCount; j++)
                {
                    packet.ReadInt32("Bag Display Id");
                    packet.ReadByteE<InventoryType>("Bag Inventory Type");
                    packet.ReadInt32("Bag Aura Id");
                }

                if (firstLogin)
                {
                    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 = firstLogin, Level = level};

                if (Storage.Objects.ContainsKey(guid))
                    Storage.Objects[guid] = new Tuple<WoWObject, TimeSpan?>(playerInfo, packet.TimeSpan);
                else
                    Storage.Objects.Add(guid, playerInfo, packet.TimeSpan);
                StoreGetters.AddName(guid, name);
            }
        }
예제 #6
0
        public static void HandleCharEnum433(Packet packet)
        {
            var unkCounter = packet.ReadBits("Unk Counter", 23);
            var count = packet.ReadBits("Char count", 17);

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

            for (var c = 0; c < count; ++c)
            {
                charGuids[c] = new byte[8];
                guildGuids[c] = new byte[8];
                //100%  pozition, and flag
                //%50   flag
                //20    nothing

                charGuids[c][0] = packet.ReadBit(); //100%
                guildGuids[c][0] = packet.ReadBit();//50%
                charGuids[c][2] = packet.ReadBit(); //100%
                guildGuids[c][2] = packet.ReadBit();//50%
                firstLogins[c] = packet.ReadBit();                  //100%
                charGuids[c][3] = packet.ReadBit(); //100%
                charGuids[c][6] = packet.ReadBit(); //100%
                guildGuids[c][2] = packet.ReadBit();//20%

                charGuids[c][4] = packet.ReadBit(); //20%
                charGuids[c][5] = packet.ReadBit(); //20%
                nameLenghts[c] = packet.ReadBits(4);                //100%
                guildGuids[c][3] = packet.ReadBit();//20%
                guildGuids[c][4] = packet.ReadBit();//50%

                guildGuids[c][5] = packet.ReadBit();//20%
                charGuids[c][1] = packet.ReadBit(); //100%
                packet.ReadBit();                                   //20%
                guildGuids[c][6] = packet.ReadBit();//20%
                charGuids[c][7] = packet.ReadBit(); //100%
                guildGuids[c][7] = packet.ReadBit();//50%
                packet.ReadBit();                                   //20%
                packet.ReadBit();                                   //20%
            }

            // no idea, not used in client
            packet.ReadByte();

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

                for (var itm = 0; itm < 19; ++itm)
                {
                    packet.ReadInt32("Item EnchantID", c, itm);
                    packet.ReadInt32("Item DisplayID", c, itm);
                    packet.ReadByteE<InventoryType>("Item InventoryType", c, itm);
                }

                for (var itm = 0; itm < 4; ++itm)
                {
                    packet.ReadInt32("Bag EnchantID", c, itm);
                    packet.ReadInt32("Bag DisplayID", c, itm);
                    packet.ReadByteE<InventoryType>("Bag InventoryType", c, itm);
                }

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

                packet.ReadByte("Facial Hair", c);

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

                packet.ReadXORByte(charGuids[c], 2);
                if (guildGuids[c][2] != 0)
                    //  guildGuids[c][2] ^= packet.ReadByte();

                    if (charGuids[c][7] != 0)
                        charGuids[c][7] ^= packet.ReadByte();
                if (guildGuids[c][7] != 0)
                    // guildGuids[c][7] ^= packet.ReadByte();

                    packet.ReadByte("List Order", c);
                packet.ReadInt32("Pet Display ID", c);

                // no ideal //////////////////////////////
                if (charGuids[c][4] != 0)
                    charGuids[c][4] ^= packet.ReadByte();

                if (guildGuids[c][4] != 0)
                    // guildGuids[c][4] ^= packet.ReadByte();

                if (charGuids[c][5] != 0)
                        // charGuids[c][5] ^= packet.ReadByte();

                if (guildGuids[c][5] != 0)
                            // guildGuids[c][5] ^= packet.ReadByte();

                if (guildGuids[c][1] != 0)
                                // guildGuids[c][1] ^= packet.ReadByte();

                                if (guildGuids[c][3] != 0)
                                    // guildGuids[c][3] ^= packet.ReadByte();

                                    if (guildGuids[c][6] != 0)
                                        // guildGuids[c][6] ^= packet.ReadByte();

                                        //////////////////////////////////////////

                                        if (charGuids[c][3] != 0)
                                            charGuids[c][3] ^= packet.ReadByte();

                var klass = packet.ReadByteE<Class>("Class", c);

                if (charGuids[c][6] != 0)
                    charGuids[c][6] ^= packet.ReadByte();

                pos.X = packet.ReadSingle("Position X", c);

                if (charGuids[c][1] != 0)
                    charGuids[c][1] ^= packet.ReadByte();

                var race = packet.ReadByteE<Race>("Race", c);
                packet.ReadInt32("Pet Family", c);
                pos.Y = packet.ReadSingle("Position Y", c);
                packet.ReadByteE<Gender>("Gender", c);
                packet.ReadByte("Hair Style", c);
                var level = packet.ReadByte("Level", c);
                pos.Z = packet.ReadSingle("Position Z", c);
                packet.ReadUInt32E<CustomizationFlag>("CustomizationFlag", c);
                packet.ReadByte("Skin", c);
                packet.ReadByte("Hair Color", c);
                packet.ReadByte("Face", c);
                var mapId = packet.ReadInt32("Map", c);
                var name = packet.ReadWoWString("Name", (int)nameLenghts[c], c);

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

                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 c = 0; c < unkCounter; c++)
            {
                packet.ReadUInt32("Unk1", c);
                packet.ReadByte("Unk2", c);
            }
        }
예제 #7
0
        public static void HandleCharEnum422(Packet packet)
        {
            packet.ReadByte("Unk Flag");
            int count = packet.ReadInt32("Char Count");
            packet.ReadInt32("Unk Count");
            var firstLogin = new bool[count];
            var playerGuid = new byte[count][];
            var guildGuid = new byte[count][];

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

                guildGuid[c][5] = packet.ReadBit();//0
                playerGuid[c][4] = packet.ReadBit();//1
                guildGuid[c][3] = packet.ReadBit();//2
                guildGuid[c][7] = packet.ReadBit();//3
                guildGuid[c][1] = packet.ReadBit();//4
                guildGuid[c][6] = packet.ReadBit();//5
                playerGuid[c][5] = packet.ReadBit();//6
                playerGuid[c][6] = packet.ReadBit();//7
                playerGuid[c][3] = packet.ReadBit();//8
                playerGuid[c][2] = packet.ReadBit();//9
                guildGuid[c][4] = packet.ReadBit();//10
                playerGuid[c][0] = packet.ReadBit();//11
                playerGuid[c][1] = packet.ReadBit();//12
                guildGuid[c][2] = packet.ReadBit();//13
                playerGuid[c][7] = packet.ReadBit();//14
                guildGuid[c][0] = packet.ReadBit();//15
                firstLogin[c] = packet.ReadBit();//16
            }

            for (int c = 0; c < count; c++)
            {
                var name = packet.ReadCString("Name", c);

                packet.ReadXORByte(guildGuid[c], 5);

                packet.ReadByte("Face", c);
                var mapId = packet.ReadInt32("Map", c);

                packet.ReadXORByte(playerGuid[c], 1);
                packet.ReadXORByte(playerGuid[c], 4);
                packet.ReadXORByte(guildGuid[c], 4);
                packet.ReadXORByte(guildGuid[c], 0);

                var pos = packet.ReadVector3("Position", c);

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

                var zone = packet.ReadInt32<ZoneId>("Zone Id", c);
                packet.ReadInt32("Pet Level", c);

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

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

                packet.ReadByte("Facial Hair", c);
                packet.ReadByte("Skin", c);
                var klass = packet.ReadByteE<Class>("Class", c);
                packet.ReadInt32("Pet Family", c);
                packet.ReadInt32E<CharacterFlag>("CharacterFlag", c);

                packet.ReadXORByte(playerGuid[c], 2);

                packet.ReadInt32("Pet Display ID", c);

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

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

                packet.ReadXORByte(playerGuid[c], 6);

                packet.ReadByte("Hair Style", c);

                packet.ReadXORByte(guildGuid[c], 2);

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

                packet.ReadXORByte(guildGuid[c], 6);

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

                packet.ReadXORByte(playerGuid[c], 5);

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

                packet.ReadByte("List Order", c);

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

                for (int itm = 0; itm < 4; itm++)
                {
                    packet.ReadInt32("Bag EnchantID", c, itm);
                    packet.ReadByteE<InventoryType>("Bag InventoryType", c, itm);
                    packet.ReadInt32("Bag DisplayID", c, itm);
                }

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

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

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

                packet.WriteGuid("Character Guid", playerGuid[c],c);
                packet.WriteGuid("Guild Guid", guildGuid[c],c);

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

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