diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2017-06-19 23:20:06 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2017-06-19 23:20:06 -0300 |
| commit | 85a7d5ce9ac68b30da2277cc91d4b70358f1880d (patch) | |
| tree | df3d2084ee2e35008903c03178039b9c986e2d08 /src/server/scripts/Outland | |
| parent | 052fc24315ace866ea1cf610e85df119b68100c9 (diff) | |
Core: ported headers cleanup from master branch
Diffstat (limited to 'src/server/scripts/Outland')
111 files changed, 778 insertions, 693 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..5bc6d049f5a 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,10 +32,10 @@ enum ACDataTypes DATA_EXARCH_MALADAAR = 1 }; -template<class AI> -AI* GetAuchenaiCryptsAI(Creature* creature) +template <class AI, class T> +inline AI* GetAuchenaiCryptsAI(T* obj) { - return GetInstanceAI<AI>(creature, ACScriptName); + return GetInstanceAI<AI>(obj, ACScriptName); } #endif // AUCHENAI_CRYPTS_H_ 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 386d65c31ce..a6ef54233bb 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 1037fcebcf8..b59cf598454 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 { @@ -55,7 +58,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new boss_shirrak_the_dead_watcherAI(creature); + return GetAuchenaiCryptsAI<boss_shirrak_the_dead_watcherAI>(creature); } struct boss_shirrak_the_dead_watcherAI : public ScriptedAI @@ -109,7 +112,7 @@ public: if (Inhibitmagic_Timer <= diff) { float dist; - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->GetSource()) if (i_pl->IsAlive() && (dist = i_pl->GetDistance(me)) < 45) @@ -172,7 +175,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_focus_fireAI(creature); + return GetAuchenaiCryptsAI<npc_focus_fireAI>(creature); } struct npc_focus_fireAI : public ScriptedAI 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..6623feead32 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,9 @@ SDCategory: Auchindoun, Mana Tombs EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "mana_tombs.h" +#include "MotionMaster.h" +#include "ScriptedCreature.h" enum Yells { @@ -259,7 +260,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 +325,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 +381,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/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..0a48696cfbf 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,10 +34,10 @@ enum MTDataTypes DATA_YOR = 3 }; -template<class AI> -AI* GetManaTombsAI(Creature* creature) +template <class AI, class T> +inline AI* GetManaTombsAI(T* obj) { - return GetInstanceAI<AI>(creature, MTScriptName); + return GetInstanceAI<AI>(obj, MTScriptName); } #endif // MANA_TOMBS_H_ 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..c97fa51a502 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 @@ -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..40882ea933b 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -16,13 +16,16 @@ */ #include "ScriptMgr.h" +#include "Creature.h" +#include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" #include "sethekk_halls.h" DoorData const doorData[] = { { GO_IKISS_DOOR, DATA_TALON_KING_IKISS, DOOR_TYPE_PASSAGE }, - { 0, 0, DOOR_TYPE_ROOM } // END + { 0, 0, DOOR_TYPE_ROOM } // END }; ObjectData const gameObjectData[] = diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h index 3471b23daa2..39f8aa9511c 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,10 +48,10 @@ enum SHGameObjectIds GO_TALON_KING_COFFER = 187372 }; -template<class AI> -AI* GetSethekkHallsAI(Creature* creature) +template <class AI, class T> +inline AI* GetSethekkHallsAI(T* obj) { - return GetInstanceAI<AI>(creature, SHScriptName); + return GetInstanceAI<AI>(obj, SHScriptName); } #endif // SETHEKK_HALLS_H_ 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..c12dd178729 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" @@ -115,7 +115,7 @@ class boss_ambassador_hellmaw : public CreatureScript me->RemoveAurasDueToSpell(SPELL_BANISH); Talk(SAY_INTRO); - Start(true, false, ObjectGuid::Empty, NULL, false, true); + Start(true, false, ObjectGuid::Empty, nullptr, false, true); } void EnterCombat(Unit* /*who*/) override 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 2c9eba30a12..35276572243 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,14 @@ Category: Auchindoun, Shadow Labyrinth */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" #include "shadow_labyrinth.h" -#include "Player.h" +#include "TemporarySummon.h" enum GrandmasterVorpil { @@ -182,7 +187,7 @@ class boss_grandmaster_vorpil : public CreatureScript break; case EVENT_DRAW_SHADOWS: { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* i_pl = i->GetSource()) if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH)) diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index ac9ef77cd82..896deca41f7 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,14 +189,12 @@ 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*/) { - GetCaster()->CastSpell((Unit*)NULL, SPELL_SONIC_BOOM_EFFECT, true); + GetCaster()->CastSpell((Unit*)nullptr, SPELL_SONIC_BOOM_EFFECT, true); } void Register() override 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 8b830ccad65..cbfd8b2c197 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.cpp @@ -36,9 +36,7 @@ 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*/) diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h index 48334af4ab9..0c7e7b5afca 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,10 +56,10 @@ enum SLMisc ACTION_AMBASSADOR_HELLMAW_BANISH = 2, }; -template<class AI> -AI* GetShadowLabyrinthAI(Creature* creature) +template <class AI, class T> +inline AI* GetShadowLabyrinthAI(T* obj) { - return GetInstanceAI<AI>(creature, SLScriptName); + return GetInstanceAI<AI>(obj, SLScriptName); } #endif // SHADOW_LABYRINTH_H_ diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index 042cff87618..08b00caa519 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -16,10 +16,11 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" -#include "SpellScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" #include "SpellAuraEffects.h" +#include "SpellScript.h" enum Spells { @@ -137,11 +138,11 @@ public: { for (ObjectGuid guid : _bloodmageList) if (Creature* bloodmage = ObjectAccessor::GetCreature(*me, guid)) - bloodmage->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL); + bloodmage->CastSpell((Unit*)nullptr, SPELL_SUMMON_CHANNEL); for (ObjectGuid guid : _deathshaperList) if (Creature* deathshaper = ObjectAccessor::GetCreature(*me, guid)) - deathshaper->CastSpell((Unit*)NULL, SPELL_SUMMON_CHANNEL); + deathshaper->CastSpell((Unit*)nullptr, SPELL_SUMMON_CHANNEL); _events.ScheduleEvent(EVENT_SET_CHANNELERS, 12000); @@ -298,9 +299,7 @@ class spell_illidari_nightlord_shadow_inferno : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_INFERNO_DAMAGE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SHADOW_INFERNO_DAMAGE }); } void OnPeriodic(AuraEffect const* aurEffect) diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h index b1c4b31ca63..bdade01ab33 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.h +++ b/src/server/scripts/Outland/BlackTemple/black_temple.h @@ -18,6 +18,8 @@ #ifndef BLACK_TEMPLE_H_ #define BLACK_TEMPLE_H_ +#include "CreatureAIImpl.h" + #define BTScriptName "instance_black_temple" #define DataHeader "BT" @@ -138,8 +140,8 @@ enum BlackTempleMisc ACTION_OPEN_DOOR = 4 }; -template<class AI, class T> -AI* GetBlackTempleAI(T* obj) +template <class AI, class T> +inline AI* GetBlackTempleAI(T* obj) { return GetInstanceAI<AI>(obj, BTScriptName); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp index 7d851ec8bf7..085ea796f05 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_gurtogg_bloodboil.cpp @@ -16,12 +16,12 @@ */ #include "ScriptMgr.h" +#include "black_temple.h" +#include "GridNotifiers.h" +#include "ObjectAccessor.h" +#include "PassiveAI.h" #include "ScriptedCreature.h" #include "SpellScript.h" -#include "PassiveAI.h" -#include "GridNotifiers.h" - -#include "black_temple.h" enum Says { @@ -381,9 +381,7 @@ public: bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_FEL_RAGE_TARGET)) - return false; - return true; + return ValidateSpellInfo({ SPELL_FEL_RAGE_TARGET }); } void FilterTargets(std::list<WorldObject*>& targets) diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 84ce4d42354..a7bfbf317c3 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -16,15 +16,20 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "PassiveAI.h" #include "black_temple.h" +#include "GridNotifiersImpl.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "PassiveAI.h" #include "Player.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellAuraEffects.h" #include "SpellInfo.h" #include "SpellScript.h" -#include "SpellAuraEffects.h" -#include "GridNotifiersImpl.h" +#include "TemporarySummon.h" enum IllidanSay { @@ -676,7 +681,7 @@ public: void EnterEvadeModeIfNeeded() { - Map::PlayerList const &players = me->GetMap()->GetPlayers(); + Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) if (Player* player = i->GetSource()) if (player->IsAlive() && !player->IsGameMaster() && CheckBoundary(player)) @@ -1889,9 +1894,7 @@ class spell_illidan_akama_door_channel : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_ARCANE_EXPLOSION)) - return false; - return true; + return ValidateSpellInfo({ SPELL_ARCANE_EXPLOSION }); } void OnRemoveDummy(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -1928,9 +1931,7 @@ class spell_illidan_draw_soul : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_DRAW_SOUL_HEAL)) - return false; - return true; + return ValidateSpellInfo({ SPELL_DRAW_SOUL_HEAL }); } void HandleScriptEffect(SpellEffIndex effIndex) @@ -1964,9 +1965,7 @@ class spell_illidan_parasitic_shadowfiend : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PARASITIC_SHADOWFIENDS)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SUMMON_PARASITIC_SHADOWFIENDS }); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -2028,9 +2027,7 @@ class spell_illidan_tear_of_azzinoth_channel : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_UNCAGED_WRATH)) - return false; - return true; + return ValidateSpellInfo({ SPELL_UNCAGED_WRATH }); } void OnPeriodic(AuraEffect const* /*aurEff*/) @@ -2071,9 +2068,7 @@ class spell_illidan_flame_blast : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_BLAZE_SUMMON)) - return false; - return true; + return ValidateSpellInfo({ SPELL_BLAZE_SUMMON }); } void HandleBlaze(SpellEffIndex /*effIndex*/) @@ -2135,9 +2130,7 @@ class spell_illidan_agonizing_flames : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_AGONIZING_FLAMES)) - return false; - return true; + return ValidateSpellInfo({ SPELL_AGONIZING_FLAMES }); } void FilterTargets(std::list<WorldObject*>& targets) @@ -2180,9 +2173,7 @@ class spell_illidan_demon_transform1 : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_DEMON_TRANSFORM_2)) - return false; - return true; + return ValidateSpellInfo({ SPELL_DEMON_TRANSFORM_2 }); } void OnPeriodic(AuraEffect const* /*aurEff*/) @@ -2216,10 +2207,7 @@ class spell_illidan_demon_transform2 : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_DEMON_FORM) - || !sSpellMgr->GetSpellInfo(SPELL_DEMON_TRANSFORM_3)) - return false; - return true; + return ValidateSpellInfo({ SPELL_DEMON_FORM, SPELL_DEMON_TRANSFORM_3 }); } void OnPeriodic(AuraEffect const* aurEff) @@ -2267,9 +2255,7 @@ class spell_illidan_flame_burst : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_FLAME_BURST_EFFECT)) - return false; - return true; + return ValidateSpellInfo({ SPELL_FLAME_BURST_EFFECT }); } void HandleScriptEffect(SpellEffIndex /*effIndex*/) @@ -2301,9 +2287,7 @@ class spell_illidan_find_target : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_PARALYZE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_PARALYZE }); } void FilterTargets(std::list<WorldObject*>& targets) @@ -2420,9 +2404,7 @@ class spell_illidan_caged : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_CAGED_DEBUFF)) - return false; - return true; + return ValidateSpellInfo({ SPELL_CAGED_DEBUFF }); } void OnPeriodic(AuraEffect const* /*aurEff*/) diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp index e19b0189147..245f7960628 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidari_council.cpp @@ -16,15 +16,14 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "SpellScript.h" -#include "SpellAuraEffects.h" #include "black_temple.h" -#include "Cell.h" #include "CellImpl.h" -#include "GridNotifiers.h" #include "GridNotifiersImpl.h" +#include "InstanceScript.h" #include "PassiveAI.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" enum Says { @@ -631,9 +630,7 @@ class spell_illidari_council_empyreal_balance : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_BALANCE_OF_POWER)) - return false; - return true; + return ValidateSpellInfo({ SPELL_BALANCE_OF_POWER }); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -698,9 +695,7 @@ class spell_illidari_council_balance_of_power : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SHARED_RULE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SHARED_RULE }); } void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& /*absorbAmount*/) @@ -734,9 +729,7 @@ class spell_illidari_council_deadly_strike : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_DEADLY_POISON)) - return false; - return true; + return ValidateSpellInfo({ SPELL_DEADLY_POISON }); } void OnTrigger(AuraEffect const* aurEff) @@ -771,9 +764,7 @@ class spell_illidari_council_deadly_poison : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_ENVENOM)) - return false; - return true; + return ValidateSpellInfo({ SPELL_ENVENOM }); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -806,12 +797,10 @@ class spell_illidari_council_reflective_shield : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_REFLECTIVE_SHIELD_DAMAGE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_REFLECTIVE_SHIELD_DAMAGE }); } - void OnAbsorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) { Unit* target = GetTarget(); if (dmgInfo.GetAttacker() == target) @@ -845,11 +834,12 @@ class spell_illidari_council_judgement : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_JUDGEMENT_OF_BLOOD) - || !sSpellMgr->GetSpellInfo(SPELL_JUDGEMENT_OF_COMMAND) - || !sSpellMgr->GetSpellInfo(SPELL_JUDGEMENT_PRIMER)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_JUDGEMENT_OF_BLOOD, + SPELL_JUDGEMENT_OF_COMMAND, + SPELL_JUDGEMENT_PRIMER + }); } void HandleScript(SpellEffIndex /*effIndex*/) @@ -893,10 +883,11 @@ class spell_illidari_council_seal : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SEAL_OF_COMMAND) - || !sSpellMgr->GetSpellInfo(SPELL_SEAL_OF_BLOOD)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_SEAL_OF_COMMAND, + SPELL_SEAL_OF_BLOOD + }); } void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index d1993aae981..38fa695c5db 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -218,10 +218,11 @@ class spell_mother_shahraz_fatal_attraction : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SABER_LASH_IMMUNITY) - || !sSpellMgr->GetSpellInfo(SPELL_FATAL_ATTRACTION)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_SABER_LASH_IMMUNITY, + SPELL_FATAL_ATTRACTION + }); } void FilterTargets(std::list<WorldObject*>& targets) @@ -265,9 +266,7 @@ class spell_mother_shahraz_fatal_attraction_link : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_FATAL_ATTRACTION_DAMAGE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_FATAL_ATTRACTION_DAMAGE }); } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -299,9 +298,7 @@ class spell_mother_shahraz_saber_lash : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].TriggerSpell)) - return false; - return true; + return ValidateSpellInfo({ spellInfo->Effects[EFFECT_1].TriggerSpell }); } void OnTrigger(AuraEffect const* aurEff) @@ -340,9 +337,7 @@ class spell_mother_shahraz_generic_periodic : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell)) - return false; - return true; + return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); } void OnTrigger(AuraEffect const* aurEff) @@ -378,10 +373,7 @@ class spell_mother_shahraz_random_periodic : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - for (uint32 spellId : RandomBeam) - if (!sSpellMgr->GetSpellInfo(spellId)) - return false; - return true; + return ValidateSpellInfo(RandomBeam); } void OnPeriodic(AuraEffect const* /*aurEffect*/) 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 d5f52b2fc7c..ae3d961ca68 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -16,12 +16,14 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "Player.h" +#include "ScriptedCreature.h" #include "Spell.h" -#include "SpellScript.h" #include "SpellAuraEffects.h" -#include "Player.h" +#include "SpellScript.h" enum Says { @@ -727,9 +729,7 @@ class spell_reliquary_of_souls_aura_of_desire : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_DESIRE_DAMAGE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_AURA_OF_DESIRE_DAMAGE }); } void OnProcSpell(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -809,9 +809,7 @@ class spell_reliquary_of_souls_spite : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SPITE_DAMAGE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_SPITE_DAMAGE }); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) 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 c2131a46696..231fa47fbda 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 "GridNotifiers.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "PassiveAI.h" +#include "ScriptedCreature.h" #include "ScriptedGossip.h" -#include "GridNotifiers.h" -#include "black_temple.h" -#include "SpellScript.h" #include "SpellAuraEffects.h" +#include "SpellScript.h" +#include "TemporarySummon.h" enum Says { @@ -286,7 +290,7 @@ public: void EnterEvadeModeIfNeeded() { - Map::PlayerList const &players = me->GetMap()->GetPlayers(); + Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) if (Player* player = i->GetSource()) if (player->IsAlive() && !player->IsGameMaster() && CheckBoundary(player)) @@ -1200,9 +1204,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 67dfa42b543..e2ec4990ccd 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -16,9 +16,11 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "PassiveAI.h" #include "black_temple.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "PassiveAI.h" +#include "ScriptedCreature.h" enum Texts { diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 0e5d5d26f73..4061eed85ec 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -16,12 +16,15 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "black_temple.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" -#include "SpellScript.h" +#include "ScriptedCreature.h" #include "SpellAuraEffects.h" +#include "SpellScript.h" enum Says { @@ -388,15 +391,16 @@ class spell_teron_gorefiend_shadow_of_death : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SPIRIT) - || !sSpellMgr->GetSpellInfo(SPELL_POSSESS_SPIRIT_IMMUNE) - || !sSpellMgr->GetSpellInfo(SPELL_SPIRITUAL_VENGEANCE) - || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_1) - || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_2) - || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_3) - || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SKELETRON_4)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_SUMMON_SPIRIT, + SPELL_POSSESS_SPIRIT_IMMUNE, + SPELL_SPIRITUAL_VENGEANCE, + SPELL_SUMMON_SKELETRON_1, + SPELL_SUMMON_SKELETRON_2, + SPELL_SUMMON_SKELETRON_3, + SPELL_SUMMON_SKELETRON_4 + }); } void Absorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/) @@ -472,11 +476,12 @@ class spell_teron_gorefiend_shadow_of_death_remove : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_OF_DEATH) - || !sSpellMgr->GetSpellInfo(SPELL_POSSESS_SPIRIT_IMMUNE) - || !sSpellMgr->GetSpellInfo(SPELL_SPIRITUAL_VENGEANCE)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_SHADOW_OF_DEATH, + SPELL_POSSESS_SPIRIT_IMMUNE, + SPELL_SPIRITUAL_VENGEANCE + }); } void RemoveAuras() diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index faaa2887e34..b49ad6e3f20 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -16,13 +16,15 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "GameObjectAI.h" #include "black_temple.h" +#include "GameObjectAI.h" +#include "GridNotifiers.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedCreature.h" #include "SpellInfo.h" #include "SpellScript.h" -#include "GridNotifiers.h" enum Texts { @@ -88,7 +90,7 @@ public: Talk(SAY_DEATH); } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override { if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD)) { @@ -140,7 +142,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.Repeat(Seconds(20), Seconds(25)); @@ -211,9 +213,7 @@ class spell_najentus_needle_spine : public SpellScriptLoader bool Validate(SpellInfo const* /*spellInfo*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_NEEDLE_SPINE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_NEEDLE_SPINE }); } void FilterTargets(std::list<WorldObject*>& targets) diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index a12d920736d..f679428e44e 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -16,8 +16,13 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" +#include "AreaBoundary.h" #include "black_temple.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/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index a468f9714ad..0554505ae74 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,12 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "serpent_shrine.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedEscortAI.h" +#include "serpent_shrine.h" +#include "TemporarySummon.h" enum FathomlordKarathress { @@ -104,7 +107,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 @@ -303,7 +306,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 @@ -341,7 +344,7 @@ public: Creature* Pet = ObjectAccessor::GetCreature(*me, SummonedPet); if (Pet && Pet->IsAlive()) - Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + Pet->DealDamage(Pet, Pet->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); SummonedPet.Clear(); @@ -447,7 +450,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 @@ -569,7 +572,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 @@ -674,9 +677,9 @@ public: if (Heal_Timer <= diff) { // It can be cast on any of the mobs - Unit* unit = NULL; + Unit* unit = nullptr; - while (unit == NULL || !unit->IsAlive()) + while (unit == nullptr || !unit->IsAlive()) unit = selectAdvisorUnit(); if (unit && unit->IsAlive()) @@ -691,7 +694,7 @@ public: Unit* selectAdvisorUnit() { - Unit* unit = NULL; + Unit* unit = nullptr; switch (rand32() % 4) { case 0: 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 a7b00d4ef70..c9727c196ef 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 @@ -217,7 +220,7 @@ public: if (!beam) { SummonBeams(); - beam=true; + beam = true; } //Return since we have no target if (!UpdateVictim()) 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 6e2a0f3c192..e8259aa34dd 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -24,10 +24,16 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" #include "Spell.h" -#include "Player.h" +#include "TemporarySummon.h" #include "WorldSession.h" enum LadyVashj @@ -140,7 +146,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 @@ -257,7 +263,7 @@ public: void EnterCombat(Unit* who) override { // remove old tainted cores to prevent cheating in phase 2 - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) if (Player* player = itr->GetSource()) player->DestroyItemCount(31088, 1, true); @@ -327,7 +333,7 @@ public: } else { - AggroTimer-=diff; + AggroTimer -= diff; return; } } @@ -555,7 +561,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 +656,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 +730,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 +832,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 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 3342b423f14..ced4aeb9fd3 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,14 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" -#include "Player.h" +#include "TemporarySummon.h" enum LeotherasTheBlind { @@ -76,7 +81,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 @@ -153,7 +158,7 @@ public: AttackStart(owner); } else if (owner && owner->isDead()) { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); return; } } @@ -186,7 +191,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 @@ -327,7 +332,7 @@ public: if (instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)) { - Unit* victim = NULL; + Unit* victim = nullptr; victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)); if (victim) me->getThreatManager().addThreat(victim, 1); @@ -514,7 +519,7 @@ public: { //DoCastVictim(SPELL_CHAOS_BLAST, true); int damage = 100; - me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID()); + me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID()); } ChaosBlast_Timer = 3000; } else ChaosBlast_Timer -= diff; @@ -580,7 +585,7 @@ public: //at this point he divides himself in two parts CastConsumingMadness(); DespawnDemon(); - Creature* Copy = NULL; + Creature* Copy = nullptr; Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000); if (Copy) { @@ -608,7 +613,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 @@ -672,7 +677,7 @@ public: { //DoCastVictim(SPELL_CHAOS_BLAST, true); int damage = 100; - me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID()); + me->CastCustomSpell(me->GetVictim(), SPELL_CHAOS_BLAST, &damage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID()); ChaosBlast_Timer = 3000; } } else ChaosBlast_Timer -= diff; @@ -689,7 +694,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 @@ -758,7 +763,7 @@ public: if (!me->IsInCombat() && instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)) { - Unit* victim = NULL; + Unit* victim = nullptr; victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)); if (victim) AttackStart(victim); @@ -778,7 +783,7 @@ public: if (Mindblast_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target)DoCast(target, SPELL_MINDBLAST); @@ -788,7 +793,7 @@ public: if (Earthshock_Timer <= diff) { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { if (Player* i_pl = itr->GetSource()) 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 7337763c298..e93ea5e7ec9 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -24,11 +24,16 @@ SDCategory: The Lurker Below EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "GameObject.h" #include "GameObjectAI.h" +#include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" +#include "Player.h" +#include "ScriptedCreature.h" #include "serpent_shrine.h" #include "Spell.h" -#include "Player.h" +#include "TemporarySummon.h" enum Spells { @@ -84,7 +89,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 @@ -170,7 +175,6 @@ public: } void MoveInLineOfSight(Unit* who) override - { if (!CanStartEvent) // boss is invisible, don't attack return; @@ -239,7 +243,9 @@ public: DoCast(me, SPELL_SUBMERGE); PhaseTimer = 60000; // 60secs submerged Submerged = true; - } else PhaseTimer-=diff; + } + else + PhaseTimer -= diff; if (SpoutTimer <= diff) { @@ -250,19 +256,23 @@ public: WhirlTimer = 20000; // whirl directly after spout RotTimer = 20000; return; - } else SpoutTimer -= diff; + } + else + SpoutTimer -= diff; // Whirl directly after a Spout and at random times if (WhirlTimer <= diff) { WhirlTimer = 18000; DoCast(me, SPELL_WHIRL); - } else WhirlTimer -= diff; + } + else + WhirlTimer -= diff; if (CheckTimer <= diff)//check if there are players in melee range { InRange = false; - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) @@ -272,11 +282,13 @@ public: } } CheckTimer = 2000; - } else CheckTimer -= diff; + } + else + CheckTimer -= diff; if (RotTimer) { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(diff/20000.f*float(M_PI)*2.f, i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater()) @@ -292,7 +304,9 @@ public: if (RotTimer <= diff) { RotTimer = 0; - } else RotTimer -= diff; + } + else + RotTimer -= diff; return; } @@ -304,7 +318,9 @@ public: if (target) DoCast(target, SPELL_GEYSER, true); GeyserTimer = rand32() % 5000 + 15000; - } else GeyserTimer -= diff; + } + else + GeyserTimer -= diff; if (!InRange) // if on players in melee range cast Waterbolt { @@ -316,7 +332,9 @@ public: if (target) DoCast(target, SPELL_WATERBOLT, true); WaterboltTimer = 3000; - } else WaterboltTimer -= diff; + } + else + WaterboltTimer -= diff; } if (!UpdateVictim()) @@ -339,7 +357,9 @@ public: SpoutTimer = 3000; // directly cast Spout after emerging! PhaseTimer = 120000; return; - } else PhaseTimer-=diff; + } + else + PhaseTimer -= diff; if (me->getThreatManager().getThreatList().empty()) // check if should evade { @@ -371,7 +391,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 @@ -421,7 +441,7 @@ public: { int bp0 = 1100; if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastCustomSpell(target, SPELL_SHOOT, &bp0, NULL, NULL, true); + me->CastCustomSpell(target, SPELL_SHOOT, &bp0, nullptr, nullptr, true); ShootBowTimer = 4000 + rand32() % 5000; MultiShotTimer += 1500; // add global cooldown } else ShootBowTimer -= diff; @@ -460,7 +480,7 @@ class go_strange_pool : public GameObjectScript GameObjectAI* GetAI(GameObject* go) const override { - return GetInstanceAI<go_strange_poolAI>(go); + return GetSerpentshrineCavernAI<go_strange_poolAI>(go); } }; 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 8640213703e..02ccdb7f075 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 0844e1a3e0f..4b694ab5861 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -24,11 +24,14 @@ SDCategory: Coilfang Resevoir, Serpent Shrine Cavern EndScriptData */ #include "ScriptMgr.h" +#include "GameObject.h" +#include "GameObjectAI.h" #include "InstanceScript.h" -#include "serpent_shrine.h" +#include "Log.h" +#include "Map.h" #include "Player.h" +#include "serpent_shrine.h" #include "TemporarySummon.h" -#include "GameObjectAI.h" #define MAX_ENCOUNTER 6 @@ -81,14 +84,14 @@ class go_bridge_console : public GameObjectScript GameObjectAI* GetAI(GameObject* go) const override { - return GetInstanceAI<go_bridge_consoleAI>(go); + return GetSerpentshrineCavernAI<go_bridge_consoleAI>(go); } }; 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 { @@ -130,7 +133,7 @@ class instance_serpent_shrine : public InstanceMapScript else Water = WATERSTATE_FRENZY; - Map::PlayerList const &PlayerList = instance->GetPlayers(); + Map::PlayerList const& PlayerList = instance->GetPlayers(); if (PlayerList.isEmpty()) return; for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) @@ -141,12 +144,11 @@ class instance_serpent_shrine : public InstanceMapScript { if (Water == WATERSTATE_SCALDING) { - if (!player->HasAura(SPELL_SCALDINGWATER)) - { player->CastSpell(player, SPELL_SCALDINGWATER, true); - } - } else if (Water == WATERSTATE_FRENZY) + + } + else if (Water == WATERSTATE_FRENZY) { //spawn frenzy if (DoSpawnFrenzy) @@ -390,7 +392,7 @@ class instance_serpent_shrine : public InstanceMapScript return stream.str(); } - void Load(const char* in) override + void Load(char const* in) override { if (!in) { diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h index 0fe6a947e05..0878bb7352d 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,4 +60,10 @@ enum SSDataTypes DATA_TRASH = 25, }; +template <class AI, class T> +inline AI* GetSerpentshrineCavernAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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..cc57cc53ffa 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 @@ -148,7 +149,7 @@ public: Talk(SAY_SLAY); } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override { //hack :( if (spell->Id == SPELL_WARLORDS_RAGE_PROC) 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 e1ee926e85d..be3afe3f2a8 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,12 @@ */ #include "ScriptMgr.h" +#include "Creature.h" +#include "GameObject.h" #include "GameObjectAI.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 ceed2eaaa14..8d0a6136cef 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, class T> -AI* GetSteamVaultAI(T* obj) +template <class AI, class T> +inline AI* GetSteamVaultAI(T* obj) { return GetInstanceAI<AI>(obj, SteamVaultScriptName); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp index f50506784a9..4bbbb8f6a29 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp @@ -15,14 +15,22 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "ScriptMgr.h" #include "CreatureTextMgr.h" +#include "GameObject.h" +#include "GameObjectAI.h" +#include "Group.h" +#include "InstanceScript.h" #include "LFGMgr.h" -#include "ScriptedGossip.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "Player.h" #include "ScriptedCreature.h" -#include "GameObjectAI.h" -#include "ScriptMgr.h" +#include "ScriptedGossip.h" #include "SpellAuraEffects.h" #include "SpellScript.h" +#include "TemporarySummon.h" #include "the_slave_pens.h" enum Spells @@ -280,7 +288,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_ahuneAI>(creature); + return GetSlavePensAI<boss_ahuneAI>(creature); } }; @@ -358,7 +366,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_frozen_coreAI>(creature); + return GetSlavePensAI<npc_frozen_coreAI>(creature); } }; @@ -396,7 +404,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 @@ -510,7 +518,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_ahune_bunnyAI>(creature); + return GetSlavePensAI<npc_ahune_bunnyAI>(creature); } }; @@ -638,7 +646,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<npc_earthen_ring_flamecallerAI>(creature); + return GetSlavePensAI<npc_earthen_ring_flamecallerAI>(creature); } }; @@ -672,7 +680,7 @@ public: GameObjectAI* GetAI(GameObject* go) const override { - return GetInstanceAI<go_ahune_ice_stoneAI>(go); + return GetSlavePensAI<go_ahune_ice_stoneAI>(go); } }; @@ -688,9 +696,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*/) @@ -724,9 +730,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) @@ -742,14 +746,14 @@ public: switch (aurEff->GetTickNumber()) { case 1: - sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_1, NULL, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); + sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_1, nullptr, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); player->CastSpell(player, SPELL_SUMMONING_RHYME_BONFIRE, true); break; case 2: - sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_2, NULL, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); + sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_2, nullptr, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); break; case 3: - sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_3, NULL, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); + sCreatureTextMgr->SendChat(caster, SAY_PLAYER_TEXT_3, nullptr, CHAT_MSG_SAY, LANG_UNIVERSAL, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); Remove(); break; } @@ -779,9 +783,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) @@ -832,9 +834,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*/) @@ -867,9 +867,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) @@ -912,9 +910,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*/) @@ -951,9 +947,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) @@ -1013,9 +1007,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..22650515c90 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 @@ -23,7 +23,9 @@ 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..3127941e392 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 <class AI, class T> +inline AI* GetSlavePensAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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 a21d4238625..9794b7d331a 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..7de1686dfb7 --- /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 <class AI, class T> +inline AI* GetTheUnderbogAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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 1406c118ad1..4d65803a7cd 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -24,9 +24,11 @@ SDCategory: Gruul's Lair EndScriptData */ #include "ScriptMgr.h" +#include "gruuls_lair.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" +#include "SpellInfo.h" #include "SpellScript.h" -#include "gruuls_lair.h" enum Yells { @@ -121,7 +123,7 @@ class boss_gruul : public CreatureScript Talk(SAY_DEATH); } - void SpellHitTarget(Unit* target, const SpellInfo* pSpell) override + void SpellHitTarget(Unit* target, SpellInfo const* pSpell) override { //This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction //It's initially wrong, since this will cause fall damage, which is by comments, not intended. @@ -132,11 +134,11 @@ class boss_gruul : public CreatureScript switch (urand(0, 1)) { case 0: - target->CastSpell(target, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); + target->CastSpell(target, SPELL_MAGNETIC_PULL, true, nullptr, nullptr, me->GetGUID()); break; case 1: - target->CastSpell(target, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); + target->CastSpell(target, SPELL_KNOCK_BACK, true, nullptr, nullptr, me->GetGUID()); break; } } @@ -234,7 +236,7 @@ class boss_gruul : public CreatureScript if (m_uiCaveIn_StaticTimer >= 4000) m_uiCaveIn_StaticTimer -= 2000; - m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer; + m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer; } else m_uiCaveIn_Timer -= diff; @@ -275,11 +277,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*/) @@ -287,7 +285,7 @@ class spell_gruul_shatter : public SpellScriptLoader if (Unit* target = GetHitUnit()) { target->RemoveAurasDueToSpell(SPELL_STONED); - target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); + target->CastSpell((Unit*)nullptr, SPELL_SHATTER_EFFECT, true); } } 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 2d3cd909ff6..b3aafe004a6 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,11 @@ SDCategory: Gruul's Lair EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "gruuls_lair.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" enum HighKingMaulgar { @@ -178,7 +181,7 @@ public: //Charging_Timer if (Charging_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) { @@ -290,7 +293,7 @@ public: //DeathCoil Timer /need correct timer if (DeathCoil_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_DEATH_COIL); @@ -555,7 +558,7 @@ public: //BlastWave_Timer if (BlastWave_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); std::vector<Unit*> target_list; for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) @@ -564,7 +567,7 @@ public: //15 yard radius minimum if (target && target->IsWithinDist(me, 15, false)) target_list.push_back(target); - target = NULL; + target = nullptr; } if (!target_list.empty()) target = *(target_list.begin() + rand32() % target_list.size()); diff --git a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h index dd9017d780d..4497d88ca05 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,10 +47,10 @@ enum GLGameObjectIds GO_GRUUL_DOOR = 184662 }; -template<class AI> -AI* GetGruulsLairAI(Creature* creature) +template <class AI, class T> +inline AI* GetGruulsLairAI(T* obj) { - return GetInstanceAI<AI>(creature, GLScriptName); + return GetInstanceAI<AI>(obj, GLScriptName); } #endif // GRUULS_LAIR_H_ diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index 2145ebee721..55cda953d94 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -16,8 +16,10 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" +#include "Creature.h" #include "gruuls_lair.h" +#include "InstanceScript.h" +#include "Map.h" DoorData const doorData[] = { @@ -52,58 +54,12 @@ class instance_gruuls_lair : public InstanceMapScript void OnCreatureCreate(Creature* creature) override { - switch (creature->GetEntry()) - { - case NPC_MAULGAR: - MaulgarGUID = creature->GetGUID(); - // no break; - case NPC_KROSH_FIREHAND: - case NPC_OLM_THE_SUMMONER: - case NPC_KIGGLER_THE_CRAZED: - case NPC_BLINDEYE_THE_SEER: - AddMinion(creature, true); - break; - default: - break; - } - } + InstanceScript::OnCreatureCreate(creature); - void OnCreatureRemove(Creature* creature) override - { switch (creature->GetEntry()) { case NPC_MAULGAR: - case NPC_KROSH_FIREHAND: - case NPC_OLM_THE_SUMMONER: - case NPC_KIGGLER_THE_CRAZED: - case NPC_BLINDEYE_THE_SEER: - AddMinion(creature, false); - break; - default: - break; - } - } - - void OnGameObjectCreate(GameObject* go) override - { - switch (go->GetEntry()) - { - case GO_MAULGAR_DOOR: - case GO_GRUUL_DOOR: - AddDoor(go, true); - break; - default: - break; - } - } - - void OnGameObjectRemove(GameObject* go) override - { - switch (go->GetEntry()) - { - case GO_MAULGAR_DOOR: - case GO_GRUUL_DOOR: - AddDoor(go, false); + MaulgarGUID = creature->GetGUID(); break; default: break; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h index 942f6fa9e6a..cf8ce2e5024 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, class T> -AI* GetBloodFurnaceAI(T* obj) +template <class AI, class T> +inline AI* GetBloodFurnaceAI(T* obj) { return GetInstanceAI<AI>(obj, BFScriptName); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index ddf51c0821d..69f7a05a634 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -16,11 +16,14 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "blood_furnace.h" +#include "GameObject.h" #include "GameObjectAI.h" -#include "SpellScript.h" +#include "InstanceScript.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" #include "SpellAuraEffects.h" -#include "blood_furnace.h" +#include "SpellScript.h" enum Yells { @@ -166,9 +169,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell)) - return false; - return true; + return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -177,7 +178,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); - GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)NULL, TRIGGERED_FULL_MASK, NULL, aurEff); + GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, mod, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff); } void Register() override 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 f3764c68434..a91669761d1 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,9 +17,11 @@ */ #include "ScriptMgr.h" +#include "blood_furnace.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuras.h" -#include "blood_furnace.h" +#include "TemporarySummon.h" enum Kelidan { 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..e662282b2be 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,11 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "InstanceScript.h" #include "blood_furnace.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "Map.h" +#include "ScriptedCreature.h" DoorData const doorData[] = { @@ -79,17 +81,12 @@ class instance_blood_furnace : public InstanceMapScript void OnGameObjectCreate(GameObject* go) override { + InstanceScript::OnGameObjectCreate(go); + switch (go->GetEntry()) { case GO_PRISON_DOOR_04: PrisonDoor4GUID = go->GetGUID(); - // no break - case GO_PRISON_DOOR_01: - case GO_PRISON_DOOR_02: - case GO_PRISON_DOOR_03: - case GO_PRISON_DOOR_05: - case GO_SUMMON_DOOR: - AddDoor(go, true); break; case GO_BROGGOK_LEVER: BroggokLeverGUID = go->GetGUID(); @@ -123,23 +120,6 @@ class instance_blood_furnace : public InstanceMapScript } } - void OnGameObjectRemove(GameObject* go) override - { - switch (go->GetEntry()) - { - case GO_PRISON_DOOR_01: - case GO_PRISON_DOOR_02: - case GO_PRISON_DOOR_03: - case GO_PRISON_DOOR_04: - case GO_PRISON_DOOR_05: - case GO_SUMMON_DOOR: - AddDoor(go, false); - break; - default: - break; - } - } - ObjectGuid GetGuidData(uint32 type) const override { switch (type) 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 feb8b29ca98..a8914c31b96 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 { @@ -157,7 +158,7 @@ class boss_omor_the_unscarred : public CreatureScript else if (OrbitalStrike_Timer <= diff) { - Unit* temp = NULL; + Unit* temp = nullptr; if (me->IsWithinMeleeRange(me->GetVictim())) temp = me->GetVictim(); else temp = SelectTarget(SELECT_TARGET_RANDOM, 0); @@ -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 7a4651f3f00..ecfecf2073e 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,12 @@ Category: Hellfire Citadel, Hellfire Ramparts EndScriptData */ #include "ScriptMgr.h" +#include "hellfire_ramparts.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" -#include "hellfire_ramparts.h" +#include "TemporarySummon.h" enum Says { @@ -108,7 +111,7 @@ class boss_nazan : public CreatureScript } } - void SpellHitTarget(Unit* target, const SpellInfo* entry) override + void SpellHitTarget(Unit* target, SpellInfo const* entry) override { if (target && entry->Id == uint32(SPELL_FIREBALL)) me->SummonCreature(NPC_LIQUID_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000); @@ -196,7 +199,7 @@ class boss_nazan : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_nazanAI(creature); + return GetHellfireRampartsAI<boss_nazanAI>(creature); } }; @@ -282,7 +285,7 @@ class boss_vazruden : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new boss_vazrudenAI(creature); + return GetHellfireRampartsAI<boss_vazrudenAI>(creature); } }; @@ -454,7 +457,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 +514,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..3137398e766 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 <class AI, class T> +inline AI* GetHellfireRampartsAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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 c4917afd598..bd676f73680 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -16,14 +16,16 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "GameObject.h" +#include "GameObjectAI.h" +#include "InstanceScript.h" #include "magtheridons_lair.h" +#include "PassiveAI.h" #include "Player.h" +#include "ScriptedCreature.h" +#include "SpellAuraEffects.h" #include "SpellInfo.h" #include "SpellScript.h" -#include "SpellAuraEffects.h" -#include "PassiveAI.h" -#include "GameObjectAI.h" enum Yells { @@ -304,7 +306,7 @@ class boss_magtheridon : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_magtheridonAI>(creature); + return GetMagtheridonsLairAI<boss_magtheridonAI>(creature); } }; @@ -422,7 +424,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); } }; @@ -455,7 +457,7 @@ public: CreatureAI* GetAI(Creature* creature) const override { - return new npc_magtheridon_roomAI(creature); + return GetMagtheridonsLairAI<npc_magtheridon_roomAI>(creature); } }; @@ -483,7 +485,7 @@ public: GameObjectAI* GetAI(GameObject* go) const override { - return new go_manticron_cubeAI(go); + return GetMagtheridonsLairAI<go_manticron_cubeAI>(go); } }; @@ -499,9 +501,7 @@ class spell_magtheridon_blaze_target : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_BLAZE)) - return false; - return true; + return ValidateSpellInfo({ SPELL_BLAZE }); } void HandleAura() @@ -534,9 +534,7 @@ class spell_magtheridon_shadow_grasp : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_MIND_EXHAUSTION)) - return false; - return true; + return ValidateSpellInfo({ SPELL_MIND_EXHAUSTION }); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -570,10 +568,11 @@ class spell_magtheridon_shadow_grasp_visual : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_SHADOW_CAGE) - || !sSpellMgr->GetSpellInfo(SPELL_SHADOW_GRASP_VISUAL)) - return false; - return true; + return ValidateSpellInfo( + { + SPELL_SHADOW_CAGE, + SPELL_SHADOW_GRASP_VISUAL + }); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) 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 6ad969c4ab7..087343a83f4 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -16,9 +16,12 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "AreaBoundary.h" +#include "GameObject.h" #include "InstanceScript.h" #include "magtheridons_lair.h" +#include "Map.h" +#include "ScriptedCreature.h" BossBoundaryData const boundaries = { @@ -64,7 +67,7 @@ static MLDataTypes const collapseObjectDatas[] = class instance_magtheridons_lair : public InstanceMapScript { public: - instance_magtheridons_lair() : InstanceMapScript("instance_magtheridons_lair", 544) { } + instance_magtheridons_lair() : InstanceMapScript(MLScriptName, 544) { } struct instance_magtheridons_lair_InstanceMapScript : public InstanceScript { diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h index 7ed1ab9ebaa..2b330222d6d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h @@ -18,6 +18,9 @@ #ifndef DEF_MAGTHERIDONS_LAIR_H #define DEF_MAGTHERIDONS_LAIR_H +#include "CreatureAIImpl.h" + +#define MLScriptName "instance_magtheridons_lair" #define DataHeader "ML" uint32 const EncounterCount = 1; @@ -71,4 +74,10 @@ enum MLGameObjectIds GO_MAGTHERIDON_COLUMN_5 = 184637 }; +template <class AI, class T> +inline AI* GetMagtheridonsLairAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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 2bf0b1870fb..b6dcb21af5c 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 08b442e033b..4d51aa67447 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,9 @@ boss_warchief_kargath_bladefist EndContentData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "shattered_halls.h" @@ -331,7 +334,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 156100f1316..f4fa4ab4cde 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 "ScriptedCreature.h" -#include "SpellScript.h" -#include "SpellAuraEffects.h" #include "InstanceScript.h" +#include "Map.h" #include "Player.h" -#include "SpellAuras.h" +#include "ScriptedCreature.h" #include "shattered_halls.h" +#include "SpellAuraEffects.h" +#include "SpellAuras.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 { @@ -92,35 +94,11 @@ class instance_shattered_halls : public InstanceMapScript ex->SetDuration(executionTimer); } - void OnGameObjectCreate(GameObject* go) override - { - switch (go->GetEntry()) - { - case GO_GRAND_WARLOCK_CHAMBER_DOOR_1: - case GO_GRAND_WARLOCK_CHAMBER_DOOR_2: - AddDoor(go, true); - default: - break; - } - } - - void OnGameObjectRemove(GameObject* go) override - { - switch (go->GetEntry()) - { - case GO_GRAND_WARLOCK_CHAMBER_DOOR_1: - case GO_GRAND_WARLOCK_CHAMBER_DOOR_2: - AddDoor(go, false); - default: - break; - } - } - void OnCreatureCreate(Creature* creature) override { if (!_team) { - Map::PlayerList const &players = instance->GetPlayers(); + Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) if (Player* player = players.begin()->GetSource()) _team = player->GetTeam(); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp index 3dad650b782..45fc8df0d1a 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 "shattered_halls.h" +#include "SpellScript.h" +#include "TemporarySummon.h" class at_nethekurse_exit : public AreaTriggerScript { @@ -109,7 +110,7 @@ class boss_shattered_executioner : public CreatureScript if (instance->GetData(DATA_PRISONERS_EXECUTED) > 0) return; - Map::PlayerList const &players = instance->instance->GetPlayers(); + Map::PlayerList const& players = instance->instance->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pl = itr->GetSource(); @@ -128,7 +129,7 @@ class boss_shattered_executioner : public CreatureScript if (data == 1) { - Map::PlayerList const &players = instance->instance->GetPlayers(); + Map::PlayerList const& players = instance->instance->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pl = itr->GetSource(); @@ -173,7 +174,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..50483e6f518 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h @@ -19,6 +19,9 @@ #ifndef DEF_SHATTERED_H #define DEF_SHATTERED_H +#include "CreatureAIImpl.h" + +#define SHScriptName "instance_shattered_halls" #define DataHeader "SH" uint32 const EncounterCount = 4; @@ -88,27 +91,32 @@ enum SHActions ACTION_EXECUTIONER_TAUNT = 1 }; -const Position Executioner = { 152.8524f, -83.63912f, 2.021005f, 0.06981317f }; +Position const Executioner = { 152.8524f, -83.63912f, 2.021005f, 0.06981317f }; struct FactionSpawnerHelper { - FactionSpawnerHelper(uint32 allianceEntry, uint32 hordeEntry, const Position& pos) : _allianceNPC(allianceEntry), _hordeNPC(hordeEntry), _spawnPos(pos) { } + FactionSpawnerHelper(uint32 allianceEntry, uint32 hordeEntry, Position const& pos) : _allianceNPC(allianceEntry), _hordeNPC(hordeEntry), _spawnPos(pos) { } inline uint32 operator()(uint32 teamID) const { return teamID == ALLIANCE ? _allianceNPC : _hordeNPC; } 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] = +FactionSpawnerHelper const executionerVictims[VictimCount] = { { NPC_CAPTAIN_ALINA, NPC_CAPTAIN_BONESHATTER, { 138.8807f, -84.22707f, 1.992269f, 0.06981317f } }, { NPC_ALLIANCE_VICTIM_1, NPC_HORDE_VICTIM_1, { 151.2411f, -91.02930f, 2.019741f, 1.57079600f } }, { NPC_ALLIANCE_VICTIM_2, NPC_HORDE_VICTIM_2, { 151.0459f, -77.51981f, 2.021008f, 4.74729500f } } }; +template <class AI, class T> +inline AI* GetShatteredHallsAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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 07d833bb234..4e891c9ba7a 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -24,9 +24,13 @@ SDCategory: Tempest Keep, The Eye EndScriptData */ #include "ScriptMgr.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" -#include "the_eye.h" #include "SpellInfo.h" +#include "TemporarySummon.h" +#include "the_eye.h" enum Spells { @@ -185,13 +189,13 @@ class boss_alar : public CreatureScript } } - void SpellHit(Unit*, const SpellInfo* spell) override + void SpellHit(Unit*, SpellInfo const* spell) override { if (spell->Id == SPELL_DIVE_BOMB_VISUAL) { me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); me->SetDisplayId(11686); - //me->SendUpdateObjectToAllExcept(NULL); + //me->SendUpdateObjectToAllExcept(nullptr); } } @@ -432,7 +436,7 @@ class boss_alar : public CreatureScript } else { - Unit* target = NULL; + Unit* target = nullptr; target = me->SelectNearestTargetInAttackDistance(5); if (target) AttackStart(target); @@ -448,7 +452,7 @@ class boss_alar : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_alarAI>(creature); + return GetTheEyeAI<boss_alarAI>(creature); } }; @@ -520,7 +524,7 @@ class npc_ember_of_alar : public CreatureScript if (toDie) { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); //me->SetVisibility(VISIBILITY_OFF); } @@ -531,7 +535,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 +557,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 3ba299d2ea0..813910f5bc5 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 "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "SpellAuras.h" #include "SpellScript.h" -#include "SpellAuraEffects.h" - +#include "TemporarySummon.h" #include "the_eye.h" enum Yells @@ -289,7 +292,7 @@ class boss_high_astromancer_solarian : public CreatureScript //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind. me->GetMotionMaster()->Clear(); me->UpdatePosition(CENTER_X, CENTER_Y, CENTER_Z, CENTER_O); - for (uint8 i=0; i <= 2; ++i) + for (uint8 i = 0; i <= 2; ++i) { if (!i) { @@ -306,15 +309,15 @@ class boss_high_astromancer_solarian : public CreatureScript } if ((std::abs(Portals[2][0] - Portals[1][0]) < 7) && (std::abs(Portals[2][1] - Portals[1][1]) < 7)) { - int i=1; + int i = 1; if (std::abs(CENTER_X + 26.0f - Portals[2][0]) < 7) i = -1; - Portals[2][0] = Portals[2][0]+7*i; + Portals[2][0] = Portals[2][0] + 7 * i; Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS); } - for (int i=0; i <= 2; ++i) + for (int i = 0; i <= 2; ++i) { - if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer+Phase3_Timer+AppearDelay_Timer+1700)) + if (Creature* Summoned = me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer + Phase3_Timer + AppearDelay_Timer + 1700)) { Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Summoned->CastSpell(Summoned, SPELL_SPOTLIGHT, false); @@ -323,7 +326,7 @@ class boss_high_astromancer_solarian : public CreatureScript AppearDelay = true; } else - Phase1_Timer-=diff; + Phase1_Timer -= diff; } else if (Phase == 2) { @@ -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); } }; @@ -455,7 +458,7 @@ class npc_solarium_priest : public CreatureScript if (healTimer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; switch (urand(0, 1)) { case 0: @@ -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 09e360a3b87..78ba67004bc 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -24,8 +24,13 @@ SDCategory: Tempest Keep, The Eye EndScriptData */ #include "ScriptMgr.h" +#include "GameObject.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "Spell.h" +#include "SpellInfo.h" #include "SpellScript.h" #include "the_eye.h" @@ -864,7 +869,7 @@ class boss_kaelthas : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return GetInstanceAI<boss_kaelthasAI>(creature); + return GetTheEyeAI<boss_kaelthasAI>(creature); } }; @@ -969,7 +974,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); } }; @@ -1033,7 +1038,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); } }; @@ -1119,7 +1124,7 @@ class boss_grand_astromancer_capernian : public CreatureScript //Conflagration_Timer if (Conflagration_Timer <= diff) { - Unit* target = NULL; + Unit* target = nullptr; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target && me->IsWithinDistInMap(target, 30)) @@ -1136,8 +1141,8 @@ class boss_grand_astromancer_capernian : public CreatureScript if (ArcaneExplosion_Timer <= diff) { bool InMeleeRange = false; - Unit* target = NULL; - ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); + Unit* target = nullptr; + ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i!= threatlist.end(); ++i) { Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); @@ -1164,7 +1169,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); } }; @@ -1243,7 +1248,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); } }; @@ -1313,7 +1318,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); } }; @@ -1372,7 +1377,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); } }; @@ -1438,7 +1443,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); } }; @@ -1460,11 +1465,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..962228a215a 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" @@ -110,7 +111,7 @@ class boss_void_reaver : public CreatureScript break; case EVENT_ARCANE_ORB: { - Unit* target = NULL; + Unit* target = nullptr; std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); std::vector<Unit*> target_list; for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) @@ -121,7 +122,7 @@ class boss_void_reaver : public CreatureScript // exclude pets & totems, 18 yard radius minimum if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive() && !target->IsWithinDist(me, 18, false)) target_list.push_back(target); - target = NULL; + target = nullptr; } if (!target_list.empty()) @@ -130,7 +131,7 @@ class boss_void_reaver : public CreatureScript target = me->GetVictim(); if (target) - me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL); + me->CastSpell(target, SPELL_ARCANE_ORB, false, nullptr, nullptr); events.ScheduleEvent(EVENT_ARCANE_ORB, 3000); break; @@ -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..71471909f6b 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 { @@ -106,13 +108,13 @@ class instance_the_eye : public InstanceMapScript { switch (identifier) { - case DATA_THALADREDTHEDARKENER: return ThaladredTheDarkener; - case DATA_LORDSANGUINAR: return LordSanguinar; - case DATA_GRANDASTROMANCERCAPERNIAN: return GrandAstromancerCapernian; - case DATA_MASTERENGINEERTELONICUS: return MasterEngineerTelonicus; - case DATA_KAELTHAS: return Kaelthas; - case DATA_HIGH_ASTROMANCER_SOLARIAN: return Astromancer; - case DATA_ALAR: return Alar; + case DATA_THALADREDTHEDARKENER: return ThaladredTheDarkener; + case DATA_LORDSANGUINAR: return LordSanguinar; + case DATA_GRANDASTROMANCERCAPERNIAN: return GrandAstromancerCapernian; + case DATA_MASTERENGINEERTELONICUS: return MasterEngineerTelonicus; + case DATA_KAELTHAS: return Kaelthas; + case DATA_HIGH_ASTROMANCER_SOLARIAN: return Astromancer; + case DATA_ALAR: return Alar; } return ObjectGuid::Empty; } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp index feabaf8e701..1cbb522552c 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp @@ -110,7 +110,7 @@ class npc_crystalcore_devastator : public CreatureScript CreatureAI* GetAI(Creature* creature) const override { - return new npc_crystalcore_devastatorAI(creature); + return GetTheEyeAI<npc_crystalcore_devastatorAI>(creature); } }; void AddSC_the_eye() diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h index 1111e2409f5..1ac735f750c 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 <class AI, class T> +inline AI* GetTheEyeAI(T* obj) +{ + return GetInstanceAI<AI>(obj, 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 19036555787..4d804355423 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,10 +16,11 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "SpellScript.h" #include "mechanar.h" #include "Player.h" +#include "ScriptedCreature.h" +#include "SpellInfo.h" +#include "SpellScript.h" enum Spells { @@ -155,7 +156,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); } }; @@ -170,15 +171,13 @@ 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) @@ -238,9 +237,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 */) @@ -248,7 +245,7 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader Unit* target = GetHitUnit(); Unit* caster = GetCaster(); - target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID()); + target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, nullptr, nullptr, caster->GetGUID()); } void Register() override 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 483cf3284c3..15f70ada7a7 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,10 @@ SDCategory: Tempest Keep, The Mechanar EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "InstanceScript.h" #include "mechanar.h" +#include "MotionMaster.h" +#include "ScriptedCreature.h" enum Says { @@ -141,7 +143,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 +231,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 9ddca823d9e..25bbfe0392a 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..5b5c2beb7dd 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -18,20 +18,21 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "Map.h" #include "mechanar.h" static DoorData const doorData[] = { { GO_DOOR_MOARG_1, DATA_GATEWATCHER_IRON_HAND, DOOR_TYPE_PASSAGE }, { GO_DOOR_MOARG_2, DATA_GATEWATCHER_GYROKILL, DOOR_TYPE_PASSAGE }, - { GO_DOOR_NETHERMANCER, DATA_NETHERMANCER_SEPRETHREA, DOOR_TYPE_ROOM }, - { 0, 0, DOOR_TYPE_ROOM } + { GO_DOOR_NETHERMANCER, DATA_NETHERMANCER_SEPRETHREA, DOOR_TYPE_ROOM }, + { 0, 0, DOOR_TYPE_ROOM } }; class instance_mechanar : public InstanceMapScript { public: - instance_mechanar(): InstanceMapScript("instance_mechanar", 554) { } + instance_mechanar(): InstanceMapScript(MechanarScriptName, 554) { } struct instance_mechanar_InstanceMapScript : public InstanceScript { @@ -42,34 +43,6 @@ class instance_mechanar : public InstanceMapScript LoadDoorData(doorData); } - void OnGameObjectCreate(GameObject* gameObject) override - { - switch (gameObject->GetEntry()) - { - case GO_DOOR_MOARG_1: - case GO_DOOR_MOARG_2: - case GO_DOOR_NETHERMANCER: - AddDoor(gameObject, true); - break; - default: - break; - } - } - - void OnGameObjectRemove(GameObject* gameObject) override - { - switch (gameObject->GetEntry()) - { - case GO_DOOR_MOARG_1: - case GO_DOOR_MOARG_2: - case GO_DOOR_NETHERMANCER: - AddDoor(gameObject, false); - break; - default: - break; - } - } - bool SetBossState(uint32 type, EncounterState state) override { if (!InstanceScript::SetBossState(type, state)) diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h index 35494c745f8..b4edfd9c74e 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 <class AI, class T> +inline AI* GetMechanarAI(T* obj) +{ + return GetInstanceAI<AI>(obj, MechanarScriptName); +} + #endif diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 6c469601efc..d571c155dbe 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -30,8 +30,10 @@ npc_zerekethvoidzone EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ScriptedCreature.h" /*##### # npc_millhouse_manastorm @@ -549,7 +551,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..2ccf1684860 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,10 +64,10 @@ enum AZGameObjectIds GO_WARDENS_SHIELD = 184802 // shield 'protecting' mellichar }; -template<class AI> -AI* GetArcatrazAI(Creature* creature) +template <class AI, class T> +inline AI* GetArcatrazAI(T* obj) { - return GetInstanceAI<AI>(creature, ArcatrazScriptName); + return GetInstanceAI<AI>(obj, ArcatrazScriptName); } #endif // ARCATRAZ_H 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..561dbaa8c5a 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,11 @@ SDCategory: Tempest Keep, The Arcatraz EndScriptData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" #include "arcatraz.h" +#include "InstanceScript.h" +#include "MotionMaster.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..bb21b999d5d 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 @@ -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..ba5b7b7e0a5 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[] = { @@ -64,12 +67,10 @@ class instance_arcatraz : public InstanceMapScript void OnGameObjectCreate(GameObject* go) override { + InstanceScript::OnGameObjectCreate(go); + switch (go->GetEntry()) { - case GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: - case GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA: - AddDoor(go, true); - break; case GO_STASIS_POD_ALPHA: StasisPodGUIDs[0] = go->GetGUID(); break; @@ -93,19 +94,6 @@ class instance_arcatraz : public InstanceMapScript } } - void OnGameObjectRemove(GameObject* go) override - { - switch (go->GetEntry()) - { - case GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: - case GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA: - AddDoor(go, false); - break; - default: - break; - } - } - void SetData(uint32 type, uint32 data) override { switch (type) 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..204a52609b0 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,8 @@ SDCategory: Tempest Keep, The Botanica EndScriptData */ #include "ScriptMgr.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "the_botanica.h" @@ -210,7 +212,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 6980ca054e9..291be813dc1 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,10 @@ SDCategory: Tempest Keep, The Botanica EndScriptData */ #include "ScriptMgr.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ScriptedCreature.h" +#include "TemporarySummon.h" #include "the_botanica.h" enum Says @@ -94,7 +97,6 @@ class npc_warp_splinter_treant : public CreatureScript void MoveInLineOfSight(Unit* /*who*/) override { } - void UpdateAI(uint32 diff) override { if (!UpdateVictim() || !me->GetVictim()) @@ -107,7 +109,7 @@ class npc_warp_splinter_treant : public CreatureScript { int32 CurrentHP_Treant = (int32)me->GetHealth(); Warp->CastCustomSpell(Warp, SPELL_HEAL_FATHER, &CurrentHP_Treant, 0, 0, true, 0, 0, me->GetGUID()); - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); return; } me->GetMotionMaster()->MoveFollow(Warp, 0, 0); @@ -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..55a4be28e33 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 <class AI, class T> +inline AI* GetBotanicaAI(T* obj) +{ + return GetInstanceAI<AI>(obj, BotanicaScriptName); +} + #endif diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 4d8ca8ff2be..93ea132a545 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -187,9 +187,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*/) @@ -204,7 +202,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader if (target->GetPower(POWER_MANA) == 0) { - target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, NULL, aurEff); + target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff); // Remove aura SetDuration(0); } @@ -234,9 +232,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 e3e39d0c27e..1bad0a75231 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -30,17 +30,19 @@ go_legion_obelisk EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" +#include "CellImpl.h" +#include "CreatureAIImpl.h" #include "GameObjectAI.h" -#include "ScriptedGossip.h" -#include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "Cell.h" -#include "CellImpl.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "SpellAuraEffects.h" +#include "SpellAuras.h" #include "SpellInfo.h" #include "SpellScript.h" -#include "SpellAuras.h" -#include "SpellAuraEffects.h" +#include "TemporarySummon.h" /*###### ## npc_nether_drake @@ -125,7 +127,7 @@ public: me->DespawnOrUnsummon(1); } - void SpellHit(Unit* caster, const SpellInfo* spell) override + void SpellHit(Unit* caster, SpellInfo const* spell) override { if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER) { @@ -842,7 +844,7 @@ class npc_simon_bunny : public CreatureScript } } - void SpellHitTarget(Unit* target, const SpellInfo* spell) override + void SpellHitTarget(Unit* target, SpellInfo const* spell) override { // Cast SPELL_BAD_PRESS_DAMAGE with scaled basepoints when the visual hits the target. // Need Fix: When SPELL_BAD_PRESS_TRIGGER hits target it triggers spell SPELL_BAD_PRESS_DAMAGE by itself @@ -850,7 +852,7 @@ class npc_simon_bunny : public CreatureScript if (spell->Id == SPELL_BAD_PRESS_TRIGGER) { int32 bp = (int32)((float)(fails)*0.33f*target->GetMaxHealth()); - target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, NULL, NULL, true); + target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, nullptr, nullptr, true); } } @@ -987,7 +989,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 e5bf6b87386..7c80a20aba9 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -31,10 +31,12 @@ npc_fel_guard_hound EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "Log.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "WorldSession.h" /*###### diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp index 6908e705a8e..ce71c80e5f0 100644 --- a/src/server/scripts/Outland/zone_nagrand.cpp +++ b/src/server/scripts/Outland/zone_nagrand.cpp @@ -27,13 +27,16 @@ 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 "GameObjectAI.h" +#include "MotionMaster.h" #include "Player.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "SpellInfo.h" +#include "TemporarySummon.h" /*###### ## npc_maghar_captive @@ -141,7 +144,7 @@ public: } - void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) override + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override { if (spell->Id == SPELL_CHAIN_LIGHTNING) { @@ -514,7 +517,7 @@ public: summoned->AI()->AttackStart(me); } - void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) override + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override { if (spell->Id == SPELL_KUR_CHAIN_LIGHTNING) { diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 6bb351169a3..8f8fc39a2b3 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -31,11 +31,13 @@ go_captain_tyralius_prison EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "GameObject.h" #include "GameObjectAI.h" +#include "Log.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" /*###### ## npc_commander_dawnforge @@ -316,7 +318,7 @@ class at_commander_dawnforge : public AreaTriggerScript public: at_commander_dawnforge() : AreaTriggerScript("at_commander_dawnforge") { } - bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) override + bool OnTrigger(Player* player, AreaTriggerEntry const* /*at*/) override { //if player lost aura or not have at all, we should not try start event. if (!player->HasAura(SPELL_SUNFURY_DISGUISE)) @@ -407,7 +409,7 @@ public: PlayerGUID = who->GetGUID(); } - //void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) override + //void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) override //{ // DoCast(me, SPELL_DE_MATERIALIZE); //} @@ -612,7 +614,7 @@ public: // take the GO -> animation me->HandleEmoteCommand(EMOTE_STATE_LOOT); SetEscortPaused(true); - bTake=true; + bTake = true; } break; case 36: //return and quest_complete @@ -639,7 +641,7 @@ public: if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE)) { SetEscortPaused(false); - bTake=false; + bTake = false; uiTakeTimer = 3000; go->Delete(); } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 9ab9b9b4eb3..9e89c34fe72 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -37,14 +37,17 @@ npc_enraged_spirit EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "GameObject.h" #include "GameObjectAI.h" #include "Group.h" -#include "SpellScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "Player.h" -#include "WorldSession.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "TemporarySummon.h" /*##### # npc_invis_infernal_caster @@ -75,7 +78,8 @@ public: void Reset() override { - ground = me->GetMap()->GetHeight(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)); } @@ -159,7 +163,7 @@ public: caster->AI()->SetData(TYPE_INFERNAL, DATA_DIED); } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override { if (spell->Id == SPELL_SUMMON_INFERNAL) { @@ -378,7 +382,7 @@ public: me->SetDisableGravity(false); } - void SpellHit(Unit* caster, const SpellInfo* spell) override + void SpellHit(Unit* caster, SpellInfo const* spell) override { if (!caster) return; @@ -507,7 +511,7 @@ public: Initialize(); } - void SpellHit(Unit* caster, const SpellInfo* spell) override + void SpellHit(Unit* caster, SpellInfo const* spell) override { if (!caster) return; @@ -550,7 +554,7 @@ public: player->KilledMonsterCredit(23209); } PoisonTimer = 0; - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->DealDamage(me, me->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); } else PoisonTimer -= diff; } if (!UpdateVictim()) @@ -1463,8 +1467,8 @@ public: } // Spawn Soul on Kill ALWAYS! - Creature* Summoned = NULL; - Unit* totemOspirits = NULL; + Creature* Summoned = nullptr; + Unit* totemOspirits = nullptr; if (entry != 0) Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000); @@ -1559,7 +1563,7 @@ public: } } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override { if (spell->Id == SPELL_WHISTLE) { diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index e1ef8991aa8..1ccb7950fa0 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -33,12 +33,12 @@ npc_slim EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "GameObject.h" #include "GameObjectAI.h" #include "Group.h" #include "Player.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "WorldSession.h" /*###### @@ -110,7 +110,7 @@ public: { if (Group* group = player->GetGroup()) { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* groupie = itr->GetSource(); if (groupie && groupie->IsInMap(player) && diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index 52263d56879..fabf7290129 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -287,13 +287,13 @@ public: { ItemPosCountVec dest; uint32 itemId = 24573; - InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, NULL); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, nullptr); if (msg == EQUIP_ERR_OK) { player->StoreNewItem(dest, itemId, true); } else - player->SendEquipError(msg, NULL, NULL, itemId); + player->SendEquipError(msg, nullptr, nullptr, itemId); } SendGossipMenuFor(player, 9231, me->GetGUID()); break; |
