Core/Spells: relocated SPELL_FINISHED_CHANNELING_COMPLETE handling to a better place

This commit is contained in:
Ovahlord committed 2020-10-02 19:04:33 +02:00
1 parent 0f60c4d820
commit 6c34d8b5ce
1 file changed
+5 -4
+5 -4
View File
@@ -3954,10 +3954,6 @@ void Spell::update(uint32 difftime)
{
SendChannelUpdate(0);
finish();
if (Creature* creatureCaster = m_caster->ToCreature())
if (creatureCaster->IsAIEnabled)
creatureCaster->AI()->OnSpellCastFinished(m_spellInfo, SPELL_FINISHED_CHANNELING_COMPLETE);
}
break;
}
@@ -4048,6 +4044,11 @@ void Spell::finish(bool ok, bool sendChannelUpdate /* = false */)
// Stop Attack for some spells
if (m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET))
m_caster->AttackStop();
if (m_spellInfo->IsChanneled())
if (Creature* creatureCaster = m_caster->ToCreature())
if (creatureCaster->IsAIEnabled)
creatureCaster->AI()->OnSpellCastFinished(m_spellInfo, SPELL_FINISHED_CHANNELING_COMPLETE);
}
void Spell::WriteCastResultInfo(WorldPacket& data, Player* caster, SpellInfo const* spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError, uint32* param1 /*= nullptr*/, uint32* param2 /*= nullptr*/)