forked from ElunaLuaEngine/Eluna
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVehicleHooks.cpp
66 lines (56 loc) · 1.55 KB
/
VehicleHooks.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
63
64
65
66
/*
* 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"
#ifndef CLASSIC
#ifndef TBC
using namespace Hooks;
#define START_HOOK(EVENT) \
if (!IsEnabled())\
return;\
auto key = EventKey<VehicleEvents>(EVENT);\
if (!VehicleEventBindings->HasBindingsFor(key))\
return;\
LOCK_ELUNA
void Eluna::OnInstall(Vehicle* vehicle)
{
START_HOOK(VEHICLE_EVENT_ON_INSTALL);
Push(vehicle);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnUninstall(Vehicle* vehicle)
{
START_HOOK(VEHICLE_EVENT_ON_UNINSTALL);
Push(vehicle);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnInstallAccessory(Vehicle* vehicle, Creature* accessory)
{
START_HOOK(VEHICLE_EVENT_ON_INSTALL_ACCESSORY);
Push(vehicle);
Push(accessory);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId)
{
START_HOOK(VEHICLE_EVENT_ON_ADD_PASSENGER);
Push(vehicle);
Push(passenger);
Push(seatId);
CallAllFunctions(VehicleEventBindings, key);
}
void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger)
{
START_HOOK(VEHICLE_EVENT_ON_REMOVE_PASSENGER);
Push(vehicle);
Push(passenger);
CallAllFunctions(VehicleEventBindings, key);
}
#endif // CLASSIC
#endif // TBC