Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sql output for areatrigger tables #885

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions WowPacketParser/SQL/Builders/AreaTriggers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ public static string AreaTriggerCreatePropertiesData()
{
// CreateProperties from spells
if (createProperties.Value.IsCustom == 0)
{
if (createProperties.Value.SpellForVisuals > 0 && createProperties.Value.SpellForVisuals == createProperties.Value.spellId)
createProperties.Value.SpellForVisuals = null;
createPropertiesData.Add(createProperties.Value);
}
else
{
createPropertiesList[createProperties.Key].CustomId = $"@ATPROPERTIESID+{customRows.Count}";
Expand All @@ -66,8 +70,13 @@ public static string AreaTriggerCreatePropertiesData()
row.Data.AnimId = createProperties.Value.AnimId;
row.Data.AnimKitId = createProperties.Value.AnimKitId;
row.Data.DecalPropertiesId = createProperties.Value.DecalPropertiesId;
row.Data.SpellForVisuals = createProperties.Value.SpellForVisuals;
row.Data.Shape = createProperties.Value.Shape;
row.Data.ShapeData = createProperties.Value.ShapeData;

if (row.Data.SpellForVisuals > 0)
row.Comment = $"SpellForVisuals: {StoreGetters.GetName(StoreNameType.Spell, (int)row.Data.SpellForVisuals)}";

customRows.Add(row);
}
}
Expand All @@ -86,6 +95,8 @@ public static string AreaTriggerCreatePropertiesData()
x =>
{
var comment = $"Spell: {StoreGetters.GetName(StoreNameType.Spell, (int)x.spellId)}";
if (x.SpellForVisuals > 0 && x.spellId != x.SpellForVisuals)
comment += $" SpellForVisuals: {StoreGetters.GetName(StoreNameType.Spell, (int)x.SpellForVisuals)}";
return comment;
});
}
Expand Down Expand Up @@ -282,6 +293,12 @@ public static string AreaTriggerData()
row.Data.Orientation = at.Movement.Transport.Offset.O;
}

string difficulties = string.Join(",", at.GetDefaultSpawnDifficulties());
if (string.IsNullOrEmpty(difficulties))
difficulties = "0";

row.Data.SpawnDifficulties = difficulties;

string phaseData = string.Join(" - ", at.Phases);
if (string.IsNullOrEmpty(phaseData) || Settings.ForcePhaseZero)
phaseData = "0";
Expand All @@ -295,9 +312,8 @@ public static string AreaTriggerData()
row.Data.SpellForVisuals = at.SpellForVisuals;

row.Data.Comment = "";
row.Comment = StoreGetters.GetName(StoreNameType.Spell, (int)at.SpellForVisuals, true);
row.Comment += " (Area: " + StoreGetters.GetName(StoreNameType.Area, at.Area, false) + " - ";
row.Comment += "Difficulty: " + StoreGetters.GetName(StoreNameType.Difficulty, (int)at.DifficultyID, false) + ")";
row.Comment += $"(Area: {StoreGetters.GetName(StoreNameType.Area, at.Area, false)} - ";
row.Comment += $"Difficulty: {StoreGetters.GetName(StoreNameType.Difficulty, (int)at.DifficultyID, false)})";

rows.Add(row);

Expand Down
19 changes: 17 additions & 2 deletions WowPacketParser/Store/Objects/AreaTrigger.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using WowPacketParser.Enums;
using System.Collections.Generic;
using WowPacketParser.Enums;
using WowPacketParser.Misc;
using WowPacketParser.SQL;

Expand All @@ -21,6 +22,9 @@ public sealed record AreaTrigger : IDataModel
[DBFieldName("MapId")]
public uint? MapId;

[DBFieldName("SpawnDifficulties", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.CataClassic)]
public string SpawnDifficulties;

[DBFieldName("PosX")]
public float? PosX;

Expand Down Expand Up @@ -48,7 +52,7 @@ public sealed record AreaTrigger : IDataModel
[DBFieldName("ShapeData", TargetedDatabaseFlag.TillShadowlands, 8, true)] // kept in TargetedDatabase.Shadowlands to preserve data for non-spell areatriggers
public float?[] ShapeData = { 0, 0, 0, 0, 0, 0, 0, 0 };

[DBFieldName("SpellForVisuals", false, false, true)]
[DBFieldName("SpellForVisuals", TargetedDatabaseFlag.TillShadowlands, false, false, true)]
public uint? SpellForVisuals;

[DBFieldName("Comment")]
Expand All @@ -58,5 +62,16 @@ public sealed record AreaTrigger : IDataModel
public int? VerifiedBuild = ClientVersion.BuildInt;

public WowGuid areatriggerGuid;

public List<int> GetDefaultSpawnDifficulties()
{
if (Settings.UseDBC && DBC.DBC.MapDifficultyStores != null)
{
if (DBC.DBC.MapDifficultyStores.ContainsKey((int)MapId))
return DBC.DBC.MapDifficultyStores[(int)MapId];
}

return new List<int>();
}
}
}
8 changes: 6 additions & 2 deletions WowPacketParser/Store/Objects/AreaTriggerCreateProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public sealed record AreaTriggerCreateProperties : WoWObject, IDataModel
[DBFieldName("DecalPropertiesId")]
public uint? DecalPropertiesId = 0;

[DBFieldName("SpellForVisuals", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.CataClassic, false, false, true)]
public uint? SpellForVisuals;

[DBFieldName("TimeToTarget")]
public uint? TimeToTarget = 0;

Expand All @@ -68,8 +71,6 @@ public sealed record AreaTriggerCreateProperties : WoWObject, IDataModel
// Will be inserted as comment
public uint spellId = 0;

public uint SpellForVisuals;

public string CustomId;

public IAreaTriggerData AreaTriggerData;
Expand Down Expand Up @@ -175,6 +176,9 @@ public sealed record AreaTriggerCreatePropertiesCustom : IDataModel
[DBFieldName("DecalPropertiesId")]
public uint? DecalPropertiesId = 0;

[DBFieldName("SpellForVisuals", TargetedDatabaseFlag.SinceDragonflight | TargetedDatabaseFlag.CataClassic, false, false, true)]
public uint? SpellForVisuals;

[DBFieldName("TimeToTarget")]
public uint? TimeToTarget = 0;

Expand Down
Loading