Convert spell scripts to new system.
--HG-- branch : trunk
This commit is contained in:
1 parent
5a345eeade
commit
14459bc467
10 files changed
+523
-528
No files matched your search
@@ -31,86 +31,89 @@ enum PriestSpells
|
||||
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
|
||||
};
|
||||
|
||||
// 47948 Pain and Suffering (proc)
|
||||
class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
|
||||
class spell_pri_pain_and_suffering_proc : public SpellHandlerScript
|
||||
{
|
||||
void HandleEffectScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
// Refresh Shadow Word: Pain on target
|
||||
if (Unit *unitTarget = GetHitUnit())
|
||||
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID()))
|
||||
aur->GetBase()->RefreshDuration();
|
||||
}
|
||||
public:
|
||||
spell_pri_pain_and_suffering_proc() : SpellHandlerScript("spell_pri_pain_and_suffering_proc") { }
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_pri_pain_and_suffering_proc_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
// 47948 Pain and Suffering (proc)
|
||||
class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
|
||||
{
|
||||
void HandleEffectScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
// Refresh Shadow Word: Pain on target
|
||||
if (Unit *unitTarget = GetHitUnit())
|
||||
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID()))
|
||||
aur->GetBase()->RefreshDuration();
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_pri_pain_and_suffering_proc_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript *GetSpellScript() const
|
||||
{
|
||||
return new spell_pri_pain_and_suffering_proc_SpellScript;
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript *GetSpellScript_spell_pri_pain_and_suffering_proc()
|
||||
class spell_pri_penance : public SpellHandlerScript
|
||||
{
|
||||
return new spell_pri_pain_and_suffering_proc_SpellScript();
|
||||
}
|
||||
public:
|
||||
spell_pri_penance() : SpellHandlerScript("spell_pri_penance") { }
|
||||
|
||||
class spell_pri_penance_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1))
|
||||
return false;
|
||||
// can't use other spell than this penance due to spell_ranks dependency
|
||||
if (spellmgr.GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id))
|
||||
return false;
|
||||
class spell_pri_penance_SpellScript : public SpellScript
|
||||
{
|
||||
bool Validate(SpellEntry const * spellEntry)
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1))
|
||||
return false;
|
||||
// can't use other spell than this penance due to spell_ranks dependency
|
||||
if (spellmgr.GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id))
|
||||
return false;
|
||||
|
||||
uint8 rank = spellmgr.GetSpellRank(spellEntry->Id);
|
||||
if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true))
|
||||
return false;
|
||||
if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true))
|
||||
return false;
|
||||
uint8 rank = spellmgr.GetSpellRank(spellEntry->Id);
|
||||
if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true))
|
||||
return false;
|
||||
if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit *unitTarget = GetHitUnit();
|
||||
if (!unitTarget || !unitTarget->isAlive())
|
||||
return;
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit *unitTarget = GetHitUnit();
|
||||
if (!unitTarget || !unitTarget->isAlive())
|
||||
return;
|
||||
|
||||
Unit *caster = GetCaster();
|
||||
Unit *caster = GetCaster();
|
||||
|
||||
uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id);
|
||||
uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id);
|
||||
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
|
||||
}
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Penance
|
||||
EffectHandlers += EffectHandlerFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
void Register()
|
||||
{
|
||||
// add dummy effect spell handler to Penance
|
||||
EffectHandlers += EffectHandlerFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript *GetSpellScript() const
|
||||
{
|
||||
return new spell_pri_penance_SpellScript;
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript *GetSpellScript_spell_pri_penance()
|
||||
{
|
||||
return new spell_pri_penance_SpellScript();
|
||||
}
|
||||
|
||||
void AddSC_priest_spell_scripts()
|
||||
{
|
||||
Script *newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "spell_pri_pain_and_suffering_proc";
|
||||
newscript->GetSpellScript = &GetSpellScript_spell_pri_pain_and_suffering_proc;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "spell_pri_penance";
|
||||
newscript->GetSpellScript = &GetSpellScript_spell_pri_penance;
|
||||
newscript->RegisterSelf();
|
||||
new spell_pri_pain_and_suffering_proc;
|
||||
new spell_pri_penance;
|
||||
}
|
||||
Reference in new issue
Block a user