Stanzilla/WoWUIBugs

C_Item.GetDetailedItemLevelInfo reports incorrect item levels for some item strings

Opened this issue · 1 comments

The C_Item.GetDetailedItemLevelInfo when given certain item links can calculate incorrect values for the actualItemLevel return. The tooltip APIs appear to return correct data, but aren't portably usable on Classic and aren't quite as convenient to use.

Test case

Execute the following commands. The first command may require executing twice if the item data hasn't been loaded into the cache.

/dump (C_Item.GetDetailedItemLevelInfo("item:172187::::::::20:71::3:1:3524:::"))
/dump C_TooltipInfo.GetHyperlink("item:172187::::::::20:71::3:1:3524:::").lines[2].leftText

The output of the first command reports actualItemLevel as being 106, however the second command reports "Item Level 274". In this case, the tooltip value is purportedly correct.

ls- commented

The only accurate ilvl API right now is C_Item.GetCurrentItemLevel which uses ItemLocation. But when all you have to work with is an item link from an event, item locations aren't really viable. One could potentially try to match the link to an item in your bags, but it's not reliable because the order of bonuses and whatnot in these item links often is different. And that's assuming you're even trying to get the ilvl for an item in the player's inventory in the first place.

So the only other option in this case is parsing tooltip data which isn't really ideal, you have to jump through a bunch of hoops there, but at least it's accurate.

-- edit

And ilvl API discrepancies like that aren't limited to older items or Classic, it affects heirlooms, or even TWW items that got upgraded, for instance, quest rewards that sometimes go from greens to blues, and stuff like that.