diff --git a/WowPacketParser/SQL/Builders/AreaTriggers.cs b/WowPacketParser/SQL/Builders/AreaTriggers.cs index 026529bf45..79ecc631d4 100644 --- a/WowPacketParser/SQL/Builders/AreaTriggers.cs +++ b/WowPacketParser/SQL/Builders/AreaTriggers.cs @@ -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}"; @@ -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); } } @@ -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; }); } @@ -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"; @@ -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); diff --git a/WowPacketParser/Store/Objects/AreaTrigger.cs b/WowPacketParser/Store/Objects/AreaTrigger.cs index 97b7b193f1..7863dbb692 100644 --- a/WowPacketParser/Store/Objects/AreaTrigger.cs +++ b/WowPacketParser/Store/Objects/AreaTrigger.cs @@ -1,4 +1,5 @@ -using WowPacketParser.Enums; +using System.Collections.Generic; +using WowPacketParser.Enums; using WowPacketParser.Misc; using WowPacketParser.SQL; @@ -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; @@ -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")] @@ -58,5 +62,16 @@ public sealed record AreaTrigger : IDataModel public int? VerifiedBuild = ClientVersion.BuildInt; public WowGuid areatriggerGuid; + + public List GetDefaultSpawnDifficulties() + { + if (Settings.UseDBC && DBC.DBC.MapDifficultyStores != null) + { + if (DBC.DBC.MapDifficultyStores.ContainsKey((int)MapId)) + return DBC.DBC.MapDifficultyStores[(int)MapId]; + } + + return new List(); + } } } diff --git a/WowPacketParser/Store/Objects/AreaTriggerCreateProperties.cs b/WowPacketParser/Store/Objects/AreaTriggerCreateProperties.cs index a93b3a7102..20a3e89dbd 100644 --- a/WowPacketParser/Store/Objects/AreaTriggerCreateProperties.cs +++ b/WowPacketParser/Store/Objects/AreaTriggerCreateProperties.cs @@ -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; @@ -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; @@ -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;