Skip to content

Commit 085c983

Browse files
committed
Add 5.5.0 handlers for ClientCache group
1 parent d3f64cb commit 085c983

File tree

4 files changed

+220
-8
lines changed

4 files changed

+220
-8
lines changed

WowPacketParser/Store/Objects/CreatureTemplate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public sealed record CreatureTemplateQuestItem : IDataModel
158158
[DBFieldName("CreatureEntry", true)]
159159
public uint? CreatureEntry;
160160

161-
[DBFieldName("DifficultyID", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.CataClassic, true)]
161+
[DBFieldName("DifficultyID", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.SinceCataClassic, true)]
162162
public uint? DifficultyID;
163163

164164
[DBFieldName("Idx", true)]
@@ -167,7 +167,7 @@ public sealed record CreatureTemplateQuestItem : IDataModel
167167
[DBFieldName("ItemId")]
168168
public uint? ItemId;
169169

170-
[DBFieldName("VerifiedBuild", TargetedDatabaseFlag.SinceWarlordsOfDraenor | TargetedDatabaseFlag.CataClassic)]
170+
[DBFieldName("VerifiedBuild", TargetedDatabaseFlag.SinceWarlordsOfDraenor | TargetedDatabaseFlag.SinceCataClassic)]
171171
public int? VerifiedBuild = ClientVersion.BuildInt;
172172
}
173173

WowPacketParser/Store/Objects/CreatureTemplateDifficulty.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ public sealed record CreatureTemplateDifficultyWDB : IDataModel
1515
[DBFieldName("DifficultyID", true)]
1616
public uint? DifficultyID;
1717

18-
[DBFieldName("HealthScalingExpansion", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.CataClassic)]
18+
[DBFieldName("HealthScalingExpansion", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.SinceCataClassic)]
1919
public ClientType? HealthScalingExpansion;
2020

21-
[DBFieldName("HealthModifier", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.CataClassic)]
21+
[DBFieldName("HealthModifier", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.SinceCataClassic)]
2222
public float? HealthModifier;
2323

24-
[DBFieldName("ManaModifier", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.CataClassic)]
24+
[DBFieldName("ManaModifier", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.SinceCataClassic)]
2525
public float? ManaModifier;
2626

27-
[DBFieldName("CreatureDifficultyID", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.CataClassic)]
27+
[DBFieldName("CreatureDifficultyID", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.SinceCataClassic)]
2828
public int? CreatureDifficultyID;
2929

30-
[DBFieldName("TypeFlags", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.CataClassic)]
30+
[DBFieldName("TypeFlags", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.SinceCataClassic)]
3131
public CreatureTypeFlag? TypeFlags;
3232

33-
[DBFieldName("TypeFlags2", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.CataClassic)]
33+
[DBFieldName("TypeFlags2", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.WotlkClassic | TargetedDatabaseFlag.SinceCataClassic)]
3434
public uint? TypeFlags2;
3535

3636
public bool WDBEqualsSkipDifficultySkipHealthScalingExpansion(CreatureTemplateDifficultyWDB rhs)

WowPacketParserModule.V5_5_0_61735/Parser/QueryHandler.cs

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,185 @@ public static void HandleNameQueryResponse(Packet packet)
4949
for (var i = 0; i < count; ++i)
5050
response.Responses.Add(ReadNameCacheLookupResult(packet, i));
5151
}
52+
53+
[HasSniffData]
54+
[Parser(Opcode.SMSG_QUERY_CREATURE_RESPONSE)]
55+
public static void HandleCreatureQueryResponse(Packet packet)
56+
{
57+
PacketQueryCreatureResponse response = packet.Holder.QueryCreatureResponse = new PacketQueryCreatureResponse();
58+
var entry = packet.ReadEntry("Entry");
59+
60+
CreatureTemplate creature = new CreatureTemplate
61+
{
62+
Entry = (uint)entry.Key
63+
};
64+
response.Entry = (uint)entry.Key;
65+
66+
Bit hasData = packet.ReadBit();
67+
response.HasData = hasData;
68+
if (!hasData)
69+
return; // nothing to do
70+
71+
packet.ResetBitReader();
72+
uint titleLen = packet.ReadBits(11);
73+
uint titleAltLen = packet.ReadBits(11);
74+
uint cursorNameLen = packet.ReadBits(6);
75+
creature.Civilian = packet.ReadBit("Civilian");
76+
creature.RacialLeader = response.Leader = packet.ReadBit("Leader");
77+
78+
var stringLens = new int[4][];
79+
for (int i = 0; i < 4; i++)
80+
{
81+
stringLens[i] = new int[2];
82+
stringLens[i][0] = (int)packet.ReadBits(11);
83+
stringLens[i][1] = (int)packet.ReadBits(11);
84+
}
85+
86+
for (var i = 0; i < 4; ++i)
87+
{
88+
if (stringLens[i][0] > 1)
89+
{
90+
string name = packet.ReadDynamicString("Name", stringLens[i][0], i);
91+
if (i == 0)
92+
creature.Name = response.Name = name;
93+
}
94+
if (stringLens[i][1] > 1)
95+
{
96+
string nameAlt = packet.ReadDynamicString("NameAlt", stringLens[i][1], i);
97+
if (i == 0)
98+
creature.FemaleName = response.NameAlt = nameAlt;
99+
}
100+
}
101+
102+
creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags");
103+
response.TypeFlags = (uint?)creature.TypeFlags ?? 0;
104+
creature.TypeFlags2 = response.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2");
105+
packet.ReadUInt32("Creature Type Flags 3");
106+
107+
creature.Type = packet.ReadByteE<CreatureType>("CreatureType");
108+
creature.Family = packet.ReadInt32E<CreatureFamily>("CreatureFamily");
109+
creature.Rank = packet.ReadSByteE<CreatureRank>("Classification");
110+
creature.PetSpellDataID = packet.ReadUInt32("PetSpellDataId");
111+
response.Type = (int?)creature.Type ?? 0;
112+
response.Family = (int?)creature.Family ?? 0;
113+
response.Rank = (int?)creature.Rank ?? 0;
114+
115+
creature.KillCredits = new uint?[2];
116+
for (int i = 0; i < 2; ++i)
117+
{
118+
creature.KillCredits[i] = (uint)packet.ReadInt32("ProxyCreatureID", i);
119+
response.KillCredits.Add(creature.KillCredits[i] ?? 0);
120+
}
121+
122+
var displayIdCount = packet.ReadUInt32("DisplayIdCount");
123+
packet.ReadSingle("TotalProbability");
124+
125+
for (var i = 0; i < displayIdCount; ++i)
126+
{
127+
CreatureTemplateModel model = new CreatureTemplateModel
128+
{
129+
CreatureID = (uint)entry.Key,
130+
Idx = (uint)i
131+
};
132+
133+
model.CreatureDisplayID = (uint)packet.ReadInt32("CreatureDisplayID", i);
134+
model.DisplayScale = packet.ReadSingle("DisplayScale", i);
135+
model.Probability = packet.ReadSingle("Probability", i);
136+
137+
response.Models.Add(model.CreatureDisplayID ?? 0);
138+
Storage.CreatureTemplateModels.Add(model, packet.TimeSpan);
139+
}
140+
141+
creature.HealthModifier = response.HpMod = packet.ReadSingle("HpMulti");
142+
creature.ManaModifier = response.ManaMod = packet.ReadSingle("EnergyMulti");
143+
uint questItems = packet.ReadUInt32("QuestItems");
144+
uint questCurrencies = packet.ReadUInt32("QuestCurrencies");
145+
creature.MovementID = response.MovementId = (uint)packet.ReadInt32("CreatureMovementInfoID");
146+
creature.HealthScalingExpansion = packet.ReadInt32E<ClientType>("HealthScalingExpansion");
147+
response.HpScalingExp = (uint?)creature.HealthScalingExpansion ?? 0;
148+
creature.RequiredExpansion = packet.ReadInt32E<ClientType>("RequiredExpansion");
149+
response.Expansion = (uint?)creature.RequiredExpansion ?? 0;
150+
creature.VignetteID = (uint)packet.ReadInt32("VignetteID");
151+
creature.UnitClass = (uint)packet.ReadInt32E<Class>("UnitClass");
152+
creature.CreatureDifficultyID = packet.ReadInt32("CreatureDifficultyID");
153+
creature.WidgetSetID = packet.ReadInt32("WidgetSetID");
154+
creature.WidgetSetUnitConditionID = packet.ReadInt32("WidgetSetUnitConditionID");
155+
156+
if (titleLen > 1)
157+
creature.SubName = response.Title = packet.ReadCString("Title");
158+
159+
if (titleAltLen > 1)
160+
creature.TitleAlt = response.TitleAlt = packet.ReadCString("TitleAlt");
161+
162+
if (cursorNameLen > 1)
163+
creature.IconName = response.IconName = packet.ReadCString("CursorName");
164+
165+
for (uint i = 0; i < questItems; ++i)
166+
{
167+
CreatureTemplateQuestItem questItem = new CreatureTemplateQuestItem
168+
{
169+
CreatureEntry = (uint)entry.Key,
170+
Idx = i,
171+
ItemId = (uint)packet.ReadInt32<ItemId>("QuestItem", i)
172+
};
173+
174+
questItem.DifficultyID = WowPacketParser.Parsing.Parsers.MovementHandler.CurrentDifficultyID;
175+
176+
Storage.CreatureTemplateQuestItems.Add(questItem, packet.TimeSpan);
177+
response.QuestItems.Add(questItem.ItemId ?? 0);
178+
}
179+
180+
for (uint i = 0; i < questCurrencies; ++i)
181+
{
182+
CreatureTemplateQuestCurrency questCurrency = new CreatureTemplateQuestCurrency
183+
{
184+
CreatureId = (uint)entry.Key,
185+
CurrencyId = packet.ReadInt32<CurrencyId>("QuestCurrency", i)
186+
};
187+
188+
Storage.CreatureTemplateQuestCurrencies.Add(questCurrency, packet.TimeSpan);
189+
response.QuestCurrencies.Add(questCurrency.CurrencyId ?? 0);
190+
}
191+
192+
packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE");
193+
194+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
195+
{
196+
CreatureTemplateLocale localesCreature = new CreatureTemplateLocale
197+
{
198+
ID = (uint)entry.Key,
199+
Name = creature.Name,
200+
NameAlt = creature.FemaleName,
201+
Title = creature.SubName,
202+
TitleAlt = creature.TitleAlt
203+
};
204+
205+
Storage.LocalesCreatures.Add(localesCreature, packet.TimeSpan);
206+
}
207+
208+
Storage.CreatureTemplates.Add(creature.Entry.Value, creature, packet.TimeSpan);
209+
210+
CreatureTemplateDifficultyWDB creatureTemplateDifficultyWDB = new CreatureTemplateDifficultyWDB
211+
{
212+
Entry = creature.Entry,
213+
DifficultyID = WowPacketParser.Parsing.Parsers.MovementHandler.CurrentDifficultyID,
214+
HealthScalingExpansion = creature.HealthScalingExpansion,
215+
HealthModifier = creature.HealthModifier,
216+
ManaModifier = creature.ManaModifier,
217+
CreatureDifficultyID = creature.CreatureDifficultyID,
218+
TypeFlags = creature.TypeFlags,
219+
TypeFlags2 = creature.TypeFlags2
220+
};
221+
creatureTemplateDifficultyWDB = WowPacketParser.SQL.SQLDatabase.CheckCreatureTemplateDifficultyWDBFallbacks(creatureTemplateDifficultyWDB, creatureTemplateDifficultyWDB.DifficultyID);
222+
Storage.CreatureTemplateDifficultiesWDB.Add(creatureTemplateDifficultyWDB);
223+
224+
ObjectName objectName = new ObjectName
225+
{
226+
ObjectType = StoreNameType.Unit,
227+
ID = entry.Key,
228+
Name = creature.Name
229+
};
230+
Storage.ObjectNames.Add(objectName, packet.TimeSpan);
231+
}
52232
}
53233
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Text;
2+
using WowPacketParser.Enums;
3+
using WowPacketParser.Misc;
4+
using WowPacketParser.Parsing;
5+
6+
namespace WowPacketParserModule.V5_5_0_61735.Parsers
7+
{
8+
public static class SessionHandler
9+
{
10+
[Parser(Opcode.SMSG_REALM_QUERY_RESPONSE)]
11+
public static void HandleRealmQueryResponse(Packet packet)
12+
{
13+
packet.ReadUInt32("VirtualRealmAddress");
14+
15+
var state = packet.ReadByte("LookupState");
16+
if (state == 0)
17+
{
18+
packet.ResetBitReader();
19+
20+
packet.ReadBit("IsLocal");
21+
packet.ReadBit("Unk bit");
22+
23+
var bits2 = packet.ReadBits(9);
24+
var bits258 = packet.ReadBits(9);
25+
packet.ReadBit();
26+
27+
packet.ReadWoWString("RealmNameActual", bits2);
28+
packet.ReadWoWString("RealmNameNormalized", bits258);
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)