forked from Niam5/Eluna
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBattleGroundHooks.cpp
62 lines (55 loc) · 1.54 KB
/
BattleGroundHooks.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* 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);
}