Core/Spells: unify OnSpellCastInterrupt and OnSuccessfulSpellCast hooks into OnSpellCastFinished

Port From (https://github.com/TrinityCore/TrinityCore/commit/d1594c7295f1ca3f21a63a13895abf371d8bd3e0)
This commit is contained in:
hondacrx
2022-05-24 12:54:25 -04:00
parent bf0c12ab0c
commit 3c3d16ab09
4 changed files with 17 additions and 7 deletions
+7 -1
View File
@@ -2904,7 +2904,7 @@ namespace Game.Spells
Creature caster = m_originalCaster.ToCreature();
if (caster)
if (caster.IsAIEnabled())
caster.GetAI().OnSuccessfulSpellCast(GetSpellInfo());
caster.GetAI().OnSpellCastFinished(GetSpellInfo(), SpellFinishReason.SuccessfulCast);
}
void DoProcessTargetContainer<T>(List<T> targetContainer) where T : TargetInfoBase
@@ -3267,6 +3267,12 @@ namespace Game.Spells
{
SendChannelUpdate(0);
Finish();
// We call the hook here instead of in Spell::finish because we only want to call it for completed channeling. Everything else is handled by interrupts
Creature creatureCaster = m_caster.ToCreature();
if (creatureCaster != null)
if (creatureCaster.IsAIEnabled())
creatureCaster.GetAI().OnSpellCastFinished(m_spellInfo, SpellFinishReason.ChannelingComplete);
}
break;
}