From 2a683a59e37cf08f4912aac2016467d99f412849 Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Sat, 15 Apr 2023 19:33:05 +0200 Subject: [PATCH] feat: add Player:GetTrader (#126) --- README.md | 1 + src/LuaEngine/LuaFunctions.cpp | 1 + src/LuaEngine/PlayerMethods.h | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 9c8847a..715c734 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ Eluna API for AC: - Added `Player:GetAchievementCriteriaProgress()`: https://github.com/azerothcore/mod-eluna/pull/78 - Added vendor entry as argument to `Player:SendListInventory(object, vendorentry)`: https://github.com/azerothcore/mod-eluna/pull/48 - Added `Player:GetPlayerSettingValue()` and `Player:UpdatePlayerSetting()`: https://github.com/azerothcore/mod-eluna/pull/125 +- Added `Player:GetTrader()`: https://github.com/azerothcore/mod-eluna/pull/126 ### Group - Added `Group:GetGroupType()`: https://github.com/azerothcore/mod-eluna/pull/82 diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index 5b97bf8..8374986 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -544,6 +544,7 @@ ElunaRegister PlayerMethods[] = { "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos }, #endif { "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue }, + { "GetTrader", &LuaPlayer::GetTrader }, // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, diff --git a/src/LuaEngine/PlayerMethods.h b/src/LuaEngine/PlayerMethods.h index 919dcb8..04143b1 100644 --- a/src/LuaEngine/PlayerMethods.h +++ b/src/LuaEngine/PlayerMethods.h @@ -4199,6 +4199,17 @@ namespace LuaPlayer return 1; } + /** + * Returns the [Player] that is currently trading with this [Player] + * + * @return [Player] trader : the player trading, or nil + */ + int GetTrader(lua_State* L, Player* player) + { + Eluna::Push(L, player->GetTrader()); + return 1; + } + /*int BindToInstance(lua_State* L, Player* player) { player->BindToInstance();