@@ -2,6 +2,9 @@ local name, ns = ...
22
33if LE_EXPANSION_LEVEL_CURRENT <= LE_EXPANSION_SHADOWLANDS then print (name , ' requires Dragonflight to work' ) return end
44
5+ local MAX_LEVEL_CLASS_CURRENCY_CAP = 31
6+ local MAX_LEVEL_SPEC_CURRENCY_CAP = 30
7+
58--- @class TalentViewer
69TalentViewer = {
710 purchasedRanks = {},
269272
270273 self .treeCurrencyInfoMap = {};
271274 for i , treeCurrency in ipairs (self .treeCurrencyInfo ) do
272- treeCurrency .maxQuantity = i == 1 and 31 or 30 ;
275+ -- hardcode currency cap to lvl 70 values
276+ treeCurrency .maxQuantity = i == 1 and MAX_LEVEL_CLASS_CURRENCY_CAP or MAX_LEVEL_SPEC_CURRENCY_CAP ;
273277 self .treeCurrencyInfoMap [treeCurrency .traitCurrencyID ] = TalentViewer :ApplyCurrencySpending (treeCurrency );
274278 end
275279
289293 end
290294 end
291295
296+ function TalentViewer_ClassTalentTalentsTabMixin :RefreshCurrencyDisplay ()
297+ local classCurrencyInfo = self .treeCurrencyInfo and self .treeCurrencyInfo [1 ] or nil ;
298+ local classInfo = self :GetClassInfo ();
299+ self .ClassCurrencyDisplay :SetPointTypeText (string.upper (classInfo .className ));
300+ self .ClassCurrencyDisplay :SetAmount (classCurrencyInfo and classCurrencyInfo .quantity or 0 );
301+
302+ local specCurrencyInfo = self .treeCurrencyInfo and self .treeCurrencyInfo [2 ] or nil ;
303+ self .SpecCurrencyDisplay :SetPointTypeText (string.upper (self :GetSpecName ()));
304+ self .SpecCurrencyDisplay :SetAmount ((specCurrencyInfo and specCurrencyInfo .quantity or 0 ));
305+ end
306+
307+ function TalentViewer_ClassTalentTalentsTabMixin :OnLoad ()
308+ ClassTalentTalentsTabMixin .OnLoad (self )
309+
310+ local setAmountOverride = function (self , amount )
311+ local requiredLevel = self .isClassCurrency and 8 or 9 ;
312+ local spent = (self .isClassCurrency and MAX_LEVEL_CLASS_CURRENCY_CAP or MAX_LEVEL_SPEC_CURRENCY_CAP ) - amount ;
313+ requiredLevel = math.max (10 , requiredLevel + (spent * 2 ));
314+
315+ local text = string.format (' %d (level %d)' , amount , requiredLevel );
316+
317+ self .CurrencyAmount :SetText (text );
318+
319+ local enabled = not self :IsInspecting () and (amount > 0 );
320+ local textColor = enabled and GREEN_FONT_COLOR or GRAY_FONT_COLOR ;
321+ self .CurrencyAmount :SetTextColor (textColor :GetRGBA ());
322+
323+ self :MarkDirty ();
324+ end
325+
326+ self .ClassCurrencyDisplay .SetAmount = setAmountOverride
327+ self .ClassCurrencyDisplay .isClassCurrency = true
328+ self .SpecCurrencyDisplay .SetAmount = setAmountOverride
329+ self .SpecCurrencyDisplay .isClassCurrency = false
330+ end
292331end
293332
294333---- ------------------
0 commit comments