Skip to content

Commit c773b7d

Browse files
committed
Use separate insert-only struct for spell_target_position sql for TARGET_DEST_NEARBY_DB
Closes #945
1 parent 7b02969 commit c773b7d

2 files changed

Lines changed: 36 additions & 6 deletions

File tree

WowPacketParser/SQL/Builders/Spells.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@ public static string SpellTargetMultiplePositions()
3131
if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.spell_target_position))
3232
return string.Empty;
3333

34-
var rows = new RowList<SpellTargetPosition>();
34+
var rows = new RowList<SpellTargetPositionMulti>();
3535
Dictionary<uint, uint> idCount = new Dictionary<uint, uint>();
3636

3737
foreach (var spellTargetPosition in Storage.SpellTargetMultiplePositions.OrderBy(t => t.Key))
3838
{
3939
foreach (var spellTargetPositionValue in spellTargetPosition.Value)
4040
{
4141
idCount.TryGetValue(spellTargetPosition.Key, out uint count);
42-
var duplicatedRow = rows.Where(spellTargetPosition2 =>
42+
var duplicatedRow = rows.Any(spellTargetPosition2 =>
4343
spellTargetPosition2.Data.ID == spellTargetPosition.Key &&
4444
spellTargetPosition2.Data.PositionX == spellTargetPositionValue.Item1.PositionX &&
4545
spellTargetPosition2.Data.PositionY == spellTargetPositionValue.Item1.PositionY &&
4646
spellTargetPosition2.Data.PositionZ == spellTargetPositionValue.Item1.PositionZ &&
4747
spellTargetPosition2.Data.MapID == spellTargetPositionValue.Item1.MapID
48-
).Any();
48+
);
4949

5050
if (duplicatedRow)
5151
continue;
5252

53-
var row = new Row<SpellTargetPosition>
53+
var row = new Row<SpellTargetPositionMulti>
5454
{
55-
Data = new SpellTargetPosition
55+
Data = new SpellTargetPositionMulti
5656
{
5757
ID = spellTargetPosition.Key,
5858
EffectIndex = spellTargetPositionValue.Item1.EffectIndex,
@@ -70,7 +70,7 @@ public static string SpellTargetMultiplePositions()
7070
rows.Add(row);
7171
}
7272
}
73-
return new SQLInsert<SpellTargetPosition>(rows, false).Build();
73+
return new SQLInsert<SpellTargetPositionMulti>(rows, false).Build();
7474
}
7575
}
7676
}

WowPacketParser/Store/Objects/SpellTargetPosition.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@ public sealed record SpellTargetPosition : IDataModel
1414
public byte? EffectIndex;
1515

1616
[DBFieldName("OrderIndex", TargetedDatabaseFlag.SinceTheWarWithin, true, true)]
17+
public int? OrderIndex;
18+
19+
[DBFieldName("MapID")]
20+
public ushort? MapID;
21+
22+
[DBFieldName("PositionX")]
23+
public float? PositionX;
24+
25+
[DBFieldName("PositionY")]
26+
public float? PositionY;
27+
28+
[DBFieldName("PositionZ")]
29+
public float? PositionZ;
30+
31+
[DBFieldName("VerifiedBuild")]
32+
public int? VerifiedBuild = ClientVersion.BuildInt;
33+
34+
public string EffectHelper;
35+
}
36+
37+
[DBTableName("spell_target_position", TargetedDatabaseFlag.SinceTheWarWithin)]
38+
public sealed record SpellTargetPositionMulti : IDataModel
39+
{
40+
[DBFieldName("ID", true)]
41+
public uint? ID;
42+
43+
[DBFieldName("EffectIndex", true)]
44+
public byte? EffectIndex;
45+
46+
[DBFieldName("OrderIndex", true, true)]
1747
public string OrderIndex;
1848

1949
[DBFieldName("MapID")]

0 commit comments

Comments
 (0)