diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-09-04 18:33:22 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-05 11:50:57 +0100 |
commit | a0edc1fb1bdd950094b2fffcf14f35aa660a5d16 (patch) | |
tree | 4b1c8c5003bdbe278554460d9ec4eb7eabc315e0 | |
parent | f3300899d8514bc4707539b2241d3d2513e4eac0 (diff) |
Scripts/Icecrown Citadel: Finish script registration refactoring - RegisterSpellScriptWithArgs
(cherry picked from commit 600a6b5f681c0f5864f9e9e37559965742e22ca9)
17 files changed, 44 insertions, 47 deletions
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 663e0e4b63c..1a53a88c7b3 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -23,6 +23,7 @@ #include "PassiveAI.h" #include "Player.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellAuraEffects.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 75a29e362c9..3ed5a10b53b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -23,6 +23,7 @@ #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellAuraEffects.h" #include "SpellMgr.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 31c9a19ae95..51c9acd7684 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -22,6 +22,7 @@ #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index 4c101038c01..ca300a6b4d1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -21,6 +21,7 @@ #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index fba760d37e1..df8e1ecc80f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -29,6 +29,7 @@ #include "PassiveAI.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "ScriptMgr.h" #include "SpellAuraEffects.h" #include "SpellHistory.h" #include "SpellMgr.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 0cdc652e9a0..91e5208be6c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -23,6 +23,7 @@ #include "Player.h" #include "QuestPools.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellInfo.h" #include "SpellScript.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index bffb633fc2d..4a41097adb5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -24,6 +24,7 @@ #include "Player.h" #include "PointMovementGenerator.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellScript.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index e472906fc73..b9f7575406e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -24,6 +24,7 @@ #include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellAuraEffects.h" #include "SpellMgr.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index e0eb0568676..84ddfab0c68 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -21,6 +21,7 @@ #include "Map.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellScript.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 26c9ae28acb..09d25e1884d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1542,8 +1542,8 @@ void AddSC_boss_sindragosa() RegisterSpellScript(spell_rimefang_icy_blast); RegisterSpellScript(spell_frostwarden_handler_order_whelp); RegisterSpellAndAuraScriptPair(spell_frostwarden_handler_focus_fire, spell_frostwarden_handler_focus_fire_aura); - new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb", SPELL_ICE_TOMB_DUMMY, TRIGGERED_IGNORE_SET_FACING); - new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb_dummy", SPELL_FROST_BEACON); + RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_sindragosa_ice_tomb", SPELL_ICE_TOMB_DUMMY, TRIGGERED_IGNORE_SET_FACING); + RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_sindragosa_ice_tomb_dummy", SPELL_FROST_BEACON); RegisterSpellScript(spell_sindragosa_ice_tomb_target); // AreaTriggers diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sister_svalna.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sister_svalna.cpp index c0f8767db0f..1fc2b5a4cf6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sister_svalna.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sister_svalna.cpp @@ -17,11 +17,12 @@ #include "icecrown_citadel.h" #include "CellImpl.h" -#include "InstanceScript.h" #include "GridNotifiersImpl.h" +#include "InstanceScript.h" #include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedEscortAI.h" +#include "ScriptMgr.h" #include "SpellScript.h" #include "VehicleDefines.h" @@ -1489,7 +1490,7 @@ void AddSC_boss_sister_svalna() RegisterIcecrownCitadelCreatureAI(npc_captain_rupert); RegisterIcecrownCitadelCreatureAI(npc_frostwing_ymirjar_vrykul); RegisterIcecrownCitadelCreatureAI(npc_impaling_spear); - new spell_trigger_spell_from_caster("spell_svalna_caress_of_death", SPELL_IMPALING_SPEAR_KILL); + RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_svalna_caress_of_death", SPELL_IMPALING_SPEAR_KILL); RegisterSpellScript(spell_svalna_revive_champion); RegisterSpellScript(spell_svalna_remove_spear); new at_icc_start_frostwing_gauntlet(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 566444dcb43..3f47a48ed46 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -23,6 +23,7 @@ #include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellAuraEffects.h" #include "SpellScript.h" @@ -2849,7 +2850,7 @@ void AddSC_boss_the_lich_king() RegisterSpellScript(spell_the_lich_king_trigger_vile_spirit); RegisterSpellScript(spell_the_lich_king_jump); RegisterSpellScript(spell_the_lich_king_jump_remove_aura); - new spell_trigger_spell_from_caster("spell_the_lich_king_mass_resurrection", SPELL_MASS_RESURRECTION_REAL); + RegisterSpellScriptWithArgs(spell_trigger_spell_from_caster, "spell_the_lich_king_mass_resurrection", SPELL_MASS_RESURRECTION_REAL); RegisterSpellScript(spell_the_lich_king_harvest_souls_teleport); // Achievements diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 4dcd5bcd8d2..0d161f209cf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -23,6 +23,7 @@ #include "ObjectAccessor.h" #include "PhasingHandler.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellAuraEffects.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/go_icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/go_icecrown_citadel_teleport.cpp index fab08ce3181..024ce9c4fd8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/go_icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/go_icecrown_citadel_teleport.cpp @@ -22,6 +22,7 @@ #include "Map.h" #include "Player.h" #include "ScriptedGossip.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellInfo.h" #include "SpellMgr.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index c93bd66e007..7a6a18c809f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -24,6 +24,7 @@ #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "SpellScript.h" enum ICCTexts @@ -1459,47 +1460,24 @@ class spell_icc_soul_missile : public SpellScriptLoader } }; -class spell_trigger_spell_from_caster_SpellScript : public SpellScript +spell_trigger_spell_from_caster::spell_trigger_spell_from_caster(uint32 triggerId, TriggerCastFlags triggerFlags /*= TRIGGERED_FULL_MASK*/) + : SpellScript(), _triggerId(triggerId), _triggerFlags(triggerFlags) { - PrepareSpellScript(spell_trigger_spell_from_caster_SpellScript); - -public: - spell_trigger_spell_from_caster_SpellScript(uint32 triggerId, TriggerCastFlags triggerFlags) - : SpellScript(), _triggerId(triggerId), _triggerFlags(triggerFlags) { } - -private: - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ _triggerId }); - } - - void HandleTrigger() - { - GetCaster()->CastSpell(GetHitUnit(), _triggerId, _triggerFlags); - } - - void Register() override - { - AfterHit += SpellHitFn(spell_trigger_spell_from_caster_SpellScript::HandleTrigger); - } - - uint32 _triggerId; - TriggerCastFlags _triggerFlags; -}; +} -spell_trigger_spell_from_caster::spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId) - : SpellScriptLoader(scriptName), _triggerId(triggerId), _triggerFlags(TRIGGERED_FULL_MASK) +bool spell_trigger_spell_from_caster::Validate(SpellInfo const* /*spell*/) { + return ValidateSpellInfo({ _triggerId }); } -spell_trigger_spell_from_caster::spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId, TriggerCastFlags triggerFlags) - : SpellScriptLoader(scriptName), _triggerId(triggerId), _triggerFlags(triggerFlags) +void spell_trigger_spell_from_caster::HandleTrigger() { + GetCaster()->CastSpell(GetHitUnit(), _triggerId, _triggerFlags); } -SpellScript* spell_trigger_spell_from_caster::GetSpellScript() const +void spell_trigger_spell_from_caster::Register() { - return new spell_trigger_spell_from_caster_SpellScript(_triggerId, _triggerFlags); + AfterHit += SpellHitFn(spell_trigger_spell_from_caster::HandleTrigger); } class at_icc_saurfang_portal : public AreaTriggerScript diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 7e849b1e7c4..d63b9664bc1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -19,7 +19,8 @@ #define ICECROWN_CITADEL_H_ #include "CreatureAIImpl.h" -#include "ScriptMgr.h" +#include "SpellDefines.h" +#include "SpellScript.h" #define ICCScriptName "instance_icecrown_citadel" #define DataHeader "IC" @@ -549,16 +550,20 @@ extern Position const SpiritWardenSpawn; uint32 const WeeklyNPCs = 9; uint32 const MaxHeroicAttempts = 50; -class spell_trigger_spell_from_caster : public SpellScriptLoader +class spell_trigger_spell_from_caster : public SpellScript { - public: - spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId, TriggerCastFlags triggerFlags); - spell_trigger_spell_from_caster(char const* scriptName, uint32 triggerId); - SpellScript* GetSpellScript() const override; - - private: - uint32 _triggerId; - TriggerCastFlags _triggerFlags; + PrepareSpellScript(spell_trigger_spell_from_caster); + +public: + spell_trigger_spell_from_caster(uint32 triggerId, TriggerCastFlags triggerFlags = TRIGGERED_FULL_MASK); + +private: + bool Validate(SpellInfo const* spell) override; + void HandleTrigger(); + void Register() override; + + uint32 _triggerId; + TriggerCastFlags _triggerFlags; }; template <class AI, class T> diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 9d9e5c5e4cc..0dd7eaece13 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -24,6 +24,7 @@ #include "ObjectMgr.h" #include "Player.h" #include "QuestPools.h" +#include "ScriptMgr.h" #include "TemporarySummon.h" #include "Transport.h" #include "TransportMgr.h" |