From b4022acdf3ac2abb091c88996cbf9a3e78f5fee1 Mon Sep 17 00:00:00 2001 From: QAston Date: Thu, 9 Feb 2012 18:35:52 +0100 Subject: Core/Spell: move conditions check to Spell::CheckCast. --- src/server/game/Spells/Spell.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index dc804d72103..b1aeb41a126 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2859,20 +2859,6 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered InitExplicitTargets(*targets); - if (Player* plrCaster = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - //check for special spell conditions - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id); - if (!conditions.empty()) - if (!sConditionMgr->IsPlayerMeetToConditions(plrCaster, conditions)) - { - //SendCastResult(SPELL_FAILED_DONT_REPORT); - SendCastResult(plrCaster, m_spellInfo, m_cast_count, SPELL_FAILED_DONT_REPORT); - finish(false); - return; - } - } - // Fill aura scaling information if (m_caster->IsControlledByPlayer() && !m_spellInfo->IsPassive() && m_spellInfo->SpellLevel && !m_spellInfo->IsChanneled() && !(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_SCALING)) { @@ -4730,6 +4716,14 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_DONT_REPORT; } + // check spell caster's conditions from database + if (Player* plrCaster = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id); + if (!conditions.empty() && !sConditionMgr->IsPlayerMeetToConditions(plrCaster, conditions)) + return SPELL_FAILED_DONT_REPORT; + } + // Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case) // those spells may have incorrect target entries or not filled at all (for example 15332) // such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead -- cgit v1.2.3