diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 9 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 9 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 10 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 231 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 223 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 151 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 285 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 9 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 9 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 111 |
10 files changed, 521 insertions, 526 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index b5c5b603217..2bfb9863725 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -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(); - */ + } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 00bca49ccd6..15bdcebd33c 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -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(); - */ + } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index c46fae68fa6..20ba278b804 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -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; } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 0e937f748e2..790e5723056 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -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); + void HandleDummy(SpellEffIndex effIndex) + { + 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; + } + } - if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && - (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && - spellInfo->Id != SPELL_MAGE_COLD_SNAP && GetSpellRecoveryTime(spellInfo) > 0) + void Register() { - caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); + // add dummy effect spell handler to Cold Snap + EffectHandlers += EffectHandlerFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - 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); - } + SpellScript* GetSpellScript() const + { + return new spell_mage_cold_snap_SpellScript(); + } }; -SpellScript * GetSpellScript_spell_mage_cold_snap() +class spell_mage_polymorph_cast_visual : public SpellHandlerScript { - return new spell_mage_cold_snap_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); - } -}; + class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript + { + static const uint32 spell_list[6]; -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 -}; + 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; + } -SpellScript * GetSpellScript_spell_mage_polymorph_visual() -{ - return new spell_mage_polymorph_cast_visual_SpellScript(); -} + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit *unitTarget = GetHitUnit()) + if (unitTarget->GetTypeId() == TYPEID_UNIT) + unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true); + } -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()) + 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 { - // 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_polymorph_cast_visual_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_summon_water_elemental : public SpellHandlerScript { - return new spell_mage_summon_water_elemental_SpellScript(); -} + 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; } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 0889106684b..ed1ad2d3987 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -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; - } - - void HandleDummy(SpellEffIndex effIndex) - { - if (Unit *unitTarget = GetHitUnit()) + public: + spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { } + + 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 + } + + GetCaster()->CastSpell(GetCaster(), spell_id, true); + } + } + + 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); + } + }; - 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); - } + SpellScript *GetSpellScript() const + { + return new spell_pal_blessing_of_faith_SpellScript(); + } }; -SpellScript * GetSpellScript_spell_pal_blessing_of_faith() +class spell_pal_holy_shock : public SpellHandlerScript { - return new spell_pal_blessing_of_faith_SpellScript(); -} + public: + spell_pal_holy_shock() : SpellHandlerScript("spell_pal_holy_shock") { } -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()) + class spell_pal_holy_shock_SpellScript : public SpellScript { - Unit *caster = GetCaster(); + bool Validate(SpellEntry const *spellEntry) + { + if (!sSpellStore.LookupEntry(PALADIN_SPELL_HOLY_SHOCK_R1)) + return false; - uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id); + // 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; - 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); - } - } + 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; - void Register() - { - // add dummy effect spell handler to Holy Shock - EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } -}; + return true; + } -SpellScript * GetSpellScript_spell_pal_holy_shock() -{ - return new spell_pal_holy_shock_SpellScript(); -} + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit *unitTarget = GetHitUnit()) + { + Unit *caster = GetCaster(); -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); - } + 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; } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 8c2fffa9c5b..6d3f605e31b 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -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(); - } - - void Register() - { - EffectHandlers += EffectHandlerFn(spell_pri_pain_and_suffering_proc_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } + public: + spell_pri_pain_and_suffering_proc() : SpellHandlerScript("spell_pri_pain_and_suffering_proc") { } + + // 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(); -} - -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; - - return true; - } - - void HandleDummy(SpellEffIndex effIndex) - { - Unit *unitTarget = GetHitUnit(); - if (!unitTarget || !unitTarget->isAlive()) - return; - - Unit *caster = GetCaster(); - - 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); - } - - void Register() - { - // add dummy effect spell handler to Penance - EffectHandlers += EffectHandlerFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } + 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; + + 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; + } + + void HandleDummy(SpellEffIndex effIndex) + { + Unit *unitTarget = GetHitUnit(); + if (!unitTarget || !unitTarget->isAlive()) + return; + + Unit *caster = GetCaster(); + + 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); + } + + 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; } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index f4aec79128f..b83a085f819 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -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; - } - - 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); - } + public: + spell_rog_cheat_death() : SpellHandlerScript("spell_rog_cheat_death") { } + + class spell_rog_cheat_death_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + 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; + } }; -SpellScript *GetSpellScript_spell_rog_cheat_death() +class spell_rog_hunger_for_blood : public SpellHandlerScript { - return new spell_rog_cheat_death_SpellScript(); -} + 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); - } + 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(); + } }; -SpellScript *GetSpellScript_spell_rog_hunger_for_blood() +class spell_rog_preparation : public SpellHandlerScript { - return new spell_rog_hunger_for_blood_SpellScript(); -} + 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();) + class spell_rog_preparation_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_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); - } + 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(); + } }; -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; - } - - 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); - } - - void Register() - { - // add dummy effect spell handler to Shiv - EffectHandlers += EffectHandlerFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } -}; + class spell_rog_shiv_SpellScript : public SpellScript + { + bool Validate(SpellEntry const * spellEntry) + { + if (!sSpellStore.LookupEntry(ROGUE_SPELL_SHIV_TRIGGERED)) + return false; + return true; + } -SpellScript *GetSpellScript_spell_rog_shiv() -{ - return new spell_rog_shiv_SpellScript(); -} + 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); + } + + 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(); + } +}; 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; } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index d4f23c7fdfa..3fe0a93229e 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -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(); - */ + } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 4700c2ad422..0f7bb4fe15d 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -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(); - */ + } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index a59c34e70cc..e9ebfa0ce5c 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -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_spell_warr_warriors_wrath() -{ - return new spell_warr_warriors_wrath_SpellScript(); -} + SpellScript *GetSpellScript() const + { + 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; } |