Convert spell scripts to new system.

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-08-06 11:35:39 -07:00
parent 5a345eeade
commit 14459bc467
10 changed files with 523 additions and 528 deletions

View File

@@ -25,12 +25,5 @@
void AddSC_deathknight_spell_scripts()
{
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_dk_";
newscript->GetSpellScript = &GetSpellScript_spell_dk_;
newscript->RegisterSelf();
*/
}

View File

@@ -25,12 +25,5 @@
void AddSC_druid_spell_scripts()
{
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_dru_";
newscript->GetSpellScript = &GetSpellScript_spell_dru_;
newscript->RegisterSelf();
*/
}

View File

@@ -252,9 +252,9 @@ class spell_hun_pet_carrion_feeder : public SpellHandlerScript
void AddSC_hunter_spell_scripts()
{
new spell_hun_last_stand_pet();
new spell_hun_masters_call();
new spell_hun_readiness();
new spell_hun_pet_heart_of_the_phoenix();
new spell_hun_pet_carrion_feeder();
new spell_hun_last_stand_pet;
new spell_hun_masters_call;
new spell_hun_readiness;
new spell_hun_pet_heart_of_the_phoenix;
new spell_hun_pet_carrion_feeder;
}

View File

@@ -37,139 +37,144 @@ enum MageSpells
SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY = 70907,
};
class spell_mage_cold_snap_SpellScript : public SpellScript
class spell_mage_cold_snap : public SpellHandlerScript
{
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
public:
spell_mage_cold_snap() : SpellHandlerScript("spell_mage_cold_snap") { }
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on Frost spells
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
class spell_mage_cold_snap_SpellScript : public SpellScript
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
spellInfo->Id != SPELL_MAGE_COLD_SNAP && GetSpellRecoveryTime(spellInfo) > 0)
void HandleDummy(SpellEffIndex effIndex)
{
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on Frost spells
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
spellInfo->Id != SPELL_MAGE_COLD_SNAP && GetSpellRecoveryTime(spellInfo) > 0)
{
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
}
else
++itr;
}
}
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Cold Snap
EffectHandlers += EffectHandlerFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
void Register()
{
// add dummy effect spell handler to Cold Snap
EffectHandlers += EffectHandlerFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_mage_cold_snap()
{
return new spell_mage_cold_snap_SpellScript();
}
class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript
{
static const uint32 spell_list[6];
bool Validate(SpellEntry const * spellEntry)
{
// check if spell ids exist in dbc
for (int i = 0; i < 6; i++)
if (!sSpellStore.LookupEntry(spell_list[i]))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
if (unitTarget->GetTypeId() == TYPEID_UNIT)
unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true);
}
void Register()
{
// add dummy effect spell handler to Polymorph visual
EffectHandlers += EffectHandlerFn(spell_mage_polymorph_cast_visual_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
const uint32 spell_mage_polymorph_cast_visual_SpellScript::spell_list[6] =
{
SPELL_MAGE_SQUIRREL_FORM,
SPELL_MAGE_GIRAFFE_FORM,
SPELL_MAGE_SERPENT_FORM,
SPELL_MAGE_DRAGONHAWK_FORM,
SPELL_MAGE_WORGEN_FORM,
SPELL_MAGE_SHEEP_FORM
};
SpellScript * GetSpellScript_spell_mage_polymorph_visual()
{
return new spell_mage_polymorph_cast_visual_SpellScript();
}
class spell_mage_summon_water_elemental_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
return false;
if (!sSpellStore.LookupEntry(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY))
return false;
if (!sSpellStore.LookupEntry(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
SpellScript* GetSpellScript() const
{
// Glyph of Eternal Water
if (unitTarget->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
unitTarget->CastSpell(unitTarget, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT, true);
else
unitTarget->CastSpell(unitTarget, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, true);
return new spell_mage_cold_snap_SpellScript();
}
}
void Register()
{
// add dummy effect spell handler to Summon Water Elemental
EffectHandlers += EffectHandlerFn(spell_mage_summon_water_elemental_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_mage_summon_water_elemental()
class spell_mage_polymorph_cast_visual : public SpellHandlerScript
{
return new spell_mage_summon_water_elemental_SpellScript();
}
public:
spell_mage_polymorph_cast_visual() : SpellHandlerScript("spell_mage_polymorph_visual") { }
class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript
{
static const uint32 spell_list[6];
bool Validate(SpellEntry const * spellEntry)
{
// check if spell ids exist in dbc
for (int i = 0; i < 6; i++)
if (!sSpellStore.LookupEntry(spell_list[i]))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
if (unitTarget->GetTypeId() == TYPEID_UNIT)
unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true);
}
void Register()
{
// add dummy effect spell handler to Polymorph visual
EffectHandlers += EffectHandlerFn(spell_mage_polymorph_cast_visual_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
const uint32 spell_mage_polymorph_cast_visual_SpellScript::spell_list[6] =
{
SPELL_MAGE_SQUIRREL_FORM,
SPELL_MAGE_GIRAFFE_FORM,
SPELL_MAGE_SERPENT_FORM,
SPELL_MAGE_DRAGONHAWK_FORM,
SPELL_MAGE_WORGEN_FORM,
SPELL_MAGE_SHEEP_FORM
};
SpellScript* GetSpellScript() const
{
return new spell_mage_polymorph_cast_visual_SpellScript();
}
};
class spell_mage_summon_water_elemental : public SpellHandlerScript
{
public:
spell_mage_summon_water_elemental() : SpellHandlerScript("spell_mage_summon_water_elemental") { }
class spell_mage_summon_water_elemental_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
return false;
if (!sSpellStore.LookupEntry(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY))
return false;
if (!sSpellStore.LookupEntry(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
{
// Glyph of Eternal Water
if (unitTarget->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
unitTarget->CastSpell(unitTarget, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT, true);
else
unitTarget->CastSpell(unitTarget, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, true);
}
}
void Register()
{
// add dummy effect spell handler to Summon Water Elemental
EffectHandlers += EffectHandlerFn(spell_mage_summon_water_elemental_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript() const
{
return new spell_mage_summon_water_elemental_SpellScript();
}
};
void AddSC_mage_spell_scripts()
{
Script *newscript;
newscript = new Script;
newscript->Name = "spell_mage_cold_snap";
newscript->GetSpellScript = &GetSpellScript_spell_mage_cold_snap;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_mage_polymorph_visual";
newscript->GetSpellScript = &GetSpellScript_spell_mage_polymorph_visual;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_mage_summon_water_elemental";
newscript->GetSpellScript = &GetSpellScript_spell_mage_summon_water_elemental;
newscript->RegisterSelf();
new spell_mage_cold_snap;
new spell_mage_polymorph_cast_visual;
new spell_mage_summon_water_elemental;
}

View File

@@ -35,135 +35,140 @@ enum PaladinSpells
SPELL_BLESSING_OF_LOWER_CITY_SHAMAN = 37881,
};
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
class spell_pal_blessing_of_faith : public SpellHandlerScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
return false;
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
return false;
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PRIEST))
return false;
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
return false;
return true;
}
public:
spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { }
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
{
uint32 spell_id = 0;
switch(unitTarget->getClass())
bool Validate(SpellEntry const *spellEntry)
{
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break;
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break;
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break;
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break;
default: return; // ignore for non-healing classes
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
return false;
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
return false;
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PRIEST))
return false;
if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN))
return false;
return true;
}
GetCaster()->CastSpell(GetCaster(), spell_id, true);
}
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
{
uint32 spell_id = 0;
switch(unitTarget->getClass())
{
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break;
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break;
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break;
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break;
default: return; // ignore for non-healing classes
}
void Register()
{
// add dummy effect spell handler to Blessing of Faith
EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
GetCaster()->CastSpell(GetCaster(), spell_id, true);
}
}
SpellScript * GetSpellScript_spell_pal_blessing_of_faith()
{
return new spell_pal_blessing_of_faith_SpellScript();
}
void Register()
{
// add dummy effect spell handler to Blessing of Faith
EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
class spell_pal_holy_shock_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
// can't use other spell than holy shock due to spell_ranks dependency
if (spellmgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id))
return false;
uint8 rank = spellmgr.GetSpellRank(spellEntry->Id);
if (!spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true))
return false;
if (!spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
SpellScript *GetSpellScript() const
{
Unit *caster = GetCaster();
uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id);
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0);
else
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
return new spell_pal_blessing_of_faith_SpellScript();
}
}
void Register()
{
// add dummy effect spell handler to Holy Shock
EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_pal_holy_shock()
class spell_pal_holy_shock : public SpellHandlerScript
{
return new spell_pal_holy_shock_SpellScript();
}
public:
spell_pal_holy_shock() : SpellHandlerScript("spell_pal_holy_shock") { }
class spell_pal_judgement_of_command_SpellScript : public SpellScript
{
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue()))
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
}
class spell_pal_holy_shock_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
return false;
void Register()
{
// add dummy effect spell handler to Judgement of Command
EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
// can't use other spell than holy shock due to spell_ranks dependency
if (spellmgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id))
return false;
uint8 rank = spellmgr.GetSpellRank(spellEntry->Id);
if (!spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true))
return false;
if (!spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
{
Unit *caster = GetCaster();
uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id);
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0);
else
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0);
}
}
void Register()
{
// add dummy effect spell handler to Holy Shock
EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_pal_holy_shock_SpellScript();
}
};
SpellScript * GetSpellScript_spell_pal_judgement_of_command()
class spell_pal_judgement_of_command : public SpellHandlerScript
{
return new spell_pal_judgement_of_command_SpellScript();
}
public:
spell_pal_judgement_of_command() : SpellHandlerScript("spell_pal_judgement_of_command") { }
class spell_pal_judgement_of_command_SpellScript : public SpellScript
{
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue()))
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
}
void Register()
{
// add dummy effect spell handler to Judgement of Command
EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_pal_judgement_of_command_SpellScript();
}
};
void AddSC_paladin_spell_scripts()
{
Script *newscript;
newscript = new Script;
newscript->Name = "spell_pal_blessing_of_faith";
newscript->GetSpellScript = &GetSpellScript_spell_pal_blessing_of_faith;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_pal_holy_shock";
newscript->GetSpellScript = &GetSpellScript_spell_pal_holy_shock;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_pal_judgement_of_command";
newscript->GetSpellScript = &GetSpellScript_spell_pal_judgement_of_command;
newscript->RegisterSelf();
new spell_pal_blessing_of_faith;
new spell_pal_holy_shock;
new spell_pal_judgement_of_command;
}

View File

@@ -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;
}

View File

@@ -31,168 +31,175 @@ enum RogueSpells
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819,
};
class spell_rog_cheat_death_SpellScript : public SpellScript
class spell_rog_cheat_death : public SpellHandlerScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_CHEATING_DEATH))
return false;
return true;
}
public:
spell_rog_cheat_death() : SpellHandlerScript("spell_rog_cheat_death") { }
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
caster->CastSpell(caster, ROGUE_SPELL_CHEATING_DEATH, true);
}
void Register()
{
// add dummy effect spell handler to Cheat Death
EffectHandlers += EffectHandlerFn(spell_rog_cheat_death_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript_spell_rog_cheat_death()
{
return new spell_rog_cheat_death_SpellScript();
}
class spell_rog_hunger_for_blood_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
caster->CastSpell(caster, ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF, true);
}
void Register()
{
// add dummy effect spell handler to Hunger for Blood
EffectHandlers += EffectHandlerFn(spell_rog_hunger_for_blood_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript_spell_rog_hunger_for_blood()
{
return new spell_rog_hunger_for_blood_SpellScript();
}
class spell_rog_preparation_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_GLYPH_OF_PREPARATION))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
//immediately finishes the cooldown on certain Rogue abilities
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
class spell_rog_cheat_death_SpellScript : public SpellScript
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
bool Validate(SpellEntry const * spellEntry)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION))
if (!sSpellStore.LookupEntry(ROGUE_SPELL_CHEATING_DEATH))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
caster->CastSpell(caster, ROGUE_SPELL_CHEATING_DEATH, true);
}
void Register()
{
// add dummy effect spell handler to Cheat Death
EffectHandlers += EffectHandlerFn(spell_rog_cheat_death_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_rog_cheat_death_SpellScript;
}
};
class spell_rog_hunger_for_blood : public SpellHandlerScript
{
public:
spell_rog_hunger_for_blood() : SpellHandlerScript("spell_rog_hunger_for_blood") { }
class spell_rog_hunger_for_blood_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
caster->CastSpell(caster, ROGUE_SPELL_HUNGER_FOR_BLOOD_BUFF, true);
}
void Register()
{
// add dummy effect spell handler to Hunger for Blood
EffectHandlers += EffectHandlerFn(spell_rog_hunger_for_blood_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_rog_hunger_for_blood_SpellScript();
}
};
class spell_rog_preparation : public SpellHandlerScript
{
public:
spell_rog_preparation() : SpellHandlerScript("spell_rog_preparation") { }
class spell_rog_preparation_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_GLYPH_OF_PREPARATION))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
//immediately finishes the cooldown on certain Rogue abilities
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION))
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
}
else
++itr;
}
else
++itr;
}
else
++itr;
}
else
++itr;
void Register()
{
// add dummy effect spell handler to Preparation
EffectHandlers += EffectHandlerFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_rog_preparation_SpellScript();
}
}
void Register()
{
// add dummy effect spell handler to Preparation
EffectHandlers += EffectHandlerFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript_spell_rog_preparation()
class spell_rog_shiv : public SpellHandlerScript
{
return new spell_rog_preparation_SpellScript();
}
public:
spell_rog_shiv() : SpellHandlerScript("spell_rog_shiv") { }
class spell_rog_shiv_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED))
return false;
return true;
}
class spell_rog_shiv_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
if (Unit *unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true);
}
if (Unit *unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true);
}
void Register()
{
// add dummy effect spell handler to Shiv
EffectHandlers += EffectHandlerFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
void Register()
{
// add dummy effect spell handler to Shiv
EffectHandlers += EffectHandlerFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_rog_shiv_SpellScript();
}
};
SpellScript *GetSpellScript_spell_rog_shiv()
{
return new spell_rog_shiv_SpellScript();
}
void AddSC_rogue_spell_scripts()
{
Script *newscript;
newscript = new Script;
newscript->Name = "spell_rog_cheat_death";
newscript->GetSpellScript = &GetSpellScript_spell_rog_cheat_death;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_rog_hunger_for_blood";
newscript->GetSpellScript = &GetSpellScript_spell_rog_hunger_for_blood;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_rog_preparation";
newscript->GetSpellScript = &GetSpellScript_spell_rog_preparation;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_rog_shiv";
newscript->GetSpellScript = &GetSpellScript_spell_rog_shiv;
newscript->RegisterSelf();
new spell_rog_cheat_death;
new spell_rog_hunger_for_blood;
new spell_rog_preparation;
new spell_rog_shiv;
}

View File

@@ -25,12 +25,5 @@
void AddSC_shaman_spell_scripts()
{
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_sha_";
newscript->GetSpellScript = &GetSpellScript_spell_sha_;
newscript->RegisterSelf();
*/
}

View File

@@ -25,12 +25,5 @@
void AddSC_warlock_spell_scripts()
{
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_warl_";
newscript->GetSpellScript = &GetSpellScript_spell_warl_;
newscript->RegisterSelf();
*/
}

View File

@@ -29,71 +29,74 @@ enum WarriorSpells
WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED = 21887,
};
class spell_warr_last_stand_SpellScript : public SpellScript
class spell_warr_last_stand : public SpellHandlerScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
public:
spell_warr_last_stand() : SpellHandlerScript("spell_warr_last_stand") { }
void HandleDummy(SpellEffIndex effIndex)
{
int32 healthModSpellBasePoints0 = int32(GetCaster()->GetMaxHealth() * 0.3);
GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
class spell_warr_last_stand_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
void Register()
{
// add dummy effect spell handler to Last Stand
EffectHandlers += EffectHandlerFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
void HandleDummy(SpellEffIndex effIndex)
{
int32 healthModSpellBasePoints0 = int32(GetCaster()->GetMaxHealth() * 0.3);
GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
void Register()
{
// add dummy effect spell handler to Last Stand
EffectHandlers += EffectHandlerFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_warr_last_stand_SpellScript();
}
};
SpellScript * GetSpellScript_spell_warr_last_stand()
class spell_warr_warriors_wrath : public SpellHandlerScript
{
return new spell_warr_last_stand_SpellScript();
}
public:
spell_warr_warriors_wrath() : SpellHandlerScript("spell_warr_warriors_wrath") { }
class spell_warr_warriors_wrath_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED))
return false;
return true;
}
class spell_warr_warriors_wrath_SpellScript : public SpellScript
{
bool Validate(SpellEntry const *spellEntry)
{
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
GetCaster()->CastSpell(unitTarget, WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED, true);
}
void HandleDummy(SpellEffIndex effIndex)
{
if (Unit *unitTarget = GetHitUnit())
GetCaster()->CastSpell(unitTarget, WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED, true);
}
void Register()
{
// add dummy effect spell handler to Warrior's Wrath
EffectHandlers += EffectHandlerFn(spell_warr_warriors_wrath_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
void Register()
{
// add dummy effect spell handler to Warrior's Wrath
EffectHandlers += EffectHandlerFn(spell_warr_warriors_wrath_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript *GetSpellScript() const
{
return new spell_warr_warriors_wrath_SpellScript();
}
};
SpellScript * GetSpellScript_spell_warr_warriors_wrath()
{
return new spell_warr_warriors_wrath_SpellScript();
}
void AddSC_warrior_spell_scripts()
{
Script *newscript;
newscript = new Script;
newscript->Name = "spell_warr_last_stand";
newscript->GetSpellScript = &GetSpellScript_spell_warr_last_stand;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_warr_warriors_wrath";
newscript->GetSpellScript = &GetSpellScript_spell_warr_warriors_wrath;
newscript->RegisterSelf();
new spell_warr_last_stand;
new spell_warr_warriors_wrath;
}