Skip to content

Commit

Permalink
feat: add OnBattlegroundDesertion hook
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCiBeR committed Jun 6, 2023
1 parent 4fb0949 commit 1cb948d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Eluna API for AC:
- Added `RegisterPlayerEvent` `56` (`PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM`): https://github.com/azerothcore/mod-eluna/pull/119
- Added `RegisterPlayerEvent` `57` (`PLAYER_EVENT_ON_APPLY_AURA`): https://github.com/azerothcore/mod-eluna/pull/137
- Added `RegisterPlayerEvent` `58` (`PLAYER_EVENT_ON_REMOVE_AURA`): https://github.com/azerothcore/mod-eluna/pull/137
- Added `RegisterPlayerEvent` `59` (`PLAYER_EVENT_ON_BG_DESERTION`): https://github.com/azerothcore/mod-eluna/pull/146
- Added `Player:GetMailCount()`: https://github.com/azerothcore/mod-eluna/pull/76
- Added `Player:GetXP()`: https://github.com/azerothcore/mod-eluna/pull/77
- Added `Player:GetAchievementCriteriaProgress()`: https://github.com/azerothcore/mod-eluna/pull/78
Expand Down
5 changes: 5 additions & 0 deletions src/ElunaLuaEngine_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,11 @@ class Eluna_PlayerScript : public PlayerScript
{
return sEluna->OnRemoveAura(player, aura, isExpired);
}

void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type) override
{
sEluna->OnBattlegroundDesertion(player, type);
}
};

class Eluna_ServerScript : public ServerScript
Expand Down
3 changes: 2 additions & 1 deletion src/LuaEngine/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,8 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting
* PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
* PLAYER_EVENT_ON_APPLY_AURA = 57, // (event, player, aura, isNewAura)
* PLAYER_EVENT_ON_REMOVE_AURA = 58, // (event, player, aura, isExpired)
* PLAYER_EVENT_ON_REMOVE_AURA = 58, // (event, player, aura, isExpired)
* PLAYER_EVENT_ON_BG_DESERTION = 59, // (event, player, type)
* };
* </pre>
*
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ namespace Hooks
PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
PLAYER_EVENT_ON_APPLY_AURA = 57, // (event, player, aura, isNewAura)
PLAYER_EVENT_ON_REMOVE_AURA = 58, // (event, player, aura, isExpired)
PLAYER_EVENT_ON_BG_DESERTION = 59, // (event, player, type)

PLAYER_EVENT_COUNT
};
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ class ELUNA_GAME_API Eluna
void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll);
void OnApplyAura(Player* player, Aura* aura, bool isNewAura);
void OnRemoveAura(Player* player, Aura* aura, bool isExpired);
void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type);

#ifndef CLASSIC
#ifndef TBC
Expand Down
8 changes: 8 additions & 0 deletions src/LuaEngine/PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,11 @@ void Eluna::OnRemoveAura(Player* player, Aura* aura, bool isExpired)
Push(isExpired);
CallAllFunctions(PlayerEventBindings, key);
}

void Eluna::OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type)
{
START_HOOK(PLAYER_EVENT_ON_BG_DESERTION);
Push(player);
Push(type);
CallAllFunctions(PlayerEventBindings, key);
}

0 comments on commit 1cb948d

Please sign in to comment.