diff options
| author | offl <11556157+offl@users.noreply.github.com> | 2022-02-18 19:14:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-18 19:14:44 +0200 |
| commit | 3dca705acc953d20e4a43d4c2b3c97a84e5ab346 (patch) | |
| tree | 40e929c09e081a195ecc3ab2eba8df09cd38cd2c /src/server/game/Spells/Spell.cpp | |
| parent | 410c3ff25f1484858263255bd3433f52280fa8ec (diff) | |
Core/AI: OnSpellCast, OnSpellFailed, OnSpellStart hooks (#27704)
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 450957a5ca9..c36d26d5096 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3145,6 +3145,11 @@ SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD)) TriggerGlobalCooldown(); + // Call CreatureAI hook OnSpellStart + if (Creature* caster = m_originalCaster->ToCreature()) + if (caster->IsAIEnabled()) + caster->AI()->OnSpellStart(GetSpellInfo()); + // commented out !m_spellInfo->StartRecoveryTime, it forces instant spells with global cooldown to be processed in spell::update // as a result a spell that passed CheckCast and should be processed instantly may suffer from this delayed process // the easiest bug to observe is LoS check in AddUnitTarget, even if spell passed the CheckCast LoS check the situation can change in spell::update @@ -3483,10 +3488,10 @@ void Spell::_cast(bool skipCheck) Unit::ProcSkillsAndAuras(m_originalCaster, nullptr, procAttacker, PROC_FLAG_NONE, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_CAST, hitMask, this, nullptr, nullptr); - // Call CreatureAI hook OnSpellCastFinished + // Call CreatureAI hook OnSpellCast if (Creature* caster = m_originalCaster->ToCreature()) if (caster->IsAIEnabled()) - caster->AI()->OnSpellCastFinished(GetSpellInfo(), SPELL_FINISHED_SUCCESSFUL_CAST); + caster->AI()->OnSpellCast(GetSpellInfo()); } template <class Container> @@ -3802,7 +3807,7 @@ void Spell::update(uint32 difftime) // 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); + creatureCaster->AI()->OnChannelFinished(m_spellInfo); } break; } |
