feat(Scripting/Spell): Add new hooks for Spell (OnSpellCast, OnSpellPrepare, OnSpellCancel) (#21149)

This commit is contained in:
iThorgrim
2025-01-18 16:26:39 +01:00
committed by GitHub
parent c55346dbe3
commit 90566589b0
4 changed files with 33 additions and 0 deletions

View File

@@ -3717,6 +3717,8 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
TriggerGlobalCooldown();
}
sScriptMgr->OnSpellPrepare(this, m_caster, m_spellInfo);
return SPELL_CAST_OK;
}
@@ -3788,6 +3790,8 @@ void Spell::cancel(bool bySelf)
//set state back so finish will be processed
m_spellState = oldState;
sScriptMgr->OnSpellCastCancel(this, m_caster, m_spellInfo, bySelf);
finish(false);
}
@@ -4114,6 +4118,8 @@ void Spell::_cast(bool skipCheck)
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
sScriptMgr->OnSpellCast(this, m_caster, m_spellInfo, skipCheck);
SetExecutedCurrently(false);
}