@@ -7,7 +7,7 @@ local IcyVeinsImport = ns.IcyVeinsImport
77local TalentViewer = ns .TalentViewer
88
99--- @type LibTalentTree-1.0
10- local libTT = LibStub (' LibTalentTree-1.0' );
10+ local LibTT = LibStub (' LibTalentTree-1.0' );
1111
1212local 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
1920function 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%#[^-]*%-[^-]*%-[^-]*%-[^-]*%-[^-]*$' );
2223end
2324
25+ --- @private
2426function IcyVeinsImport :ShowImportError (errorString )
2527 StaticPopup_Show (" TALENT_VIEWER_LOADOUT_IMPORT_ERROR_DIALOG" , errorString );
2628end
2729
2830--- @param fullUrl string
31+ --- @public
2932function 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 );
9194--- @param levelMultiplier number
9295--- @param dataStream ImportDataStreamMixin
9396--- @param nodes number[]
97+ --- @return table<number , TalentViewer_LevelingBuildEntry> # [level] = entry
98+ --- @private
9499function 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 ;
133138end
134139
140+ --- @private
135141IcyVeinsImport .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
140147function 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