Skip to content

Commit 8cc2d3d

Browse files
committed
Show item upgrade level in the TUM Collections UI tooltip (closes #11)
1 parent e78bf46 commit 8cc2d3d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

collectionUi.lua

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,9 @@ function UI:BuildUI()
412412
if result.distance > 0 then
413413
text = WARBAND_MARKUP .. ' ' .. text;
414414
end
415+
if result.upgradeLevel > 0 then
416+
text = text .. (' %d/%d'):format(result.upgradeLevel, result.maxUpgradeLevel);
417+
end
415418
GameTooltip:AddDoubleLine(text, result.location, 1, 1, 1, 1, 1, 1);
416419
end
417420
else
@@ -616,6 +619,9 @@ function UI:OnUpdate()
616619
if a.distance ~= b.distance then
617620
return a.distance < b.distance;
618621
end
622+
if a.upgradeLevel ~= b.upgradeLevel then
623+
return a.upgradeLevel > b.upgradeLevel;
624+
end
619625
if a.location ~= b.location then
620626
return a.location > b.location;
621627
end
@@ -693,7 +699,7 @@ end
693699
--- @param classID number
694700
--- @param seasonID number
695701
--- @return nil|TUM_UI_ResultData info
696-
--- @return nil|TUM_UI_ResultData upgradeInfo
702+
--- @return nil|TUM_UI_ResultData upgradedInfo
697703
local function checkResult(scanResult, classID, seasonID)
698704
if
699705
scanResult.source.guild -- ignore guild banks, might add some filter setting later
@@ -749,8 +755,11 @@ local function checkResult(scanResult, classID, seasonID)
749755
location = CreateAtlasMarkup('warbands-icon', 17, 13) .. ' Warband bank';
750756
distance = 100 + scanResult.source.warband;
751757
end
758+
local upgradeInfo = C_Item.GetItemUpgradeInfo(scanResult.itemLink)
759+
local upgradeLevel = upgradeInfo and upgradeInfo.currentLevel or 0
760+
local maxUpgradeLevel = upgradeInfo and upgradeInfo.maxLevel or 0
752761

753-
local info, upgradeInfo;
762+
local info, upgradedInfo;
754763
if not isItemCatalysed and tumResult.catalystAppearanceMissing then
755764
--- @type TUM_UI_ResultData
756765
info = {
@@ -762,12 +771,14 @@ local function checkResult(scanResult, classID, seasonID)
762771
itemLink = scanResult.itemLink,
763772
location = location,
764773
distance = distance,
774+
upgradeLevel = upgradeLevel,
775+
maxUpgradeLevel = maxUpgradeLevel,
765776
};
766777
end
767778

768779
if tumResult.catalystUpgradeAppearanceMissing or (isItemCatalysed and tumResult.upgradeAppearanceMissing) then
769780
--- @type TUM_UI_ResultData
770-
upgradeInfo = {
781+
upgradedInfo = {
771782
slot = itemSlot,
772783
tier = tumResult.contextData.tier + 1,
773784
knownFromOtherItem = (isItemCatalysed and tumResult.upgradeAppearanceLearnedFromOtherItem) or tumResult.catalystUpgradeAppearanceLearnedFromOtherItem,
@@ -776,10 +787,12 @@ local function checkResult(scanResult, classID, seasonID)
776787
itemLink = scanResult.itemLink,
777788
location = location,
778789
distance = distance,
790+
upgradeLevel = upgradeLevel,
791+
maxUpgradeLevel = maxUpgradeLevel,
779792
};
780793
end
781794

782-
return info, upgradeInfo;
795+
return info, upgradedInfo;
783796
end
784797

785798
--- @param result SyndicatorSearchResult

types.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
--- @field requiresCatalyse boolean
1818
--- @field itemLink string
1919
--- @field location string
20+
--- @field upgradeLevel number # upgrade track level, 1-6/8
21+
--- @field maxUpgradeLevel number # 6 or 8
2022
--- @field distance number # 0 = same character, 100+ = warband bank, 1000 = different character.
2123

2224
--- @class TUM_AppearanceMissingResult

0 commit comments

Comments
 (0)