public static void HandleGameObjectQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); if (entry.Value) // entry is masked return; GameObjectTemplate gameObject = new GameObjectTemplate { Entry = (uint)entry.Key }; int unk1 = packet.ReadInt32("Unk1 UInt32"); if (unk1 == 0) { packet.ReadByte("Unk1 Byte"); return; } gameObject.Type = packet.ReadInt32E<GameObjectType>("Type"); gameObject.DisplayID = packet.ReadUInt32("Display ID"); var name = new string[4]; for (int i = 0; i < 4; i++) name[i] = packet.ReadCString("Name", i); gameObject.Name = name[0]; gameObject.IconName = packet.ReadCString("Icon Name"); gameObject.CastCaption = packet.ReadCString("Cast Caption"); gameObject.UnkString = packet.ReadCString("Unk String"); gameObject.Data = new int?[32]; for (int i = 0; i < gameObject.Data.Length; i++) gameObject.Data[i] = packet.ReadInt32("Data", i); gameObject.Size = packet.ReadSingle("Size"); gameObject.QuestItems = new uint?[packet.ReadByte("QuestItems Length")]; for (int i = 0; i < gameObject.QuestItems.Length; i++) gameObject.QuestItems[i] = (uint)packet.ReadInt32<ItemId>("Quest Item", i); packet.ReadUInt32E<ClientType>("Expansion"); packet.ReadByte("Unk1 Byte"); Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.GameObject, ID = entry.Key, Name = gameObject.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleGameObjectQueryResponse(Packet packet) { var gameObject = new GameObjectTemplate(); packet.ReadByte("Unk1 Byte"); var entry = packet.ReadEntry("Entry"); if (entry.Value) // entry is masked return; var unk1 = packet.ReadInt32("Unk1 UInt32"); if (unk1 == 0) { //packet.ReadByte("Unk1 Byte"); return; } gameObject.Type = packet.ReadEnum<GameObjectType>("Type", TypeCode.Int32); gameObject.DisplayId = packet.ReadUInt32("Display ID"); var name = new string[4]; for (var i = 0; i < 4; i++) name[i] = packet.ReadCString("Name", i); gameObject.Name = name[0]; gameObject.IconName = packet.ReadCString("Icon Name"); gameObject.CastCaption = packet.ReadCString("Cast Caption"); gameObject.UnkString = packet.ReadCString("Unk String"); gameObject.Data = new int[32]; for (var i = 0; i < gameObject.Data.Length; i++) gameObject.Data[i] = packet.ReadInt32("Data", i); gameObject.Size = packet.ReadSingle("Size"); gameObject.QuestItems = new uint[packet.ReadByte("QuestItems Length")]; for (var i = 0; i < gameObject.QuestItems.Length; i++) gameObject.QuestItems[i] = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Quest Item", i); packet.ReadEnum<ClientType>("Expansion", TypeCode.UInt32); Storage.GameObjectTemplates.Add((uint)entry.Key, gameObject, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.GameObject, Name = gameObject.Name, }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleGameObjectQueryResponse(Packet packet) { var gameObject = new GameObjectTemplate(); var entry = packet.ReadEntry("Entry"); if (entry.Value) // entry is masked return; gameObject.Type = packet.ReadEnum<GameObjectType>("Type", TypeCode.Int32); gameObject.DisplayId = packet.ReadUInt32("Display ID"); var name = new string[4]; for (var i = 0; i < 4; i++) name[i] = packet.ReadCString("Name", i); gameObject.Name = name[0]; gameObject.IconName = packet.ReadCString("Icon Name"); gameObject.CastCaption = packet.ReadCString("Cast Caption"); gameObject.UnkString = packet.ReadCString("Unk String"); gameObject.Data = new int[ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6_13596) ? 32 : 24]; for (var i = 0; i < gameObject.Data.Length; i++) gameObject.Data[i] = packet.ReadInt32("Data", i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056)) // not sure when it was added exactly - did not exist in 2.4.1 sniff gameObject.Size = packet.ReadSingle("Size"); gameObject.QuestItems = new uint[ClientVersion.AddedInVersion(ClientVersionBuild.V3_2_0_10192) ? 6 : 4]; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) for (var i = 0; i < gameObject.QuestItems.Length; i++) gameObject.QuestItems[i] = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Quest Item", i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6_13596)) gameObject.UnknownInt = packet.ReadInt32("Unknown UInt32"); packet.AddSniffData(StoreNameType.GameObject, entry.Key, "QUERY_RESPONSE"); Storage.GameObjectTemplates.Add((uint) entry.Key, gameObject, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.GameObject, Name = gameObject.Name, }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleGameObjectQueryResponse(Packet packet) { var gameObject = new GameObjectTemplate(); var entry = packet.ReadEntry("Entry"); var dataSize = packet.ReadUInt32("Unk 1"); // Maybe data size? if (dataSize > 0) { gameObject.Type = packet.ReadEnum<GameObjectType>("Type", TypeCode.Int32); gameObject.DisplayId = packet.ReadUInt32("Display Id"); var name = new string[4]; for (var i = 0; i < 4; i++) name[i] = packet.ReadCString("Name", i); gameObject.Name = name[0]; gameObject.IconName = packet.ReadCString("Icon Name"); gameObject.CastCaption = packet.ReadCString("Cast Caption"); gameObject.UnkString = packet.ReadCString("Unk String"); gameObject.Data = new int[32]; for (var i = 0; i < gameObject.Data.Length; i++) gameObject.Data[i] = packet.ReadInt32("Data", i); gameObject.Size = packet.ReadSingle("Size"); gameObject.QuestItems = new uint[packet.ReadByte("Quest Item Count")]; for (var i = 0; i < gameObject.QuestItems.Length; i++) gameObject.QuestItems[i] = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Quest Item", i); packet.ReadEnum<ClientType>("Expansion", TypeCode.UInt32); } packet.ReadByte("Unk Byte"); // Mostly seen 128. Storage.GameObjectTemplates.Add((uint)entry.Key, gameObject, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.GameObject, Name = gameObject.Name, }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); // +5 var creature = new UnitTemplate(); var hasData = packet.ReadBit(); //+16 if (!hasData) return; // nothing to do creature.DisplayIds = new uint[4]; creature.KillCredits = new uint[2]; var bits24 = packet.ReadBits(11); //+7 var qItemCount = packet.ReadBits(22); //+72 var bits1C = (int)packet.ReadBits(11); //+9 var stringLens = new int[4][]; for (var i = 0; i < 4; i++) { stringLens[i] = new int[2]; stringLens[i][0] = (int)packet.ReadBits(11); stringLens[i][1] = (int)packet.ReadBits(11); } creature.RacialLeader = packet.ReadBit("Racial Leader"); //+68 var bits2C = packet.ReadBits(6); //+136 if (bits1C > 1) packet.ReadCString("String1C"); creature.KillCredits[0] = packet.ReadUInt32(); //+27 creature.DisplayIds[3] = packet.ReadUInt32(); //+32 creature.DisplayIds[2] = packet.ReadUInt32(); //+31 creature.Expansion = packet.ReadEnum<ClientType>("Expansion", TypeCode.UInt32); //+24 creature.Type = packet.ReadEnum<CreatureType>("Type", TypeCode.Int32); //+12 creature.Modifier1 = packet.ReadSingle("Modifier 1"); //+15 //for (var i = 0; i < 2; ++i) //{ creature.TypeFlags = packet.ReadEnum<CreatureTypeFlag>("Type Flags", TypeCode.UInt32); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum //} creature.Rank = packet.ReadEnum<CreatureRank>("Rank", TypeCode.Int32); //+14 creature.MovementId = packet.ReadUInt32("Movement ID"); //+23 var name = new string[4]; var femaleName = new string[4]; for (var i = 0; i < 4; ++i) { if (stringLens[i][1] > 1) femaleName[i] = packet.ReadCString("Female Name", i); if (stringLens[i][0] > 1) name[i] = packet.ReadCString("Name", i); } creature.Name = name[0]; creature.femaleName = femaleName[0]; if (bits24 > 1) creature.SubName = packet.ReadCString("Sub Name"); creature.DisplayIds[0] = packet.ReadUInt32(); //+29 creature.DisplayIds[1] = packet.ReadUInt32(); //+30 if (bits2C > 1) creature.IconName = packet.ReadCString("Icon Name"); //+100 creature.QuestItems = new uint[qItemCount]; for (var i = 0; i < qItemCount; ++i) creature.QuestItems[i] = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Quest Item", i); //+72 creature.KillCredits[1] = packet.ReadUInt32(); //+28 creature.Modifier2 = packet.ReadSingle("Modifier 2"); //+16 creature.Family = packet.ReadEnum<CreatureFamily>("Family", TypeCode.Int32); //+13 for (var i = 0; i < 4; ++i) packet.AddValue("Display ID", creature.DisplayIds[i], i); for (var i = 0; i < 2; ++i) packet.AddValue("Kill Credit", creature.KillCredits[i], i); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.UnitTemplates.Add((uint)entry.Key, creature, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.Unit, Name = creature.Name, }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); var hasData = packet.ReadBit("hasData"); if (!hasData) return; // nothing to do var creature = new UnitTemplate(); creature.RacialLeader = packet.ReadBit("Racial Leader"); uint lengthIconName = packet.ReadBits(6) ^ 1; var lengthName = new int[4][]; for (var i = 0; i < 4; i++) { lengthName[i] = new int[2]; lengthName[i][0] = (int)packet.ReadBits("Name length female", 11); lengthName[i][1] = (int)packet.ReadBits("Name length male", 11); } uint qItemCount = packet.ReadBits("itemCount", 22); uint lengthSubname = packet.ReadBits("Subname length", 11); packet.ReadBits(11); // Unk String length. Needs reading somewhere? creature.Modifier1 = packet.ReadSingle("Modifier Mana"); var name = new string[8]; for (var i = 0; i < 4; ++i) { if (lengthName[i][1] > 1) packet.ReadCString("Male Name", i); if (lengthName[i][0] > 1) name[i] = packet.ReadCString("Female name", i); } creature.Name = name[0]; creature.Modifier2 = packet.ReadSingle("Modifier Health"); creature.KillCredits = new uint[2]; creature.KillCredits[1] = packet.ReadUInt32("Kill Credit 2"); creature.DisplayIds = new uint[4]; creature.DisplayIds[1] = packet.ReadUInt32("Display Id 2"); creature.QuestItems = new uint[qItemCount]; for (var i = 0; i < qItemCount; ++i) creature.QuestItems[i] = (uint)packet.ReadEntryWithName<UInt32>(StoreNameType.Item, "Quest Item", i); creature.Type = packet.ReadEnum<CreatureType>("Type", TypeCode.Int32); if (lengthIconName > 1) creature.IconName = packet.ReadCString("Icon Name"); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); creature.TypeFlags = packet.ReadEnum<CreatureTypeFlag>("Type Flags", TypeCode.UInt32); creature.KillCredits[0] = packet.ReadUInt32("Kill Credit 1"); creature.Family = packet.ReadEnum<CreatureFamily>("Family", TypeCode.Int32); creature.MovementId = packet.ReadUInt32("Movement Id"); creature.Expansion = packet.ReadEnum<ClientType>("Expansion", TypeCode.UInt32); creature.DisplayIds[0] = packet.ReadUInt32("Display Id 1"); creature.DisplayIds[2] = packet.ReadUInt32("Display Id 3"); creature.Rank = packet.ReadEnum<CreatureRank>("Rank", TypeCode.Int32); if (lengthSubname > 1) creature.SubName = packet.ReadCString("Sub Name"); creature.DisplayIds[3] = packet.ReadUInt32("Display Id 4"); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.UnitTemplates.Add((uint)entry.Key, creature, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.Unit, Name = creature.Name, }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleNameQueryResponse(Packet packet) { Guid guid; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { guid = packet.ReadPackedGuid("GUID"); var end = packet.ReadBoolean("Name Not Found"); if (end) return; } else guid = packet.ReadGuid("GUID"); var name = packet.ReadCString("Name"); packet.ReadCString("Realm Name"); TypeCode typeCode = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767) ? TypeCode.Byte : TypeCode.Int32; packet.ReadEnum<Race>("Race", typeCode); packet.ReadEnum<Gender>("Gender", typeCode); packet.ReadEnum<Class>("Class", typeCode); if (!packet.ReadBoolean("Name Declined")) return; for (var i = 0; i < 5; i++) packet.ReadCString("Declined Name", i); var objectName = new ObjectName { ObjectType = ObjectType.Player, Name = name, }; packet.SniffFileInfo.Stuffing.ObjectNames.TryAdd((uint)guid.GetLow(), objectName); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); CreatureTemplate creature = new CreatureTemplate { Entry = (uint)entry.Key }; Bit hasData = packet.ReadBit(); if (!hasData) return; // nothing to do packet.ResetBitReader(); uint titleLen = packet.ReadBits(11); uint titleAltLen = packet.ReadBits(11); uint cursorNameLen = packet.ReadBits(6); creature.RacialLeader = packet.ReadBit("Leader"); var stringLens = new int[4][]; for (int i = 0; i < 4; i++) { stringLens[i] = new int[2]; stringLens[i][0] = (int)packet.ReadBits(11); stringLens[i][1] = (int)packet.ReadBits(11); } for (var i = 0; i < 4; ++i) { if (stringLens[i][0] > 1) creature.Name = packet.ReadCString("Name"); if (stringLens[i][1] > 1) creature.FemaleName = packet.ReadCString("NameAlt"); } creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); creature.Type = packet.ReadInt32E<CreatureType>("CreatureType"); creature.Family = packet.ReadInt32E<CreatureFamily>("CreatureFamily"); creature.Rank = packet.ReadInt32E<CreatureRank>("Classification"); creature.KillCredits = new uint?[2]; for (int i = 0; i < 2; ++i) creature.KillCredits[i] = packet.ReadUInt32("ProxyCreatureID", i); creature.ModelIDs = new uint?[4]; for (int i = 0; i < 4; ++i) creature.ModelIDs[i] = packet.ReadUInt32("CreatureDisplayID", i); creature.HealthModifier = packet.ReadSingle("HpMulti"); creature.ManaModifier = packet.ReadSingle("EnergyMulti"); //TODO: move to creature_questitems //creature.QuestItems = new uint[6]; int questItems = packet.ReadInt32("QuestItems"); creature.MovementID = packet.ReadUInt32("CreatureMovementInfoID"); creature.HealthScalingExpansion = packet.ReadUInt32E<ClientType>("HealthScalingExpansion"); creature.RequiredExpansion = packet.ReadUInt32E<ClientType>("RequiredExpansion"); if (titleLen > 1) creature.SubName = packet.ReadCString("Title"); if (titleAltLen > 1) packet.ReadCString("TitleAlt"); if (cursorNameLen > 1) creature.IconName = packet.ReadCString("CursorName"); for (int i = 0; i < questItems; ++i) /*creature.QuestItems[i] = (uint)*/packet.ReadInt32<ItemId>("Quest Item", i); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.CreatureTemplates.Add(creature, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.Unit, ID = entry.Key, Name = creature.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleGameObjectQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); if (entry.Value) // entry is masked return; GameObjectTemplate gameObject = new GameObjectTemplate { Entry = (uint)entry.Key }; packet.ReadBit("Allow"); int dataSize = packet.ReadInt32("DataSize"); if (dataSize == 0) return; gameObject.Type = packet.ReadInt32E<GameObjectType>("Type"); gameObject.DisplayID = packet.ReadUInt32("Display ID"); var name = new string[4]; for (int i = 0; i < 4; i++) name[i] = packet.ReadCString("Name", i); gameObject.Name = name[0]; gameObject.IconName = packet.ReadCString("Icon Name"); gameObject.CastCaption = packet.ReadCString("Cast Caption"); gameObject.UnkString = packet.ReadCString("Unk String"); gameObject.Data = new int?[33]; for (int i = 0; i < gameObject.Data.Length; i++) gameObject.Data[i] = packet.ReadInt32("Data", i); gameObject.Size = packet.ReadSingle("Size"); byte questItemsCount = packet.ReadByte("QuestItemsCount"); for (uint i = 0; i < questItemsCount; i++) { GameObjectTemplateQuestItem questItem = new GameObjectTemplateQuestItem { GameObjectEntry = (uint)entry.Key, Idx = i, ItemId = packet.ReadUInt32<ItemId>("QuestItem", i) }; Storage.GameObjectTemplateQuestItems.Add(questItem, packet.TimeSpan); } gameObject.RequiredLevel = packet.ReadInt32("RequiredLevel"); Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.GameObject, ID = entry.Key, Name = gameObject.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleItemNameQueryResponse(Packet packet) { var entry = packet.ReadUInt32<ItemId>("Entry"); var name = packet.ReadCString("Name"); packet.ReadUInt32E<InventoryType>("Inventory Type"); var objectName = new ObjectName { ObjectType = ObjectType.Item, ID = (int)entry, Name = name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); var creature = new UnitTemplate(); var hasData = packet.ReadBit(); if (!hasData) return; // nothing to do packet.ResetBitReader(); var bits4 = packet.ReadBits(11); var bits16 = packet.ReadBits(11); var bits28 = packet.ReadBits(6); creature.RacialLeader = packet.ReadBit("Leader"); var stringLens = new int[4][]; for (var i = 0; i < 4; i++) { stringLens[i] = new int[2]; stringLens[i][0] = (int)packet.ReadBits(11); stringLens[i][1] = (int)packet.ReadBits(11); } for (var i = 0; i < 4; ++i) { if (stringLens[i][0] > 1) creature.Name = packet.ReadCString("Name"); if (stringLens[i][1] > 1) creature.FemaleName = packet.ReadCString("NameAlt"); } //for (var i = 0; i < 2; ++i) //{ creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); //} creature.Type = packet.ReadInt32E<CreatureType>("CreatureType"); creature.Family = packet.ReadInt32E<CreatureFamily>("CreatureFamily"); creature.Rank = packet.ReadInt32E<CreatureRank>("Classification"); creature.KillCredits = new uint[2]; for (var i = 0; i < 2; ++i) creature.KillCredits[i] = packet.ReadUInt32("ProxyCreatureID", i); creature.DisplayIds = new uint[4]; for (var i = 0; i < 4; ++i) creature.DisplayIds[i] = packet.ReadUInt32("CreatureDisplayID", i); creature.Modifier1 = packet.ReadSingle("HpMulti"); creature.Modifier2 = packet.ReadSingle("EnergyMulti"); creature.QuestItems = new uint[6]; var questItems = packet.ReadInt32("QuestItems"); creature.MovementId = packet.ReadUInt32("CreatureMovementInfoID"); creature.Expansion = packet.ReadUInt32E<ClientType>("RequiredExpansion"); packet.ReadInt32("FlagQuest"); if (bits4 > 1) creature.SubName = packet.ReadCString("Title"); if (bits16 > 1) packet.ReadCString("TitleAlt"); if (bits28 > 1) creature.IconName = packet.ReadCString("CursorName"); for (var i = 0; i < questItems; ++i) creature.QuestItems[i] = (uint)packet.ReadInt32<ItemId>("Quest Item", i); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.UnitTemplates.Add((uint)entry.Key, creature, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.Unit, Name = creature.Name }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); var hasData = packet.ReadBit(); if (!hasData) return; // nothing to do var creature = new UnitTemplate(); var stringLens = new int[4][]; for (var i = 0; i < 4; i++) { stringLens[i] = new int[2]; stringLens[i][0] = (int)packet.ReadBits(11); stringLens[i][1] = (int)packet.ReadBits(11); } var qItemCount = packet.ReadBits(22); var lenS4 = (int)packet.ReadBits(6); var lenS3 = (int)packet.ReadBits(11); var lenS5 = (int)packet.ReadBits(11); creature.RacialLeader = packet.ReadBit("Racial Leader"); packet.ResetBitReader(); creature.Type = packet.ReadInt32E<CreatureType>("Type"); creature.KillCredits = new uint[2]; creature.KillCredits[1] = packet.ReadUInt32("Kill Credit 1"); creature.DisplayIds = new uint[4]; creature.DisplayIds[3] = packet.ReadUInt32("Display ID 3"); creature.DisplayIds[2] = packet.ReadUInt32("Display ID 2"); creature.QuestItems = new uint[qItemCount]; for (var i = 0; i < qItemCount; ++i) creature.QuestItems[i] = (uint)packet.ReadInt32<ItemId>("Quest Item", i); creature.Expansion = packet.ReadUInt32E<ClientType>("Expansion"); var name = new string[8]; var femaleName = new string[4]; for (var i = 0; i < 4; ++i) { if (stringLens[i][0] > 1) name[i] = packet.ReadCString("Name", i); if (stringLens[i][1] > 1) femaleName[i] = packet.ReadCString("Female Name", i); } creature.Name = name[0]; creature.FemaleName = femaleName[0]; if (lenS5 > 1) packet.ReadCString("string5"); creature.Modifier2 = packet.ReadSingle("Modifier 2"); creature.DisplayIds[0] = packet.ReadUInt32("Display ID 0"); if (lenS4 > 1) creature.IconName = packet.ReadCString("Icon Name"); creature.KillCredits[0] = packet.ReadUInt32("Kill Credit 0"); creature.DisplayIds[1] = packet.ReadUInt32("Display ID 1"); if (lenS3 > 1) creature.SubName = packet.ReadCString("Sub Name"); creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum creature.Modifier1 = packet.ReadSingle("Modifier 1"); creature.Family = packet.ReadInt32E<CreatureFamily>("Family"); creature.Rank = packet.ReadInt32E<CreatureRank>("Rank"); creature.MovementId = packet.ReadUInt32("Movement ID"); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.UnitTemplates.Add((uint)entry.Key, creature, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.Unit, Name = creature.Name }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleNameQueryResponse(Packet packet) { var guid = packet.StartBitStream(3, 6, 7, 2, 5, 4, 0, 1); packet.ParseBitStream(guid, 5, 4, 7, 6, 1, 2); var nameData = !packet.ReadBoolean("!nameData"); if (nameData) { packet.ReadInt32("RealmID"); // 108 packet.ReadInt32("unk36"); packet.ReadEnum<Class>("Class", TypeCode.Byte); packet.ReadEnum<Race>("Race", TypeCode.Byte); packet.ReadByte("Level"); packet.ReadEnum<Gender>("Gender", TypeCode.Byte); } packet.ParseBitStream(guid, 0, 3); packet.WriteGuid("Guid", guid); if (!nameData) return; var guid2 = new byte[8]; var guid3 = new byte[8]; guid2[2] = packet.ReadBit(); guid2[7] = packet.ReadBit(); guid3[7] = packet.ReadBit(); guid3[2] = packet.ReadBit(); guid3[0] = packet.ReadBit(); var unk32 = packet.ReadBit(); guid2[4] = packet.ReadBit(); guid3[5] = packet.ReadBit(); guid2[1] = packet.ReadBit(); guid2[3] = packet.ReadBit(); guid2[0] = packet.ReadBit(); var len = new uint[5]; for (var i = 5; i > 0; i--) len[i - 1] = packet.ReadBits(7); guid3[6] = packet.ReadBit(); guid3[3] = packet.ReadBit(); guid2[5] = packet.ReadBit(); guid3[1] = packet.ReadBit(); guid3[4] = packet.ReadBit(); var len56 = packet.ReadBits(6); guid2[6] = packet.ReadBit(); packet.ReadXORByte(guid3, 6); packet.ReadXORByte(guid3, 0); var name = packet.ReadWoWString("Name", len56); var playerGuid = new Guid(BitConverter.ToUInt64(guid, 0)); StoreGetters.AddName(playerGuid, name); packet.ReadXORByte(guid2, 5); packet.ReadXORByte(guid2, 2); packet.ReadXORByte(guid3, 3); packet.ReadXORByte(guid2, 4); packet.ReadXORByte(guid2, 3); packet.ReadXORByte(guid3, 4); packet.ReadXORByte(guid3, 2); packet.ReadXORByte(guid2, 7); for (var i = 5; i > 0; i--) packet.ReadWoWString("str", len[i - 1], i); packet.ReadXORByte(guid2, 6); packet.ReadXORByte(guid3, 7); packet.ReadXORByte(guid3, 1); packet.ReadXORByte(guid2, 1); packet.ReadXORByte(guid3, 5); packet.ReadXORByte(guid2, 0); packet.WriteLine("Account: {0}", BitConverter.ToUInt64(guid2, 0)); packet.WriteGuid("Guid3", guid3); var objectName = new ObjectName { ObjectType = ObjectType.Player, Name = name, }; Storage.ObjectNames.Add((uint)playerGuid.GetLow(), objectName, packet.TimeSpan); }
public static void HandleGameObjectQueryResponse(Packet packet) { var gameObject = new GameObjectTemplate(); var entry = packet.ReadEntry("Entry"); if (entry.Value) // entry is masked return; packet.ReadBit("Allow"); var dataSize = packet.ReadInt32("DataSize"); if (dataSize == 0) return; gameObject.Type = packet.ReadInt32E<GameObjectType>("Type"); gameObject.DisplayId = packet.ReadUInt32("Display ID"); var name = new string[4]; for (var i = 0; i < 4; i++) name[i] = packet.ReadCString("Name", i); gameObject.Name = name[0]; gameObject.IconName = packet.ReadCString("Icon Name"); gameObject.CastCaption = packet.ReadCString("Cast Caption"); gameObject.UnkString = packet.ReadCString("Unk String"); gameObject.Data = new int[33]; for (var i = 0; i < gameObject.Data.Length; i++) gameObject.Data[i] = packet.ReadInt32("Data", i); gameObject.Size = packet.ReadSingle("Size"); gameObject.QuestItems = new uint[6]; var length = packet.ReadByte("QuestItems Length"); for (var i = 0; i < length; i++) gameObject.QuestItems[i] = (uint)packet.ReadInt32<ItemId>("Quest Item", i); packet.ReadUInt32E<ClientType>("Expansion"); Storage.GameObjectTemplates.Add((uint)entry.Key, gameObject, packet.TimeSpan); var objectName = new ObjectName { ObjectType = ObjectType.GameObject, Name = gameObject.Name }; Storage.ObjectNames.Add((uint)entry.Key, objectName, packet.TimeSpan); }
public static void HandleNameQueryResponse(Packet packet) { WowGuid guid; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { guid = packet.ReadPackedGuid("GUID"); var end = packet.ReadByte("Result"); /* if (end == 1) DenyItem(&WDB_CACHE_NAME, v11, v12); if (end == 2) RetryItem(&WDB_CACHE_NAME, v11, v12); if (end == 3) { AddItem(&WDB_CACHE_NAME, (int)&v8, v11, v12); SetTemporary(&WDB_CACHE_NAME, v11, v12); } */ if (end != 0) return; } else guid = packet.ReadGuid("GUID"); var name = packet.ReadCString("Name"); StoreGetters.AddName(guid, name); packet.ReadCString("Realm Name"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { packet.ReadByteE<Race>("Race"); packet.ReadByteE<Gender>("Gender"); packet.ReadByteE<Class>("Class"); } else { packet.ReadInt32E<Race>("Race"); packet.ReadInt32E<Gender>("Gender"); packet.ReadInt32E<Class>("Class"); } if (!packet.ReadBool("Name Declined")) return; for (var i = 0; i < 5; i++) packet.ReadCString("Declined Name", i); var objectName = new ObjectName { ObjectType = ObjectType.Player, ID = (int)guid.GetLow(), Name = name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); if (entry.Value) return; CreatureTemplate creature = new CreatureTemplate { Entry = (uint)entry.Key }; var name = new string[4]; for (int i = 0; i < name.Length; i++) name[i] = packet.ReadCString("Name", i); creature.Name = name[0]; if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914)) { var femaleName = new string[4]; for (int i = 0; i < femaleName.Length; i++) femaleName[i] = packet.ReadCString("Female Name", i); creature.FemaleName = femaleName[0]; } creature.SubName = packet.ReadCString("Sub Name"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_0_5_16048)) packet.ReadCString("Unk String"); creature.IconName = packet.ReadCString("Icon Name"); creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914)) // Might be earlier or later creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum creature.Type = packet.ReadInt32E<CreatureType>("Type"); creature.Family = packet.ReadInt32E<CreatureFamily>("Family"); creature.Rank = packet.ReadInt32E<CreatureRank>("Rank"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { creature.KillCredits = new uint?[2]; for (int i = 0; i < 2; ++i) creature.KillCredits[i] = packet.ReadUInt32("Kill Credit", i); } else // Did they stop sending pet spell data after 3.1? { packet.ReadInt32("Unk Int"); creature.PetSpellDataID = packet.ReadUInt32("Pet Spell Data Id"); } creature.ModelIDs = new uint?[4]; for (int i = 0; i < 4; i++) creature.ModelIDs[i] = packet.ReadUInt32("Model ID", i); creature.HealthModifier = packet.ReadSingle("Modifier 1"); creature.ManaModifier = packet.ReadSingle("Modifier 2"); creature.RacialLeader = packet.ReadBool("Racial Leader"); int qItemCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_2_0_10192) ? 6 : 4; //TODO: Move to creature_questitem //creature.QuestItems = new uint[qItemCount]; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { for (int i = 0; i < qItemCount; i++) /*creature.QuestItems[i] = (uint)*/packet.ReadInt32<ItemId>("Quest Item", i); creature.MovementID = packet.ReadUInt32("Movement ID"); } if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164)) creature.ExpUnk = packet.ReadUInt32E<ClientType>("Expansion"); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.CreatureTemplates.Add(creature, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.Unit, ID = entry.Key, Name = creature.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleNameQueryResponse(Packet packet) { Guid guid; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { guid = packet.ReadPackedGuid("GUID"); var end = packet.ReadByte("Result"); /* if (end == 1) DenyItem(&WDB_CACHE_NAME, v11, v12); if (end == 2) RetryItem(&WDB_CACHE_NAME, v11, v12); if (end == 3) { AddItem(&WDB_CACHE_NAME, (int)&v8, v11, v12); SetTemporary(&WDB_CACHE_NAME, v11, v12); } */ if (end != 0) return; } else guid = packet.ReadGuid("GUID"); var name = packet.ReadCString("Name"); packet.ReadCString("Realm Name"); TypeCode typeCode = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767) ? TypeCode.Byte : TypeCode.Int32; packet.ReadEnum<Race>("Race", typeCode); packet.ReadEnum<Gender>("Gender", typeCode); packet.ReadEnum<Class>("Class", typeCode); if (!packet.ReadBoolean("Name Declined")) return; for (var i = 0; i < 5; i++) packet.ReadCString("Declined Name", i); var objectName = new ObjectName { ObjectType = ObjectType.Player, Name = name, }; Storage.ObjectNames.TryAdd((uint)guid.GetLow(), objectName); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); Bit hasData = packet.ReadBit(); if (!hasData) return; // nothing to do CreatureTemplate creature = new CreatureTemplate { Entry = (uint)entry.Key }; packet.ReadBits(11); uint qItemCount = packet.ReadBits(22); int lenS4 = (int)packet.ReadBits(6); creature.RacialLeader = packet.ReadBit("Racial Leader"); var stringLens = new int[4][]; for (int i = 0; i < 4; i++) { stringLens[i] = new int[2]; stringLens[i][0] = (int)packet.ReadBits(11); stringLens[i][1] = (int)packet.ReadBits(11); } int lenS5 = (int)packet.ReadBits(11); packet.ResetBitReader(); creature.Family = packet.ReadInt32E<CreatureFamily>("Family"); creature.ExpUnk = packet.ReadUInt32E<ClientType>("Expansion"); creature.Type = packet.ReadInt32E<CreatureType>("Type"); if (lenS5 > 1) creature.SubName = packet.ReadCString("Sub Name"); creature.ModelIDs = new uint?[4]; creature.ModelIDs[0] = packet.ReadUInt32("Display ID 0"); creature.ModelIDs[3] = packet.ReadUInt32("Display ID 3"); //TODO: move to creature_questitems //creature.QuestItems = new uint[qItemCount]; for (int i = 0; i < qItemCount; ++i) /*creature.QuestItems[i] = (uint)*/packet.ReadInt32<ItemId>("Quest Item", i); var name = new string[4]; var femaleName = new string[4]; for (int i = 0; i < 4; ++i) { if (stringLens[i][0] > 1) name[i] = packet.ReadCString("Name", i); if (stringLens[i][1] > 1) femaleName[i] = packet.ReadCString("Female Name", i); } creature.Name = name[0]; creature.FemaleName = femaleName[0]; if (lenS4 > 1) creature.IconName = packet.ReadCString("Icon Name"); creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum creature.HealthModifier = packet.ReadSingle("Modifier 1"); creature.Rank = packet.ReadInt32E<CreatureRank>("Rank"); creature.KillCredits = new uint?[2]; for (int i = 0; i < 2; ++i) creature.KillCredits[i] = packet.ReadUInt32("Kill Credit", i); creature.ManaModifier = packet.ReadSingle("Modifier 2"); creature.MovementID = packet.ReadUInt32("Movement ID"); creature.ModelIDs[1] = packet.ReadUInt32("Display ID 1"); creature.ModelIDs[2] = packet.ReadUInt32("Display ID 2"); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.CreatureTemplates.Add(creature, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.Unit, ID = entry.Key, Name = creature.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); if (entry.Value) return; var creature = new UnitTemplate(); var nameCount = ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914) ? 8 : 4; // Might be earlier or later var name = new string[nameCount]; for (var i = 0; i < name.Length; i++) name[i] = packet.ReadCString("Name", i); creature.Name = name[0]; creature.SubName = packet.ReadCString("Sub Name"); creature.IconName = packet.ReadCString("Icon Name"); creature.TypeFlags = packet.ReadEnum<CreatureTypeFlag>("Type Flags", TypeCode.UInt32); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914)) // Might be earlier or later creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum creature.Type = packet.ReadEnum<CreatureType>("Type", TypeCode.Int32); creature.Family = packet.ReadEnum<CreatureFamily>("Family", TypeCode.Int32); creature.Rank = packet.ReadEnum<CreatureRank>("Rank", TypeCode.Int32); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { creature.KillCredit1 = packet.ReadUInt32("Kill Credit 1"); creature.KillCredit2 = packet.ReadUInt32("Kill Credit 2"); } else // Did they stop sending pet spell data after 3.1? { creature.UnkInt = packet.ReadInt32("Unk Int"); creature.PetSpellData = packet.ReadUInt32("Pet Spell Data Id"); } creature.DisplayIds = new uint[4]; for (var i = 0; i < 4; i++) creature.DisplayIds[i] = packet.ReadUInt32("Display ID", i); creature.Modifier1 = packet.ReadSingle("Modifier 1"); creature.Modifier2 = packet.ReadSingle("Modifier 2"); creature.RacialLeader = packet.ReadBoolean("Racial Leader"); var qItemCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_2_0_10192) ? 6 : 4; creature.QuestItems = new uint[qItemCount]; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { for (var i = 0; i < qItemCount; i++) creature.QuestItems[i] = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Quest Item", i); creature.MovementId = packet.ReadUInt32("Movement ID"); } if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164)) creature.Expansion = packet.ReadEnum<ClientType>("Expansion", TypeCode.UInt32); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.UnitTemplates.TryAdd((uint)entry.Key, creature); var objectName = new ObjectName { ObjectType = ObjectType.Unit, Name = creature.Name, }; Storage.ObjectNames.TryAdd((uint)entry.Key, objectName); }
public static void HandleItemNameQueryResponse(Packet packet) { var entry = packet.ReadEntryWithName<UInt32>(StoreNameType.Item, "Entry"); var name = packet.ReadCString("Name"); packet.ReadEnum<InventoryType>("Inventory Type", TypeCode.UInt32); var objectName = new ObjectName { ObjectType = ObjectType.Item, Name = name, }; Storage.ObjectNames.Add((uint)entry, objectName, packet.TimeSpan); }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); // +5 CreatureTemplate creature = new CreatureTemplate { Entry = (uint)entry.Key }; Bit hasData = packet.ReadBit(); //+16 if (!hasData) return; // nothing to do creature.ModelIDs = new uint?[4]; creature.KillCredits = new uint?[2]; uint bits24 = packet.ReadBits(11); //+7 uint qItemCount = packet.ReadBits(22); //+72 int bits1C = (int)packet.ReadBits(11); //+9 var stringLens = new int[4][]; for (int i = 0; i < 4; i++) { stringLens[i] = new int[2]; stringLens[i][0] = (int)packet.ReadBits(11); stringLens[i][1] = (int)packet.ReadBits(11); } creature.RacialLeader = packet.ReadBit("Racial Leader"); //+68 uint bits2C = packet.ReadBits(6); //+136 if (bits1C > 1) packet.ReadCString("String1C"); creature.KillCredits[0] = packet.ReadUInt32(); //+27 creature.ModelIDs[3] = packet.ReadUInt32(); //+32 creature.ModelIDs[2] = packet.ReadUInt32(); //+31 creature.RequiredExpansion = packet.ReadUInt32E<ClientType>("Expansion"); //+24 creature.Type = packet.ReadInt32E<CreatureType>("Type"); //+12 creature.HealthModifier = packet.ReadSingle("Modifier 1"); //+15 creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum creature.Rank = packet.ReadInt32E<CreatureRank>("Rank"); //+14 creature.MovementID = packet.ReadUInt32("Movement ID"); //+23 var name = new string[4]; var femaleName = new string[4]; for (int i = 0; i < 4; ++i) { if (stringLens[i][1] > 1) femaleName[i] = packet.ReadCString("Female Name", i); if (stringLens[i][0] > 1) name[i] = packet.ReadCString("Name", i); } creature.Name = name[0]; creature.FemaleName = femaleName[0]; if (bits24 > 1) creature.SubName = packet.ReadCString("Sub Name"); creature.ModelIDs[0] = packet.ReadUInt32(); //+29 creature.ModelIDs[1] = packet.ReadUInt32(); //+30 if (bits2C > 1) creature.IconName = packet.ReadCString("Icon Name"); //+100 //creature.QuestItems = new uint[qItemCount]; for (int i = 0; i < qItemCount; ++i) /*creature.QuestItems[i] = (uint)*/packet.ReadInt32<ItemId>("Quest Item", i); //+72 creature.KillCredits[1] = packet.ReadUInt32(); //+28 creature.ManaModifier = packet.ReadSingle("Modifier 2"); //+16 creature.Family = packet.ReadInt32E<CreatureFamily>("Family"); //+13 for (int i = 0; i < 4; ++i) packet.AddValue("Display ID", creature.ModelIDs[i], i); for (int i = 0; i < 2; ++i) packet.AddValue("Kill Credit", creature.KillCredits[i], i); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.CreatureTemplates.Add(creature, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.Unit, ID = entry.Key, Name = creature.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }