Core/Hooks: Adds hooks for start and stop game events (#1472)

This commit is contained in:
Dmitry Brusenskiy
2019-02-19 05:24:55 +03:00
committed by Kargatum
parent 23d78ce6bc
commit 3a39aaeed5
3 changed files with 53 additions and 10 deletions

View File

@@ -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);
}