diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e54019cb3d..56fa8459b5 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3208,8 +3208,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered if ((_triggeredCastFlags & TRIGGERED_IGNORE_COMBO_POINTS) || m_CastItem || !m_caster->m_playerMovingMe) m_needComboPoints = false; + MountResult mountResult = MountResult::Ok; uint32 param1 = 0, param2 = 0; - SpellCastResult result = CheckCast(true, ¶m1, ¶m2); + SpellCastResult result = CheckCast(true, ¶m1, ¶m2, &mountResult); // target is checked in too many locations and with different results to handle each of them // handle just the general SPELL_FAILED_BAD_TARGETS result which is the default result for most DBC target checks if (_triggeredCastFlags & TRIGGERED_IGNORE_TARGET_CHECK && result == SPELL_FAILED_BAD_TARGETS) @@ -3226,6 +3227,10 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered triggeredByAura->GetBase()->SetDuration(0); } + // Send mount result + if (mountResult != MountResult::Ok) + SendMountResult(mountResult); + if (param1 || param2) SendCastResult(result, ¶m1, ¶m2); else @@ -5365,7 +5370,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGoT } } -SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint32* param2 /*= nullptr*/) +SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint32* param2 /*= nullptr*/, MountResult* mountResult /*= mountResult*/) { // check death state if (!m_caster->IsAlive() && !m_spellInfo->IsPassive() && !(m_spellInfo->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell))) @@ -6139,8 +6144,13 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint if (m_caster->IsInDisallowedMountForm()) { - SendMountResult(MountResult::Shapeshifted); // mount result gets sent before the cast result - return SPELL_FAILED_DONT_REPORT; + if (mountResult) + { + *mountResult = MountResult::Shapeshifted; + return SPELL_FAILED_DONT_REPORT; + } + else + return SPELL_FAILED_NOT_SHAPESHIFT; } break; diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 1fa883d4d7..d25cbe517e 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -444,7 +444,7 @@ class TC_GAME_API Spell void TakeReagents(); void TakeCastItem(); - SpellCastResult CheckCast(bool strict, uint32* param1 = nullptr, uint32* param2 = nullptr); + SpellCastResult CheckCast(bool strict, uint32* param1 = nullptr, uint32* param2 = nullptr, MountResult* mountResult = nullptr); SpellCastResult CheckPetCast(Unit* target); // handlers