feat: add PLAYER_EVENT_ON_CAN_SEND_MAIL (#85)

This commit is contained in:
Axel Cocat
2022-12-31 00:43:46 +01:00
committed by GitHub
parent 1e57b45c40
commit 3700b4246a
5 changed files with 22 additions and 0 deletions

View File

@@ -761,6 +761,11 @@ public:
{
return sEluna->OnCanInitTrade(player, target);
}
bool CanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 cod, Item* item) override
{
return sEluna->OnCanSendMail(player, receiverGuid, mailbox, subject, body, money, cod, item);
}
};
class Eluna_ServerScript : public ServerScript

View File

@@ -721,6 +721,7 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp)
* 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_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
* };
* </pre>
*

View File

@@ -210,6 +210,7 @@ namespace Hooks
PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp)
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_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
PLAYER_EVENT_COUNT
};

View File

@@ -477,6 +477,7 @@ public:
void OnAchiComplete(Player* player, AchievementEntry const* achievement);
void OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp);
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);
#ifndef CLASSIC
#ifndef TBC

View File

@@ -599,3 +599,17 @@ bool Eluna::OnCanInitTrade(Player* player, Player* target)
Push(target);
return CallAllFunctionsBool(PlayerEventBindings, key);
}
bool Eluna::OnCanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 cod, Item* item)
{
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_SEND_MAIL, true);
Push(player);
Push(receiverGuid);
Push(mailbox);
Push(subject);
Push(body);
Push(money);
Push(cod);
Push(item);
return CallAllFunctionsBool(PlayerEventBindings, key);
}