diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-05-28 16:34:44 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-05-28 16:34:44 +0200 |
| commit | a0a158b5b851db7e2c16819ec89e913d914a3aba (patch) | |
| tree | e2170b14fe7bba2bf70c30500eb129c6eadc2c20 /src/server/scripts/Outland | |
| parent | d427fed13b49aec1722544b3ca72a0a41160bbe3 (diff) | |
Core/Scripts: Include cleanup
Diffstat (limited to 'src/server/scripts/Outland')
113 files changed, 568 insertions, 371 deletions
diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h index 18354890ba9..38aaf35ccf6 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/auchenai_crypts.h @@ -18,6 +18,8 @@ #ifndef AUCHENAI_CRYPTS_H_ #define AUCHENAI_CRYPTS_H_ +#include "CreatureAIImpl.h" + #define ACScriptName "instance_auchenai_crypts" #define DataHeader "AC" @@ -30,8 +32,8 @@ enum ACDataTypes DATA_EXARCH_MALADAAR = 1 }; -template<class AI> -AI* GetAuchenaiCryptsAI(Creature* creature) +template<typename AI> +inline AI* GetAuchenaiCryptsAI(Creature* creature) { return GetInstanceAI<AI>(creature, ACScriptName); } diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 93d5ce2f556..3d5d7c370dd 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -30,6 +30,8 @@ npc_avatar_of_martyred EndContentData */ #include "ScriptMgr.h" +#include "auchenai_crypts.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" enum Spells @@ -56,7 +58,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_stolen_soulAI(creature); + return GetAuchenaiCryptsAI<npc_stolen_soulAI>(creature); } struct npc_stolen_soulAI : public ScriptedAI @@ -163,7 +165,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_exarch_maladaarAI(creature); + return GetAuchenaiCryptsAI<boss_exarch_maladaarAI>(creature); } struct boss_exarch_maladaarAI : public ScriptedAI @@ -319,7 +321,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_avatar_of_martyredAI(creature); + return GetAuchenaiCryptsAI<npc_avatar_of_martyredAI>(creature); } struct npc_avatar_of_martyredAI : public ScriptedAI diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 9e4151c808b..93649481db7 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -24,8 +24,11 @@ Category: Auchindoun, Auchenai Crypts EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "auchenai_crypts.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp index 9655b20b551..4f88489923c 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/instance_auchenai_crypts.cpp @@ -16,8 +16,9 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" #include "auchenai_crypts.h" +#include "InstanceScript.h" +#include "Map.h" class instance_auchenai_crypts : public InstanceMapScript { diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index 7917d40b8f7..e93c0baba2a 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -23,8 +23,8 @@ SDCategory: Auchindoun, Mana Tombs EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "mana_tombs.h" +#include "ScriptedCreature.h" enum Yells { @@ -259,7 +259,7 @@ class npc_ethereal_beacon : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_ethereal_beaconAI(creature); + return GetManaTombsAI<npc_ethereal_beaconAI>(creature); } }; @@ -324,7 +324,7 @@ class npc_ethereal_apprentice : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_ethereal_apprenticeAI(creature); + return GetManaTombsAI<npc_ethereal_apprenticeAI>(creature); } }; @@ -380,7 +380,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_yorAI(creature); + return GetManaTombsAI<npc_yorAI>(creature); } }; diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp index 0b0dd616311..aa24fbc3e03 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp @@ -16,8 +16,8 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "mana_tombs.h" +#include "ScriptedCreature.h" enum Texts { diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp index 7f388b198ae..8ab7c798194 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/instance_mana_tombs.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "mana_tombs.h" +#include "Map.h" class instance_mana_tombs : public InstanceMapScript { diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h b/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h index 707eb89ef9b..5734498cbde 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/mana_tombs.h @@ -18,6 +18,8 @@ #ifndef MANA_TOMBS_H_ #define MANA_TOMBS_H_ +#include "CreatureAIImpl.h" + #define MTScriptName "instance_mana_tombs" #define DataHeader "MT" @@ -32,8 +34,8 @@ enum MTDataTypes DATA_YOR = 3 }; -template<class AI> -AI* GetManaTombsAI(Creature* creature) +template<typename AI> +inline AI* GetManaTombsAI(Creature* creature) { return GetInstanceAI<AI>(creature, MTScriptName); } diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp index f0bc7a3b537..91a4efc3c62 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp @@ -257,7 +257,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_syth_fireAI(creature); + return GetSethekkHallsAI<npc_syth_fireAI>(creature); } }; @@ -316,7 +316,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_syth_arcaneAI(creature); + return GetSethekkHallsAI<npc_syth_arcaneAI>(creature); } }; @@ -375,7 +375,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_syth_frostAI(creature); + return GetSethekkHallsAI<npc_syth_frostAI>(creature); } }; @@ -434,7 +434,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_syth_shadowAI(creature); + return GetSethekkHallsAI<npc_syth_shadowAI>(creature); } }; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp index 369bce2457e..e51fefab2bb 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp @@ -17,8 +17,8 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#include "SpellScript.h" #include "sethekk_halls.h" +#include "SpellScript.h" enum Says { @@ -173,9 +173,7 @@ class spell_talon_king_ikiss_blink : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_BLINK_TELEPORT)) - return false; - return true; + return ValidateSpellInfo({ SPELL_BLINK_TELEPORT }); } void FilterTargets(std::list<WorldObject*>& targets) diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp index 31f874dcb61..b0d6eaab86b 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -16,7 +16,10 @@ */ #include "ScriptMgr.h" +#include "Creature.h" +#include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" #include "sethekk_halls.h" DoorData const doorData[] = diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h index 3471b23daa2..266c8025701 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h @@ -18,6 +18,8 @@ #ifndef SETHEKK_HALLS_H_ #define SETHEKK_HALLS_H_ +#include "CreatureAIImpl.h" + #define SHScriptName "instance_sethekk_halls" #define DataHeader "SH" @@ -46,8 +48,8 @@ enum SHGameObjectIds GO_TALON_KING_COFFER = 187372 }; -template<class AI> -AI* GetSethekkHallsAI(Creature* creature) +template<typename AI> +inline AI* GetSethekkHallsAI(Creature* creature) { return GetInstanceAI<AI>(creature, SHScriptName); } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index 976f95cfd90..43d90a1c70a 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -24,7 +24,7 @@ SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "ScriptedEscortAI.h" #include "shadow_labyrinth.h" diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index fa3978840c9..f0a47bd8604 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -24,6 +24,7 @@ Category: Auchindoun, Shadow Labyrinth */ #include "ScriptMgr.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "shadow_labyrinth.h" diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 0d59d301a5a..6f2563eb82e 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -23,9 +23,13 @@ Category: Auchindoun, Shadow Labyrinth */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Map.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" #include "shadow_labyrinth.h" -#include "Player.h" +#include "TemporarySummon.h" enum GrandmasterVorpil { diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index ac9ef77cd82..73fb65992d3 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -24,9 +24,10 @@ SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ #include "ScriptMgr.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" -#include "SpellScript.h" #include "shadow_labyrinth.h" +#include "SpellScript.h" enum Murmur { @@ -188,9 +189,7 @@ class spell_murmur_sonic_boom : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SONIC_BOOM_EFFECT)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SONIC_BOOM_EFFECT }); } void HandleEffect(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 0e75d609195..c5ddb8e6b50 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -16,8 +16,11 @@ */ #include "ScriptMgr.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" #include "InstanceScript.h" -#include "ScriptedCreature.h" +#include "Map.h" #include "shadow_labyrinth.h" DoorData const doorData[] = diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp index 168a92640ed..8ec7dce4c15 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp @@ -16,9 +16,8 @@ */ #include "ScriptMgr.h" -#include "SpellMgr.h" #include "SpellScript.h" -#include "SpellAuraEffects.h" +#include "Unit.h" enum Spells { @@ -36,16 +35,14 @@ class spell_mark_of_malice : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_MALICE_TRIGGERED)) - return false; - return true; + return ValidateSpellInfo({ SPELL_MARK_OF_MALICE_TRIGGERED }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); // just drop charges - if (aurEff->GetBase()->GetCharges() > 1) + if (GetCharges() > 1) return; GetTarget()->CastSpell(GetTarget(), SPELL_MARK_OF_MALICE_TRIGGERED, true); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h index 0558c5e3fa3..6ac8ee4f2bd 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h @@ -18,6 +18,8 @@ #ifndef SHADOW_LABYRINTH_H_ #define SHADOW_LABYRINTH_H_ +#include "CreatureAIImpl.h" + #define SLScriptName "instance_shadow_labyrinth" #define DataHeader "SL" @@ -54,8 +56,8 @@ enum SLMisc ACTION_AMBASSADOR_HELLMAW_BANISH = 2, }; -template<class AI> -AI* GetShadowLabyrinthAI(Creature* creature) +template<typename AI> +inline AI* GetShadowLabyrinthAI(Creature* creature) { return GetInstanceAI<AI>(creature, SLScriptName); } diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index df11cb2aadc..0c33325b4e5 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -16,8 +16,9 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum Spells { diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h index e5d76475e03..48987283711 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.h +++ b/src/server/scripts/Outland/BlackTemple/black_temple.h @@ -18,7 +18,7 @@ #ifndef BLACK_TEMPLE_H_ #define BLACK_TEMPLE_H_ -#include "InstanceScript.h" +#include "CreatureAIImpl.h" #define BTScriptName "instance_black_temple" #define DataHeader "BT" @@ -91,8 +91,8 @@ enum BTGameObjectIds GO_ILLIDAN_DOOR_L = 186262 }; -template<class AI> -AI* GetBlackTempleAI(Creature* creature) +template<typename AI> +inline AI* GetBlackTempleAI(Creature* creature) { return GetInstanceAI<AI>(creature, BTScriptName); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp index 89d6d73a808..ee422c5acd1 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp @@ -23,9 +23,10 @@ Category: Black Temple EndScriptData */ #include "ScriptMgr.h" +#include "black_temple.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" -#include "black_temple.h" enum Bloodboil { @@ -61,7 +62,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_gurtogg_bloodboilAI>(creature); + return GetBlackTempleAI<boss_gurtogg_bloodboilAI>(creature); } struct boss_gurtogg_bloodboilAI : public BossAI diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 03a73e0a1cf..25905514ad7 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -25,12 +25,15 @@ EndScriptData */ #include "ScriptMgr.h" #include "black_temple.h" +#include "GameObject.h" +#include "InstanceScript.h" #include "Log.h" +#include "ObjectAccessor.h" #include "PassiveAI.h" -#include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "SpellInfo.h" +#include "TemporarySummon.h" // Other defines #define CENTER_X 676.740f @@ -464,7 +467,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new flame_of_azzinothAI(creature); + return GetBlackTempleAI<flame_of_azzinothAI>(creature); } }; @@ -1141,7 +1144,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_illidan_stormrageAI>(creature); + return GetBlackTempleAI<boss_illidan_stormrageAI>(creature); } }; @@ -1372,7 +1375,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_maievAI(creature); + return GetBlackTempleAI<boss_maievAI>(creature); } }; @@ -1805,7 +1808,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_akama_illidanAI>(creature); + return GetBlackTempleAI<npc_akama_illidanAI>(creature); } }; @@ -2048,7 +2051,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new cage_trap_triggerAI(creature); + return GetBlackTempleAI<cage_trap_triggerAI>(creature); } }; @@ -2059,9 +2062,6 @@ public: bool OnGossipHello(Player* player, GameObject* go) override { - float x, y, z; - player->GetPosition(x, y, z); - // Grid search for nearest live Creature of entry 23304 within 10 yards if (Creature* pTrigger = go->FindNearestCreature(23304, 10.0f)) ENSURE_AI(npc_cage_trap_trigger::cage_trap_triggerAI, pTrigger->AI())->Active = true; @@ -2122,7 +2122,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new shadow_demonAI(creature); + return GetBlackTempleAI<shadow_demonAI>(creature); } }; @@ -2144,7 +2144,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new blade_of_azzinothAI(creature); + return GetBlackTempleAI<blade_of_azzinothAI>(creature); } }; @@ -2234,7 +2234,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_parasitic_shadowfiendAI>(creature); + return GetBlackTempleAI<npc_parasitic_shadowfiendAI>(creature); } }; diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index a183b03d650..665eda75aed 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -23,8 +23,9 @@ SDCategory: Black Temple EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum Texts { diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 461c4c0f66e..76d57cf2e16 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -87,7 +87,7 @@ enum ReliquaryOfSouls NUMBER_ENSLAVED_SOUL = 8 }; -G3D::Vector2 const Coords[]= +Position const Coords[]= { {450.4f, 212.3f}, {542.1f, 212.3f}, @@ -104,7 +104,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_enslaved_soulAI(creature); + return GetBlackTempleAI<npc_enslaved_soulAI>(creature); } struct npc_enslaved_soulAI : public ScriptedAI @@ -135,7 +135,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_reliquary_of_soulsAI>(creature); + return GetBlackTempleAI<boss_reliquary_of_soulsAI>(creature); } struct boss_reliquary_of_soulsAI : public BossAI @@ -211,11 +211,8 @@ public: bool SummonSoul() { - uint32 random = rand32() % 6; - float x = Coords[random].x; - float y = Coords[random].y; - - Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); + Position const& pos = Trinity::Containers::SelectRandomContainerElement(Coords); + Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Soul) return false; @@ -390,7 +387,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_essence_of_sufferingAI(creature); + return GetBlackTempleAI<boss_essence_of_sufferingAI>(creature); } struct boss_essence_of_sufferingAI : public ScriptedAI @@ -517,7 +514,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_essence_of_desireAI(creature); + return GetBlackTempleAI<boss_essence_of_desireAI>(creature); } struct boss_essence_of_desireAI : public ScriptedAI @@ -628,7 +625,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_essence_of_angerAI(creature); + return GetBlackTempleAI<boss_essence_of_angerAI>(creature); } struct boss_essence_of_angerAI : public ScriptedAI diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index e2fee8d3b73..d4978d249ec 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -15,15 +15,19 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ObjectMgr.h" #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "black_temple.h" +#include "InstanceScript.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "PassiveAI.h" +#include "Player.h" +#include "ScriptedCreature.h" #include "ScriptedGossip.h" -#include "GridNotifiers.h" -#include "black_temple.h" -#include "SpellScript.h" #include "SpellAuraEffects.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "TemporarySummon.h" enum Says { @@ -351,7 +355,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_shade_of_akamaAI>(creature); + return GetBlackTempleAI<boss_shade_of_akamaAI>(creature); } }; @@ -567,7 +571,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_akamaAI>(creature); + return GetBlackTempleAI<npc_akamaAI>(creature); } }; @@ -613,7 +617,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_channelerAI>(creature); + return GetBlackTempleAI<npc_ashtongue_channelerAI>(creature); } }; @@ -711,7 +715,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_creature_generator_akamaAI>(creature); + return GetBlackTempleAI<npc_creature_generator_akamaAI>(creature); } }; @@ -819,7 +823,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_sorcererAI>(creature); + return GetBlackTempleAI<npc_ashtongue_sorcererAI>(creature); } }; @@ -897,7 +901,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_defenderAI>(creature); + return GetBlackTempleAI<npc_ashtongue_defenderAI>(creature); } }; @@ -966,7 +970,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_rogueAI>(creature); + return GetBlackTempleAI<npc_ashtongue_rogueAI>(creature); } }; @@ -1035,7 +1039,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_elementalistAI>(creature); + return GetBlackTempleAI<npc_ashtongue_elementalistAI>(creature); } }; @@ -1136,7 +1140,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_spiritbinderAI>(creature); + return GetBlackTempleAI<npc_ashtongue_spiritbinderAI>(creature); } }; @@ -1187,7 +1191,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ashtongue_brokenAI>(creature); + return GetBlackTempleAI<npc_ashtongue_brokenAI>(creature); } }; @@ -1202,9 +1206,7 @@ public: bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SHADE_SOUL_CHANNEL_2)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SHADE_SOUL_CHANNEL_2 }); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 32449016b28..425d63c0287 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -16,9 +16,10 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "PassiveAI.h" #include "black_temple.h" +#include "ObjectAccessor.h" +#include "PassiveAI.h" +#include "ScriptedCreature.h" enum Texts { @@ -65,7 +66,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new molten_flameAI(creature); + return GetBlackTempleAI<molten_flameAI>(creature); } struct molten_flameAI : public NullCreatureAI @@ -264,7 +265,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_volcanoAI(creature); + return GetBlackTempleAI<npc_volcanoAI>(creature); } }; diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 2a1b9e49ff2..d8cd53916ae 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -24,8 +24,11 @@ SDCategory: Black Temple EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" +#include "TemporarySummon.h" enum DoomBlossom { @@ -58,7 +61,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_doom_blossomAI(creature); + return GetBlackTempleAI<npc_doom_blossomAI>(creature); } struct npc_doom_blossomAI : public ScriptedAI @@ -135,7 +138,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_shadowy_constructAI(creature); + return GetBlackTempleAI<npc_shadowy_constructAI>(creature); } struct npc_shadowy_constructAI : public ScriptedAI @@ -233,7 +236,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_teron_gorefiendAI>(creature); + return GetBlackTempleAI<boss_teron_gorefiendAI>(creature); } struct boss_teron_gorefiendAI : public BossAI @@ -449,7 +452,7 @@ public: float X = CalculateRandomLocation(target->GetPositionX(), 20); float Y = CalculateRandomLocation(target->GetPositionY(), 20); float Z = target->GetPositionZ(); - Z = me->GetMap()->GetHeight(me->GetPhases(), X, Y, Z); + me->UpdateGroundPositionZ(X, Y, Z); Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); if (DoomBlossom) { diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index af64f991b24..585a19a05ea 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -16,9 +16,12 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedCreature.h" #include "SpellInfo.h" enum Texts @@ -150,7 +153,7 @@ public: DoCast(target, SPELL_IMPALING_SPINE, true); SpineTargetGUID = target->GetGUID(); //must let target summon, otherwise you cannot click the spine - target->SummonGameObject(GO_NAJENTUS_SPINE, *target, G3D::Quat(), 30); + target->SummonGameObject(GO_NAJENTUS_SPINE, *target, QuaternionData(), 30); Talk(SAY_NEEDLE); events.DelayEvents(1500, GCD_CAST); events.DelayEvents(15000, GCD_YELL); diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index 500ea991238..b3685b3af0a 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -24,10 +24,11 @@ SDCategory: Black Temple EndScriptData */ #include "ScriptMgr.h" +#include "black_temple.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" -#include "SpellAuraEffects.h" -#include "black_temple.h" enum IllidariCouncil { @@ -120,7 +121,7 @@ public: CreatureAI* GetAI(Creature* c) const override { - return new npc_blood_elf_council_voice_triggerAI(c); + return GetBlackTempleAI<npc_blood_elf_council_voice_triggerAI>(c); } struct npc_blood_elf_council_voice_triggerAI : public ScriptedAI @@ -220,7 +221,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_illidari_councilAI>(creature); + return GetBlackTempleAI<npc_illidari_councilAI>(creature); } struct npc_illidari_councilAI : public ScriptedAI @@ -456,7 +457,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_gathios_the_shattererAI>(creature); + return GetBlackTempleAI<boss_gathios_the_shattererAI>(creature); } struct boss_gathios_the_shattererAI : public boss_illidari_councilAI @@ -596,7 +597,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_high_nethermancer_zerevorAI>(creature); + return GetBlackTempleAI<boss_high_nethermancer_zerevorAI>(creature); } struct boss_high_nethermancer_zerevorAI : public boss_illidari_councilAI @@ -708,7 +709,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_lady_malandeAI>(creature); + return GetBlackTempleAI<boss_lady_malandeAI>(creature); } struct boss_lady_malandeAI : public boss_illidari_councilAI @@ -794,7 +795,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_veras_darkshadowAI>(creature); + return GetBlackTempleAI<boss_veras_darkshadowAI>(creature); } struct boss_veras_darkshadowAI : public boss_illidari_councilAI @@ -912,7 +913,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - return sSpellMgr->GetSpellInfo(SPELL_REFLECTIVE_SHIELD_T) != nullptr; + return ValidateSpellInfo({ SPELL_REFLECTIVE_SHIELD_T }); } void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index 1db95c31478..2e734702b7d 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -16,8 +16,12 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" +#include "AreaBoundary.h" #include "black_temple.h" +#include "Creature.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" DoorData const doorData[] = { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 6ed5abef4c2..8d31ebe63e5 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -24,9 +24,11 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "serpent_shrine.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedEscortAI.h" +#include "serpent_shrine.h" +#include "TemporarySummon.h" enum FathomlordKarathress { @@ -104,7 +106,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_fathomlord_karathressAI>(creature); + return GetSerpentshrineCavernAI<boss_fathomlord_karathressAI>(creature); } struct boss_fathomlord_karathressAI : public ScriptedAI @@ -308,7 +310,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_fathomguard_sharkkisAI>(creature); + return GetSerpentshrineCavernAI<boss_fathomguard_sharkkisAI>(creature); } struct boss_fathomguard_sharkkisAI : public ScriptedAI @@ -452,7 +454,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_fathomguard_tidalvessAI>(creature); + return GetSerpentshrineCavernAI<boss_fathomguard_tidalvessAI>(creature); } struct boss_fathomguard_tidalvessAI : public ScriptedAI @@ -574,7 +576,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_fathomguard_caribdisAI>(creature); + return GetSerpentshrineCavernAI<boss_fathomguard_caribdisAI>(creature); } struct boss_fathomguard_caribdisAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index 0bce78607d3..341ef499e8f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -24,8 +24,11 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" +#include "TemporarySummon.h" enum HydrossTheUnstable { @@ -86,7 +89,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_hydross_the_unstableAI>(creature); + return GetSerpentshrineCavernAI<boss_hydross_the_unstableAI>(creature); } struct boss_hydross_the_unstableAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 06bf51ce115..7cb504351cf 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -24,11 +24,15 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" -#include "serpent_shrine.h" #include "Spell.h" -#include "Player.h" -#include "WorldSession.h" +#include "serpent_shrine.h" +#include "TemporarySummon.h" enum LadyVashj { @@ -70,11 +74,6 @@ enum LadyVashj #define SPOREBAT_Z 77.176567f #define SPOREBAT_O 5.223932f - - -#define TEXT_NOT_INITIALIZED "Instance script not initialized" -#define TEXT_ALREADY_DEACTIVATED "Already deactivated" - float ElementPos[8][4] = { {8.3f, -835.3f, 21.9f, 5.0f}, @@ -140,7 +139,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_lady_vashjAI>(creature); + return GetSerpentshrineCavernAI<boss_lady_vashjAI>(creature); } struct boss_lady_vashjAI : public ScriptedAI @@ -555,7 +554,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_enchanted_elementalAI>(creature); + return GetSerpentshrineCavernAI<npc_enchanted_elementalAI>(creature); } struct npc_enchanted_elementalAI : public ScriptedAI @@ -650,7 +649,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_tainted_elementalAI>(creature); + return GetSerpentshrineCavernAI<npc_tainted_elementalAI>(creature); } struct npc_tainted_elementalAI : public ScriptedAI @@ -724,7 +723,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_toxic_sporebatAI>(creature); + return GetSerpentshrineCavernAI<npc_toxic_sporebatAI>(creature); } struct npc_toxic_sporebatAI : public ScriptedAI @@ -826,7 +825,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_shield_generator_channelAI>(creature); + return GetSerpentshrineCavernAI<npc_shield_generator_channelAI>(creature); } struct npc_shield_generator_channelAI : public ScriptedAI @@ -889,10 +888,7 @@ public: { InstanceScript* instance = player->GetInstanceScript(); if (!instance) - { - player->GetSession()->SendNotification(TEXT_NOT_INITIALIZED); return true; - } Creature* vashj = ObjectAccessor::GetCreature((*player), instance->GetGuidData(DATA_LADYVASHJ)); if (vashj && (ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->Phase == 2)) @@ -924,10 +920,7 @@ public: } if (instance->GetData(identifier)) - { - player->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED); return true; - } // get and remove channel if (Unit* channel = ObjectAccessor::GetCreature(*vashj, ENSURE_AI(boss_lady_vashj::boss_lady_vashjAI, vashj->AI())->ShieldGeneratorChannel[channelIdentifier])) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 357756414db..d82bd4e38d1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -24,9 +24,13 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Map.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" -#include "Player.h" +#include "TemporarySummon.h" enum LeotherasTheBlind { @@ -76,7 +80,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_inner_demonAI(creature); + return GetSerpentshrineCavernAI<npc_inner_demonAI>(creature); } struct npc_inner_demonAI : public ScriptedAI @@ -186,7 +190,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_leotheras_the_blindAI>(creature); + return GetSerpentshrineCavernAI<boss_leotheras_the_blindAI>(creature); } struct boss_leotheras_the_blindAI : public ScriptedAI @@ -607,7 +611,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_leotheras_the_blind_demonformAI(creature); + return GetSerpentshrineCavernAI<boss_leotheras_the_blind_demonformAI>(creature); } struct boss_leotheras_the_blind_demonformAI : public ScriptedAI @@ -688,7 +692,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_greyheart_spellbinderAI>(creature); + return GetSerpentshrineCavernAI<npc_greyheart_spellbinderAI>(creature); } struct npc_greyheart_spellbinderAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 0d766785627..e2fd8409805 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -24,10 +24,13 @@ SDCategory: The Lurker Below EndScriptData */ #include "ScriptMgr.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" +#include "Player.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" -#include "Spell.h" -#include "Player.h" +#include "TemporarySummon.h" enum Spells { @@ -83,7 +86,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_the_lurker_belowAI>(creature); + return GetSerpentshrineCavernAI<boss_the_lurker_belowAI>(creature); } struct boss_the_lurker_belowAI : public ScriptedAI @@ -370,7 +373,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_coilfang_ambusherAI(creature); + return GetSerpentshrineCavernAI<npc_coilfang_ambusherAI>(creature); } struct npc_coilfang_ambusherAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index 1d932a0f94a..142b0a5d65f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -24,8 +24,11 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Map.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" +#include "TemporarySummon.h" enum Yells { @@ -91,7 +94,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_morogrim_tidewalkerAI>(creature); + return GetSerpentshrineCavernAI<boss_morogrim_tidewalkerAI>(creature); } struct boss_morogrim_tidewalkerAI : public ScriptedAI @@ -296,7 +299,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_water_globuleAI(creature); + return GetSerpentshrineCavernAI<npc_water_globuleAI>(creature); } struct npc_water_globuleAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 0030b0ddbdd..71423926de0 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -24,8 +24,10 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "GameObject.h" #include "InstanceScript.h" #include "Log.h" +#include "Map.h" #include "Player.h" #include "serpent_shrine.h" #include "TemporarySummon.h" @@ -82,7 +84,7 @@ class go_bridge_console : public GameObjectScript class instance_serpent_shrine : public InstanceMapScript { public: - instance_serpent_shrine() : InstanceMapScript("instance_serpent_shrine", 548) { } + instance_serpent_shrine() : InstanceMapScript(SSCScriptName, 548) { } struct instance_serpentshrine_cavern_InstanceMapScript : public InstanceScript { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h index 2a37df0ef0f..5b2f5c02ff4 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h @@ -19,6 +19,9 @@ #ifndef DEF_SERPENT_SHRINE_H #define DEF_SERPENT_SHRINE_H +#include "CreatureAIImpl.h" + +#define SSCScriptName "instance_serpent_shrine" #define DataHeader "SS" enum SSWaterEventState @@ -57,5 +60,10 @@ enum SSDataTypes DATA_TRASH = 25, }; -#endif +template<typename AI> +inline AI* GetSerpentshrineCavernAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, SSCScriptName); +} +#endif diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index f7e9dff38bf..90d3800b965 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -114,7 +114,7 @@ class boss_hydromancer_thespia : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_thespiaAI>(creature); + return GetSteamVaultAI<boss_thespiaAI>(creature); } }; @@ -175,7 +175,7 @@ class npc_coilfang_waterelemental : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_coilfang_waterelementalAI(creature); + return GetSteamVaultAI<npc_coilfang_waterelementalAI>(creature); } }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index bd13ab09a67..f0bbe51c31d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -23,6 +23,8 @@ SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "steam_vault.h" @@ -57,7 +59,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_mekgineer_steamriggerAI>(creature); + return GetSteamVaultAI<boss_mekgineer_steamriggerAI>(creature); } struct boss_mekgineer_steamriggerAI : public ScriptedAI @@ -200,7 +202,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_steamrigger_mechanicAI>(creature); + return GetSteamVaultAI<npc_steamrigger_mechanicAI>(creature); } struct npc_steamrigger_mechanicAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index e0aaf89e25d..8071e8f25b6 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -23,9 +23,10 @@ SDCategory: Coilfang Resevoir, The Steamvault EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" #include "ScriptedCreature.h" -#include "steam_vault.h" #include "SpellInfo.h" +#include "steam_vault.h" enum NagaDistiller { @@ -50,7 +51,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_naga_distillerAI>(creature); + return GetSteamVaultAI<npc_naga_distillerAI>(creature); } struct npc_naga_distillerAI : public ScriptedAI @@ -103,7 +104,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_warlord_kalithreshAI>(creature); + return GetSteamVaultAI<boss_warlord_kalithreshAI>(creature); } struct boss_warlord_kalithreshAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index b4b7d0f5fce..7c655082ba9 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -16,8 +16,11 @@ */ #include "ScriptMgr.h" +#include "Creature.h" +#include "GameObject.h" #include "InstanceScript.h" #include "Log.h" +#include "Map.h" #include "steam_vault.h" class go_main_chambers_access_panel : public GameObjectScript diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h index 30f9f34a5da..d5eaf7d5396 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h @@ -18,6 +18,8 @@ #ifndef DEF_STEAM_VAULT_H #define DEF_STEAM_VAULT_H +#include "CreatureAIImpl.h" + #define SteamVaultScriptName "instance_steam_vault" #define DataHeader "SV" @@ -49,8 +51,8 @@ enum SVGameObjectIds GO_ACCESS_PANEL_MEK = 184126 }; -template<class AI> -AI* GetSteamVaultAI(Creature* creature) +template<typename AI> +inline AI* GetSteamVaultAI(Creature* creature) { return GetInstanceAI<AI>(creature, SteamVaultScriptName); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp index d2571e9d1d5..db5acbaa61b 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp @@ -15,13 +15,21 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "ScriptMgr.h" #include "CreatureTextMgr.h" +#include "GameObject.h" +#include "Group.h" +#include "InstanceScript.h" #include "LFGMgr.h" +#include "Map.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedGossip.h" #include "ScriptedCreature.h" -#include "ScriptMgr.h" #include "SpellAuraEffects.h" +#include "SpellInfo.h" #include "SpellScript.h" +#include "TemporarySummon.h" #include "the_slave_pens.h" enum Spells @@ -279,7 +287,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_ahuneAI>(creature); + return GetSlavePensAI<boss_ahuneAI>(creature); } }; @@ -357,7 +365,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_frozen_coreAI>(creature); + return GetSlavePensAI<npc_frozen_coreAI>(creature); } }; @@ -395,7 +403,7 @@ public: _summons.DespawnAll(); ResetFlameCallers(); - me->SummonGameObject(GO_ICE_STONE, -69.90455f, -162.2449f, -2.366563f, 2.426008f, G3D::Quat(0.0f, 0.0f, 0.9366722f, 0.3502074f), 0); + me->SummonGameObject(GO_ICE_STONE, -69.90455f, -162.2449f, -2.366563f, 2.426008f, QuaternionData(0.0f, 0.0f, 0.9366722f, 0.3502074f), 0); } void DoAction(int32 action) override @@ -509,7 +517,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ahune_bunnyAI>(creature); + return GetSlavePensAI<npc_ahune_bunnyAI>(creature); } }; @@ -637,7 +645,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_earthen_ring_flamecallerAI>(creature); + return GetSlavePensAI<npc_earthen_ring_flamecallerAI>(creature); } }; @@ -680,9 +688,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SYNCH_HEALTH)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SYNCH_HEALTH }); } void HandleScript(SpellEffIndex /*effIndex*/) @@ -716,9 +722,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_WHISP_FLIGHT) || !sSpellMgr->GetSpellInfo(SPELL_SUMMONING_RHYME_BONFIRE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_FORCE_WHISP_FLIGHT, SPELL_SUMMONING_RHYME_BONFIRE }); } void PeriodicTick(AuraEffect const* aurEff) @@ -771,9 +775,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ICE_SPEAR_GO) || !sSpellMgr->GetSpellInfo(SPELL_ICE_SPEAR_KNOCKBACK)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SUMMON_ICE_SPEAR_GO, SPELL_ICE_SPEAR_KNOCKBACK }); } void PeriodicTick(AuraEffect const* aurEff) @@ -824,9 +826,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_ICE_SPEAR_TARGET_PICKER)) - return false; - return true; + return ValidateSpellInfo({ SPELL_ICE_SPEAR_TARGET_PICKER }); } void PeriodicTick(AuraEffect const* /*aurEff*/) @@ -859,9 +859,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ICE_SPEAR_BUNNY)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SUMMON_ICE_SPEAR_BUNNY }); } void FilterTargets(std::list<WorldObject*>& targets) @@ -904,9 +902,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SLIPPERY_FLOOR_SLIP)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SLIPPERY_FLOOR_SLIP }); } void HandleScriptEffect(SpellEffIndex /*effIndex*/) @@ -943,9 +939,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_COLD_SLAP)) - return false; - return true; + return ValidateSpellInfo({ SPELL_COLD_SLAP }); } void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) @@ -1005,9 +999,7 @@ public: bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BOMBARDMENT)) - return false; - return true; + return ValidateSpellInfo({ SPELL_ICE_BOMBARDMENT }); } void HandleScriptEffect(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp index 7a9fa30b631..0c93b0b1631 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp @@ -134,7 +134,7 @@ class boss_mennu_the_betrayer : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_mennu_the_betrayerAI(creature); + return GetSlavePensAI<boss_mennu_the_betrayerAI>(creature); } }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp index 36400166f09..6d46ef4ac07 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp @@ -117,7 +117,7 @@ class boss_quagmirran : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_quagmirranAI(creature); + return GetSlavePensAI<boss_quagmirranAI>(creature); } }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp index cab61b0f7e9..71e51df4c1c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp @@ -128,7 +128,7 @@ class boss_rokmar_the_crackler : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_rokmar_the_cracklerAI(creature); + return GetSlavePensAI<boss_rokmar_the_cracklerAI>(creature); } }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp index 77b438a11c2..b6b17268c14 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp @@ -15,15 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* -This placeholder for the instance is needed for dungeon finding to be able -to give credit after the boss defined in lastEncounterDungeon is killed. -Without it, the party doing random dungeon won't get satchel of spoils and -gets instead the deserter debuff. -*/ - #include "ScriptMgr.h" +#include "Creature.h" #include "InstanceScript.h" +#include "Map.h" #include "the_slave_pens.h" class instance_the_slave_pens : public InstanceMapScript diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h index 9b22d61f4e7..6eff6cd66fc 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h @@ -18,6 +18,8 @@ #ifndef SLAVE_PENS_H #define SLAVE_PENS_H +#include "CreatureAIImpl.h" + uint32 const EncounterCount = 3; #define SPScriptName "instance_the_slave_pens" @@ -66,4 +68,10 @@ enum SPGameObjectIds GO_ICE_STONE = 187882 }; +template<typename AI> +inline AI* GetSlavePensAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, SPScriptName); +} + #endif // SLAVE_PENS_H diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp index ca8c64194ab..3ca97269d19 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "the_underbog.h" enum Spells { @@ -43,7 +44,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_hungarfenAI(creature); + return GetTheUnderbogAI<boss_hungarfenAI>(creature); } struct boss_hungarfenAI : public ScriptedAI @@ -117,7 +118,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_underbog_mushroomAI(creature); + return GetTheUnderbogAI<npc_underbog_mushroomAI>(creature); } struct npc_underbog_mushroomAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp index 8ec440d6378..77eeca42595 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp @@ -24,7 +24,9 @@ SDCategory: Coilfang Resevoir, Underbog EndScriptData */ #include "ScriptMgr.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "the_underbog.h" enum Spells { @@ -49,7 +51,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_the_black_stalkerAI(creature); + return GetTheUnderbogAI<boss_the_black_stalkerAI>(creature); } struct boss_the_black_stalkerAI : public ScriptedAI diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp index 7da087cc0b1..6168f57e3f2 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp @@ -24,11 +24,13 @@ gets instead the deserter debuff. #include "ScriptMgr.h" #include "InstanceScript.h" +#include "Map.h" +#include "the_underbog.h" class instance_the_underbog : public InstanceMapScript { public: - instance_the_underbog() : InstanceMapScript("instance_the_underbog", 546) { } + instance_the_underbog() : InstanceMapScript(TheUndebogScriptName, 546) { } InstanceScript* GetInstanceScript(InstanceMap* map) const override { diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h new file mode 100644 index 00000000000..a36a1c61fc0 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef the_underbog_h__ +#define the_underbog_h__ + +#include "CreatureAIImpl.h" + +#define TheUndebogScriptName "instance_the_underbog" + +template<typename AI> +inline AI* GetTheUnderbogAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, TheUndebogScriptName); +} + +#endif // the_underbog_h__ diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index e3e2d731764..b7dc8b81bb9 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -24,11 +24,10 @@ SDCategory: Gruul's Lair EndScriptData */ #include "ScriptMgr.h" +#include "gruuls_lair.h" #include "ScriptedCreature.h" #include "SpellInfo.h" -#include "SpellMgr.h" #include "SpellScript.h" -#include "gruuls_lair.h" enum Yells { @@ -277,11 +276,7 @@ class spell_gruul_shatter : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_STONED)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SHATTER_EFFECT)) - return false; - return true; + return ValidateSpellInfo({ SPELL_STONED, SPELL_SHATTER_EFFECT }); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index fdbff278653..055fc4d6e30 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -24,8 +24,10 @@ SDCategory: Gruul's Lair EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "gruuls_lair.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum HighKingMaulgar { diff --git a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h index dd9017d780d..1fde2a419a4 100644 --- a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h +++ b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h @@ -18,6 +18,8 @@ #ifndef GRUULS_LAIR_H_ #define GRUULS_LAIR_H_ +#include "CreatureAIImpl.h" + #define GLScriptName "instance_gruuls_lair" #define DataHeader "GL" @@ -45,8 +47,8 @@ enum GLGameObjectIds GO_GRUUL_DOOR = 184662 }; -template<class AI> -AI* GetGruulsLairAI(Creature* creature) +template<typename AI> +inline AI* GetGruulsLairAI(Creature* creature) { return GetInstanceAI<AI>(creature, GLScriptName); } diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index 2145ebee721..0529e8f727b 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -16,8 +16,11 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" +#include "Creature.h" +#include "GameObject.h" #include "gruuls_lair.h" +#include "InstanceScript.h" +#include "Map.h" DoorData const doorData[] = { diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h index 6553920f079..8dc3546a5e8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h @@ -18,6 +18,8 @@ #ifndef BLOOD_FURNACE_H_ #define BLOOD_FURNACE_H_ +#include "CreatureAIImpl.h" + #define BFScriptName "instance_blood_furnace" #define DataHeader "BF" @@ -80,8 +82,8 @@ enum BFActionIds ACTION_PREPARE_BROGGOK = 3 }; -template<class AI> -AI* GetBloodFurnaceAI(Creature* creature) +template<typename AI> +inline AI* GetBloodFurnaceAI(Creature* creature) { return GetInstanceAI<AI>(creature, BFScriptName); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index f1e4a9786ce..03d72ba343b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -16,10 +16,14 @@ */ #include "ScriptMgr.h" +#include "blood_furnace.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" -#include "SpellScript.h" #include "SpellAuraEffects.h" -#include "blood_furnace.h" +#include "SpellInfo.h" +#include "SpellScript.h" enum Yells { @@ -154,9 +158,8 @@ class spell_broggok_poison_cloud : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->GetEffect(EFFECT_0)->TriggerSpell)) - return false; - return true; + SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0); + return effect0 && ValidateSpellInfo({ effect0->TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index fe30357631d..db5d3a4a49d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -17,10 +17,15 @@ */ #include "ScriptMgr.h" +#include "blood_furnace.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" -#include "SpellAuras.h" #include "Spell.h" -#include "blood_furnace.h" +#include "SpellAuras.h" +#include "SpellMgr.h" +#include "SpellInfo.h" +#include "TemporarySummon.h" enum Kelidan { diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index 7528a98c650..17090c5bceb 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -16,8 +16,8 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "blood_furnace.h" +#include "ScriptedCreature.h" enum Yells { diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 09cd247d89a..fbc7e9290e2 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -16,9 +16,12 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "InstanceScript.h" #include "blood_furnace.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" DoorData const doorData[] = { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index f925cdd8515..e30ac62cc0e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -24,9 +24,10 @@ SDCategory: Hellfire Citadel, Hellfire Ramparts EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "Player.h" #include "hellfire_ramparts.h" +#include "ObjectAccessor.h" +#include "Player.h" +#include "ScriptedCreature.h" enum Says { @@ -230,7 +231,7 @@ class boss_omor_the_unscarred : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_omor_the_unscarredAI>(creature); + return GetHellfireRampartsAI<boss_omor_the_unscarredAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index e88833a36c6..7f28650c9b8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -24,9 +24,11 @@ Category: Hellfire Citadel, Hellfire Ramparts EndScriptData */ #include "ScriptMgr.h" +#include "hellfire_ramparts.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" -#include "hellfire_ramparts.h" +#include "TemporarySummon.h" enum Says { @@ -196,7 +198,7 @@ class boss_nazan : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_nazanAI(creature); + return GetHellfireRampartsAI<boss_nazanAI>(creature); } }; @@ -282,7 +284,7 @@ class boss_vazruden : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_vazrudenAI(creature); + return GetHellfireRampartsAI<boss_vazrudenAI>(creature); } }; @@ -454,7 +456,7 @@ class boss_vazruden_the_herald : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_vazruden_the_heraldAI(creature); + return GetHellfireRampartsAI<boss_vazruden_the_heraldAI>(creature); } }; @@ -511,7 +513,7 @@ class npc_hellfire_sentry : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_hellfire_sentryAI(creature); + return GetHellfireRampartsAI<npc_hellfire_sentryAI>(creature); } }; void AddSC_boss_vazruden_the_herald() diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index 0115d3fdd88..dd2e7700d1c 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -24,8 +24,8 @@ SDCategory: Hellfire Citadel, Hellfire Ramparts EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "hellfire_ramparts.h" +#include "ScriptedCreature.h" enum Says { @@ -175,7 +175,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_watchkeeper_gargolmarAI(creature); + return GetHellfireRampartsAI<boss_watchkeeper_gargolmarAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h index 620f4018f6d..1b7e09ab99d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h @@ -19,6 +19,9 @@ #ifndef DEF_RAMPARTS_H #define DEF_RAMPARTS_H +#include "CreatureAIImpl.h" + +#define HRScriptName "instance_ramparts" #define DataHeader "HR" uint32 const EncounterCount = 4; @@ -46,4 +49,10 @@ enum HRGameobjectIds GO_FEL_IRON_CHEST_HEROIC = 185169 }; +template<typename AI> +inline AI* GetHellfireRampartsAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, HRScriptName); +} + #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index 8d6ac51f81a..2de3c155eef 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -24,13 +24,15 @@ SDCategory: Hellfire Ramparts EndScriptData */ #include "ScriptMgr.h" -#include "InstanceScript.h" +#include "GameObject.h" #include "hellfire_ramparts.h" +#include "InstanceScript.h" +#include "Map.h" class instance_ramparts : public InstanceMapScript { public: - instance_ramparts() : InstanceMapScript("instance_ramparts", 543) { } + instance_ramparts() : InstanceMapScript(HRScriptName, 543) { } struct instance_ramparts_InstanceMapScript : public InstanceScript { diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 0a6a32b93a1..f988aed128a 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -24,10 +24,14 @@ SDCategory: Hellfire Citadel, Magtheridon's lair EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "GameObject.h" +#include "InstanceScript.h" #include "magtheridons_lair.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedCreature.h" #include "SpellInfo.h" +#include "TemporarySummon.h" enum Yells { @@ -196,7 +200,7 @@ class npc_abyssal : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_abyssalAI(creature); + return GetMagtheridonsLairAI<npc_abyssalAI>(creature); } }; @@ -463,7 +467,7 @@ class boss_magtheridon : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_magtheridonAI>(creature); + return GetMagtheridonsLairAI<boss_magtheridonAI>(creature); } }; @@ -585,7 +589,7 @@ class npc_hellfire_channeler : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_hellfire_channelerAI>(creature); + return GetMagtheridonsLairAI<npc_hellfire_channelerAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 5271d447106..62a53a4c2f3 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -24,9 +24,12 @@ SDCategory: Hellfire Citadel, Magtheridon's lair EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" #include "InstanceScript.h" #include "magtheridons_lair.h" +#include "Map.h" enum Spells { @@ -45,8 +48,7 @@ enum Spells class instance_magtheridons_lair : public InstanceMapScript { public: - instance_magtheridons_lair() - : InstanceMapScript("instance_magtheridons_lair", 544) + instance_magtheridons_lair() : InstanceMapScript(MLScriptName, 544) { } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h index 270eb892cf2..5bb8ff7977f 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h @@ -19,6 +19,9 @@ #ifndef DEF_MAGTHERIDONS_LAIR_H #define DEF_MAGTHERIDONS_LAIR_H +#define MLScriptName "instance_magtheridons_lair" +#include "CreatureAIImpl.h" + #define DataHeader "ML" enum MLDataTypes @@ -30,5 +33,11 @@ enum MLDataTypes DATA_CHANNELER = 9 }; +template<typename AI> +inline AI* GetMagtheridonsLairAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, MLScriptName); +} + #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index 0757cc44acf..5d776022279 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -30,6 +30,8 @@ npc_lesser_shadow_fissure EndContentData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "shattered_halls.h" @@ -299,7 +301,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_grand_warlock_nethekurseAI>(creature); + return GetShatteredHallsAI<boss_grand_warlock_nethekurseAI>(creature); } }; @@ -367,7 +369,7 @@ class npc_fel_orc_convert : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_fel_orc_convertAI>(creature); + return GetShatteredHallsAI<npc_fel_orc_convertAI>(creature); } }; @@ -392,7 +394,7 @@ class npc_lesser_shadow_fissure : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_lesser_shadow_fissureAI(creature); + return GetShatteredHallsAI<npc_lesser_shadow_fissureAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 68ac53eb708..967e01a5cef 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -29,6 +29,8 @@ boss_warbringer_omrogg EndContentData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "shattered_halls.h" @@ -393,7 +395,7 @@ class boss_warbringer_omrogg : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_warbringer_omroggAI>(creature); + return GetShatteredHallsAI<boss_warbringer_omroggAI>(creature); } }; @@ -443,7 +445,7 @@ class npc_omrogg_heads : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_omrogg_headsAI>(creature); + return GetShatteredHallsAI<npc_omrogg_headsAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index a4f10aa9eda..a052fd941fc 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -28,6 +28,8 @@ boss_warchief_kargath_bladefist EndContentData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "shattered_halls.h" @@ -339,7 +341,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_warchief_kargath_bladefistAI>(creature); + return GetShatteredHallsAI<boss_warchief_kargath_bladefistAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index 72a29272c84..a692e5c8429 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -24,13 +24,15 @@ SDCategory: Hellfire Citadel, Shattered Halls EndScriptData */ #include "ScriptMgr.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" #include "InstanceScript.h" -#include "shattered_halls.h" +#include "Map.h" #include "Player.h" +#include "shattered_halls.h" #include "SpellAuras.h" -#include "CreatureAI.h" -#include "ScriptedCreature.h" -#include "SpellScript.h" +#include "TemporarySummon.h" DoorData const doorData[] = { @@ -42,7 +44,7 @@ DoorData const doorData[] = class instance_shattered_halls : public InstanceMapScript { public: - instance_shattered_halls() : InstanceMapScript("instance_shattered_halls", 540) { } + instance_shattered_halls() : InstanceMapScript(SHScriptName, 540) { } InstanceScript* GetInstanceScript(InstanceMap* map) const override { diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp index 0c17f711982..9b68f751249 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp @@ -16,13 +16,14 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "SpellScript.h" -#include "SpellAuraEffects.h" #include "InstanceScript.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "Player.h" -#include "SpellAuras.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "shattered_halls.h" +#include "TemporarySummon.h" class at_nethekurse_exit : public AreaTriggerScript { @@ -171,7 +172,7 @@ class boss_shattered_executioner : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_shattered_executionerAI>(creature); + return GetShatteredHallsAI<boss_shattered_executionerAI>(creature); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h index d62746e098f..d92255f5b59 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h @@ -19,6 +19,10 @@ #ifndef DEF_SHATTERED_H #define DEF_SHATTERED_H +#include "CreatureAIImpl.h" +#include "Position.h" + +#define SHScriptName "instance_shattered_halls" #define DataHeader "SH" uint32 const EncounterCount = 4; @@ -98,9 +102,9 @@ struct FactionSpawnerHelper inline Position const& GetPos() const { return _spawnPos; } private: - const uint32 _allianceNPC; - const uint32 _hordeNPC; - const Position _spawnPos; + uint32 const _allianceNPC; + uint32 const _hordeNPC; + Position const _spawnPos; }; const FactionSpawnerHelper executionerVictims[VictimCount] = @@ -110,5 +114,10 @@ const FactionSpawnerHelper executionerVictims[VictimCount] = { NPC_ALLIANCE_VICTIM_2, NPC_HORDE_VICTIM_2, { 151.0459f, -77.51981f, 2.021008f, 4.74729500f } } }; +template<typename AI> +inline AI* GetShatteredHallsAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, SHScriptName); +} #endif diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 04ee2c90fa0..cfaa9ff8b45 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -24,9 +24,12 @@ SDCategory: Tempest Keep, The Eye EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" -#include "the_eye.h" #include "SpellInfo.h" +#include "TemporarySummon.h" +#include "the_eye.h" enum Spells { @@ -448,7 +451,7 @@ class boss_alar : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_alarAI>(creature); + return GetTheEyeAI<boss_alarAI>(creature); } }; @@ -531,7 +534,7 @@ class npc_ember_of_alar : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ember_of_alarAI>(creature); + return GetTheEyeAI<npc_ember_of_alarAI>(creature); } }; @@ -553,7 +556,7 @@ class npc_flame_patch_alar : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_flame_patch_alarAI(creature); + return GetTheEyeAI<npc_flame_patch_alarAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 671d1e8a9ca..9736d61d44e 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -24,10 +24,13 @@ SDCategory: Tempest Keep, The Eye EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "SpellAuras.h" +#include "SpellInfo.h" #include "SpellScript.h" -#include "SpellAuraEffects.h" - +#include "TemporarySummon.h" #include "the_eye.h" enum Yells @@ -410,7 +413,7 @@ class boss_high_astromancer_solarian : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_high_astromancer_solarianAI>(creature); + return GetTheEyeAI<boss_high_astromancer_solarianAI>(creature); } }; @@ -497,7 +500,7 @@ class npc_solarium_priest : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_solarium_priestAI>(creature); + return GetTheEyeAI<npc_solarium_priestAI>(creature); } }; @@ -512,9 +515,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_WRATH_OF_THE_ASTROMANCER_DOT)) - return false; - return true; + return ValidateSpellInfo({ SPELL_WRATH_OF_THE_ASTROMANCER_DOT }); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index ccda9fd839d..b624b614ac8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -29,7 +29,6 @@ EndScriptData */ #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" -#include "SpellMgr.h" #include "SpellScript.h" #include "the_eye.h" @@ -867,7 +866,7 @@ class boss_kaelthas : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_kaelthasAI>(creature); + return GetTheEyeAI<boss_kaelthasAI>(creature); } }; @@ -972,7 +971,7 @@ class boss_thaladred_the_darkener : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_thaladred_the_darkenerAI>(creature); + return GetTheEyeAI<boss_thaladred_the_darkenerAI>(creature); } }; @@ -1036,7 +1035,7 @@ class boss_lord_sanguinar : public CreatureScript }; CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_lord_sanguinarAI>(creature); + return GetTheEyeAI<boss_lord_sanguinarAI>(creature); } }; @@ -1167,7 +1166,7 @@ class boss_grand_astromancer_capernian : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_grand_astromancer_capernianAI>(creature); + return GetTheEyeAI<boss_grand_astromancer_capernianAI>(creature); } }; @@ -1246,7 +1245,7 @@ class boss_master_engineer_telonicus : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_master_engineer_telonicusAI>(creature); + return GetTheEyeAI<boss_master_engineer_telonicusAI>(creature); } }; @@ -1316,7 +1315,7 @@ class npc_kael_flamestrike : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_kael_flamestrikeAI(creature); + return GetTheEyeAI<npc_kael_flamestrikeAI>(creature); } }; @@ -1375,7 +1374,7 @@ class npc_phoenix_tk : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_phoenix_tkAI(creature); + return GetTheEyeAI<npc_phoenix_tkAI>(creature); } }; @@ -1441,7 +1440,7 @@ class npc_phoenix_egg_tk : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_phoenix_egg_tkAI(creature); + return GetTheEyeAI<npc_phoenix_egg_tkAI>(creature); } }; @@ -1463,11 +1462,7 @@ class spell_kael_gravity_lapse : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - for (uint8 i = 0; i < 25; ++i) - if (!sSpellMgr->GetSpellInfo(GravityLapseSpells[i])) - return false; - - return true; + return ValidateSpellInfo(GravityLapseSpells); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index c111756aa5c..673a260a15a 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "the_eye.h" @@ -167,7 +168,7 @@ class boss_void_reaver : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_void_reaverAI>(creature); + return GetTheEyeAI<boss_void_reaverAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 0d279c928f0..e36d7a818c8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -24,7 +24,9 @@ SDCategory: Tempest Keep, The Eye EndScriptData */ #include "ScriptMgr.h" +#include "Creature.h" #include "InstanceScript.h" +#include "Map.h" #include "the_eye.h" /* The Eye encounters: @@ -52,7 +54,7 @@ ObjectData const gameObjectData[] = class instance_the_eye : public InstanceMapScript { public: - instance_the_eye() : InstanceMapScript("instance_the_eye", 550) { } + instance_the_eye() : InstanceMapScript(TheEyeScriptName, 550) { } struct instance_the_eye_InstanceMapScript : public InstanceScript { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h index 1111e2409f5..f2232707ebd 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h +++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h @@ -19,6 +19,9 @@ #ifndef DEF_THE_EYE_H #define DEF_THE_EYE_H +#include "CreatureAIImpl.h" + +#define TheEyeScriptName "instance_the_eye" #define DataHeader "TE" uint32 const EncounterCount = 4; @@ -63,4 +66,10 @@ enum TEGameObjectIds GO_ARCANE_DOOR_RIGHT = 184325 }; +template<typename AI> +inline AI* GetTheEyeAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, TheEyeScriptName); +} + #endif diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp index b10b6276337..6376a0e8175 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp @@ -23,8 +23,8 @@ SDCategory: Tempest Keep, The Mechanar EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "mechanar.h" +#include "ScriptedCreature.h" enum Say { @@ -120,7 +120,7 @@ class boss_gatewatcher_gyrokill : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_gatewatcher_gyrokillAI(creature); + return GetMechanarAI<boss_gatewatcher_gyrokillAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp index 1733d94bc78..0b060d35771 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp @@ -24,8 +24,8 @@ SDCategory: Tempest Keep, The Mechanar EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "mechanar.h" +#include "ScriptedCreature.h" enum Says { @@ -127,7 +127,7 @@ class boss_gatewatcher_iron_hand : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_gatewatcher_iron_handAI(creature); + return GetMechanarAI<boss_gatewatcher_iron_handAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 8187cdb14a0..6a6c80578ca 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -16,11 +16,10 @@ */ #include "ScriptMgr.h" +#include "mechanar.h" #include "ScriptedCreature.h" -#include "SpellScript.h" #include "SpellInfo.h" -#include "mechanar.h" -#include "Player.h" +#include "SpellScript.h" enum Spells { @@ -156,7 +155,7 @@ class boss_mechano_lord_capacitus : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_mechano_lord_capacitusAI(creature); + return GetMechanarAI<boss_mechano_lord_capacitusAI>(creature); } }; @@ -171,24 +170,22 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_STACK)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_STACK)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_POSITIVE_CHARGE, + SPELL_POSITIVE_CHARGE_STACK, + SPELL_NEGATIVE_CHARGE, + SPELL_NEGATIVE_CHARGE_STACK + }); } void HandleTargets(std::list<WorldObject*>& targetList) { uint8 count = 0; - for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit) - if ((*ihit)->GetGUID() != GetCaster()->GetGUID()) - if (Player* target = (*ihit)->ToPlayer()) - if (target->HasAura(GetTriggeringSpell()->Id)) + for (WorldObject* target : targetList) + if (target->GetGUID() != GetCaster()->GetGUID()) + if (target->GetTypeId() == TYPEID_PLAYER) + if (target->ToUnit()->HasAura(GetTriggeringSpell()->Id)) ++count; if (count) @@ -239,9 +236,7 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY)) - return false; - return true; + return ValidateSpellInfo({ SPELL_POSITIVE_POLARITY, SPELL_NEGATIVE_POLARITY }); } void HandleDummy(SpellEffIndex /* effIndex */) diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index 199fa3d81c1..a3be06dd188 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -24,8 +24,9 @@ SDCategory: Tempest Keep, The Mechanar EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "mechanar.h" +#include "ScriptedCreature.h" enum Says { @@ -141,7 +142,7 @@ class boss_nethermancer_sepethrea : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_nethermancer_sepethreaAI(creature); + return GetMechanarAI<boss_nethermancer_sepethreaAI>(creature); } }; @@ -229,7 +230,7 @@ class npc_ragin_flames : public CreatureScript }; CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ragin_flamesAI>(creature); + return GetMechanarAI<npc_ragin_flamesAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp index 33ffa66b387..5bba703362c 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -24,8 +24,9 @@ SDCategory: Tempest Keep, The Mechanar EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "mechanar.h" +#include "ScriptedCreature.h" +#include "TemporarySummon.h" enum Says { @@ -163,7 +164,7 @@ class boss_pathaleon_the_calculator : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_pathaleon_the_calculatorAI(creature); + return GetMechanarAI<boss_pathaleon_the_calculatorAI>(creature); } }; @@ -243,7 +244,7 @@ class npc_nether_wraith : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_nether_wraithAI(creature); + return GetMechanarAI<npc_nether_wraithAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 47587cf528e..483364b8c22 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -17,7 +17,9 @@ */ #include "ScriptMgr.h" +#include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" #include "mechanar.h" static DoorData const doorData[] = @@ -31,7 +33,7 @@ static DoorData const doorData[] = class instance_mechanar : public InstanceMapScript { public: - instance_mechanar(): InstanceMapScript("instance_mechanar", 554) { } + instance_mechanar(): InstanceMapScript(MechanarScriptName, 554) { } struct instance_mechanar_InstanceMapScript : public InstanceScript { diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h index 35494c745f8..8b7dc09bced 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h @@ -18,6 +18,9 @@ #ifndef DEF_MECHANAR_H #define DEF_MECHANAR_H +#include "CreatureAIImpl.h" + +#define MechanarScriptName "instance_mechanar" #define DataHeader "MR" uint32 const EncounterCount = 5; @@ -38,4 +41,10 @@ enum MRGameobjectIds GO_DOOR_NETHERMANCER = 184449 }; +template<typename AI> +inline AI* GetMechanarAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, MechanarScriptName); +} + #endif diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index f96fadfc5a7..8771b8a5af5 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -30,8 +30,9 @@ npc_zerekethvoidzone EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "InstanceScript.h" +#include "ScriptedCreature.h" /*##### # npc_millhouse_manastorm @@ -549,7 +550,7 @@ class npc_zerekethvoidzone : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_zerekethvoidzoneAI(creature); + return GetArcatrazAI<npc_zerekethvoidzoneAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h index 038dfb16067..5a6368d08f2 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h @@ -18,6 +18,8 @@ #ifndef ARCATRAZ_H #define ARCATRAZ_H +#include "CreatureAIImpl.h" + #define ArcatrazScriptName "instance_arcatraz" #define DataHeader "AZ" @@ -62,8 +64,8 @@ enum AZGameObjectIds GO_WARDENS_SHIELD = 184802 // shield 'protecting' mellichar }; -template<class AI> -AI* GetArcatrazAI(Creature* creature) +template<typename AI> +inline AI* GetArcatrazAI(Creature* creature) { return GetInstanceAI<AI>(creature, ArcatrazScriptName); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp index 52481ac629d..e2235a34c3c 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp @@ -16,8 +16,10 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum Say { diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 763d0c206cc..564bb6b2d9c 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -29,8 +29,10 @@ boss_harbinger_skyriss_illusion EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum Says { @@ -293,7 +295,7 @@ class boss_harbinger_skyriss_illusion : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_harbinger_skyriss_illusionAI(creature); + return GetArcatrazAI<boss_harbinger_skyriss_illusionAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp index 4f12a669a6a..4232d6efdc9 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp @@ -23,8 +23,10 @@ SDCategory: Tempest Keep, The Arcatraz EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum Say { diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp index 54693d3776a..5c5bfa2c4fa 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp @@ -16,8 +16,8 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "ScriptedCreature.h" enum Say { @@ -118,7 +118,7 @@ class boss_zereketh_the_unbound : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_zereketh_the_unboundAI(creature); + return GetArcatrazAI<boss_zereketh_the_unboundAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index b79274d3b5d..f700d5f725f 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -16,8 +16,11 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" #include "arcatraz.h" +#include "Creature.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" DoorData const doorData[] = { diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp index ad83bd90e61..48c2d0dadad 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp @@ -16,9 +16,10 @@ */ #include "ScriptMgr.h" +#include "Map.h" #include "ScriptedCreature.h" -#include "the_botanica.h" #include "SpellScript.h" +#include "the_botanica.h" enum Says { @@ -142,7 +143,7 @@ class boss_commander_sarannis : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_commander_sarannisAI(creature); + return GetBotanicaAI<boss_commander_sarannisAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index 91de750ad81..3ba08006940 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -24,6 +24,7 @@ SDCategory: Tempest Keep, The Botanica EndScriptData */ #include "ScriptMgr.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "the_botanica.h" @@ -210,7 +211,7 @@ class boss_high_botanist_freywinn : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_high_botanist_freywinnAI(creature); + return GetBotanicaAI<boss_high_botanist_freywinnAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp index e8283eeb8cb..31241a050dd 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp @@ -223,7 +223,7 @@ class boss_laj : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_lajAI(creature); + return GetBotanicaAI<boss_lajAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp index 6480b8a2b58..67a27523d99 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp @@ -152,7 +152,7 @@ class boss_thorngrin_the_tender : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_thorngrin_the_tenderAI(creature); + return GetBotanicaAI<boss_thorngrin_the_tenderAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index 0f5c31445e8..21ac858cb6b 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -24,7 +24,9 @@ SDCategory: Tempest Keep, The Botanica EndScriptData */ #include "ScriptMgr.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "TemporarySummon.h" #include "the_botanica.h" enum Says @@ -125,7 +127,7 @@ class npc_warp_splinter_treant : public CreatureScript }; CreatureAI* GetAI(Creature* creature) const override { - return new npc_warp_splinter_treantAI(creature); + return GetBotanicaAI<npc_warp_splinter_treantAI>(creature); } }; @@ -239,7 +241,7 @@ class boss_warp_splinter : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_warp_splinterAI(creature); + return GetBotanicaAI<boss_warp_splinterAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp index 3d878bae81e..6e092b743f3 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp @@ -16,13 +16,15 @@ */ #include "ScriptMgr.h" +#include "Creature.h" #include "InstanceScript.h" +#include "Map.h" #include "the_botanica.h" class instance_the_botanica : public InstanceMapScript { public: - instance_the_botanica() : InstanceMapScript("instance_the_botanica", 553) { } + instance_the_botanica() : InstanceMapScript(BotanicaScriptName, 553) { } struct instance_the_botanica_InstanceMapScript : public InstanceScript { diff --git a/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h b/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h index fc773d0b133..4c3c2dbe2b7 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h +++ b/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h @@ -19,6 +19,9 @@ #ifndef DEF_THE_BOTANICA_H #define DEF_THE_BOTANICA_H +#include "CreatureAIImpl.h" + +#define BotanicaScriptName "instance_the_botanica" #define DataHeader "BC" uint32 const EncounterCount = 5; @@ -41,4 +44,10 @@ enum BCCreatureIds NPC_WARP_SPLINTER = 17977 }; +template<typename AI> +inline AI* GetBotanicaAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, BotanicaScriptName); +} + #endif diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 28c424d39b6..8d6440a43b2 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -18,7 +18,6 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#include "SpellAuraEffects.h" #include "SpellScript.h" enum Texts @@ -187,9 +186,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_KAZZAK_DAMAGE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE }); } void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) @@ -234,9 +231,7 @@ class spell_twisted_reflection : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_TWISTED_REFLECTION_HEAL)) - return false; - return true; + return ValidateSpellInfo({ SPELL_TWISTED_REFLECTION_HEAL }); } void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 84e2635d8a9..42783ce2953 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -30,16 +30,17 @@ go_legion_obelisk EndContentData */ #include "ScriptMgr.h" +#include "CellImpl.h" +#include "CreatureAIImpl.h" +#include "GameObject.h" +#include "GridNotifiersImpl.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "Cell.h" -#include "CellImpl.h" #include "SpellInfo.h" #include "SpellScript.h" -#include "SpellAuras.h" -#include "SpellAuraEffects.h" +#include "TemporarySummon.h" /*###### ## npc_nether_drake @@ -959,7 +960,7 @@ public: { // Spell 37392 does not exist in dbc, manually spawning me->SummonCreature(NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 0.5f, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 50000); - me->SummonGameObject(GO_OSCILLATING_FREQUENCY_SCANNER, *me, G3D::Quat(), 50); + me->SummonGameObject(GO_OSCILLATING_FREQUENCY_SCANNER, *me, QuaternionData(), 50); me->DespawnOrUnsummon(50000); } diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 92d87b5a279..439a07161fc 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -32,11 +32,11 @@ EndContentData */ #include "ScriptMgr.h" #include "Log.h" +#include "ObjectAccessor.h" #include "Player.h" -#include "ScriptedCreature.h" +#include "QuestDef.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" -#include "WorldSession.h" /*###### ## npc_aeranas @@ -661,7 +661,7 @@ public: switch (gossipListId) { case 1: - player->PlayerTalkClass->SendCloseGossip(); + CloseGossipMenuFor(player); me->AI()->Talk(SAY_BARADA_1); me->AI()->DoAction(ACTION_START_EVENT); break; diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp index de689f03fa9..bddbc07a8e5 100644 --- a/src/server/scripts/Outland/zone_nagrand.cpp +++ b/src/server/scripts/Outland/zone_nagrand.cpp @@ -27,12 +27,15 @@ EndScriptData */ npc_maghar_captive npc_creditmarker_visit_with_ancestors EndContentData */ + #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "GameObject.h" #include "Player.h" +#include "QuestDef.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "SpellInfo.h" +#include "TemporarySummon.h" /*###### ## npc_maghar_captive diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 9532d43c162..38d48bc4118 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -31,9 +31,11 @@ go_captain_tyralius_prison EndContentData */ #include "ScriptMgr.h" +#include "GameObject.h" #include "Log.h" +#include "ObjectAccessor.h" #include "Player.h" -#include "ScriptedCreature.h" +#include "QuestDef.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 82ba849bbbe..d216e08ece7 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -41,6 +41,7 @@ EndContentData */ #include "Group.h" #include "ObjectAccessor.h" #include "Player.h" +#include "QuestDef.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "SpellInfo.h" @@ -76,7 +77,8 @@ public: void Reset() override { - ground = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset()); + ground = me->GetPositionZ(); + me->UpdateGroundPositionZ(me->GetPositionX(), me->GetPositionY(), ground); SummonInfernal(); events.ScheduleEvent(EVENT_CAST_SUMMON_INFERNAL, urand(1000, 3000)); } diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp index 78bbb88e021..9342417acdc 100644 --- a/src/server/scripts/Outland/zone_shattrath_city.cpp +++ b/src/server/scripts/Outland/zone_shattrath_city.cpp @@ -32,11 +32,9 @@ npc_kservant EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "Player.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" -#include "Player.h" -#include "WorldSession.h" /*###### ## npc_raliq_the_drunk diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index 1927dae9d57..98752c1eb1e 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -33,12 +33,11 @@ npc_slim EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "GameObject.h" #include "Group.h" #include "Player.h" -#include "WorldSession.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_unkor_the_ruthless diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index a1810316cf1..7417cd04085 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -31,11 +31,9 @@ npc_kayra_longmane EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "Player.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" -#include "Player.h" -#include "WorldSession.h" /*###### ## npcs_ashyen_and_keleth |
