Repository navigation
Expand file tree
/
Copy pathVehicleHooks.cpp
More file actions
62 lines (52 loc) · 1.52 KB
/
Copy pathVehicleHooks.cpp
File metadata and controls
62 lines (52 loc) · 1.52 KB
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 - 2024 Eluna Lua Engine <https://elunaluaengine.github.io/>
* 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"
#if ELUNA_EXPANSION >= EXP_WOTLK
using namespace Hooks;
#define START_HOOK(EVENT) \
auto binding = GetBinding<EventKey<VehicleEvents>>(REGTYPE_VEHICLE);\
auto key = EventKey<VehicleEvents>(EVENT);\
if (!binding->HasBindingsFor(key))\
return;
void Eluna::OnInstall(Vehicle* vehicle)
{
START_HOOK(VEHICLE_EVENT_ON_INSTALL);
HookPush(vehicle);
CallAllFunctions(binding, key);
}
void Eluna::OnUninstall(Vehicle* vehicle)
{
START_HOOK(VEHICLE_EVENT_ON_UNINSTALL);
HookPush(vehicle);
CallAllFunctions(binding, key);
}
void Eluna::OnInstallAccessory(Vehicle* vehicle, Creature* accessory)
{
START_HOOK(VEHICLE_EVENT_ON_INSTALL_ACCESSORY);
HookPush(vehicle);
HookPush(accessory);
CallAllFunctions(binding, key);
}
void Eluna::OnAddPassenger(Vehicle* vehicle, Unit* passenger, int8 seatId)
{
START_HOOK(VEHICLE_EVENT_ON_ADD_PASSENGER);
HookPush(vehicle);
HookPush(passenger);
HookPush(seatId);
CallAllFunctions(binding, key);
}
void Eluna::OnRemovePassenger(Vehicle* vehicle, Unit* passenger)
{
START_HOOK(VEHICLE_EVENT_ON_REMOVE_PASSENGER);
HookPush(vehicle);
HookPush(passenger);
CallAllFunctions(binding, key);
}
#endif