From d0d5d309bb5877dc2fcb27f6cb123707a31ec1e8 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 28 Mar 2024 19:29:22 +0100 Subject: Core/Battlegrounds: Move to scripts (#29799) * Introduce new BattlegroundScript class for map/bg specific scripts * Remove all sub, zone specific, battleground classes except Arena * Move all bg zone scripts to new BattlegroundScripts class in script folder * Remove ZoneScript from Battleground class * Remove some unused hooks from Battleground (cherry picked from commit be11f42a16d1fa0482e9572bf54e99e4dedd3c78) --- src/server/game/Scripting/ScriptMgr.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/server/game/Scripting/ScriptMgr.h') diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index fe3fb48df79..31a5842a383 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -35,6 +35,7 @@ class AuraScript; class Battlefield; class Battleground; class BattlegroundMap; +class BattlegroundScript; class Channel; class Conversation; class Creature; @@ -372,6 +373,9 @@ class TC_GAME_API BattlegroundMapScript : public ScriptObject, public MapScript< public: ~BattlegroundMapScript(); + + // Gets an BattlegroundScript object for this battleground. + virtual BattlegroundScript* GetBattlegroundScript(BattlegroundMap* map) const; }; class TC_GAME_API ItemScript : public ScriptObject @@ -501,20 +505,6 @@ class TC_GAME_API BattlefieldScript : public ScriptObject virtual Battlefield* GetBattlefield(Map* map) const = 0; }; -class TC_GAME_API BattlegroundScript : public ScriptObject -{ - protected: - - explicit BattlegroundScript(char const* name); - - public: - - ~BattlegroundScript(); - - // Should return a fully valid Battleground object for the type ID. - virtual Battleground* GetBattleground() const = 0; -}; - class TC_GAME_API OutdoorPvPScript : public ScriptObject { protected: @@ -1151,7 +1141,7 @@ class TC_GAME_API ScriptMgr public: /* BattlegroundScript */ - Battleground* CreateBattleground(BattlegroundTypeId typeId); + BattlegroundScript* CreateBattlegroundData(BattlegroundMap* map); public: /* OutdoorPvPScript */ @@ -1415,6 +1405,16 @@ class GenericAreaTriggerEntityScript : public AreaTriggerEntityScript }; #define RegisterAreaTriggerAI(ai_name) new GenericAreaTriggerEntityScript(#ai_name) +template +class GenericBattlegroundMapScript : public BattlegroundMapScript +{ +public: + GenericBattlegroundMapScript(char const* name, uint32 mapId) : BattlegroundMapScript(name, mapId) { } + + BattlegroundScript* GetBattlegroundScript(BattlegroundMap* map) const override { return new Script(map); } +}; +#define RegisterBattlegroundMapScript(script_name, mapId) new GenericBattlegroundMapScript(#script_name, mapId) + #define sScriptMgr ScriptMgr::instance() #endif -- cgit v1.2.3