Skip to content

Commit

Permalink
feat(LuaEngine/PlayerMethods): BonusTalent methods (#235)
Browse files Browse the repository at this point in the history
Co-authored-by: IntelligentQuantum <[email protected]>
  • Loading branch information
iThorgrim and IntelligentQuantum authored Feb 5, 2025
1 parent b799efd commit d869057
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/LuaEngine/LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetShieldBlockValue", &LuaPlayer::GetShieldBlockValue },
{ "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue },
{ "GetTrader", &LuaPlayer::GetTrader },
{ "GetBonusTalentCount", &LuaPlayer::GetBonusTalentCount },

// Setters
{ "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax },
Expand Down Expand Up @@ -572,6 +573,9 @@ ElunaRegister<Player> 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 },

Expand Down
50 changes: 50 additions & 0 deletions src/LuaEngine/methods/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32>(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
*
Expand All @@ -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<uint32>(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<uint32>(L, 2);

player->RemoveBonusTalent(count);
return 0;
}

/**
* Returns the [Player] homebind location.
*
Expand Down

0 comments on commit d869057

Please sign in to comment.