mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
Core/Hooks: Adds hooks for start and stop game events (#1472)
This commit is contained in:
committed by
Kargatum
parent
23d78ce6bc
commit
3a39aaeed5
@@ -60,6 +60,7 @@ template class ScriptRegistry<MovementHandlerScript>;
|
||||
template class ScriptRegistry<BGScript>;
|
||||
template class ScriptRegistry<SpellSC>;
|
||||
template class ScriptRegistry<AccountScript>;
|
||||
template class ScriptRegistry<GameEventScript>;
|
||||
|
||||
#include "ScriptMgrMacros.h"
|
||||
|
||||
@@ -213,6 +214,7 @@ void ScriptMgr::Unload()
|
||||
SCR_CLEAR(ModuleScript);
|
||||
SCR_CLEAR(BGScript);
|
||||
SCR_CLEAR(SpellSC);
|
||||
SCR_CLEAR(GameEventScript);
|
||||
|
||||
#undef SCR_CLEAR
|
||||
}
|
||||
@@ -2058,6 +2060,22 @@ void ScriptMgr::OnCalcMaxDuration(Aura const* aura, int32& maxDuration)
|
||||
FOREACH_SCRIPT(SpellSC)->OnCalcMaxDuration(aura, maxDuration);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGameEventStart(uint16 EventID)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnGameEventStart(EventId);
|
||||
#endif
|
||||
FOREACH_SCRIPT(GameEventScript)->OnStart(EventID);
|
||||
}
|
||||
|
||||
void ScriptMgr::OnGameEventStop(uint16 EventID)
|
||||
{
|
||||
#ifdef ELUNA
|
||||
sEluna->OnGameEventStop(EventID);
|
||||
#endif
|
||||
FOREACH_SCRIPT(GameEventScript)->OnStop(EventID);
|
||||
}
|
||||
|
||||
AllMapScript::AllMapScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
@@ -2257,3 +2275,9 @@ ModuleScript::ModuleScript(const char* name)
|
||||
ScriptRegistry<ModuleScript>::AddScript(this);
|
||||
}
|
||||
|
||||
GameEventScript::GameEventScript(const char* name)
|
||||
: ScriptObject(name)
|
||||
{
|
||||
ScriptRegistry<GameEventScript>::AddScript(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "AchievementMgr.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "GameEventMgr.h"
|
||||
|
||||
class AuctionHouseObject;
|
||||
class AuraScript;
|
||||
@@ -1135,6 +1136,19 @@ class ModuleScript : public ScriptObject
|
||||
ModuleScript(const char* name);
|
||||
};
|
||||
|
||||
class GameEventScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
GameEventScript(const char* name);
|
||||
|
||||
public:
|
||||
// Runs on start event
|
||||
virtual void OnStart(uint16 /*EventID*/) { }
|
||||
|
||||
// Runs on stop event
|
||||
virtual void OnStop(uint16 /*EventID*/) { }
|
||||
};
|
||||
|
||||
// Placed here due to ScriptRegistry::AddScript dependency.
|
||||
#define sScriptMgr ACE_Singleton<ScriptMgr, ACE_Null_Mutex>::instance()
|
||||
|
||||
@@ -1469,7 +1483,12 @@ class ScriptMgr
|
||||
|
||||
public: /* SpellSC */
|
||||
|
||||
void OnCalcMaxDuration(Aura const* aura, int32& maxDuration);
|
||||
void OnCalcMaxDuration(Aura const* aura, int32& maxDuration);
|
||||
|
||||
public: /* GameEventScript */
|
||||
|
||||
void OnGameEventStart(uint16 EventID);
|
||||
void OnGameEventStop(uint16 EventID);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user