Core/AreaTriggers: Move SpellForVisuals override from AT spawn to properties

Port From (https://github.com/TrinityCore/TrinityCore/commit/2ad7c7829b17bb9e6e951632e8e0e68f68b9aa44)
This commit is contained in:
Hondacrx
2024-08-25 00:09:30 -04:00
parent f48b091380
commit a4baf73814
3 changed files with 35 additions and 33 deletions
+12 -11
View File
@@ -128,8 +128,17 @@ namespace Game.Entities
if (spellInfo != null && !IsStaticSpawn())
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellID), spellInfo.Id);
if (spellInfo != null)
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellForVisuals), spellInfo.Id);
SpellInfo spellForVisuals = spellInfo;
if (GetCreateProperties().SpellForVisuals.HasValue)
{
spellForVisuals = Global.SpellMgr.GetSpellInfo(GetCreateProperties().SpellForVisuals.Value, Difficulty.None);
if (spellForVisuals != null)
spellVisual.SpellXSpellVisualID = spellForVisuals.GetSpellXSpellVisualId();
}
if (spellForVisuals != null)
SetUpdateFieldValue(areaTriggerData.ModifyValue(m_areaTriggerData.SpellForVisuals), spellForVisuals.Id);
SpellCastVisualField spellCastVisual = areaTriggerData.ModifyValue(m_areaTriggerData.SpellVisual);
SetUpdateFieldValue(ref spellCastVisual.SpellXSpellVisualID, spellVisual.SpellXSpellVisualID);
@@ -268,15 +277,7 @@ namespace Game.Entities
if (createProperties == null)
return false;
SpellInfo spellInfo = null;
SpellCastVisual spellVisual = default;
if (spawnData.SpellForVisuals.HasValue)
{
spellInfo = Global.SpellMgr.GetSpellInfo(spawnData.SpellForVisuals.Value, Difficulty.None);
if (spellInfo != null)
spellVisual.SpellXSpellVisualID = spellInfo.GetSpellXSpellVisualId();
}
return Create(spawnData.Id, map, spawnData.SpawnPoint, -1, spawnData, null, null, spellVisual, spellInfo);
return Create(spawnData.Id, map, spawnData.SpawnPoint, -1, spawnData);
}
public override void Update(uint diff)