aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptMgr.h
diff options
context:
space:
mode:
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