From d869057fe4a809baab3fd204cda641d9a74b4737 Mon Sep 17 00:00:00 2001 From: iThorgrim <125808072+iThorgrim@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:14:24 +0100 Subject: [PATCH] feat(LuaEngine/PlayerMethods): BonusTalent methods (#235) Co-authored-by: IntelligentQuantum --- src/LuaEngine/LuaFunctions.cpp | 4 +++ src/LuaEngine/methods/PlayerMethods.h | 50 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index 90201ffe4e..77cdc68c08 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -539,6 +539,7 @@ ElunaRegister PlayerMethods[] = { "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue }, { "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue }, { "GetTrader", &LuaPlayer::GetTrader }, + { "GetBonusTalentCount", &LuaPlayer::GetBonusTalentCount }, // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, @@ -572,6 +573,9 @@ ElunaRegister PlayerMethods[] = { "SetPlayerLock", &LuaPlayer::SetPlayerLock }, { "SetGender", &LuaPlayer::SetGender }, { "SetSheath", &LuaPlayer::SetSheath }, + { "SetBonusTalentCount", &LuaPlayer::SetBonusTalentCount }, + { "AddBonusTalent", &LuaPlayer::AddBonusTalent }, + { "RemoveBonusTalent", &LuaPlayer::RemoveBonusTalent }, { "GetHomebind", &LuaPlayer::GetHomebind }, { "GetSpells", &LuaPlayer::GetSpells }, diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 5bf717f3ce..5501182704 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -3914,6 +3914,30 @@ namespace LuaPlayer return 0; }*/ + /** + * Set bonus talent count to a specific count for the [Player] + * + * @param uint32 value : bonus talent points + */ + int SetBonusTalentCount(lua_State* L, Player* player) + { + uint32 value = Eluna::CHECKVAL(L, 2); + + player->SetBonusTalentCount(value); + return 0; + } + + /** + * Get bonus talents count from the [Player] + * + * @return uint32 bonusTalent + */ + int GetBonusTalentCount(lua_State* L, Player* player) + { + Eluna::Push(L, player->GetBonusTalentCount()); + return 1; + } + /** * Returns the [Player] spells list * @@ -3938,6 +3962,32 @@ namespace LuaPlayer return 1; } + /** + * Add bonus talents count to the [Player] + * + * @param uint32 count = count of bonus talent + */ + int AddBonusTalent(lua_State* L, Player* player) + { + uint32 count = Eluna::CHECKVAL(L, 2); + + player->AddBonusTalent(count); + return 0; + } + + /** + * Remove bonus talents count to the [Player] + * + * @param uint32 count = count of bonus talent + */ + int RemoveBonusTalent(lua_State* L, Player* player) + { + uint32 count = Eluna::CHECKVAL(L, 2); + + player->RemoveBonusTalent(count); + return 0; + } + /** * Returns the [Player] homebind location. *