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(LuaEngine/PlayerMethods): BonusTalent methods #235

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

iThorgrim
Copy link

@iThorgrim iThorgrim commented Jan 25, 2025

📝 Description

This pull request introduces four new methods in mod-eluna for player:

  • SetBonusTalentCount
  • GetBonusTalentCount
  • AddBonusTalent
  • RemoveBonusTalent

🚨 Prerequisites

Warning

Requires the following dependency:

Note

Implemented based on feature request:

🆕 New Methods Overview

1. SetBonusTalentCount(points)

Sets the bonus talent points for a player to a specific value.

Example

player:SetBonusTalentCount(10)

2. GetBonusTalentCount()

Retrieves the current number of bonus talent points for a player.

Example

local bonusTalents = player:GetBonusTalentCount()
print(bonusTalents)

3. AddBonusTalent(points)

Adds a specified number of bonus talent points to a player.

Example

player:AddBonusTalent(5)

4. RemoveBonusTalent(points)

Removes a specified number of bonus talent points from a player.

Example

player:RemoveBonusTalent(3)

🧪 Test Case

Test Script

local function PerformTest(player)
    print("===============================")
    print("   Eluna - Test new methods    ")
    print("===============================")
    
    local extra_talent_count = player:GetBonusTalentCount()
    print("Initial Bonus Talent Count ->", extra_talent_count)
    
    player:SetBonusTalentCount(1)
    extra_talent_count = player:GetBonusTalentCount()
    print("After SetBonusTalentCount(1) ->", extra_talent_count)
    
    player:AddBonusTalent(5)
    extra_talent_count = player:GetBonusTalentCount()
    print("After AddBonusTalent(5) ->", extra_talent_count)
    
    player:RemoveBonusTalent(1)
    extra_talent_count = player:GetBonusTalentCount()
    print("After RemoveBonusTalent(1) ->", extra_talent_count)
end

local function OnPlayerCommand(event, player, command)
    if (command == "eluna") then
        PerformTest(player)
    end
end

RegisterPlayerEvent(42, OnPlayerCommand)

📸 Test Results

image

Desktop.2025-01-25.12-12-11.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant