Skip to content

Commit cfc7f03

Browse files
committed
Minor cleanup
1 parent 94856a0 commit cfc7f03

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

TalentTreeViewer_TWW/IcyVeinsImport.lua

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local IcyVeinsImport = ns.IcyVeinsImport
77
local TalentViewer = ns.TalentViewer
88

99
--- @type LibTalentTree-1.0
10-
local libTT = LibStub('LibTalentTree-1.0');
10+
local LibTT = LibStub('LibTalentTree-1.0');
1111

1212
local L = LibStub('AceLocale-3.0'):GetLocale(name)
1313

@@ -16,16 +16,19 @@ IcyVeinsImport.bitWidthNodeIndex = 6;
1616

1717
--- @param text string
1818
--- @return boolean
19+
--- @public
1920
function IcyVeinsImport:IsTalentUrl(text)
2021
-- example URL https://www.icy-veins.com/wow/the-war-within-talent-calculator#seg1-seg2-seg3-seg4-seg5
2122
return not not text:match('^https?://www%.icy%-veins%.com/wow/the%-war%-within%-talent%-calculator%#[^-]*%-[^-]*%-[^-]*%-[^-]*%-[^-]*$');
2223
end
2324

25+
--- @private
2426
function IcyVeinsImport:ShowImportError(errorString)
2527
StaticPopup_Show("TALENT_VIEWER_LOADOUT_IMPORT_ERROR_DIALOG", errorString);
2628
end
2729

2830
--- @param fullUrl string
31+
--- @public
2932
function IcyVeinsImport:ImportUrl(fullUrl)
3033
if not self:IsTalentUrl(fullUrl) then
3134
self:ShowImportError("Invalid URL");
@@ -61,7 +64,7 @@ function IcyVeinsImport:ParseUrl(url)
6164
local specID = tonumber(specIDStream:ExtractValue(self.bitWidthSpecID));
6265
local classID = specID and C_SpecializationInfo.GetClassIDFromSpecID(specID);
6366

64-
local treeID = classID and libTT:GetClassTreeId(classID);
67+
local treeID = classID and LibTT:GetClassTreeId(classID);
6568

6669
if not classID or not specID or not classString or not specString or not treeID then
6770
return nil;
@@ -72,7 +75,7 @@ function IcyVeinsImport:ParseUrl(url)
7275
local selectedSubTreeID;
7376
if heroStream:GetNumberOfBits() > 0 then
7477
local heroTreeIndex = heroStream:ExtractValue(1) + 1;
75-
selectedSubTreeID = libTT:GetSubTreeIDsForSpecID(specID)[heroTreeIndex];
78+
selectedSubTreeID = LibTT:GetSubTreeIDsForSpecID(specID)[heroTreeIndex];
7679
end
7780

7881
local classNodes, specNodes, heroNodes = self:GetClassAndSpecNodeIDs(specID, treeID, selectedSubTreeID);
@@ -91,6 +94,8 @@ end
9194
--- @param levelMultiplier number
9295
--- @param dataStream ImportDataStreamMixin
9396
--- @param nodes number[]
97+
--- @return table<number, TalentViewer_LevelingBuildEntry> # [level] = entry
98+
--- @private
9499
function IcyVeinsImport:ParseDataSegment(startingLevel, levelMultiplier, dataStream, nodes)
95100
local level = startingLevel;
96101
local rankByNodeID = {};
@@ -111,7 +116,7 @@ function IcyVeinsImport:ParseDataSegment(startingLevel, levelMultiplier, dataStr
111116
}, 'Error while importing IcyVeins URL: Could not find node for index')
112117
end
113118
else
114-
local nodeInfo = libTT:GetNodeInfo(nodeID);
119+
local nodeInfo = LibTT:GetNodeInfo(nodeID);
115120
local isChoiceNode = nodeInfo.type == Enum.TraitNodeType.Selection or nodeInfo.type == Enum.TraitNodeType.SubTreeSelection;
116121
local entry
117122
if isChoiceNode then
@@ -132,11 +137,13 @@ function IcyVeinsImport:ParseDataSegment(startingLevel, levelMultiplier, dataStr
132137
return levelingOrder;
133138
end
134139

140+
--- @private
135141
IcyVeinsImport.classAndSpecNodeCache = {};
136142
--- @param specID number
137143
--- @param treeID number
138144
--- @param selectedSubTreeID number?
139145
--- @return number[], number[], nil|number[] # classNodes, specNodes, heroNodes (if applicable)
146+
--- @private
140147
function IcyVeinsImport:GetClassAndSpecNodeIDs(specID, treeID, selectedSubTreeID)
141148
if self.classAndSpecNodeCache[specID] then
142149
local classNodes, specNodes, heroNodesByTree = unpack(self.classAndSpecNodeCache[specID]);
@@ -150,8 +157,8 @@ function IcyVeinsImport:GetClassAndSpecNodeIDs(specID, treeID, selectedSubTreeID
150157
local heroNodesByTree = {};
151158

152159
for _, nodeID in ipairs(nodes or {}) do
153-
local nodeInfo = libTT:GetNodeInfo(nodeID);
154-
if libTT:IsNodeVisibleForSpec(specID, nodeID) and nodeInfo.maxRanks > 0 then
160+
local nodeInfo = LibTT:GetNodeInfo(nodeID);
161+
if LibTT:IsNodeVisibleForSpec(specID, nodeID) and nodeInfo.maxRanks > 0 then
155162
if nodeInfo.isSubTreeSelection then
156163
-- skip
157164
elseif nodeInfo.subTreeID then

0 commit comments

Comments
 (0)