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
-7
View File
@@ -25,12 +25,5 @@
void AddSC_deathknight_spell_scripts() void AddSC_deathknight_spell_scripts()
{ {
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_dk_";
newscript->GetSpellScript = &GetSpellScript_spell_dk_;
newscript->RegisterSelf();
*/
} }
@@ -25,12 +25,5 @@
void AddSC_druid_spell_scripts() void AddSC_druid_spell_scripts()
{ {
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_dru_";
newscript->GetSpellScript = &GetSpellScript_spell_dru_;
newscript->RegisterSelf();
*/
} }
+5 -5
View File
@@ -252,9 +252,9 @@ class spell_hun_pet_carrion_feeder : public SpellHandlerScript
void AddSC_hunter_spell_scripts() void AddSC_hunter_spell_scripts()
{ {
new spell_hun_last_stand_pet(); new spell_hun_last_stand_pet;
new spell_hun_masters_call(); new spell_hun_masters_call;
new spell_hun_readiness(); new spell_hun_readiness;
new spell_hun_pet_heart_of_the_phoenix(); new spell_hun_pet_heart_of_the_phoenix;
new spell_hun_pet_carrion_feeder(); new spell_hun_pet_carrion_feeder;
} }
+125 -120
View File
@@ -37,139 +37,144 @@ enum MageSpells
SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY = 70907, 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) public:
{ spell_mage_cold_snap() : SpellHandlerScript("spell_mage_cold_snap") { }
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER) class spell_mage_cold_snap_SpellScript : public SpellScript
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); void HandleDummy(SpellEffIndex effIndex)
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); 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() void Register()
{ {
// add dummy effect spell handler to Cold Snap // add dummy effect spell handler to Cold Snap
EffectHandlers += EffectHandlerFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); EffectHandlers += EffectHandlerFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} }
}; };
SpellScript * GetSpellScript_spell_mage_cold_snap() SpellScript* GetSpellScript() const
{
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())
{ {
// Glyph of Eternal Water return new spell_mage_cold_snap_SpellScript();
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_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() void AddSC_mage_spell_scripts()
{ {
Script *newscript; new spell_mage_cold_snap;
new spell_mage_polymorph_cast_visual;
newscript = new Script; new spell_mage_summon_water_elemental;
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();
} }
+114 -109
View File
@@ -35,135 +35,140 @@ enum PaladinSpells
SPELL_BLESSING_OF_LOWER_CITY_SHAMAN = 37881, 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) public:
{ spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { }
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;
}
void HandleDummy(SpellEffIndex effIndex) class spell_pal_blessing_of_faith_SpellScript : public SpellScript
{
if (Unit *unitTarget = GetHitUnit())
{ {
uint32 spell_id = 0; bool Validate(SpellEntry const *spellEntry)
switch(unitTarget->getClass())
{ {
case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break; if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_DRUID))
case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break; return false;
case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break; if (!sSpellStore.LookupEntry(SPELL_BLESSING_OF_LOWER_CITY_PALADIN))
case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break; return false;
default: return; // ignore for non-healing classes 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() GetCaster()->CastSpell(GetCaster(), spell_id, true);
{ }
// add dummy effect spell handler to Blessing of Faith }
EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_pal_blessing_of_faith() void Register()
{ {
return new spell_pal_blessing_of_faith_SpellScript(); // 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 SpellScript *GetSpellScript() const
{
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())
{ {
Unit *caster = GetCaster(); return new spell_pal_blessing_of_faith_SpellScript();
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_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 class spell_pal_holy_shock_SpellScript : public SpellScript
{ {
void HandleDummy(SpellEffIndex effIndex) bool Validate(SpellEntry const *spellEntry)
{ {
if (Unit *unitTarget = GetHitUnit()) if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1))
if (SpellEntry const* spell_proto = sSpellStore.LookupEntry(GetEffectValue())) return false;
GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL);
}
void Register() // 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))
// add dummy effect spell handler to Judgement of Command return false;
EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
} 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() void AddSC_paladin_spell_scripts()
{ {
Script *newscript; new spell_pal_blessing_of_faith;
new spell_pal_holy_shock;
newscript = new Script; new spell_pal_judgement_of_command;
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();
} }
+68 -65
View File
@@ -31,86 +31,89 @@ enum PriestSpells
PRIEST_SPELL_PENANCE_R1_HEAL = 47757, PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
}; };
// 47948 Pain and Suffering (proc) class spell_pri_pain_and_suffering_proc : public SpellHandlerScript
class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
{ {
void HandleEffectScriptEffect(SpellEffIndex effIndex) public:
{ spell_pri_pain_and_suffering_proc() : SpellHandlerScript("spell_pri_pain_and_suffering_proc") { }
// 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() // 47948 Pain and Suffering (proc)
{ class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
EffectHandlers += EffectHandlerFn(spell_pri_pain_and_suffering_proc_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); {
} 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 class spell_pri_penance_SpellScript : public SpellScript
{ {
bool Validate(SpellEntry const * spellEntry) bool Validate(SpellEntry const * spellEntry)
{ {
if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1)) if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1))
return false; return false;
// can't use other spell than this penance due to spell_ranks dependency // can't use other spell than this penance due to spell_ranks dependency
if (spellmgr.GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id)) if (spellmgr.GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id))
return false; return false;
uint8 rank = spellmgr.GetSpellRank(spellEntry->Id); uint8 rank = spellmgr.GetSpellRank(spellEntry->Id);
if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true)) if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true))
return false; return false;
if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true)) if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true))
return false; return false;
return true; return true;
} }
void HandleDummy(SpellEffIndex effIndex) void HandleDummy(SpellEffIndex effIndex)
{ {
Unit *unitTarget = GetHitUnit(); Unit *unitTarget = GetHitUnit();
if (!unitTarget || !unitTarget->isAlive()) if (!unitTarget || !unitTarget->isAlive())
return; return;
Unit *caster = GetCaster(); Unit *caster = GetCaster();
uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id); uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id);
if (caster->IsFriendlyTo(unitTarget)) if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0); caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
else else
caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0); caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
} }
void Register() void Register()
{ {
// add dummy effect spell handler to Penance // add dummy effect spell handler to Penance
EffectHandlers += EffectHandlerFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); 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() void AddSC_priest_spell_scripts()
{ {
Script *newscript; new spell_pri_pain_and_suffering_proc;
new spell_pri_penance;
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();
} }
+150 -143
View File
@@ -31,168 +31,175 @@ enum RogueSpells
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819, 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) public:
{ spell_rog_cheat_death() : SpellHandlerScript("spell_rog_cheat_death") { }
if (!sSpellStore.LookupEntry(ROGUE_SPELL_CHEATING_DEATH))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex) class spell_rog_cheat_death_SpellScript : public SpellScript
{
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();)
{ {
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); bool Validate(SpellEntry const * spellEntry)
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{ {
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep if (!sSpellStore.LookupEntry(ROGUE_SPELL_CHEATING_DEATH))
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint return false;
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); return true;
else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION)) }
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 SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY)) {
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); 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 else
++itr; ++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 class spell_rog_shiv_SpellScript : public SpellScript
{ {
bool Validate(SpellEntry const * spellEntry) bool Validate(SpellEntry const * spellEntry)
{ {
if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED)) if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED))
return false; return false;
return true; return true;
} }
void HandleDummy(SpellEffIndex effIndex) void HandleDummy(SpellEffIndex effIndex)
{ {
Unit *caster = GetCaster(); Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER) if (caster->GetTypeId() != TYPEID_PLAYER)
return; return;
if (Unit *unitTarget = GetHitUnit()) if (Unit *unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true); caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true);
} }
void Register() void Register()
{ {
// add dummy effect spell handler to Shiv // add dummy effect spell handler to Shiv
EffectHandlers += EffectHandlerFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); 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() void AddSC_rogue_spell_scripts()
{ {
Script *newscript; new spell_rog_cheat_death;
new spell_rog_hunger_for_blood;
newscript = new Script; new spell_rog_preparation;
newscript->Name = "spell_rog_cheat_death"; new spell_rog_shiv;
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();
} }
@@ -25,12 +25,5 @@
void AddSC_shaman_spell_scripts() void AddSC_shaman_spell_scripts()
{ {
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_sha_";
newscript->GetSpellScript = &GetSpellScript_spell_sha_;
newscript->RegisterSelf();
*/
} }
@@ -25,12 +25,5 @@
void AddSC_warlock_spell_scripts() void AddSC_warlock_spell_scripts()
{ {
//Script *newscript;
/*
newscript = new Script;
newscript->Name = "spell_warl_";
newscript->GetSpellScript = &GetSpellScript_spell_warl_;
newscript->RegisterSelf();
*/
} }
+57 -54
View File
@@ -29,71 +29,74 @@ enum WarriorSpells
WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED = 21887, 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) public:
{ spell_warr_last_stand() : SpellHandlerScript("spell_warr_last_stand") { }
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex) class spell_warr_last_stand_SpellScript : public SpellScript
{ {
int32 healthModSpellBasePoints0 = int32(GetCaster()->GetMaxHealth() * 0.3); bool Validate(SpellEntry const *spellEntry)
GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); {
} if (!sSpellStore.LookupEntry(WARRIOR_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
void Register() void HandleDummy(SpellEffIndex effIndex)
{ {
// add dummy effect spell handler to Last Stand int32 healthModSpellBasePoints0 = int32(GetCaster()->GetMaxHealth() * 0.3);
EffectHandlers += EffectHandlerFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); 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 class spell_warr_warriors_wrath_SpellScript : public SpellScript
{ {
bool Validate(SpellEntry const *spellEntry) bool Validate(SpellEntry const *spellEntry)
{ {
if (!sSpellStore.LookupEntry(WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED)) if (!sSpellStore.LookupEntry(WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED))
return false; return false;
return true; return true;
} }
void HandleDummy(SpellEffIndex effIndex) void HandleDummy(SpellEffIndex effIndex)
{ {
if (Unit *unitTarget = GetHitUnit()) if (Unit *unitTarget = GetHitUnit())
GetCaster()->CastSpell(unitTarget, WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED, true); GetCaster()->CastSpell(unitTarget, WARRIOR_SPELL_WARRIORS_WRATH_TRIGGERED, true);
} }
void Register() void Register()
{ {
// add dummy effect spell handler to Warrior's Wrath // add dummy effect spell handler to Warrior's Wrath
EffectHandlers += EffectHandlerFn(spell_warr_warriors_wrath_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); 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() void AddSC_warrior_spell_scripts()
{ {
Script *newscript; new spell_warr_last_stand;
new spell_warr_warriors_wrath;
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();
} }