Files
mod-ale/BattleGroundHooks.cpp
ayase 9b5499db9c AZEROTHCORE compatibility (#271)
* Done Compatible AZEROTHCORE.

* Fix TC build

* Try fix whitespace (trailing and tabs2spaces)

* Remove undefs and TC_LOG defines

* Revert indentation change

* Indentation and style change

* Add more possible SQL types to query

* change bg hooks OnBGEnd parameter type.
2018-06-06 18:42:46 +03:00

63 lines
1.5 KiB
C++

/*
* Copyright (C) 2010 - 2016 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);
}
#if AZEROTHCORE
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, TeamId winner)
#else
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
#endif
{
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);
}