diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp index 22cf6f4..9278262 100644 --- a/LuaFunctions.cpp +++ b/LuaFunctions.cpp @@ -447,8 +447,9 @@ ElunaRegister PlayerMethods[] = { "GetLevelPlayedTime", &LuaPlayer::GetLevelPlayedTime }, // :GetLevelPlayedTime() - Returns the player's played time at that level { "GetTotalPlayedTime", &LuaPlayer::GetTotalPlayedTime }, // :GetTotalPlayedTime() - Returns the total played time of that player { "GetItemByPos", &LuaPlayer::GetItemByPos }, // :GetItemByPos(bag, slot) - Returns item in given slot in a bag (bag: 19-22 slot: 0-35) or inventory (bag: 255 slot : 0-38) - { "GetReputation", &LuaPlayer::GetReputation }, // :GetReputation(faction) - Gets player's reputation with given faction { "GetItemByEntry", &LuaPlayer::GetItemByEntry }, // :GetItemByEntry(entry) - Gets an item if the player has it + { "GetItemByGUID", &LuaPlayer::GetItemByGUID }, + { "GetReputation", &LuaPlayer::GetReputation }, // :GetReputation(faction) - Gets player's reputation with given faction { "GetEquippedItemBySlot", &LuaPlayer::GetEquippedItemBySlot }, // :GetEquippedItemBySlot(slotId) - Returns equipped item by slot { "GetQuestLevel", &LuaPlayer::GetQuestLevel }, // :GetQuestLevel(quest) - Returns quest's level { "GetChatTag", &LuaPlayer::GetChatTag }, // :GetChatTag() - Returns player chat tag ID diff --git a/PlayerMethods.h b/PlayerMethods.h index 331ffbd..5ec3daf 100644 --- a/PlayerMethods.h +++ b/PlayerMethods.h @@ -1126,20 +1126,6 @@ namespace LuaPlayer return 1; } - /** - * Returns a [Player]s [Item] object by entry ID specified - * - * @param uint32 entryId - * @return [Item] item - */ - int GetItemByEntry(Eluna* /*E*/, lua_State* L, Player* player) - { - uint32 entry = Eluna::CHECKVAL(L, 2); - - Eluna::Push(L, player->GetItemByEntry(entry)); - return 1; - } - /** * Returns a [Player]s [Item] object by gear slot specified * @@ -1232,6 +1218,38 @@ namespace LuaPlayer return 1; } + /** + * Returns an [Item] from the player by guid. + * + * The item can be equipped, in bags or in bank. + * + * @param uint64 guid : an item guid + * @return [Item] item + */ + int GetItemByGUID(Eluna* /*E*/, lua_State* L, Player* player) + { + uint64 guid = Eluna::CHECKVAL(L, 2); + + Eluna::Push(L, player->GetItemByGuid(ObjectGuid(guid))); + return 1; + } + + /** + * Returns an [Item] from the player by entry. + * + * The item can be equipped, in bags or in bank. + * + * @param uint32 entryId + * @return [Item] item + */ + int GetItemByEntry(Eluna* /*E*/, lua_State* L, Player* player) + { + uint32 entry = Eluna::CHECKVAL(L, 2); + + Eluna::Push(L, player->GetItemByEntry(entry)); + return 1; + } + int GetGossipTextId(Eluna* /*E*/, lua_State* L, Player* player) { WorldObject* obj = Eluna::CHECKOBJ(L, 2);