Skip to content

Commit 96052d4

Browse files
committed
Implemented gameobject_template_locale sql generation
1 parent 4d39586 commit 96052d4

File tree

17 files changed

+220
-6
lines changed

17 files changed

+220
-6
lines changed

WowPacketParser/Parsing/Parsers/GameObjectHandler.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ public static void HandleGameObjectQueryResponse(Packet packet)
6464

6565
packet.AddSniffData(StoreNameType.GameObject, entry.Key, "QUERY_RESPONSE");
6666

67+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
68+
{
69+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
70+
{
71+
Entry = (uint)entry.Key,
72+
Name = gameObject.Name,
73+
OpeningText = gameObject.OpeningText,
74+
ClosingText = gameObject.ClosingText
75+
};
76+
77+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
78+
}
6779
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
6880

6981
ObjectName objectName = new ObjectName
@@ -101,14 +113,14 @@ public static void HandleGOMisc(Packet packet)
101113
var use = packet.Holder.ClientUseGameObject = new PacketClientUseGameObject();
102114
packet.ReadGuid("GUID");
103115
}
104-
116+
105117
[Parser(Opcode.CMSG_GAME_OBJ_USE)]
106118
public static void HandleGOUse(Packet packet)
107119
{
108120
var use = packet.Holder.ClientUseGameObject = new PacketClientUseGameObject();
109121
use.GameObject = packet.ReadGuid("GUID");
110122
}
111-
123+
112124
[Parser(Opcode.CMSG_GAME_OBJ_REPORT_USE)]
113125
public static void HandleGOReportUse(Packet packet)
114126
{

WowPacketParser/SQL/Builders/Locales.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,20 @@ public static string PlayerChoiceResponseLocale()
143143

144144
return "SET NAMES 'utf8';" + Environment.NewLine + SQLUtil.Compare(Storage.PlayerChoiceResponseLocales, playerChoiceResponseDb, StoreNameType.None) + Environment.NewLine + "SET NAMES 'latin1';";
145145
}
146+
147+
[BuilderMethod]
148+
public static string LocalesGameObject()
149+
{
150+
if (Storage.LocalesGameObject.IsEmpty())
151+
return string.Empty;
152+
153+
if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gameobject_template))
154+
return string.Empty;
155+
156+
// pass empty list, because we want to select the whole db table (faster than select only needed columns)
157+
var templatesDb = SQLDatabase.Get(new RowList<Store.Objects.GameObjectTemplateLocale>());
158+
159+
return "SET NAMES 'utf8';" + Environment.NewLine + SQLUtil.Compare(Storage.LocalesGameObject, templatesDb, StoreNameType.None) + Environment.NewLine + "SET NAMES 'latin1';";
160+
}
146161
}
147162
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using WowPacketParser.Enums;
2+
using WowPacketParser.Misc;
3+
using WowPacketParser.SQL;
4+
5+
namespace WowPacketParser.Store.Objects
6+
{
7+
[DBTableName("gameobject_template_locale")]
8+
public sealed record GameObjectTemplateLocale : IDataModel
9+
{
10+
[DBFieldName("entry", true)]
11+
public uint? Entry;
12+
13+
[DBFieldName("locale", true)]
14+
public string Locale = ClientLocale.PacketLocaleString;
15+
16+
[DBFieldName("name", nullable: true)]
17+
public string Name;
18+
19+
[DBFieldName("castBarCaption", nullable: true)]
20+
public string OpeningText;
21+
22+
[DBFieldName("unk1", nullable: true)]
23+
public string ClosingText;
24+
25+
[DBFieldName("VerifiedBuild")]
26+
public int? VerifiedBuild = ClientVersion.BuildInt;
27+
}
28+
}

WowPacketParser/Store/Storage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public static class Storage
131131
public static readonly DataBag<QuestGreetingLocale> LocalesQuestGreeting = new DataBag<QuestGreetingLocale>(new List<SQLOutput> { SQLOutput.locales_quest });
132132
public static readonly DataBag<QuestRequestItemsLocale> LocalesQuestRequestItems = new DataBag<QuestRequestItemsLocale>(new List<SQLOutput> { SQLOutput.locales_quest });
133133
public static readonly DataBag<PageTextLocale> LocalesPageText = new DataBag<PageTextLocale>(new List<SQLOutput> { SQLOutput.page_text_locale });
134+
public static readonly DataBag<GameObjectTemplateLocale> LocalesGameObject = new DataBag<GameObjectTemplateLocale>(new List<SQLOutput> { SQLOutput.gameobject_template });
134135

135136
// Spell Target Position
136137
public static readonly DataBag<SpellTargetPosition> SpellTargetPositions = new DataBag<SpellTargetPosition>(new List<SQLOutput> { SQLOutput.spell_target_position });
@@ -2751,6 +2752,7 @@ public static void ClearContainers()
27512752
LocalesQuestGreeting.Clear();
27522753
LocalesQuestRequestItems.Clear();
27532754
LocalesPageText.Clear();
2755+
LocalesGameObject.Clear();
27542756

27552757
HotfixDatas.Clear();
27562758
HotfixBlobs.Clear();

WowPacketParserModule.V2_5_1_38707/Parsers/QueryHandler.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ public static void HandleGameObjectQueryResponse1141(Packet packet)
262262

263263
packet.AddSniffData(StoreNameType.GameObject, entry.Key, "QUERY_RESPONSE");
264264

265+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
266+
{
267+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
268+
{
269+
Entry = (uint)entry.Key,
270+
Name = gameObject.Name,
271+
OpeningText = gameObject.OpeningText,
272+
ClosingText = gameObject.ClosingText
273+
};
274+
275+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
276+
}
265277
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
266278

267279
ObjectName objectName = new ObjectName

WowPacketParserModule.V3_4_0_45166/Parsers/QueryHandler.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,18 @@ public static void HandleGameObjectQueryResponse1141(Packet packet)
466466

467467
packet.AddSniffData(StoreNameType.GameObject, entry.Key, "QUERY_RESPONSE");
468468

469+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
470+
{
471+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
472+
{
473+
Entry = (uint)entry.Key,
474+
Name = gameObject.Name,
475+
OpeningText = gameObject.OpeningText,
476+
ClosingText = gameObject.ClosingText
477+
};
478+
479+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
480+
}
469481
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
470482

471483
ObjectName objectName = new ObjectName

WowPacketParserModule.V4_4_0_54481/Parsers/QueryHandler.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,18 @@ public static void HandleGameObjectQueryResponse1141(Packet packet)
303303

304304
packet.AddSniffData(StoreNameType.GameObject, entry.Key, "QUERY_RESPONSE");
305305

306+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
307+
{
308+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
309+
{
310+
Entry = (uint)entry.Key,
311+
Name = gameObject.Name,
312+
OpeningText = gameObject.OpeningText,
313+
ClosingText = gameObject.ClosingText
314+
};
315+
316+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
317+
}
306318
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
307319

308320
ObjectName objectName = new ObjectName

WowPacketParserModule.V5_3_0_16981/Parsers/GameObjectHandler.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ public static void HandleGameObjectQueryResponse(Packet packet)
6666

6767
packet.ReadByte("Unk Byte");
6868

69+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
70+
{
71+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
72+
{
73+
Entry = (uint)entry.Key,
74+
Name = gameObject.Name,
75+
OpeningText = gameObject.OpeningText,
76+
ClosingText = gameObject.ClosingText
77+
};
78+
79+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
80+
}
6981
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
7082

7183
ObjectName objectName = new ObjectName
@@ -93,7 +105,7 @@ public static void HandleGameObjectQueryResponse(Packet packet)
93105
public static void HandleGOCustomAnim(Packet packet)
94106
{
95107
var customAnim = packet.Holder.GameObjectCustomAnim = new();
96-
108+
97109
var guid = new byte[8];
98110
packet.ReadBit("Unk bit");
99111
packet.StartBitStream(guid, 6, 3, 4);

WowPacketParserModule.V5_4_0_17359/Parsers/GameObjectHandler.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ public static void HandleGameObjectQueryResponse(Packet packet)
5454

5555
gameObject.RequiredLevel = (int)packet.ReadUInt32E<ClientType>("Expansion");
5656

57+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
58+
{
59+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
60+
{
61+
Entry = (uint)entry.Key,
62+
Name = gameObject.Name,
63+
OpeningText = gameObject.OpeningText,
64+
ClosingText = gameObject.ClosingText
65+
};
66+
67+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
68+
}
5769
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
5870

5971
ObjectName objectName = new ObjectName
@@ -63,7 +75,7 @@ public static void HandleGameObjectQueryResponse(Packet packet)
6375
Name = gameObject.Name
6476
};
6577
Storage.ObjectNames.Add(objectName, packet.TimeSpan);
66-
78+
6779
query.Type = (uint)gameObject.Type.Value;
6880
query.Model = gameObject.DisplayID.Value;
6981
query.Name = gameObject.Name;

WowPacketParserModule.V5_4_1_17538/Parsers/GameObjectHandler.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ public static void HandleGameObjectQueryResponse(Packet packet)
5555

5656
packet.ReadByte("Unk1 Byte");
5757

58+
if (ClientLocale.PacketLocale != LocaleConstant.enUS)
59+
{
60+
GameObjectTemplateLocale localesGameObject = new GameObjectTemplateLocale
61+
{
62+
Entry = (uint)entry.Key,
63+
Name = gameObject.Name,
64+
OpeningText = gameObject.OpeningText,
65+
ClosingText = gameObject.ClosingText
66+
};
67+
68+
Storage.LocalesGameObject.Add(localesGameObject, packet.TimeSpan);
69+
}
5870
Storage.GameObjectTemplates.Add(gameObject, packet.TimeSpan);
5971

6072
ObjectName objectName = new ObjectName
@@ -64,7 +76,7 @@ public static void HandleGameObjectQueryResponse(Packet packet)
6476
Name = gameObject.Name
6577
};
6678
Storage.ObjectNames.Add(objectName, packet.TimeSpan);
67-
79+
6880
query.Type = (uint)gameObject.Type.Value;
6981
query.Model = gameObject.DisplayID.Value;
7082
query.Name = gameObject.Name;

0 commit comments

Comments
 (0)