@@ -29,7 +29,7 @@ ns.TalentViewer = TalentViewer
2929local cache = TalentViewer .cache
3030local LibDBIcon = LibStub (' LibDBIcon-1.0' )
3131--- @type LibTalentTree
32- local LibTalentTree = LibStub (' LibTalentTree-0.1 ' ) -- should be updated to 1.0 once the library is finalized
32+ local LibTalentTree = LibStub (' LibTalentTree-1.0 ' )
3333
3434---- ------------------
3535--- Reorganize data
107107 local isChoiceNode = # nodeInfo .entryIDs > 1
108108 local selectedEntryId = isChoiceNode and TalentViewer :GetSelectedEntryId (nodeID ) or nil
109109
110+ local meetsEdgeRequirements = true
111+ local meetsGateRequirements = true
112+ if not TalentViewer .db .ignoreRestrictions then
113+ for _ , conditionId in ipairs (nodeInfo .conditionIDs ) do
114+ local condInfo = self :GetAndCacheCondInfo (conditionId )
115+ if condInfo .isGate and not condInfo .isMet then meetsGateRequirements = false end
116+ end
117+ end
118+
119+ local isAvailable = meetsEdgeRequirements and meetsGateRequirements
120+
110121 nodeInfo .activeRank = isGranted
111122 and nodeInfo .maxRanks
112123 or ((isChoiceNode and selectedEntryId and 1 ) or TalentViewer :GetActiveRank (nodeID ))
113124 nodeInfo .currentRank = nodeInfo .activeRank
114125 nodeInfo .ranksPurchased = not isGranted and nodeInfo .currentRank or 0
115- nodeInfo .isAvailable = true -- TODO: should depend on incoming edges
116- nodeInfo .canPurchaseRank = not isGranted and ((TalentViewer .purchasedRanks [nodeID ] or 0 ) < nodeInfo .maxRanks )
126+ nodeInfo .isAvailable = isAvailable
127+ nodeInfo .canPurchaseRank = isAvailable and not isGranted and ((TalentViewer .purchasedRanks [nodeID ] or 0 ) < nodeInfo .maxRanks )
117128 nodeInfo .canRefundRank = not isGranted and ((TalentViewer .purchasedRanks [nodeID ] or 0 ) > 0 )
118- nodeInfo .meetsEdgeRequirements = true
129+ nodeInfo .meetsEdgeRequirements = meetsEdgeRequirements
119130
120131 for _ , edge in ipairs (nodeInfo .visibleEdges ) do
121132 edge .isActive = nodeInfo .activeRank == nodeInfo .maxRanks
195206 TalentViewer :PurchaseRank (self :GetNodeID ());
196207 talentFrame :MarkNodeInfoCacheDirty (self :GetNodeID ())
197208 talentFrame :UpdateTreeCurrencyInfo ()
198- self :CheckTooltip ();
209+ -- self:CheckTooltip();
199210 end
200211
201212 function talentButton :RefundRank ()
202213 self :PlayDeselectSound ();
203214 TalentViewer :RefundRank (self :GetNodeID ());
204215 talentFrame :MarkNodeInfoCacheDirty (self :GetNodeID ())
205216 talentFrame :UpdateTreeCurrencyInfo ()
206- self :CheckTooltip ();
217+ -- self:CheckTooltip();
207218 end
208219
209220 return talentButton
257268 self .treeCurrencyInfo = C_Traits .GetTreeCurrencyInfo (self :GetConfigID (), self :GetTalentTreeID (), self .excludeStagedChangesForCurrencies );
258269
259270 self .treeCurrencyInfoMap = {};
260- for _ , treeCurrency in ipairs (self .treeCurrencyInfo ) do
271+ for i , treeCurrency in ipairs (self .treeCurrencyInfo ) do
272+ treeCurrency .maxQuantity = i == 1 and 31 or 30 ;
261273 self .treeCurrencyInfoMap [treeCurrency .traitCurrencyID ] = TalentViewer :ApplyCurrencySpending (treeCurrency );
262274 end
263- self :UpdateAllButtons ();
264275
265276 self :RefreshCurrencyDisplay ();
266277
273284 end
274285
275286 self :RefreshGates ();
287+ for talentButton in self :EnumerateAllTalentButtons () do
288+ self :MarkNodeInfoCacheDirty (talentButton :GetNodeID ());
289+ end
276290 end
277291
278292end
@@ -478,6 +492,9 @@ function TalentViewer:OnInitialize()
478492 hide = false ,
479493 }
480494 end
495+ if self .db .ignoreRestrictions == nil then
496+ self .db .ignoreRestrictions = true
497+ end
481498 local dataObject = LibStub (' LibDataBroker-1.1' ):NewDataObject (
482499 name ,
483500 {
@@ -518,19 +535,10 @@ function TalentViewer:OnInitialize()
518535 TalentViewer :ToggleTalentView ()
519536 end
520537
521- self :PatchBlizzardImport ()
522538 self :AddButtonToBlizzardTalentFrame ()
523539 self :HookIntoBlizzardImport ()
524540end
525541
526- function TalentViewer :PatchBlizzardImport ()
527- -- This is the only(?) thing stopping us from importing 'bad' string to the blizzard UI
528- -- The main risk is that if the tree is changed significantly, weird things happen
529- function ClassTalentFrame .TalentsTab :HashEquals (a ,b )
530- return true
531- end
532- end
533-
534542function TalentViewer :AddButtonToBlizzardTalentFrame ()
535543 local button = CreateFrame (' Button' , nil , ClassTalentFrame , ' UIPanelButtonTemplate' )
536544 button :SetText (' Talent Viewer' )
@@ -598,7 +606,7 @@ function TalentViewer:SelectSpec(classId, specId)
598606 self .selectedClassId = classId
599607 self .selectedSpecId = specId
600608 self .treeId = LibTalentTree :GetClassTreeId (classId )
601- self :SetClassIcon ( classId )
609+ self :SetPortraitIcon ( specId )
602610
603611 TalentViewer_DF :SetTitle (string.format (
604612 ' %s %s - %s' ,
@@ -610,11 +618,10 @@ function TalentViewer:SelectSpec(classId, specId)
610618 self :ResetTree ();
611619end
612620
613- function TalentViewer :SetClassIcon (classId )
614- local class = cache .classFiles [classId ]
615-
616- local left , right , bottom , top = unpack (CLASS_ICON_TCOORDS [string.upper (class )]);
617- TalentViewer_DF .PortraitOverlay .Portrait :SetTexCoord (left , right , bottom , top );
621+ function TalentViewer :SetPortraitIcon (specId )
622+ local icon = cache .specIconId [specId ]
623+ TalentViewer_DF :SetPortraitTexCoord (0 , 1 , 0 , 1 );
624+ TalentViewer_DF :SetPortraitToAsset (icon );
618625end
619626
620627function TalentViewer :MakeDropDownButton ()
0 commit comments