diff options
| author | QAston <none@none> | 2010-10-04 19:12:20 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2010-10-04 19:12:20 +0200 |
| commit | 69057dcaeb27daaa7bb1ecb06c22103b0a168e28 (patch) | |
| tree | d7be8e8de24342a1cee33007eeea1b3faf0ca684 /src/server/game/Spells/Spell.cpp | |
| parent | caaa77deb285d65b1bc3a0c6f7b5f88ec3508d0c (diff) | |
Core/ScriptSystem/SpellScripts: Runtime checks for functions working only during spell hit phase
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 861cc57dc01..15b1b2069c0 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4857,7 +4857,6 @@ SpellCastResult Spell::CheckCast(bool strict) } else if (m_caster == target) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster { // Additional check for some spells @@ -5005,141 +5004,6 @@ SpellCastResult Spell::CheckCast(bool strict) return castResult; } - /*//ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38 - if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example) - { - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER || - m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) - { - SpellScriptTarget::const_iterator lower = sSpellMgr.GetBeginSpellScriptTarget(m_spellInfo->Id); - SpellScriptTarget::const_iterator upper = sSpellMgr.GetEndSpellScriptTarget(m_spellInfo->Id); - if (lower == upper) - sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_UNIT_NEARBY_ENTRY or TARGET_DST_NEARBY_ENTRY, but does not have record in `spell_script_target`",m_spellInfo->Id); - - SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex); - float range = GetSpellMaxRange(srange); - - Creature* creatureScriptTarget = NULL; - GameObject* goScriptTarget = NULL; - - for (SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) - { - switch(i_spellST->second.type) - { - case SPELL_TARGET_TYPE_GAMEOBJECT: - { - GameObject* p_GameObject = NULL; - - if (i_spellST->second.targetEntry) - { - CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - - Trinity::NearestGameObjectEntryInObjectRangeCheck go_check(*m_caster,i_spellST->second.targetEntry,range); - Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> checker(m_caster, p_GameObject,go_check); - - TypeContainerVisitor<Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker); - CellLock<GridReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *m_caster->GetMap()); - - if (p_GameObject) - { - // remember found target and range, next attempt will find more near target with another entry - creatureScriptTarget = NULL; - goScriptTarget = p_GameObject; - range = go_check.GetLastRange(); - } - } - else if (focusObject) // Focus Object - { - float frange = m_caster->GetDistance(focusObject); - if (range >= frange) - { - creatureScriptTarget = NULL; - goScriptTarget = focusObject; - range = frange; - } - } - break; - } - case SPELL_TARGET_TYPE_CREATURE: - case SPELL_TARGET_TYPE_DEAD: - default: - { - Creature *p_Creature = NULL; - - CellPair p(Trinity::ComputeCellPair(m_caster->GetPositionX(), m_caster->GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); // Really don't know what is that??? - - Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster,i_spellST->second.targetEntry,i_spellST->second.type != SPELL_TARGET_TYPE_DEAD,range); - Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_caster, p_Creature, u_check); - - TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); - - CellLock<GridReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range); - - if (p_Creature) - { - creatureScriptTarget = p_Creature; - goScriptTarget = NULL; - range = u_check.GetLastRange(); - } - break; - } - } - } - - if (creatureScriptTarget) - { - // store coordinates for TARGET_DST_NEARBY_ENTRY - if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) - { - m_targets.setDst(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ()); - - if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j] != SPELL_EFFECT_PERSISTENT_AREA_AURA) - AddUnitTarget(creatureScriptTarget, j); - } - // store explicit target for TARGET_UNIT_NEARBY_ENTRY - else - AddUnitTarget(creatureScriptTarget, j); - } - else if (goScriptTarget) - { - // store coordinates for TARGET_DST_NEARBY_ENTRY - if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) - { - m_targets.setDst(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ()); - - if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetB[j] == 0 && m_spellInfo->Effect[j] != SPELL_EFFECT_PERSISTENT_AREA_AURA) - AddGOTarget(goScriptTarget, j); - } - // store explicit target for TARGET_UNIT_NEARBY_ENTRY - else - AddGOTarget(goScriptTarget, j); - } - //Missing DB Entry or targets for this spellEffect. - else - { - // not report target not existence for triggered spells - if (m_triggeredByAuraSpell || m_IsTriggeredSpell) - return SPELL_FAILED_DONT_REPORT; - else - return SPELL_FAILED_BAD_TARGETS; - } - } - } - }*/ - if (!m_IsTriggeredSpell) { SpellCastResult castResult = CheckRange(strict); |
