Core/Spells: convert some spell effects to SpellScripts

This commit is contained in:
joschiwald committed 2012-05-28 04:07:51 +02:00
1 parent 58f63509cd
commit ca07f30d03
26 files changed
+1099 -455

No files matched your search

@@ -42,6 +42,10 @@ enum ShamanSpells
// For Earthen Power
SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM = 6474,
SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566,
ICON_ID_SHAMAN_LAVA_FLOW = 3087,
SHAMAN_LAVA_FLOWS_R1 = 51480,
SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694,
};
// 51474 - Astral shift
@@ -652,6 +656,52 @@ class spell_sha_chain_heal : public SpellScriptLoader
}
};
class spell_sha_flame_shock : public SpellScriptLoader
{
public:
spell_sha_flame_shock() : SpellScriptLoader("spell_sha_flame_shock") { }
class spell_sha_flame_shock_AuraScript : public AuraScript
{
PrepareAuraScript(spell_sha_flame_shock_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_R1))
return false;
if (!sSpellMgr->GetSpellInfo(SHAMAN_LAVA_FLOWS_TRIGGERED_R1))
return false;
return true;
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
{
if (Unit* caster = GetCaster())
{
// Lava Flows
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, ICON_ID_SHAMAN_LAVA_FLOW, 0))
{
if (sSpellMgr->GetFirstSpellInChain(SHAMAN_LAVA_FLOWS_R1) != sSpellMgr->GetFirstSpellInChain(aurEff->GetId()))
return;
uint8 rank = sSpellMgr->GetSpellRank(aurEff->GetId());
caster->CastSpell(caster, sSpellMgr->GetSpellWithRank(SHAMAN_LAVA_FLOWS_TRIGGERED_R1, rank), true);
}
}
}
void Register()
{
AfterDispel += AuraDispelFn(spell_sha_flame_shock_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_sha_flame_shock_AuraScript();
}
};
void AddSC_shaman_spell_scripts()
{
new spell_sha_astral_shift();
@@ -667,4 +717,5 @@ void AddSC_shaman_spell_scripts()
new spell_sha_mana_spring_totem();
new spell_sha_lava_lash();
new spell_sha_chain_heal();
new spell_sha_flame_shock();
}