Skip to content

Commit 888f648

Browse files
committed
SQL: Some final polishing
1 parent 5f5dd37 commit 888f648

36 files changed

+172
-192
lines changed

WowPacketParser/App.config

+2-3
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@
101101
<add key="creature_template" value="false"/>
102102
<add key="creature_template_addon" value="false"/>
103103
<add key="creature_text" value="false"/>
104-
<add key="defense_message" value="false"/>
105104
<add key="gameobject" value="false"/>
106105
<add key="gameobject_template" value="false"/>
107106
<add key="gossip_menu" value="false"/>
108107
<add key="gossip_menu_option" value="false"/>
109108
<add key="item_template" value="false"/>
109+
<add key="locales_quest" value="false"/>
110+
<add key="locales_quest_objectives" value="false"/>
110111
<add key="npc_spellclick_spells" value="false"/>
111112
<add key="npc_text" value="false"/>
112113
<add key="npc_trainer" value="false"/>
@@ -115,9 +116,7 @@
115116
<add key="page_text" value="false"/>
116117
<add key="playercreateinfo" value="false"/>
117118
<add key="playercreateinfo_action" value="false"/>
118-
<add key="playercreateinfo_spell" value="false"/>
119119
<add key="points_of_interest" value="false"/>
120-
<add key="quest_objectives" value="false"/>
121120
<add key="quest_poi" value="false"/>
122121
<add key="quest_poi_points" value="false"/>
123122
<add key="quest_template" value="false"/>

WowPacketParser/Enums/HotfixSQLOutput.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public enum HotfixSQLOutput
1212
creatureDB2,
1313
creature_difficulty,
1414
curve_point,
15-
defense_message,
1615
gameobjectDB2,
1716
holidays,
1817
hotfix_data,
@@ -43,7 +42,7 @@ public enum HotfixSQLOutput
4342
taxi_nodes,
4443
taxi_path,
4544
taxi_path_node,
46-
toy,
45+
toy
4746
// ReSharper restore InconsistentNaming
4847
}
4948
}

WowPacketParser/Enums/ObjectType.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public enum ObjectType
1212
Corpse = 7,
1313
AreaTrigger = 8,
1414
SceneObject = 9,
15-
Conversation = 10
15+
Conversation = 10,
16+
Map = 11
1617
}
1718
}

WowPacketParser/Enums/SQLOutput.cs

-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ public enum SQLOutput
2525
page_text,
2626
playercreateinfo,
2727
playercreateinfo_action,
28-
playercreateinfo_spell,
2928
points_of_interest,
30-
quest_objectives,
3129
quest_poi,
3230
quest_poi_points,
3331
quest_template,

WowPacketParser/Parsing/Parsers/ActionBarHandler.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using WowPacketParser.Enums;
43
using WowPacketParser.Misc;
54
using WowPacketParser.Store;

WowPacketParser/Parsing/Parsers/LootHandler.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
31
using WowPacketParser.Enums;
4-
using WowPacketParser.Enums.Version;
52
using WowPacketParser.Misc;
6-
using WowPacketParser.Store;
7-
using WowPacketParser.Store.Objects;
83

94
namespace WowPacketParser.Parsing.Parsers
105
{
@@ -104,7 +99,7 @@ public static void HandleLootRemoved(Packet packet)
10499
[Parser(Opcode.SMSG_LOOT_RESPONSE)]
105100
public static void HandleLootResponse(Packet packet)
106101
{
107-
var guid = packet.ReadGuid("GUID");
102+
packet.ReadGuid("GUID");
108103
var lootType = packet.ReadByteE<LootType>("Loot Type");
109104
if (lootType == LootType.None)
110105
{

WowPacketParser/Parsing/Parsers/PetHandler.cs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using WowPacketParser.Enums;
55
using WowPacketParser.Misc;
66
using WowPacketParser.Store;
7-
using WowPacketParser.Store.Objects;
87

98
namespace WowPacketParser.Parsing.Parsers
109
{

WowPacketParser/SQL/Builders/DB2.cs

+30-30
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ public static string AreaPOIState()
5252
[BuilderMethod]
5353
public static string BattlePetSpecies()
5454
{
55-
if (Storage.BattlePetSpecies.IsEmpty())
55+
if (Storage.BattlePetSpeciesBag.IsEmpty())
5656
return string.Empty;
5757

5858
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.battle_pet_species))
5959
return string.Empty;
6060

61-
var templatesDb = SQLDatabase.Get(Storage.BattlePetSpecies, Settings.HotfixesDatabase);
61+
var templatesDb = SQLDatabase.Get(Storage.BattlePetSpeciesBag, Settings.HotfixesDatabase);
6262

63-
return SQLUtil.Compare(Storage.BattlePetSpecies, templatesDb, StoreNameType.None);
63+
return SQLUtil.Compare(Storage.BattlePetSpeciesBag, templatesDb, StoreNameType.None);
6464
}
6565

6666
[BuilderMethod]
@@ -164,15 +164,15 @@ public static string CurvePoint()
164164
[BuilderMethod]
165165
public static string HolidayData()
166166
{
167-
if (Storage.Holidays.IsEmpty())
167+
if (Storage.HolidaysBag.IsEmpty())
168168
return string.Empty;
169169

170170
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.holidays))
171171
return string.Empty;
172172

173-
var templatesDb = SQLDatabase.Get(Storage.Holidays, Settings.HotfixesDatabase);
173+
var templatesDb = SQLDatabase.Get(Storage.HolidaysBag, Settings.HotfixesDatabase);
174174

175-
return SQLUtil.Compare(Storage.Holidays, templatesDb, StoreNameType.None);
175+
return SQLUtil.Compare(Storage.HolidaysBag, templatesDb, StoreNameType.None);
176176
}
177177

178178
[BuilderMethod]
@@ -251,7 +251,7 @@ public static string ItemEffect()
251251
if (Storage.ItemEffects.IsEmpty())
252252
return string.Empty;
253253

254-
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.item_extended_cost))
254+
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.item_effect))
255255
return string.Empty;
256256

257257
var templatesDb = SQLDatabase.Get(Storage.ItemEffects, Settings.HotfixesDatabase);
@@ -279,7 +279,7 @@ public static string ItemModifiedAppearance()
279279
if (Storage.ItemModifiedAppearances.IsEmpty())
280280
return string.Empty;
281281

282-
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.item_extended_cost))
282+
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.item_modified_appearance))
283283
return string.Empty;
284284

285285
var templatesDb = SQLDatabase.Get(Storage.ItemModifiedAppearances, Settings.HotfixesDatabase);
@@ -304,15 +304,15 @@ public static string ItemSparse()
304304
[BuilderMethod]
305305
public static string GameObjects()
306306
{
307-
if (Storage.GameObjects.IsEmpty())
307+
if (Storage.GameObjectsBag.IsEmpty())
308308
return string.Empty;
309309

310310
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.gameobjectDB2))
311311
return string.Empty;
312312

313-
var templatesDb = SQLDatabase.Get(Storage.GameObjects, Settings.HotfixesDatabase);
313+
var templatesDb = SQLDatabase.Get(Storage.GameObjectsBag, Settings.HotfixesDatabase);
314314

315-
return SQLUtil.Compare(Storage.GameObjects, templatesDb, StoreNameType.GameObject);
315+
return SQLUtil.Compare(Storage.GameObjectsBag, templatesDb, StoreNameType.GameObject);
316316
}
317317

318318
[BuilderMethod]
@@ -402,43 +402,43 @@ public static string SceneScript()
402402
[BuilderMethod]
403403
public static string SpellAuraRestrictions()
404404
{
405-
if (Storage.SpellAuraRestrictions.IsEmpty())
405+
if (Storage.SpellAuraRestrictionsBag.IsEmpty())
406406
return string.Empty;
407407

408408
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_aura_restrictions))
409409
return string.Empty;
410410

411-
var templatesDb = SQLDatabase.Get(Storage.SpellAuraRestrictions, Settings.HotfixesDatabase);
411+
var templatesDb = SQLDatabase.Get(Storage.SpellAuraRestrictionsBag, Settings.HotfixesDatabase);
412412

413-
return SQLUtil.Compare(Storage.SpellAuraRestrictions, templatesDb, StoreNameType.None);
413+
return SQLUtil.Compare(Storage.SpellAuraRestrictionsBag, templatesDb, StoreNameType.None);
414414
}
415415

416416
[BuilderMethod]
417417
public static string SpellCastingRequirements()
418418
{
419-
if (Storage.SpellCastingRequirements.IsEmpty())
419+
if (Storage.SpellCastingRequirementsBag.IsEmpty())
420420
return string.Empty;
421421

422422
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_casting_requirements))
423423
return string.Empty;
424424

425-
var templatesDb = SQLDatabase.Get(Storage.SpellCastingRequirements, Settings.HotfixesDatabase);
425+
var templatesDb = SQLDatabase.Get(Storage.SpellCastingRequirementsBag, Settings.HotfixesDatabase);
426426

427-
return SQLUtil.Compare(Storage.SpellCastingRequirements, templatesDb, StoreNameType.None);
427+
return SQLUtil.Compare(Storage.SpellCastingRequirementsBag, templatesDb, StoreNameType.None);
428428
}
429429

430430
[BuilderMethod]
431431
public static string SpellClassOptions()
432432
{
433-
if (Storage.SpellClassOptions.IsEmpty())
433+
if (Storage.SpellClassOptionsBag.IsEmpty())
434434
return string.Empty;
435435

436436
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_class_options))
437437
return string.Empty;
438438

439-
var templatesDb = SQLDatabase.Get(Storage.SpellClassOptions, Settings.HotfixesDatabase);
439+
var templatesDb = SQLDatabase.Get(Storage.SpellClassOptionsBag, Settings.HotfixesDatabase);
440440

441-
return SQLUtil.Compare(Storage.SpellClassOptions, templatesDb, StoreNameType.None);
441+
return SQLUtil.Compare(Storage.SpellClassOptionsBag, templatesDb, StoreNameType.None);
442442
}
443443

444444
[BuilderMethod]
@@ -500,23 +500,23 @@ public static string SpellPower()
500500
[BuilderMethod]
501501
public static string SpellReagents()
502502
{
503-
if (Storage.SpellReagents.IsEmpty())
503+
if (Storage.SpellReagentsBag.IsEmpty())
504504
return string.Empty;
505505

506506
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_power))
507507
return string.Empty;
508508

509-
var templatesDb = SQLDatabase.Get(Storage.SpellReagents, Settings.HotfixesDatabase);
509+
var templatesDb = SQLDatabase.Get(Storage.SpellReagentsBag, Settings.HotfixesDatabase);
510510

511-
return SQLUtil.Compare(Storage.SpellReagents, templatesDb, StoreNameType.None);
511+
return SQLUtil.Compare(Storage.SpellReagentsBag, templatesDb, StoreNameType.None);
512512
}
513513

514514
public static string SpellRuneCost()
515515
{
516516
if (Storage.SpellRuneCosts.IsEmpty())
517517
return string.Empty;
518518

519-
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_power))
519+
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_rune_cost))
520520
return string.Empty;
521521

522522
var templatesDb = SQLDatabase.Get(Storage.SpellRuneCosts, Settings.HotfixesDatabase);
@@ -527,28 +527,28 @@ public static string SpellRuneCost()
527527
[BuilderMethod]
528528
public static string SpellTotems()
529529
{
530-
if (Storage.SpellTotems.IsEmpty())
530+
if (Storage.SpellTotemsBag.IsEmpty())
531531
return string.Empty;
532532

533533
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.spell_totems))
534534
return string.Empty;
535535

536-
var templatesDb = SQLDatabase.Get(Storage.SpellTotems, Settings.HotfixesDatabase);
536+
var templatesDb = SQLDatabase.Get(Storage.SpellTotemsBag, Settings.HotfixesDatabase);
537537

538-
return SQLUtil.Compare(Storage.SpellTotems, templatesDb, StoreNameType.None);
538+
return SQLUtil.Compare(Storage.SpellTotemsBag, templatesDb, StoreNameType.None);
539539
}
540540

541541
public static string TaxiNodes()
542542
{
543-
if (Storage.TaxiNodes.IsEmpty())
543+
if (Storage.TaxiNodesBag.IsEmpty())
544544
return string.Empty;
545545

546546
if (!Settings.HotfixSQLOutputFlag.HasAnyFlagBit(HotfixSQLOutput.taxi_nodes))
547547
return string.Empty;
548548

549-
var templatesDb = SQLDatabase.Get(Storage.TaxiNodes, Settings.HotfixesDatabase);
549+
var templatesDb = SQLDatabase.Get(Storage.TaxiNodesBag, Settings.HotfixesDatabase);
550550

551-
return SQLUtil.Compare(Storage.TaxiNodes, templatesDb, StoreNameType.None);
551+
return SQLUtil.Compare(Storage.TaxiNodesBag, templatesDb, StoreNameType.None);
552552
}
553553

554554
public static string TaxiPathNode()

WowPacketParser/SQL/Builders/Miscellaneous.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static string ObjectNames()
4747
if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.ObjectNames))
4848
return string.Empty;
4949

50-
var templateDb = SQLDatabase.Get(Storage.ObjectNames);
50+
var templateDb = SQLDatabase.Get(Storage.ObjectNames, Settings.WPPDatabase);
5151

5252
return SQLUtil.Compare(Storage.ObjectNames, templateDb, StoreNameType.None);
5353
}
@@ -62,7 +62,7 @@ public static string SniffData()
6262
if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.SniffData) && !Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.SniffDataOpcodes))
6363
return string.Empty;
6464

65-
var templateDb = SQLDatabase.Get(Storage.SniffData);
65+
var templateDb = SQLDatabase.Get(Storage.SniffData, Settings.WPPDatabase);
6666

6767
return SQLUtil.Compare(Storage.SniffData, templateDb, x => string.Empty);
6868
}

WowPacketParser/SQL/Builders/Spawns.cs

+31-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static string Creature(Dictionary<WowGuid, Unit> units)
8080
spawnDist = 10;
8181
}
8282

83-
row.Data.GUID = "@CGUID" + count;
83+
row.Data.GUID = "@CGUID+" + count;
8484

8585
row.Data.ID = entry;
8686
if (!creature.IsOnTransport())
@@ -96,7 +96,13 @@ public static string Creature(Dictionary<WowGuid, Unit> units)
9696
row.Data.PhaseMask = creature.PhaseMask;
9797

9898
if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_4_15595) && creature.Phases != null)
99-
row.Data.PhaseID = string.Join(" - ", creature.Phases);
99+
{
100+
string data = string.Join(" - ", creature.Phases);
101+
if (string.IsNullOrEmpty(data))
102+
data = "0";
103+
104+
row.Data.PhaseID = data;
105+
}
100106

101107
if (!creature.IsOnTransport())
102108
{
@@ -117,13 +123,24 @@ public static string Creature(Dictionary<WowGuid, Unit> units)
117123
row.Data.SpawnDist = spawnDist;
118124
row.Data.MovementType = movementType;
119125

126+
// set some defaults
127+
row.Data.ZoneID = 0;
128+
row.Data.AreaID = 0;
129+
row.Data.PhaseGroup = 0;
130+
row.Data.ModelID = 0;
131+
row.Data.CurrentWaypoint = 0;
132+
row.Data.CurHealth = 0;
133+
row.Data.CurMana = 0;
134+
row.Data.NpcFlag = 0;
135+
row.Data.UnitFlag = 0;
136+
row.Data.DynamicFlag = 0;
120137

121138
row.Comment = StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
122139
row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, creature.Area, false) + ")";
123140

124141
string auras = string.Empty;
125142
string commentAuras = string.Empty;
126-
if (creature.Auras != null && creature.Auras.Count() != 0)
143+
if (creature.Auras != null && creature.Auras.Count != 0)
127144
{
128145
foreach (Aura aura in creature.Auras)
129146
{
@@ -148,9 +165,11 @@ public static string Creature(Dictionary<WowGuid, Unit> units)
148165
if (Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_addon))
149166
{
150167
addonRow.Data.GUID = "@CGUID+" + count;
151-
addonRow.Data.Mount = creature.Mount;
152-
addonRow.Data.Bytes1 = creature.Bytes1;
153-
addonRow.Data.Bytes2 = creature.Bytes2;
168+
addonRow.Data.PathID = 0;
169+
addonRow.Data.Mount = creature.Mount.GetValueOrDefault(0);
170+
addonRow.Data.Bytes1 = creature.Bytes1.GetValueOrDefault(0);
171+
addonRow.Data.Bytes2 = creature.Bytes2.GetValueOrDefault(0);
172+
addonRow.Data.Emote = 0;
154173
addonRow.Data.Auras = auras;
155174
addonRow.Comment += StoreGetters.GetName(StoreNameType.Unit, (int)unit.Key.GetEntry(), false);
156175
if (!string.IsNullOrWhiteSpace(auras))
@@ -239,7 +258,7 @@ public static string GameObject(Dictionary<WowGuid, GameObject> gameObjects)
239258
animprogress = Convert.ToUInt32((bytes & 0xFF000000) >> 24);
240259
}
241260

242-
row.Data.GUID = "@OGUID" + count;
261+
row.Data.GUID = "@OGUID+" + count;
243262

244263
row.Data.ID = entry;
245264
if (!go.IsOnTransport())
@@ -282,6 +301,11 @@ public static string GameObject(Dictionary<WowGuid, GameObject> gameObjects)
282301
row.Data.AnimProgress = animprogress;
283302
row.Data.State = state;
284303

304+
// set some defaults
305+
row.Data.ZoneID = 0;
306+
row.Data.AreaID = 0;
307+
row.Data.PhaseGroup = 0;
308+
285309
row.Comment = StoreGetters.GetName(StoreNameType.GameObject, (int)gameobject.Key.GetEntry(), false);
286310
row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, go.Area, false) + ")";
287311

0 commit comments

Comments
 (0)