Quantcast
way to purchase skillpoints? - ESOUI
Thread Tools Display Modes
07/25/22, 08:15 AM   #1
tim99
 
tim99's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 20
Question way to purchase skillpoints?

Hi,
does anyone knows if there is a API for purchasing/spending skillpoints?


Just found things to allocate them to the actionbar after you purchased them, but not for purchasing in the first place.
For example on a new toon to spend the 3 skillpoints on the first skill of each of the 3 class skill lines.
  Reply With Quote
07/25/22, 09:26 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,207
Addons like Caro's Skill and Champion Points Saver should have code to do so, if you want to have a look. But maybe I'm wrong and it just assigns the already purchased skills to the action slots.


If I find the API functions (if they exist, maybe it's the SKILLS_DATA_MANAGER or similar with functions which is able to assign the points) I'll add them here.

Edit:
At the addon compatibility there exists this function, which uses the SKILLS_DATA_MANAGER
https://github.com/esoui/esoui/blob/...iases.lua#L680

Code:
function ZO_Skills_PurchaseAbility(skillType, skillLineIndex, skillIndex)
    local skillData = SKILLS_DATA_MANAGER:GetSkillDataByIndices(skillType, skillLineIndex, skillIndex)
    if skillData then
        skillData:GetPointAllocator():Purchase()
    end
end

function ZO_Skills_UpgradeAbility(skillType, skillLineIndex, skillIndex)
    local skillData = SKILLS_DATA_MANAGER:GetSkillDataByIndices(skillType, skillLineIndex, skillIndex)
    if skillData then
        skillData:GetPointAllocator():IncreaseRank()
    end
end

function ZO_Skills_MorphAbility(progressionIndex, morphSlot)
    local skillType, skillLineIndex, skillIndex = GetSkillAbilityIndicesFromProgressionIndex(progressionIndex)
    local skillData = SKILLS_DATA_MANAGER:GetSkillDataByIndices(skillType, skillLineIndex, skillIndex)
    if skillData then
        skillData:GetPointAllocator():Morph(morphSlot)
    end
end
Better use the SKILLS_DATA_MANAGER directly instead of using those ZO_Skills_* functions, maybe these addon compatibility aliases will be gone one day!

Last edited by Baertram : 07/25/22 at 09:31 AM.
  Reply With Quote
07/25/22, 09:55 AM   #3
tim99
 
tim99's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2017
Posts: 20
awesome, it works. thx very much!!


btw do they really remove aliases from time to time? whats the point in adding aliases when they get removed later anyway? then they can remove it right away as well when it changes...?
  Reply With Quote
07/25/22, 10:18 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,207
Yes they did but not that much yet.
If one sees what the alias does it's a good way to use the "new code" instead of sticking with the old one.

The aliases are only there to make older addons not break, as they used the old exisitng functions and code.
But new addons should not use them anymore and adopt to the same way like vanilla code does it.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » way to purchase skillpoints?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off