Skip to content

Commit 5bbed96

Browse files
committed
Added StarterBuild info to LibTalentTree-1.0
1 parent 008309c commit 5bbed96

File tree

3 files changed

+2334
-2145
lines changed

3 files changed

+2334
-2145
lines changed

LibTalentTree-1.0.lua

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- the data for LibTalentTree resides in LibTalentTree-1.0_data.lua
22

3-
local MAJOR, MINOR = "LibTalentTree-1.0", 1
3+
local MAJOR, MINOR = "LibTalentTree-1.0", 2
44
--- @class LibTalentTree
55
local LibTalentTree = LibStub:NewLibrary(MAJOR, MINOR)
66

@@ -56,6 +56,11 @@ LibTalentTree.dataVersion = 0 -- overwritten in LibTalentTree-1.0_data.lua
5656
---@field spentAmountRequired number # the total amount of currency required to unlock the gate
5757
---@field traitCurrencyID number # TraitCurrencyID
5858

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+
5964
--------------------------------------------------------------------------------
6065
--------------------------------------------------------------------------------
6166

@@ -301,3 +306,24 @@ function LibTalentTree:GetGates(specId)
301306

302307
return deepCopy(gates);
303308
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

Comments
 (0)