From df8b3efbbe2092fab76d86211140037839e2cba0 Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Thu, 4 Nov 2021 11:23:07 +0100 Subject: [PATCH] feat(PlayerMethods): expose GetMItem (#5) --- LuaFunctions.cpp | 1 + PlayerMethods.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index f7cd08b..738127b 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -467,6 +467,7 @@ ElunaRegister PlayerMethods[] = { "GetItemByPos", &LuaPlayer::GetItemByPos }, { "GetItemByEntry", &LuaPlayer::GetItemByEntry }, { "GetItemByGUID", &LuaPlayer::GetItemByGUID }, + { "GetMailItem", &LuaPlayer::GetMailItem }, { "GetReputation", &LuaPlayer::GetReputation }, { "GetEquippedItemBySlot", &LuaPlayer::GetEquippedItemBySlot }, { "GetQuestLevel", &LuaPlayer::GetQuestLevel }, diff --git a/PlayerMethods.h b/PlayerMethods.h index 99d12e6..0dc800f 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -1381,6 +1381,20 @@ namespace LuaPlayer return 1; } + /** + * Returns a mailed [Item] by guid. + * + * @param ObjectGuid guid : an item guid + * @return [Item] item + */ + int GetMailItem(lua_State* L, Player* player) + { + ObjectGuid guid = Eluna::CHECKVAL(L, 2); + + Eluna::Push(L, player->GetMItem(guid.GetCounter())); + return 1; + } + /** * Returns an [Item] from the player by entry. *