diff --git a/README.md b/README.md index 61345db8a2..0d646058be 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ Eluna API for AC: - Added `RegisterPlayerEvent` `54` (`PLAYER_EVENT_ON_COMPLETE_QUEST`): https://github.com/azerothcore/mod-eluna/pull/90 - Added `RegisterPlayerEvent` `55` (`PLAYER_EVENT_ON_CAN_GROUP_INVITE`): https://github.com/azerothcore/mod-eluna/pull/100 - Added `RegisterPlayerEvent` `56` (`PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM`): https://github.com/azerothcore/mod-eluna/pull/119 +- Added `RegisterPlayerEvent` `57` (`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 diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp index 343de8b752..803044c904 100644 --- a/src/ElunaLuaEngine_SC.cpp +++ b/src/ElunaLuaEngine_SC.cpp @@ -801,6 +801,11 @@ class Eluna_PlayerScript : public PlayerScript { return sEluna->OnCanGroupInvite(player, memberName); } + + void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type) override + { + sEluna->OnBattlegroundDesertion(player, type); + } }; class Eluna_ServerScript : public ServerScript diff --git a/src/LuaEngine/GlobalMethods.h b/src/LuaEngine/GlobalMethods.h index 121fab1c63..b0e1bdbb42 100644 --- a/src/LuaEngine/GlobalMethods.h +++ b/src/LuaEngine/GlobalMethods.h @@ -729,6 +729,7 @@ namespace LuaGlobalFunctions * PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest) * 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_BG_DESERTION = 57, // (event, player, type) * }; * * diff --git a/src/LuaEngine/Hooks.h b/src/LuaEngine/Hooks.h index 11b61fd060..f368317d5d 100644 --- a/src/LuaEngine/Hooks.h +++ b/src/LuaEngine/Hooks.h @@ -218,6 +218,7 @@ namespace Hooks PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest) 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_BG_DESERTION = 57, // (event, player, type) PLAYER_EVENT_COUNT }; diff --git a/src/LuaEngine/LuaEngine.h b/src/LuaEngine/LuaEngine.h index d5b395a78d..69553567e5 100644 --- a/src/LuaEngine/LuaEngine.h +++ b/src/LuaEngine/LuaEngine.h @@ -489,6 +489,7 @@ class ELUNA_GAME_API Eluna bool OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment); bool OnCanGroupInvite(Player* player, std::string& memberName); void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll); + void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type); #ifndef CLASSIC #ifndef TBC diff --git a/src/LuaEngine/PlayerHooks.cpp b/src/LuaEngine/PlayerHooks.cpp index bd9bca2355..6d3043480c 100644 --- a/src/LuaEngine/PlayerHooks.cpp +++ b/src/LuaEngine/PlayerHooks.cpp @@ -690,3 +690,11 @@ void Eluna::OnGroupRollRewardItem(Player* player, Item* item, uint32 count, Roll Push(roll); 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); +}