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

[Suggest] Add some ExtraTalentPoints functions so can add TalentPoints and save permanent. #205

Open
kissingers opened this issue Dec 24, 2024 · 1 comment

Comments

@kissingers
Copy link

kissingers commented Dec 24, 2024

I dont know how to do lua function, but some mod can use this way to add ExtraBonusTalentPoints, so will not lost the add TalentPoints when player relogin or server reboot. this will increase or replace SetFreeTalentPoints.
This is very useful in some Lua scripts for custom rewards of permanent talent points, as the original function could only retain temporary reward talent points.

And who can do this? I dont know how to do.

lua function can use this way: Player:AddExtraTalentPoints(+or- point) or Player:RewardExtraTalentPoints(+or- point)
and eluna will do this way:
player->RewardExtraBonusTalentPoints(point); or change palyer m_extraBonusTalentCount = m_extraBonusTalentCount +point
player->InitTalentForLevel();

Also can add some function just like these
GetExtraBonusTalentPoints() get absolute for ExtraTalentPoints, just read m_extraBonusTalentCount
SetExtraBonusTalentPoints(point) set absolute for ExtraTalentPoints, it seems just need change m_extraBonusTalentCount and InitTalentForLevel, not very sure

Alternatively, the function SetFreeTalentPoints also can be modified to SetFreeTalentPoints(point, true). When the parameter is true, use ExtraTalentPoints as a substitute, and default is false so will compatible with the original function.

@kissingers
Copy link
Author

kissingers commented Dec 24, 2024

and now can use CharDBExecute("UPDATE characters SET extraBonusTalentCount = extraBonusTalentCount + 1 WHERE guid = "..PGUID..";") to change the database extraBonusTalentCount , but when player logout, will be rewrite by m_extraBonusTalentCount, just back to before. So now need kick player first , than later write extraBonusTalentCount. It seem not so smart.

local function UseItemAddTalent(event, player, item, target)
player:RemoveItem(item, 1)
local PGUID = player:GetGUIDLow()
Kick(player)
local function LaterAddExtTalent()
CharDBExecute("UPDATE characters SET extraBonusTalentCount = extraBonusTalentCount + 1 WHERE guid = "..PGUID..";")
end
CreateLuaEvent(LaterAddExtTalent, 2000, 1)
end

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

No branches or pull requests

1 participant