summaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 9ad08dd7b3..425189d1bf 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4112,6 +4112,11 @@ void Spell::_cast(bool skipCheck)
sScriptMgr->OnSpellCast(this, m_caster, m_spellInfo, skipCheck);
SetExecutedCurrently(false);
+
+ // Call CreatureAI hook OnSpellCastFinished
+ if (Creature* caster = m_originalCaster->ToCreature())
+ if (caster->IsAIEnabled)
+ caster->AI()->OnSpellCastFinished(GetSpellInfo(), SPELL_FINISHED_SUCCESSFUL_CAST);
}
void Spell::handle_immediate()
@@ -4463,6 +4468,11 @@ void Spell::update(uint32 difftime)
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
+ if (Creature* creatureCaster = m_caster->ToCreature())
+ if (creatureCaster->IsAIEnabled)
+ creatureCaster->AI()->OnSpellCastFinished(m_spellInfo, SPELL_FINISHED_CHANNELING_COMPLETE);
}
// Xinef: Dont update channeled target list on last tick, allow auras to update duration properly
// Xinef: Added this strange check because of diffrent update routines for players / creatures