From 7581aa4855ab0d22b93f6e278cf387eadf7ab49c Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Sat, 15 Apr 2023 19:28:50 +0200 Subject: [PATCH 1/2] feat: add Player:GetTrader() --- src/LuaEngine/LuaFunctions.cpp | 1 + src/LuaEngine/PlayerMethods.h | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index 5b97bf8228..8374986748 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 919dcb886c..04143b1aec 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(); From d463d061b175d43574a815866d8d26666866756e Mon Sep 17 00:00:00 2001 From: Axel Cocat Date: Sat, 15 Apr 2023 19:32:45 +0200 Subject: [PATCH 2/2] update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9c8847a4cf..715c73469f 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