Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Player:GetTrader #126

Merged
merged 2 commits into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos },
#endif
{ "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue },
{ "GetTrader", &LuaPlayer::GetTrader },

// Setters
{ "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax },
Expand Down
11 changes: 11 additions & 0 deletions src/LuaEngine/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down