mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Merge new_bindings, closes #151
Refer to 6194ddb43c for new C++11 required changes for mangos based cores
This commit is contained in:
@@ -4,64 +4,55 @@
|
||||
* Please see the included DOCS/LICENSE.md for more information
|
||||
*/
|
||||
|
||||
#ifndef _BATTLEGROUND_HOOKS_H
|
||||
#define _BATTLEGROUND_HOOKS_H
|
||||
|
||||
#include "Hooks.h"
|
||||
#include "HookHelpers.h"
|
||||
#include "LuaEngine.h"
|
||||
#include "ElunaBinding.h"
|
||||
#include "BindingMap.h"
|
||||
#include "ElunaTemplate.h"
|
||||
|
||||
using namespace Hooks;
|
||||
|
||||
#define START_HOOK(EVENT) \
|
||||
if (!IsEnabled())\
|
||||
return;\
|
||||
auto key = EventKey<BGEvents>(EVENT);\
|
||||
if (!BGEventBindings->HasBindingsFor(key))\
|
||||
return;\
|
||||
LOCK_ELUNA
|
||||
|
||||
void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
|
||||
{
|
||||
if (!BGEventBindings->HasEvents(BG_EVENT_ON_START))
|
||||
return;
|
||||
|
||||
LOCK_ELUNA;
|
||||
START_HOOK(BG_EVENT_ON_START);
|
||||
Push(bg);
|
||||
Push(bgId);
|
||||
Push(instanceId);
|
||||
CallAllFunctions(BGEventBindings, BG_EVENT_ON_START);
|
||||
CallAllFunctions(BGEventBindings, key);
|
||||
}
|
||||
|
||||
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
|
||||
{
|
||||
if (!BGEventBindings->HasEvents(BG_EVENT_ON_END))
|
||||
return;
|
||||
|
||||
LOCK_ELUNA;
|
||||
START_HOOK(BG_EVENT_ON_END);
|
||||
Push(bg);
|
||||
Push(bgId);
|
||||
Push(instanceId);
|
||||
Push(winner);
|
||||
CallAllFunctions(BGEventBindings, BG_EVENT_ON_END);
|
||||
CallAllFunctions(BGEventBindings, key);
|
||||
}
|
||||
|
||||
void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
|
||||
{
|
||||
if (!BGEventBindings->HasEvents(BG_EVENT_ON_CREATE))
|
||||
return;
|
||||
|
||||
LOCK_ELUNA;
|
||||
START_HOOK(BG_EVENT_ON_CREATE);
|
||||
Push(bg);
|
||||
Push(bgId);
|
||||
Push(instanceId);
|
||||
CallAllFunctions(BGEventBindings, BG_EVENT_ON_CREATE);
|
||||
CallAllFunctions(BGEventBindings, key);
|
||||
}
|
||||
|
||||
void Eluna::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
|
||||
{
|
||||
if (!BGEventBindings->HasEvents(BG_EVENT_ON_PRE_DESTROY))
|
||||
return;
|
||||
|
||||
LOCK_ELUNA;
|
||||
START_HOOK(BG_EVENT_ON_PRE_DESTROY);
|
||||
Push(bg);
|
||||
Push(bgId);
|
||||
Push(instanceId);
|
||||
CallAllFunctions(BGEventBindings, BG_EVENT_ON_PRE_DESTROY);
|
||||
CallAllFunctions(BGEventBindings, key);
|
||||
}
|
||||
|
||||
#endif // _BATTLEGROUND_HOOKS_H
|
||||
|
||||
Reference in New Issue
Block a user