Fix action buttons sent to client when swapping between talent specs. Storage related parts by Hunuza (MaNGOS), big thanks.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-04-28 16:08:31 +02:00
parent 311d108529
commit ab013e42c9
5 changed files with 172 additions and 101 deletions

View File

@@ -7602,24 +7602,26 @@ void Spell::EffectCastButtons(uint32 i)
for (; n_buttons; n_buttons--, button_id++)
{
if (uint32 spell_id = p_caster->GetActionButtonSpell(button_id))
{
if (!spell_id)
continue;
ActionButton const* ab = p_caster->GetActionButton(button_id);
if (!ab || ab->GetAction() != ACTION_BUTTON_SPELL)
continue;;
if (p_caster->HasSpellCooldown(spell_id))
continue;
uint32 spell_id = ab->GetAction();
if (!spell_id)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
uint32 cost = CalculatePowerCost(spellInfo, m_caster, GetSpellSchoolMask(spellInfo));
if (p_caster->HasSpellCooldown(spell_id))
continue;
if (m_caster->GetPower(POWER_MANA) < cost)
break;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
uint32 cost = CalculatePowerCost(spellInfo, m_caster, GetSpellSchoolMask(spellInfo));
if (m_caster->GetPower(POWER_MANA) < cost)
break;
m_caster->CastSpell(unitTarget, spell_id, true);
m_caster->ModifyPower(POWER_MANA, -(int32)cost);
p_caster->AddSpellAndCategoryCooldowns(spellInfo, 0);
}
}
}