Core/Spells: Return CheckCast result from CastSpell (#23236)

* Return CheckCast result from CastSpell

* Return cast result from UnitAI methods too.
This commit is contained in:
brotalnia authored and Ovahlord committed 2022-09-12 09:15:23 +02:00
1 parent 89d0f363cf
commit 7cc33f1bb7
6 files changed
+35 -35

No files matched your search

+7 -11
View File
@@ -3138,7 +3138,7 @@ bool Spell::UpdateChanneledTargetList()
return channelTargetEffectMask == 0;
}
void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggeredByAura)
SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggeredByAura)
{
if (m_CastItem)
{
@@ -3191,7 +3191,7 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
{
SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
finish(false);
return;
return SPELL_FAILED_SPELL_UNAVAILABLE;
}
// Prevent casting at cast another spell (ServerSide check)
@@ -3199,15 +3199,9 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
{
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
finish(false);
return;
return SPELL_FAILED_SPELL_IN_PROGRESS;
}
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster))
{
SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
finish(false);
return;
}
LoadScripts();
// Fill cost data (do not use power for item casts)
@@ -3246,7 +3240,7 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
SendCastResult(result);
finish(false);
return;
return result;
}
// Prepare data for triggers
@@ -3278,7 +3272,7 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
{
SendCastResult(SPELL_FAILED_MOVING);
finish(false);
return;
return SPELL_FAILED_MOVING;
}
}
@@ -3332,6 +3326,8 @@ void Spell::prepare(SpellCastTargets const& targets, AuraEffect const* triggered
if (!m_casttime && /*!m_spellInfo->StartRecoveryTime && */ GetCurrentContainer() == CURRENT_GENERIC_SPELL)
cast(true);
}
return SPELL_CAST_OK;
}
void Spell::cancel(Spell* interruptingSpell /* = nullptr */)