feat: add Player:GetMailCount() (#76)

This commit is contained in:
Axel Cocat
2022-12-29 11:54:55 +01:00
committed by GitHub
parent 900ad17d2e
commit 4395d9c624
2 changed files with 21 additions and 0 deletions

View File

@@ -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.
*