Skip to content

Commit 203dee5

Browse files
committed
Unify binding var name in hooks
1 parent 1456d69 commit 203dee5

File tree

10 files changed

+165
-165
lines changed

10 files changed

+165
-165
lines changed

hooks/BattleGroundHooks.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
using namespace Hooks;
1414

1515
#define START_HOOK(EVENT) \
16-
auto BGEventBindings = GetBinding<EventKey<BGEvents>>(REGTYPE_BG);\
16+
auto binding = GetBinding<EventKey<BGEvents>>(REGTYPE_BG);\
1717
auto key = EventKey<BGEvents>(EVENT);\
18-
if (!BGEventBindings->HasBindingsFor(key))\
18+
if (!binding->HasBindingsFor(key))\
1919
return;
2020

2121
void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
@@ -24,7 +24,7 @@ void Eluna::OnBGStart(BattleGround* bg, BattleGroundTypeId bgId, uint32 instance
2424
HookPush(bg);
2525
HookPush(bgId);
2626
HookPush(instanceId);
27-
CallAllFunctions(BGEventBindings, key);
27+
CallAllFunctions(binding, key);
2828
}
2929

3030
void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId, Team winner)
@@ -34,7 +34,7 @@ void Eluna::OnBGEnd(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId
3434
HookPush(bgId);
3535
HookPush(instanceId);
3636
HookPush(winner);
37-
CallAllFunctions(BGEventBindings, key);
37+
CallAllFunctions(binding, key);
3838
}
3939

4040
void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
@@ -43,7 +43,7 @@ void Eluna::OnBGCreate(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanc
4343
HookPush(bg);
4444
HookPush(bgId);
4545
HookPush(instanceId);
46-
CallAllFunctions(BGEventBindings, key);
46+
CallAllFunctions(binding, key);
4747
}
4848

4949
void Eluna::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instanceId)
@@ -52,5 +52,5 @@ void Eluna::OnBGDestroy(BattleGround* bg, BattleGroundTypeId bgId, uint32 instan
5252
HookPush(bg);
5353
HookPush(bgId);
5454
HookPush(instanceId);
55-
CallAllFunctions(BGEventBindings, key);
55+
CallAllFunctions(binding, key);
5656
}

hooks/GameObjectHooks.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
using namespace Hooks;
1616

1717
#define START_HOOK(EVENT, ENTRY) \
18-
auto GameObjectEventBindings = GetBinding<EntryKey<GameObjectEvents>>(REGTYPE_GAMEOBJECT);\
18+
auto binding = GetBinding<EntryKey<GameObjectEvents>>(REGTYPE_GAMEOBJECT);\
1919
auto key = EntryKey<GameObjectEvents>(EVENT, ENTRY);\
20-
if (!GameObjectEventBindings->HasBindingsFor(key))\
20+
if (!binding->HasBindingsFor(key))\
2121
return;
2222

2323
#define START_HOOK_WITH_RETVAL(EVENT, ENTRY, RETVAL) \
24-
auto GameObjectEventBindings = GetBinding<EntryKey<GameObjectEvents>>(REGTYPE_GAMEOBJECT);\
24+
auto binding = GetBinding<EntryKey<GameObjectEvents>>(REGTYPE_GAMEOBJECT);\
2525
auto key = EntryKey<GameObjectEvents>(EVENT, ENTRY);\
26-
if (!GameObjectEventBindings->HasBindingsFor(key))\
26+
if (!binding->HasBindingsFor(key))\
2727
return RETVAL;
2828

2929
void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, GameObject* pTarget)
@@ -33,15 +33,15 @@ void Eluna::OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex ef
3333
HookPush(spellId);
3434
HookPush(effIndex);
3535
HookPush(pTarget);
36-
CallAllFunctions(GameObjectEventBindings, key);
36+
CallAllFunctions(binding, key);
3737
}
3838

3939
void Eluna::UpdateAI(GameObject* pGameObject, uint32 diff)
4040
{
4141
START_HOOK(GAMEOBJECT_EVENT_ON_AIUPDATE, pGameObject->GetEntry());
4242
HookPush(pGameObject);
4343
HookPush(diff);
44-
CallAllFunctions(GameObjectEventBindings, key);
44+
CallAllFunctions(binding, key);
4545
}
4646

4747
bool Eluna::OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest)
@@ -50,7 +50,7 @@ bool Eluna::OnQuestAccept(Player* pPlayer, GameObject* pGameObject, Quest const*
5050
HookPush(pPlayer);
5151
HookPush(pGameObject);
5252
HookPush(pQuest);
53-
return CallAllFunctionsBool(GameObjectEventBindings, key);
53+
return CallAllFunctionsBool(binding, key);
5454
}
5555

5656
bool Eluna::OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const* pQuest, uint32 opt)
@@ -60,15 +60,15 @@ bool Eluna::OnQuestReward(Player* pPlayer, GameObject* pGameObject, Quest const*
6060
HookPush(pGameObject);
6161
HookPush(pQuest);
6262
HookPush(opt);
63-
return CallAllFunctionsBool(GameObjectEventBindings, key);
63+
return CallAllFunctionsBool(binding, key);
6464
}
6565

6666
void Eluna::GetDialogStatus(const Player* pPlayer, const GameObject* pGameObject)
6767
{
6868
START_HOOK(GAMEOBJECT_EVENT_ON_DIALOG_STATUS, pGameObject->GetEntry());
6969
HookPush(pPlayer);
7070
HookPush(pGameObject);
71-
CallAllFunctions(GameObjectEventBindings, key);
71+
CallAllFunctions(binding, key);
7272
}
7373

7474
#if ELUNA_EXPANSION >= EXP_WOTLK
@@ -77,15 +77,15 @@ void Eluna::OnDestroyed(GameObject* pGameObject, WorldObject* attacker)
7777
START_HOOK(GAMEOBJECT_EVENT_ON_DESTROYED, pGameObject->GetEntry());
7878
HookPush(pGameObject);
7979
HookPush(attacker);
80-
CallAllFunctions(GameObjectEventBindings, key);
80+
CallAllFunctions(binding, key);
8181
}
8282

8383
void Eluna::OnDamaged(GameObject* pGameObject, WorldObject* attacker)
8484
{
8585
START_HOOK(GAMEOBJECT_EVENT_ON_DAMAGED, pGameObject->GetEntry());
8686
HookPush(pGameObject);
8787
HookPush(attacker);
88-
CallAllFunctions(GameObjectEventBindings, key);
88+
CallAllFunctions(binding, key);
8989
}
9090
#endif
9191

@@ -94,42 +94,42 @@ void Eluna::OnLootStateChanged(GameObject* pGameObject, uint32 state)
9494
START_HOOK(GAMEOBJECT_EVENT_ON_LOOT_STATE_CHANGE, pGameObject->GetEntry());
9595
HookPush(pGameObject);
9696
HookPush(state);
97-
CallAllFunctions(GameObjectEventBindings, key);
97+
CallAllFunctions(binding, key);
9898
}
9999

100100
void Eluna::OnGameObjectStateChanged(GameObject* pGameObject, uint32 state)
101101
{
102102
START_HOOK(GAMEOBJECT_EVENT_ON_GO_STATE_CHANGED, pGameObject->GetEntry());
103103
HookPush(pGameObject);
104104
HookPush(state);
105-
CallAllFunctions(GameObjectEventBindings, key);
105+
CallAllFunctions(binding, key);
106106
}
107107

108108
void Eluna::OnSpawn(GameObject* pGameObject)
109109
{
110110
START_HOOK(GAMEOBJECT_EVENT_ON_SPAWN, pGameObject->GetEntry());
111111
HookPush(pGameObject);
112-
CallAllFunctions(GameObjectEventBindings, key);
112+
CallAllFunctions(binding, key);
113113
}
114114

115115
void Eluna::OnAddToWorld(GameObject* pGameObject)
116116
{
117117
START_HOOK(GAMEOBJECT_EVENT_ON_ADD, pGameObject->GetEntry());
118118
HookPush(pGameObject);
119-
CallAllFunctions(GameObjectEventBindings, key);
119+
CallAllFunctions(binding, key);
120120
}
121121

122122
void Eluna::OnRemoveFromWorld(GameObject* pGameObject)
123123
{
124124
START_HOOK(GAMEOBJECT_EVENT_ON_REMOVE, pGameObject->GetEntry());
125125
HookPush(pGameObject);
126-
CallAllFunctions(GameObjectEventBindings, key);
126+
CallAllFunctions(binding, key);
127127
}
128128

129129
bool Eluna::OnGameObjectUse(Player* pPlayer, GameObject* pGameObject)
130130
{
131131
START_HOOK_WITH_RETVAL(GAMEOBJECT_EVENT_ON_USE, pGameObject->GetEntry(), false);
132132
HookPush(pGameObject);
133133
HookPush(pPlayer);
134-
return CallAllFunctionsBool(GameObjectEventBindings, key);
134+
return CallAllFunctionsBool(binding, key);
135135
}

hooks/GroupHooks.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@
1313
using namespace Hooks;
1414

1515
#define START_HOOK(EVENT) \
16-
auto GroupEventBindings = GetBinding<EventKey<GroupEvents>>(REGTYPE_GROUP);\
16+
auto binding = GetBinding<EventKey<GroupEvents>>(REGTYPE_GROUP);\
1717
auto key = EventKey<GroupEvents>(EVENT);\
18-
if (!GroupEventBindings->HasBindingsFor(key))\
18+
if (!binding->HasBindingsFor(key))\
1919
return;
2020

2121
#define START_HOOK_WITH_RETVAL(EVENT, RETVAL) \
22-
auto GroupEventBindings = GetBinding<EventKey<GroupEvents>>(REGTYPE_GROUP);\
22+
auto binding = GetBinding<EventKey<GroupEvents>>(REGTYPE_GROUP);\
2323
auto key = EventKey<GroupEvents>(EVENT);\
24-
if (!GroupEventBindings->HasBindingsFor(key))\
24+
if (!binding->HasBindingsFor(key))\
2525
return RETVAL;
2626

2727
void Eluna::OnAddMember(Group* group, ObjectGuid guid)
2828
{
2929
START_HOOK(GROUP_EVENT_ON_MEMBER_ADD);
3030
HookPush(group);
3131
HookPush(guid);
32-
CallAllFunctions(GroupEventBindings, key);
32+
CallAllFunctions(binding, key);
3333
}
3434

3535
void Eluna::OnInviteMember(Group* group, ObjectGuid guid)
3636
{
3737
START_HOOK(GROUP_EVENT_ON_MEMBER_INVITE);
3838
HookPush(group);
3939
HookPush(guid);
40-
CallAllFunctions(GroupEventBindings, key);
40+
CallAllFunctions(binding, key);
4141
}
4242

4343
void Eluna::OnRemoveMember(Group* group, ObjectGuid guid, uint8 method)
@@ -46,7 +46,7 @@ void Eluna::OnRemoveMember(Group* group, ObjectGuid guid, uint8 method)
4646
HookPush(group);
4747
HookPush(guid);
4848
HookPush(method);
49-
CallAllFunctions(GroupEventBindings, key);
49+
CallAllFunctions(binding, key);
5050
}
5151

5252
void Eluna::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
@@ -55,14 +55,14 @@ void Eluna::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid ol
5555
HookPush(group);
5656
HookPush(newLeaderGuid);
5757
HookPush(oldLeaderGuid);
58-
CallAllFunctions(GroupEventBindings, key);
58+
CallAllFunctions(binding, key);
5959
}
6060

6161
void Eluna::OnDisband(Group* group)
6262
{
6363
START_HOOK(GROUP_EVENT_ON_DISBAND);
6464
HookPush(group);
65-
CallAllFunctions(GroupEventBindings, key);
65+
CallAllFunctions(binding, key);
6666
}
6767

6868
void Eluna::OnCreate(Group* group, ObjectGuid leaderGuid, GroupType groupType)
@@ -71,13 +71,13 @@ void Eluna::OnCreate(Group* group, ObjectGuid leaderGuid, GroupType groupType)
7171
HookPush(group);
7272
HookPush(leaderGuid);
7373
HookPush(groupType);
74-
CallAllFunctions(GroupEventBindings, key);
74+
CallAllFunctions(binding, key);
7575
}
7676

7777
bool Eluna::OnMemberAccept(Group* group, Player* player)
7878
{
7979
START_HOOK_WITH_RETVAL(GROUP_EVENT_ON_MEMBER_ACCEPT, true);
8080
HookPush(group);
8181
HookPush(player);
82-
return CallAllFunctionsBool(GroupEventBindings, key, true);
82+
return CallAllFunctionsBool(binding, key, true);
8383
}

hooks/GuildHooks.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
using namespace Hooks;
1414

1515
#define START_HOOK(EVENT) \
16-
auto GuildEventBindings = GetBinding<EventKey<GuildEvents>>(REGTYPE_GUILD);\
16+
auto binding = GetBinding<EventKey<GuildEvents>>(REGTYPE_GUILD);\
1717
auto key = EventKey<GuildEvents>(EVENT);\
18-
if (!GuildEventBindings->HasBindingsFor(key))\
18+
if (!binding->HasBindingsFor(key))\
1919
return;
2020

2121
void Eluna::OnAddMember(Guild* guild, Player* player, uint32 plRank)
@@ -24,7 +24,7 @@ void Eluna::OnAddMember(Guild* guild, Player* player, uint32 plRank)
2424
HookPush(guild);
2525
HookPush(player);
2626
HookPush(plRank);
27-
CallAllFunctions(GuildEventBindings, key);
27+
CallAllFunctions(binding, key);
2828
}
2929

3030
void Eluna::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding)
@@ -33,23 +33,23 @@ void Eluna::OnRemoveMember(Guild* guild, Player* player, bool isDisbanding)
3333
HookPush(guild);
3434
HookPush(player);
3535
HookPush(isDisbanding);
36-
CallAllFunctions(GuildEventBindings, key);
36+
CallAllFunctions(binding, key);
3737
}
3838

3939
void Eluna::OnMOTDChanged(Guild* guild, const std::string& newMotd)
4040
{
4141
START_HOOK(GUILD_EVENT_ON_MOTD_CHANGE);
4242
HookPush(guild);
4343
HookPush(newMotd);
44-
CallAllFunctions(GuildEventBindings, key);
44+
CallAllFunctions(binding, key);
4545
}
4646

4747
void Eluna::OnInfoChanged(Guild* guild, const std::string& newInfo)
4848
{
4949
START_HOOK(GUILD_EVENT_ON_INFO_CHANGE);
5050
HookPush(guild);
5151
HookPush(newInfo);
52-
CallAllFunctions(GuildEventBindings, key);
52+
CallAllFunctions(binding, key);
5353
}
5454

5555
void Eluna::OnCreate(Guild* guild, Player* leader, const std::string& name)
@@ -58,14 +58,14 @@ void Eluna::OnCreate(Guild* guild, Player* leader, const std::string& name)
5858
HookPush(guild);
5959
HookPush(leader);
6060
HookPush(name);
61-
CallAllFunctions(GuildEventBindings, key);
61+
CallAllFunctions(binding, key);
6262
}
6363

6464
void Eluna::OnDisband(Guild* guild)
6565
{
6666
START_HOOK(GUILD_EVENT_ON_DISBAND);
6767
HookPush(guild);
68-
CallAllFunctions(GuildEventBindings, key);
68+
CallAllFunctions(binding, key);
6969
}
7070

7171
void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, bool isRepair)
@@ -76,7 +76,7 @@ void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint32& amount, b
7676
HookPush(amount);
7777
HookPush(isRepair); // isRepair not a part of Mangos, implement?
7878
int amountIndex = lua_gettop(L) - 1;
79-
int n = SetupStack(GuildEventBindings, key, 4);
79+
int n = SetupStack(binding, key, 4);
8080

8181
while (n > 0)
8282
{
@@ -104,7 +104,7 @@ void Eluna::OnMemberWitdrawMoney(Guild* guild, Player* player, uint64& amount, b
104104
HookPush(amount);
105105
HookPush(isRepair); // isRepair not a part of Mangos, implement?
106106
int amountIndex = lua_gettop(L) - 1;
107-
int n = SetupStack(GuildEventBindings, key, 4);
107+
int n = SetupStack(binding, key, 4);
108108

109109
while (n > 0)
110110
{
@@ -131,7 +131,7 @@ void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint32& amount)
131131
HookPush(player);
132132
HookPush(amount);
133133
int amountIndex = lua_gettop(L);
134-
int n = SetupStack(GuildEventBindings, key, 3);
134+
int n = SetupStack(binding, key, 3);
135135

136136
while (n > 0)
137137
{
@@ -158,7 +158,7 @@ void Eluna::OnMemberDepositMoney(Guild* guild, Player* player, uint64& amount)
158158
HookPush(player);
159159
HookPush(amount);
160160
int amountIndex = lua_gettop(L);
161-
int n = SetupStack(GuildEventBindings, key, 3);
161+
int n = SetupStack(binding, key, 3);
162162

163163
while (n > 0)
164164
{
@@ -191,7 +191,7 @@ void Eluna::OnItemMove(Guild* guild, Player* player, Item* pItem, bool isSrcBank
191191
HookPush(isDestBank);
192192
HookPush(destContainer);
193193
HookPush(destSlotId);
194-
CallAllFunctions(GuildEventBindings, key);
194+
CallAllFunctions(binding, key);
195195
}
196196

197197
void Eluna::OnEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 playerGuid2, uint8 newRank)
@@ -202,7 +202,7 @@ void Eluna::OnEvent(Guild* guild, uint8 eventType, uint32 playerGuid1, uint32 pl
202202
HookPush(playerGuid1);
203203
HookPush(playerGuid2);
204204
HookPush(newRank);
205-
CallAllFunctions(GuildEventBindings, key);
205+
CallAllFunctions(binding, key);
206206
}
207207

208208
void Eluna::OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playerGuid, uint32 itemOrMoney, uint16 itemStackCount, uint8 destTabId)
@@ -215,5 +215,5 @@ void Eluna::OnBankEvent(Guild* guild, uint8 eventType, uint8 tabId, uint32 playe
215215
HookPush(itemOrMoney);
216216
HookPush(itemStackCount);
217217
HookPush(destTabId);
218-
CallAllFunctions(GuildEventBindings, key);
218+
CallAllFunctions(binding, key);
219219
}

0 commit comments

Comments
 (0)