diff --git a/README.md b/README.md index 47e3305..9c8847a 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Eluna API for AC: - Added `Player:GetXP()`: https://github.com/azerothcore/mod-eluna/pull/77 - 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 ### 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 1bff865..5b97bf8 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -543,6 +543,7 @@ ElunaRegister PlayerMethods[] = { "GetRankPoints", &LuaPlayer::GetRankPoints }, { "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos }, #endif + { "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue }, // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, @@ -779,6 +780,7 @@ ElunaRegister PlayerMethods[] = { "ResetHonor", &LuaPlayer::ResetHonor }, { "ClearHonorInfo", &LuaPlayer::ClearHonorInfo }, #endif + { "UpdatePlayerSetting", &LuaPlayer::UpdatePlayerSetting }, { NULL, NULL } }; diff --git a/src/LuaEngine/PlayerMethods.h b/src/LuaEngine/PlayerMethods.h index 093a832..919dcb8 100644 --- a/src/LuaEngine/PlayerMethods.h +++ b/src/LuaEngine/PlayerMethods.h @@ -4168,6 +4168,37 @@ namespace LuaPlayer } #endif + /** + * Sets a setting value for the [Player] + * + * @param string source + * @param uint32 index + * @param uint32 value + */ + int UpdatePlayerSetting(lua_State* L, Player* player) + { + std::string source = Eluna::CHECKVAL(L, 2); + uint32 index = Eluna::CHECKVAL(L, 3); + uint32 value = Eluna::CHECKVAL(L, 4); + player->UpdatePlayerSetting(source, index, value); + return 0; + } + + /** + * Gets a setting value for the [Player] + * + * @param string source + * @param uint32 index + */ + int GetPlayerSettingValue(lua_State* L, Player* player) + { + std::string source = Eluna::CHECKVAL(L, 2); + uint32 index = Eluna::CHECKVAL(L, 3); + uint32 value = player->GetPlayerSetting(source, index).value; + Eluna::Push(L, value); + return 1; + } + /*int BindToInstance(lua_State* L, Player* player) { player->BindToInstance();