Core/World: implement database support for default map and realm wide world states

Co-Authored-By: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Shauren
2022-06-25 22:48:27 +02:00
parent e708bd28d1
commit 737d94d7ef
10 changed files with 331 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ struct MapEntry;
struct Position;
struct QuestObjective;
struct SceneTemplate;
struct WorldStateTemplate;
namespace Trinity::ChatCommands { struct ChatCommandBuilder; }
@@ -987,6 +988,20 @@ class TC_GAME_API QuestScript : public ScriptObject
virtual void OnQuestObjectiveChange(Player* /*player*/, Quest const* /*quest*/, QuestObjective const& /*objective*/, int32 /*oldAmount*/, int32 /*newAmount*/) { }
};
class TC_GAME_API WorldStateScript : public ScriptObject
{
protected:
WorldStateScript(char const* name);
public:
~WorldStateScript();
// Called when worldstate changes value, map is optional
virtual void OnValueChange([[maybe_unused]] int32 worldStateId, [[maybe_unused]] int32 oldValue, [[maybe_unused]] int32 newValue, [[maybe_unused]] Map const* map) { }
};
// Manages registration, loading, and execution of scripts.
class TC_GAME_API ScriptMgr
{
@@ -1289,6 +1304,10 @@ class TC_GAME_API ScriptMgr
void OnQuestAcknowledgeAutoAccept(Player* player, Quest const* quest);
void OnQuestObjectiveChange(Player* player, Quest const* quest, QuestObjective const& objective, int32 oldAmount, int32 newAmount);
public: /* WorldStateScript */
void OnWorldStateValueChange(WorldStateTemplate const* worldStateTemplate, int32 oldValue, int32 newValue, Map const* map);
private:
uint32 _scriptCount;
bool _scriptIdUpdated;