Skip to content

Commit

Permalink
feat: add PLAYER_EVENT_ON_CAN_GROUP_INVITE (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-o-b-o-t-o authored Mar 1, 2023
1 parent 53514a2 commit 85714c1
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 @@ -89,6 +89,7 @@ Eluna API for AC:
- Added `RegisterPlayerEvent` `52` (`PLAYER_EVENT_ON_CREATE_ITEM`): https://github.com/azerothcore/mod-eluna/pull/88
- Added `RegisterPlayerEvent` `53` (`PLAYER_EVENT_ON_STORE_NEW_ITEM`): https://github.com/azerothcore/mod-eluna/pull/88
- 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 `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 @@ -791,6 +791,11 @@ class Eluna_PlayerScript : public PlayerScript
{
sEluna->OnPlayerCompleteQuest(player, quest);
}

bool CanGroupInvite(Player* player, std::string& memberName) override
{
return sEluna->OnCanGroupInvite(player, memberName);
}
};

class Eluna_ServerScript : public ServerScript
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count)
* PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count)
* 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
* };
* </pre>
*
Expand Down
3 changes: 2 additions & 1 deletion src/LuaEngine/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ namespace Hooks
PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count)
PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count)
PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count)
PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest)
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_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 @@ -484,6 +484,7 @@ class ELUNA_GAME_API Eluna
bool OnCanInitTrade(Player* player, Player* target);
bool OnCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 cod, Item* item);
bool OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment);
bool OnCanGroupInvite(Player* player, std::string& memberName);

#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 @@ -670,3 +670,11 @@ void Eluna::OnPlayerCompleteQuest(Player* player, Quest const* quest)
Push(quest);
CallAllFunctions(PlayerEventBindings, key);
}

bool Eluna::OnCanGroupInvite(Player* player, std::string& memberName)
{
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_GROUP_INVITE, true);
Push(player);
Push(memberName);
return CallAllFunctionsBool(PlayerEventBindings, key);
}

0 comments on commit 85714c1

Please sign in to comment.