Core/Spells: Fix Shaman totem bar exploit that would allow the player to cast any spell when using Call of the Elements etc.

Original patch by 3kids

Closes #2356
This commit is contained in:
Machiavelli
2011-07-31 14:12:53 +02:00
parent db28ae55c9
commit 8ceb780213
+11 -2
View File
@@ -6967,14 +6967,23 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
if (!ab || ab->GetType() != ACTION_BUTTON_SPELL)
continue;
//! Action button data is unverified when it's set so it can be "hacked"
//! to contain invalid spells, so filter here.
uint32 spell_id = ab->GetAction();
if (!spell_id)
continue;
if (p_caster->HasSpellCooldown(spell_id))
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
continue;
if (!p_caster->HasSpell(spell_id) || p_caster->HasSpellCooldown(spell_id))
continue;
//! Valid totem spells only have the first TotemCategory field set, so only check this
if (spellInfo->TotemCategory[0] < TC_EARTH_TOTEM || spellInfo->TotemCategory[0] > TC_WATER_TOTEM)
continue;
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
if (m_caster->GetPower(POWER_MANA) < cost)