Files
mod-ale/BattleGroundHooks.cpp
Patman64 7397c98a61 Merge new_bindings, closes #151
Refer to 6194ddb43c for new C++11 required changes for mangos based cores
2015-06-01 20:37:32 +03:00

59 lines
1.4 KiB
C++

/*
* Copyright (C) 2010 - 2015 Eluna Lua Engine <http://emudevs.com/>
* This program is free software licensed under GPL version 3
* Please see the included DOCS/LICENSE.md for more information
*/
#include "Hooks.h"
#include "HookHelpers.h"
#include "LuaEngine.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)
{
START_HOOK(BG_EVENT_ON_START);
Push(bg);
Push(bgId);
Push(instanceId);
CallAllFunctions(BGEventBindings, key);
}
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
{
START_HOOK(BG_EVENT_ON_END);
Push(bg);
Push(bgId);
Push(instanceId);
Push(winner);
CallAllFunctions(BGEventBindings, key);
}
void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
{
START_HOOK(BG_EVENT_ON_CREATE);
Push(bg);
Push(bgId);
Push(instanceId);
CallAllFunctions(BGEventBindings, key);
}
void Eluna::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
{
START_HOOK(BG_EVENT_ON_PRE_DESTROY);
Push(bg);
Push(bgId);
Push(instanceId);
CallAllFunctions(BGEventBindings, key);
}