Merge pull request #10323 from joschiwald/spellranks

Core/Spells: use SpellInfo class to get spellrank node instead of SpellMgr helpers
This commit is contained in:
Nay committed 2013-07-22 16:28:35 -07:00
commit 5463f211b4
9 files changed
+49 -44

No files matched your search

+8 -4
View File
@@ -953,11 +953,15 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) OVERRIDE
{
// can't use other spell than will of the necropolis due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id))
SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1);
if (!firstRankSpellInfo)
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id);
// can't use other spell than will of the necropolis due to spell_ranks dependency
if (!spellInfo->IsRankOf(firstRankSpellInfo))
return false;
uint8 rank = spellInfo->GetRank();
if (!sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true))
return false;
@@ -981,7 +985,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// min pct of hp is stored in effect 0 of talent spell
uint32 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
uint8 rank = GetSpellInfo()->GetRank();
SpellInfo const* talentProto = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank));
int32 remainingHp = int32(GetTarget()->GetHealth() - dmgInfo.GetDamage());
+8 -7
View File
@@ -597,16 +597,17 @@ class spell_pal_holy_shock : public SpellScriptLoader
{
PrepareSpellScript(spell_pal_holy_shock_SpellScript);
bool Validate(SpellInfo const* spell) OVERRIDE
bool Validate(SpellInfo const* spellInfo) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1))
SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1);
if (!firstRankSpellInfo)
return false;
// can't use other spell than holy shock due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(SPELL_PALADIN_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spell->Id))
if (!spellInfo->IsRankOf(firstRankSpellInfo))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spell->Id);
uint8 rank = spellInfo->GetRank();
if (!sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
@@ -618,11 +619,11 @@ class spell_pal_holy_shock : public SpellScriptLoader
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
{
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
uint8 rank = GetSpellInfo()->GetRank();
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank), true, 0);
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank), true);
else
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank), true);
}
}
+10 -8
View File
@@ -382,13 +382,15 @@ class spell_pri_penance : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_PENANCE_R1))
return false;
// can't use other spell than this penance due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(SPELL_PRIEST_PENANCE_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id))
SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PRIEST_PENANCE_R1);
if (!firstRankSpellInfo)
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id);
// can't use other spell than this penance due to spell_ranks dependency
if (!spellInfo->IsRankOf(firstRankSpellInfo))
return false;
uint8 rank = spellInfo->GetRank();
if (!sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank, true))
return false;
if (!sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank, true))
@@ -405,12 +407,12 @@ class spell_pri_penance : public SpellScriptLoader
if (!unitTarget->IsAlive())
return;
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
uint8 rank = GetSpellInfo()->GetRank();
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank), false, 0);
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank), false);
else
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank), false, 0);
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank), false);
}
}
+11 -12
View File
@@ -441,10 +441,11 @@ class spell_sha_fire_nova : public SpellScriptLoader
bool Validate(SpellInfo const* spellInfo) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FIRE_NOVA_R1) || sSpellMgr->GetFirstSpellInChain(SPELL_SHAMAN_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id))
SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_SHAMAN_FIRE_NOVA_R1);
if (!firstRankSpellInfo || !spellInfo->IsRankOf(firstRankSpellInfo))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id);
uint8 rank = spellInfo->GetRank();
if (!sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank, true))
return false;
return true;
@@ -464,15 +465,12 @@ class spell_sha_fire_nova : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
Unit* caster = GetCaster();
if (Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]))
{
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
if (uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank))
{
Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]);
if (totem && totem->IsTotem())
caster->CastSpell(totem, spellId, true);
}
uint8 rank = GetSpellInfo()->GetRank();
if (totem->IsTotem())
caster->CastSpell(totem, sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_FIRE_NOVA_TRIGGERED_R1, rank), true);
}
}
@@ -514,10 +512,11 @@ class spell_sha_flame_shock : public SpellScriptLoader
// Lava Flows
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW, EFFECT_0))
{
if (sSpellMgr->GetFirstSpellInChain(SPELL_SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId()))
SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_SHAMAN_LAVA_FLOWS_R1);
if (!aurEff->GetSpellInfo()->IsRankOf(firstRankSpellInfo))
return;
uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId());
uint8 rank = aurEff->GetSpellInfo()->GetRank();
caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true);
}
}
+2 -2
View File
@@ -135,7 +135,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
{
if (Player* caster = GetCaster()->ToPlayer())
{
uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
uint8 spellRank = GetSpellInfo()->GetRank();
ItemPosCountVec dest;
InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL);
if (msg != EQUIP_ERR_OK)
@@ -165,7 +165,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
break;
}
}
uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
uint8 spellRank = GetSpellInfo()->GetRank();
if (spellRank > 0 && spellRank <= 8)
CreateItem(effIndex, iTypes[spellRank - 1][rank]);
}
+1 -1
View File
@@ -264,7 +264,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader
// apply percent damage mods
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
ApplyPct(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
ApplyPct(damage, 16 * GetSpellInfo()->GetRank());
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);