mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
feat(PlayerMethods): Expose the player settings methods (#125)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -543,6 +543,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
{ "GetRankPoints", &LuaPlayer::GetRankPoints },
|
||||
{ "GetHonorLastWeekStandingPos", &LuaPlayer::GetHonorLastWeekStandingPos },
|
||||
#endif
|
||||
{ "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue },
|
||||
|
||||
// Setters
|
||||
{ "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax },
|
||||
@@ -779,6 +780,7 @@ ElunaRegister<Player> PlayerMethods[] =
|
||||
{ "ResetHonor", &LuaPlayer::ResetHonor },
|
||||
{ "ClearHonorInfo", &LuaPlayer::ClearHonorInfo },
|
||||
#endif
|
||||
{ "UpdatePlayerSetting", &LuaPlayer::UpdatePlayerSetting },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -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<std::string>(L, 2);
|
||||
uint32 index = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 value = Eluna::CHECKVAL<uint32>(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<std::string>(L, 2);
|
||||
uint32 index = Eluna::CHECKVAL<uint32>(L, 3);
|
||||
uint32 value = player->GetPlayerSetting(source, index).value;
|
||||
Eluna::Push(L, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*int BindToInstance(lua_State* L, Player* player)
|
||||
{
|
||||
player->BindToInstance();
|
||||
|
||||
Reference in New Issue
Block a user