|
1 | 1 | -- the data for LibTalentTree resides in LibTalentTree-1.0_data.lua |
2 | 2 |
|
3 | | -local MAJOR, MINOR = "LibTalentTree-1.0", 1 |
| 3 | +local MAJOR, MINOR = "LibTalentTree-1.0", 2 |
4 | 4 | --- @class LibTalentTree |
5 | 5 | local LibTalentTree = LibStub:NewLibrary(MAJOR, MINOR) |
6 | 6 |
|
@@ -56,6 +56,11 @@ LibTalentTree.dataVersion = 0 -- overwritten in LibTalentTree-1.0_data.lua |
56 | 56 | ---@field spentAmountRequired number # the total amount of currency required to unlock the gate |
57 | 57 | ---@field traitCurrencyID number # TraitCurrencyID |
58 | 58 |
|
| 59 | +---@class starterBuildEntryInfo |
| 60 | +---@field nodeID number # TraitNodeID |
| 61 | +---@field entryID number|nil # TraitEntryID - only present in case of choice nodes |
| 62 | +---@field numPoints number # the number of points to spend in this node |
| 63 | + |
59 | 64 | -------------------------------------------------------------------------------- |
60 | 65 | -------------------------------------------------------------------------------- |
61 | 66 |
|
@@ -301,3 +306,24 @@ function LibTalentTree:GetGates(specId) |
301 | 306 |
|
302 | 307 | return deepCopy(gates); |
303 | 308 | end |
| 309 | + |
| 310 | +--- @public |
| 311 | +--- @param specId number # See https://wowpedia.fandom.com/wiki/SpecializationID |
| 312 | +--- @return starterBuildEntryInfo[]|nil # list of starter build entries for the given spec, sorted by suggested spending order; nil if no starter build is available |
| 313 | +function LibTalentTree:GetStarterBuildBySpec(specId) |
| 314 | + assert(type(specId) == 'number', 'specId must be a number'); |
| 315 | + |
| 316 | + local starterBuild = self.starterBuilds[specId]; |
| 317 | + if not starterBuild then return nil end |
| 318 | + |
| 319 | + local entries = {}; |
| 320 | + for _, entry in pairs(starterBuild) do |
| 321 | + table.insert(entries, { |
| 322 | + nodeID = entry.node, |
| 323 | + entryID = entry.entry or nil, |
| 324 | + numPoints = entry.points or 1, |
| 325 | + }); |
| 326 | + end |
| 327 | + |
| 328 | + return entries; |
| 329 | +end |
0 commit comments