Core/Spells: Use SpellDifficulty.dbc to check casterAuraSpell, excludeCasterAuraSpell, targetAuraSpell and excludeTargetAuraSpell

Scripts/Icecrown Citadel: Fixed Mutated Abomination not being able to eat ooze on heroic mode
Scripts/Icecrown Citadel: Removed some obsolete code

Closes #523, #1447
This commit is contained in:
Shauren
2011-05-17 13:17:42 +02:00
parent 2086eb37e8
commit 63f7a6d3d9
11 changed files with 84 additions and 99 deletions
+1 -1
View File
@@ -8016,7 +8016,7 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& n
if (mainpart != GetMainPartOfName(wname, i+1))
x = false;
if (w_ownname != wname)
y = false;
}
+6 -6
View File
@@ -4767,9 +4767,9 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_CASTER_AURASTATE;
// Note: spell 62473 requres casterAuraSpell = triggering spell
if (m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
if (m_spellInfo->casterAuraSpell && !m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->casterAuraSpell, m_caster)))
return SPELL_FAILED_CASTER_AURASTATE;
if (m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell))
if (m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->excludeCasterAuraSpell, m_caster)))
return SPELL_FAILED_CASTER_AURASTATE;
if (reqCombat && m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
@@ -4798,10 +4798,10 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!m_IsTriggeredSpell && m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot), m_spellInfo, m_caster))
return SPELL_FAILED_TARGET_AURASTATE;
if (m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
if (m_spellInfo->targetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->targetAuraSpell, m_caster)))
return SPELL_FAILED_TARGET_AURASTATE;
if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->excludeTargetAuraSpell, m_caster)))
return SPELL_FAILED_TARGET_AURASTATE;
if (!m_IsTriggeredSpell && target == m_caster && m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_TARGET_SELF)
@@ -6549,9 +6549,9 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
}
// Check Aura spell req (need for AoE spells)
if (m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
if (m_spellInfo->targetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->targetAuraSpell, m_caster)))
return false;
if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->excludeTargetAuraSpell, m_caster)))
return false;
// Check targets for not_selectable unit flag and remove
-5
View File
@@ -4053,11 +4053,6 @@ void SpellMgr::LoadSpellCustomAttr()
spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST;
++count;
break;
// this is here until targetAuraSpell and alike support SpellDifficulty.dbc
case 70459: // Ooze Eruption Search Effect (Professor Putricide)
spellInfo->targetAuraSpell = 0;
++count;
break;
// THIS IS HERE BECAUSE COOLDOWN ON CREATURE PROCS IS NOT IMPLEMENTED
case 71604: // Mutated Strength (Professor Putricide)
case 72673: // Mutated Strength (Professor Putricide)
+38 -24
View File
@@ -1051,46 +1051,60 @@ class SpellMgr
return NULL;
}
// Spell Difficulty data
SpellEntry const* GetSpellForDifficultyFromSpell(SpellEntry const* spell, Unit* Caster)
uint32 GetSpellIdForDifficulty(uint32 spellId, Unit* caster) const
{
//spell never can be NULL in this case!
if (!Caster || !Caster->GetMap() || !Caster->GetMap()->IsDungeon())
return spell;
if (!sSpellStore.LookupEntry(spellId))
return spellId;
uint32 mode = uint32(Caster->GetMap()->GetSpawnMode());
if (!caster || !caster->GetMap() || !caster->GetMap()->IsDungeon())
return spellId;
uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
if (mode >= MAX_DIFFICULTY)
{
sLog->outError("GetSpellForDifficultyFromSpell: Incorrect Difficulty for spell %u.", spell->Id);
return spell;//return source spell
sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
return spellId; //return source spell
}
uint32 SpellDiffId = GetSpellDifficultyId(spell->Id);
if (!SpellDiffId)
return spell;//return source spell, it has only REGULAR_DIFFICULTY
SpellDifficultyEntry const *SpellDiff = sSpellDifficultyStore.LookupEntry(SpellDiffId);
if (!SpellDiff)
uint32 difficultyId = GetSpellDifficultyId(spellId);
if (!difficultyId)
return spellId; //return source spell, it has only REGULAR_DIFFICULTY
SpellDifficultyEntry const *difficultyEntry = sSpellDifficultyStore.LookupEntry(difficultyId);
if (!difficultyEntry)
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: SpellDifficultyEntry not found for spell %u. This Should never happen.", spell->Id);
return spell;//return source spell
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId);
return spellId; //return source spell
}
if (SpellDiff->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: spell %u mode %u spell is NULL, using mode %u", spell->Id, mode, mode-2);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2);
mode -= 2;
}
if (SpellDiff->SpellID[mode] <= 0)
if (difficultyEntry->SpellID[mode] <= 0)
{
sLog->outErrorDb("GetSpellForDifficultyFromSpell: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spell->Id, mode);
return spell;
sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
return spellId;
}
SpellEntry const* newSpell = sSpellStore.LookupEntry(uint32(SpellDiff->SpellID[mode]));
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]);
return uint32(difficultyEntry->SpellID[mode]);
}
// Spell Difficulty data
SpellEntry const* GetSpellForDifficultyFromSpell(SpellEntry const* spell, Unit* caster) const
{
uint32 newSpellId = GetSpellIdForDifficulty(spell->Id, caster);
SpellEntry const* newSpell = sSpellStore.LookupEntry(newSpellId);
if (!newSpell)
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: spell %u not found in SpellStore. Check spelldifficulty_dbc!", SpellDiff->SpellID[mode]);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found in sSpellStore. Check spelldifficulty_dbc!", newSpellId);
return spell;
}
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "GetSpellForDifficultyFromSpell: spellid for spell %u in mode %u is %u ", spell->Id, mode, newSpell->Id);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id);
return newSpell;
}
@@ -1353,7 +1367,7 @@ class SpellMgr
return false;
return true;
}
uint32 GetSpellDifficultyId(uint32 spellId)
uint32 GetSpellDifficultyId(uint32 spellId) const
{
SpellDifficultySearcherMap::const_iterator i = mSpellDifficultySearcherMap.find(spellId);
return i == mSpellDifficultySearcherMap.end() ? 0 : (*i).second;