mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat: add PLAYER_EVENT_ON_CAN_JOIN_LFG (#86)
This commit is contained in:
@@ -83,6 +83,8 @@ Eluna API for AC:
|
|||||||
- Added `RegisterPlayerEvent` `46` (`PLAYER_EVENT_ON_FFAPVP_CHANGE`): https://github.com/azerothcore/mod-eluna/pull/63
|
- Added `RegisterPlayerEvent` `46` (`PLAYER_EVENT_ON_FFAPVP_CHANGE`): https://github.com/azerothcore/mod-eluna/pull/63
|
||||||
- Added `RegisterPlayerEvent` `47` (`PLAYER_EVENT_ON_UPDATE_AREA`): https://github.com/azerothcore/mod-eluna/pull/65
|
- Added `RegisterPlayerEvent` `47` (`PLAYER_EVENT_ON_UPDATE_AREA`): https://github.com/azerothcore/mod-eluna/pull/65
|
||||||
- Added `RegisterPlayerEvent` `48` (`PLAYER_EVENT_ON_CAN_INIT_TRADE`): https://github.com/azerothcore/mod-eluna/pull/83
|
- Added `RegisterPlayerEvent` `48` (`PLAYER_EVENT_ON_CAN_INIT_TRADE`): https://github.com/azerothcore/mod-eluna/pull/83
|
||||||
|
- Added `RegisterPlayerEvent` `49` (`PLAYER_EVENT_ON_CAN_SEND_MAIL`): https://github.com/azerothcore/mod-eluna/pull/85
|
||||||
|
- Added `RegisterPlayerEvent` `50` (`PLAYER_EVENT_ON_CAN_JOIN_LFG`): https://github.com/azerothcore/mod-eluna/pull/86
|
||||||
- Added `Player:GetMailCount()`: https://github.com/azerothcore/mod-eluna/pull/76
|
- Added `Player:GetMailCount()`: https://github.com/azerothcore/mod-eluna/pull/76
|
||||||
- Added `Player:GetXP()`: https://github.com/azerothcore/mod-eluna/pull/77
|
- Added `Player:GetXP()`: https://github.com/azerothcore/mod-eluna/pull/77
|
||||||
- Added `Player:GetAchievementCriteriaProgress()`: https://github.com/azerothcore/mod-eluna/pull/78
|
- Added `Player:GetAchievementCriteriaProgress()`: https://github.com/azerothcore/mod-eluna/pull/78
|
||||||
|
|||||||
@@ -766,6 +766,11 @@ public:
|
|||||||
{
|
{
|
||||||
return sEluna->OnCanSendMail(player, receiverGuid, mailbox, subject, body, money, cod, item);
|
return sEluna->OnCanSendMail(player, receiverGuid, mailbox, subject, body, money, cod, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment) override
|
||||||
|
{
|
||||||
|
return sEluna->OnCanJoinLfg(player, roles, dungeons, comment);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Eluna_ServerScript : public ServerScript
|
class Eluna_ServerScript : public ServerScript
|
||||||
|
|||||||
@@ -722,6 +722,7 @@ namespace LuaGlobalFunctions
|
|||||||
* PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea)
|
* PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea)
|
||||||
* PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
|
* PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
|
||||||
* PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
|
* PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
|
||||||
|
* PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing
|
||||||
* };
|
* };
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ namespace Hooks
|
|||||||
PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea)
|
PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea)
|
||||||
PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
|
PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
|
||||||
PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
|
PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
|
||||||
|
PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing
|
||||||
|
|
||||||
PLAYER_EVENT_COUNT
|
PLAYER_EVENT_COUNT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
|
#include "LFG.h"
|
||||||
#include "ElunaUtility.h"
|
#include "ElunaUtility.h"
|
||||||
#include "HttpManager.h"
|
#include "HttpManager.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@@ -478,6 +479,7 @@ public:
|
|||||||
void OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp);
|
void OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp);
|
||||||
bool OnCanInitTrade(Player* player, Player* target);
|
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 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);
|
||||||
|
|
||||||
#ifndef CLASSIC
|
#ifndef CLASSIC
|
||||||
#ifndef TBC
|
#ifndef TBC
|
||||||
|
|||||||
@@ -613,3 +613,25 @@ bool Eluna::OnCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid ma
|
|||||||
Push(item);
|
Push(item);
|
||||||
return CallAllFunctionsBool(PlayerEventBindings, key);
|
return CallAllFunctionsBool(PlayerEventBindings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Eluna::OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeons, const std::string& comment)
|
||||||
|
{
|
||||||
|
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_JOIN_LFG, true);
|
||||||
|
Push(player);
|
||||||
|
Push(roles);
|
||||||
|
|
||||||
|
lua_newtable(L);
|
||||||
|
int table = lua_gettop(L);
|
||||||
|
uint32 counter = 1;
|
||||||
|
for (uint32 dungeon : dungeons)
|
||||||
|
{
|
||||||
|
Eluna::Push(L, dungeon);
|
||||||
|
lua_rawseti(L, table, counter);
|
||||||
|
++counter;
|
||||||
|
}
|
||||||
|
lua_settop(L, table);
|
||||||
|
++push_counter;
|
||||||
|
|
||||||
|
Push(comment);
|
||||||
|
return CallAllFunctionsBool(PlayerEventBindings, key);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user