mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat: add Player:GetMailCount() (#76)
This commit is contained in:
@@ -471,6 +471,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
{ "GetItemByPos", &LuaPlayer::GetItemByPos },
|
||||
{ "GetItemByEntry", &LuaPlayer::GetItemByEntry },
|
||||
{ "GetItemByGUID", &LuaPlayer::GetItemByGUID },
|
||||
{ "GetMailCount", &LuaPlayer::GetMailCount },
|
||||
{ "GetMailItem", &LuaPlayer::GetMailItem },
|
||||
{ "GetReputation", &LuaPlayer::GetReputation },
|
||||
{ "GetEquippedItemBySlot", &LuaPlayer::GetEquippedItemBySlot },
|
||||
|
||||
@@ -1416,6 +1416,26 @@ namespace LuaPlayer
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of mails in the player's mailbox.
|
||||
*
|
||||
* @return uint32 mailCount
|
||||
*/
|
||||
int GetMailCount(lua_State* L, Player* player)
|
||||
{
|
||||
const CharacterCacheEntry* cache = sCharacterCache->GetCharacterCacheByGuid(player->GetGUID());
|
||||
if (cache)
|
||||
{
|
||||
Eluna::Push(L, static_cast<uint32>(cache->MailCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
Eluna::Push(L, player->GetMailSize());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mailed [Item] by guid.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user