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

@@ -18,6 +18,7 @@
#include "UnitAI.h"
#include "GameObjectAI.h"
#include "Transport.h"
#include "ScriptMgr.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
@@ -127,10 +128,10 @@ bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite)
if (data.end <= data.start)
data.end = data.start + data.length;
}
#ifdef ELUNA
if (IsActiveEvent(event_id))
sEluna->OnGameEventStart(event_id);
#endif
sScriptMgr->OnGameEventStart(event_id);
return false;
}
else
@@ -153,10 +154,10 @@ bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite)
// or to scedule another update where the next event will be started
if (overwrite && conditions_met)
sWorld->ForceGameEventUpdate();
#ifdef ELUNA
if (IsActiveEvent(event_id))
sEluna->OnGameEventStart(event_id);
#endif
sScriptMgr->OnGameEventStart(event_id);
return conditions_met;
}
}
@@ -199,10 +200,9 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
CharacterDatabase.CommitTransaction(trans);
}
}
#ifdef ELUNA
if (!IsActiveEvent(event_id))
sEluna->OnGameEventStop(event_id);
#endif
sScriptMgr->OnGameEventStop(event_id);
}
void GameEventMgr::LoadFromDB()