aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptMgr.h
diff options
context:
space:
mode:
authorJeremy <Golrag@users.noreply.github.com>2024-03-28 19:29:22 +0100
committerfunjoker <funjoker109@gmail.com>2024-03-28 20:38:55 +0100
commitd0d5d309bb5877dc2fcb27f6cb123707a31ec1e8 (patch)
treef487ecb6ff8fd052357ea582ffa630027dc8bd07 /src/server/game/Scripting/ScriptMgr.h
parentaefa15ece72bccdeb47cbdbdc75df87837c9da00 (diff)
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)
Diffstat (limited to 'src/server/game/Scripting/ScriptMgr.h')
-rw-r--r--src/server/game/Scripting/ScriptMgr.h30
1 files changed, 15 insertions, 15 deletions
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>(#ai_name)
+template<class Script>
+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>(#script_name, mapId)
+
#define sScriptMgr ScriptMgr::instance()
#endif