diff options
| author | QAston <qaston@gmail.com> | 2012-02-10 23:40:38 +0100 |
|---|---|---|
| committer | QAston <qaston@gmail.com> | 2012-02-10 23:42:08 +0100 |
| commit | ce4a4ffe50a26fa2040d4af3933621b66813488d (patch) | |
| tree | ca1afb50445232f1c7e7a30862038c31024d8934 /src/server/game/Spells/Spell.cpp | |
| parent | 8c2526e7d0f8cd516e0a3d3ebd6e554774c76c7b (diff) | |
Core/Db/Conditions: Add ContidionTarget column which allows selection of objects which will be checked by condition, depending on SourceTypeOrReferenceId.
So far usable only with CONDITION_SOURCE_TYPE_SPELL:
ContidionTarget = 0 - check caster
ContidionTarget = 1 - check explicit target
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rwxr-xr-x | src/server/game/Spells/Spell.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 9dccb0ff341..7c578a39355 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4716,12 +4716,23 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_DONT_REPORT; } - // check spell caster's conditions from database - if (Player* plrCaster = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) + // check spell cast conditions from database { + ConditionSourceInfo condInfo = ConditionSourceInfo(m_caster); + condInfo.mConditionTargets[1] = m_targets.GetObjectTarget(); ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id); - if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(plrCaster, conditions)) + if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions)) + { + // send error msg to player if condition failed and text message available + // TODO: using WorldSession::SendNotification is not blizzlike + if (Player* playerCaster = m_caster->ToPlayer()) + { + if (playerCaster->GetSession() && condInfo.mLastFailedCondition + && condInfo.mLastFailedCondition->ErrorTextd) + playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextd); + } return SPELL_FAILED_DONT_REPORT; + } } // Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case) |
