mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 20:13:48 +00:00
feat(Core/Instance): Add instance validation for creature scripts (#4596)
This commit is contained in:
@@ -1,18 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
* Copyright (C) 2008-2018 TrinityCore <https://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 AUCHENAI_CRYPTS_H_
|
||||
@@ -32,4 +20,10 @@ enum ACDataTypes
|
||||
DATA_EXARCH_MALADAAR = 1
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetAuchenaiCryptsAI(T* obj)
|
||||
{
|
||||
return GetInstanceAI<AI>(obj, ACScriptName);
|
||||
}
|
||||
|
||||
#endif // AUCHENAI_CRYPTS_H_
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#include "auchenai_crypts.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
@@ -35,7 +36,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
|
||||
@@ -162,7 +163,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
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#include "auchenai_crypts.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -39,7 +40,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
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Player.h"
|
||||
#include "mana_tombs.h"
|
||||
|
||||
enum ePrince
|
||||
{
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_nexusprince_shaffarAI (creature);
|
||||
return GetManaTombsAI<boss_nexusprince_shaffarAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
@@ -167,7 +168,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_yorAI(creature);
|
||||
return GetManaTombsAI<npc_yorAI>(creature);
|
||||
}
|
||||
|
||||
struct npc_yorAI : public ScriptedAI
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "mana_tombs.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -35,7 +36,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_pandemoniusAI(creature);
|
||||
return GetManaTombsAI<boss_pandemoniusAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_pandemoniusAI : public ScriptedAI
|
||||
|
||||
@@ -34,4 +34,10 @@ enum MTDataTypes
|
||||
DATA_YOR = 3
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetManaTombsAI(T* obj)
|
||||
{
|
||||
return GetInstanceAI<AI>(obj, MTScriptName);
|
||||
}
|
||||
|
||||
#endif // MANA_TOMBS_H_
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_talon_king_ikissAI (creature);
|
||||
return GetSethekkHallsAI<boss_talon_king_ikissAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_talon_king_ikissAI : public ScriptedAI
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_anzuAI (creature);
|
||||
return GetSethekkHallsAI<boss_anzuAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_anzuAI : public ScriptedAI
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#ifndef DEF_SETHEKK_HALLS_H
|
||||
#define DEF_SETHEKK_HALLS_H
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#define SethekkHallsScriptName "instance_sethekk_halls"
|
||||
|
||||
enum eTypes
|
||||
{
|
||||
DATA_IKISSDOOREVENT = 1,
|
||||
@@ -20,4 +24,10 @@ enum eIds
|
||||
GO_THE_TALON_KINGS_COFFER = 187372
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetSethekkHallsAI(T* obj)
|
||||
{
|
||||
return GetInstanceAI<AI>(obj, SethekkHallsScriptName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_ambassador_hellmawAI(creature);
|
||||
return GetShadowLabyrinthAI<boss_ambassador_hellmawAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_ambassador_hellmawAI : public npc_escortAI
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_blackheart_the_inciterAI (creature);
|
||||
return GetShadowLabyrinthAI<boss_blackheart_the_inciterAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_blackheart_the_inciterAI : public ScriptedAI
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_grandmaster_vorpilAI (creature);
|
||||
return GetShadowLabyrinthAI<boss_grandmaster_vorpilAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_grandmaster_vorpilAI : public ScriptedAI
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_voidtravelerAI (creature);
|
||||
return GetShadowLabyrinthAI<npc_voidtravelerAI>(creature);
|
||||
}
|
||||
|
||||
struct npc_voidtravelerAI : public ScriptedAI
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new boss_murmurAI (creature);
|
||||
return GetShadowLabyrinthAI<boss_murmurAI>(creature);
|
||||
}
|
||||
|
||||
struct boss_murmurAI : public ScriptedAI
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
#define DEF_SHADOW_LABYRINTH_H
|
||||
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
#define ShadowLabyrinthScriptName "instance_shadow_labyrinth"
|
||||
|
||||
enum slData
|
||||
{
|
||||
TYPE_OVERSEER = 0,
|
||||
@@ -28,4 +31,10 @@ enum slNPCandGO
|
||||
SCREAMING_HALL_DOOR = 183295 //door opened when grandmaster vorpil dies
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetShadowLabyrinthAI(T* obj)
|
||||
{
|
||||
return GetInstanceAI<AI>(obj, ShadowLabyrinthScriptName);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user