@@ -197,8 +197,9 @@ function TUM:IsToken(itemID)
197197 return not not self .data .tokens [itemID ]
198198end
199199
200- --- @return nil |{ season : number , classList : number[] , tier : number | nil , slot : number }
201- function TUM :GetTokenInfo (itemID , itemLink )
200+ --- @param tooltipData TooltipData ?
201+ --- @return nil |{ season : number , classList : number[] , tier : TUM_Tier | nil , slot : number }
202+ function TUM :GetTokenInfo (itemID , itemLink , tooltipData )
202203 local tokenInfo = self .data .tokens [itemID ]
203204 if not tokenInfo then
204205 return nil
@@ -207,7 +208,7 @@ function TUM:GetTokenInfo(itemID, itemLink)
207208 local _ , data = LinkUtil .ExtractLink (itemLink )
208209 local parts = strsplittable (' :' , data )
209210 local itemCreationContext = tonumber (parts [12 ])
210- local tier = self .data .constants .itemContextTiers [itemCreationContext ] or nil
211+ local tier = self .data .constants .itemContextTiers [itemCreationContext ] or self : GetTooltipDifficultyTier ( itemLink , tooltipData )
211212
212213 return {
213214 season = tokenInfo .season ,
@@ -217,6 +218,24 @@ function TUM:GetTokenInfo(itemID, itemLink)
217218 }
218219end
219220
221+ --- @param itemLink string
222+ --- @param tooltipData TooltipData ?
223+ --- @return TUM_Tier | nil tier
224+ function TUM :GetTooltipDifficultyTier (itemLink , tooltipData )
225+ tooltipData = tooltipData or C_TooltipInfo .GetHyperlink (itemLink )
226+ local line2Text = tooltipData and tooltipData .lines [2 ] and tooltipData .lines [2 ].leftText or nil
227+ if not line2Text then return nil end
228+
229+ for tier , difficultyString in pairs (self .data .constants .difficultyTierStrings ) do
230+ if line2Text == difficultyString then
231+ return tier
232+ end
233+ end
234+
235+ -- default to normal
236+ return self .data .constants .tiers .normal
237+ end
238+
220239--- doesn't return season information for catalysed items from previous seasons, but that's fine, since nothing can be done with those items anyway
221240function TUM :GetItemSeason (itemLink )
222241 if self :IsCurrentSeasonItem (itemLink ) then
283302
284303--- @param itemLink string
285304--- @param tooltipData TooltipData
286- --- @return number ? itemBinding # see Enum.TooltipDataItemBinding
305+ --- @return Enum.TooltipDataItemBinding | nil itemBinding
287306function TUM :GetItemBinding (itemLink , tooltipData )
288307 local data = tooltipData or C_TooltipInfo .GetHyperlink (itemLink );
289308 for _ , line in ipairs (data and data .lines or {}) do
341360--- @param itemLink string
342361--- @param classID number ? # defaults to the player's class
343362--- @param debugLines string[] ? # if provided, debug lines will be added to this table
363+ --- @param tooltipData TooltipData ?
344364--- @return TUM_AppearanceMissingResult
345- function TUM :IsAppearanceMissing (itemLink , classID , debugLines )
365+ function TUM :IsAppearanceMissing (itemLink , classID , debugLines , tooltipData )
346366 --- @type TUM_AppearanceMissingResult
347367 local result = {
348368 canCatalyse = nil ,
@@ -403,7 +423,7 @@ function TUM:IsAppearanceMissing(itemLink, classID, debugLines)
403423 tryInsert (debugLines , ' itemModID: ' .. tostring (sourceInfo and sourceInfo .itemModID ))
404424 end
405425
406- local tokenInfo = isToken and self :GetTokenInfo (itemID , itemLink )
426+ local tokenInfo = isToken and self :GetTokenInfo (itemID , itemLink , tooltipData )
407427 if tokenInfo then
408428 if not tokenInfo .classList [classID ] then
409429 tryInsert (debugLines , ' item is a token for another class' )
@@ -531,7 +551,7 @@ function TUM:HandleTooltip(tooltip, tooltipData)
531551 if not itemLink then return end
532552
533553 local debugLines = {}
534- local result = self :IsAppearanceMissing (itemLink , nil , debugLines )
554+ local result = self :IsAppearanceMissing (itemLink , nil , debugLines , tooltipData )
535555
536556 for _ , line in ipairs (debugLines ) do
537557 self :AddDebugLine (tooltip , line )
@@ -580,7 +600,7 @@ function TUM:HandleTooltip(tooltip, tooltipData)
580600 local catalystUpgradeClassList = {}
581601 for classID = 1 , GetNumClasses () do
582602 if classID ~= playerClassID and self .db .warbandCatalystClassList [classID ] then
583- local classResult = self :IsAppearanceMissing (itemLink , classID )
603+ local classResult = self :IsAppearanceMissing (itemLink , classID , nil , tooltipData )
584604 if classResult .catalystAppearanceMissing then
585605 table.insert (catalystClassList , classID )
586606 end
0 commit comments