Skip to content

Commit e78bf46

Browse files
committed
Switched to a more robust method of determining the upgrade track an item from a previous season belonged to, which supports all seasons
1 parent ba94a41 commit e78bf46

File tree

2 files changed

+74
-65
lines changed

2 files changed

+74
-65
lines changed

TransmogUpgradeMaster.lua

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ TUM.Config = ns.Config
1616
--- @alias TUM_LearnedFromOtherItem "learnedFromOtherItem"
1717
local LEARNED_FROM_OTHER_ITEM = 'learnedFromOtherItem'
1818

19+
local BONUS_ID_OFFSET = 13
1920
local ITEM_UPGRADE_TOOLTIP_PATTERN = ITEM_UPGRADE_TOOLTIP_FORMAT_STRING:gsub('%%d', '(%%d+)'):gsub('%%s', '(.-)');
2021
local CATALYST_MARKUP = CreateAtlasMarkup('CreationCatalyst-32x32', 18, 18)
2122
local UPGRADE_MARKUP = CreateAtlasMarkup('CovenantSanctum-Upgrade-Icon-Available', 18, 18)
@@ -216,7 +217,6 @@ function TUM:GetTokenInfo(itemID, itemLink)
216217
}
217218
end
218219

219-
local BONUS_ID_OFFSET = 13;
220220
--- doesn't return season information for catalysed items from previous seasons, but that's fine, since nothing can be done with those items anyway
221221
function TUM:GetItemSeason(itemLink)
222222
if self:IsCurrentSeasonItem(itemLink) then
@@ -393,7 +393,7 @@ function TUM:IsAppearanceMissing(itemLink, classID, debugLines)
393393
result.canUpgrade = true
394394
end
395395
else
396-
currentTier = self:GetTierFromItemLevel(itemLink, seasonID) or 0
396+
currentTier = self:GetTierFromUpgradeTrackBonusID(itemLink) or 0
397397
end
398398
local _, sourceID = C_TransmogCollection.GetItemInfo(itemLink)
399399
tryInsert(debugLines, 'sourceID: ' .. tostring(sourceID))
@@ -636,30 +636,18 @@ function TUM:GetSourceIDsForItemID(itemID)
636636
end
637637

638638
--- @param itemLink string
639-
--- @param seasonID TUM_Season
640-
--- @return TUM_Tier? tier # nil if the tier cannot be determined from ilvl
641-
function TUM:GetTierFromItemLevel(itemLink, seasonID)
642-
local seasonInfo = self.data.upgradeItemLevels[seasonID]
643-
local tooltipData = C_TooltipInfo.GetHyperlink(itemLink)
644-
if not tooltipData or not seasonInfo then return nil end
645-
646-
local itemLevel
647-
for _, line in ipairs(tooltipData.lines) do
648-
if line.type == Enum.TooltipDataLineType.ItemLevel then
649-
itemLevel = line.itemLevel;
650-
break;
651-
end
652-
end
653-
if not itemLevel then return nil; end
639+
--- @return TUM_Tier? tier # nil if the tier cannot be determined from itemlink
640+
function TUM:GetTierFromUpgradeTrackBonusID(itemLink)
641+
local _, data = LinkUtil.ExtractLink(itemLink);
642+
local parts = strsplittable(':', data);
654643

655-
local foundTier = nil
656-
for tier, minItemLevel in ipairs(seasonInfo) do
657-
if itemLevel >= minItemLevel then
658-
foundTier = tier;
644+
local numBonusIDs = tonumber(parts[BONUS_ID_OFFSET]) or 0;
645+
for index = (BONUS_ID_OFFSET + 1), (BONUS_ID_OFFSET + numBonusIDs) do
646+
local bonusID = tonumber(parts[index]);
647+
if self.data.constants.upgradeTrackBonusIDs[bonusID] then
648+
return self.data.constants.upgradeTrackBonusIDs[bonusID];
659649
end
660650
end
661-
662-
return foundTier;
663651
end
664652

665653
--- @param itemLink string

data.lua

Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ local WRIST = Enum.InventoryType.IndexWristType;
2727
local HAND = Enum.InventoryType.IndexHandType;
2828
local CLOAK = Enum.InventoryType.IndexCloakType;
2929

30-
local WARRIOR = 1
31-
local PALADIN = 2
32-
local HUNTER = 3
33-
local ROGUE = 4
34-
local PRIEST = 5
35-
local DEATHKNIGHT = 6
36-
local SHAMAN = 7
37-
local MAGE = 8
38-
local WARLOCK = 9
39-
local MONK = 10
40-
local DRUID = 11
41-
local DEMONHUNTER = 12
42-
local EVOKER = 13
30+
local WARRIOR = 1;
31+
local PALADIN = 2;
32+
local HUNTER = 3;
33+
local ROGUE = 4;
34+
local PRIEST = 5;
35+
local DEATHKNIGHT = 6;
36+
local SHAMAN = 7;
37+
local MAGE = 8;
38+
local WARLOCK = 9;
39+
local MONK = 10;
40+
local DRUID = 11;
41+
local DEMONHUNTER = 12;
42+
local EVOKER = 13;
4343

44-
data.currentSeason = TWW_S2;
44+
data.currentSeason = TWW_S3;
4545

4646
data.constants = {};
4747
do
@@ -63,7 +63,7 @@ do
6363
TWW_S1 = TWW_S1,
6464
TWW_S2 = TWW_S2,
6565
TWW_S3 = TWW_S3,
66-
}
66+
};
6767

6868
-- see https://wago.tools/db2/SharedString
6969
local VETERAN_TRACK_STRING_ID = 972;
@@ -77,6 +77,44 @@ do
7777
[MYTH_TRACK_STRING_ID] = data.constants.tiers.mythic,
7878
};
7979

80+
data.constants.upgradeTrackBonusIDs = {
81+
[11969] = TIER_LFR, -- Veteran 1
82+
[11970] = TIER_LFR, -- Veteran 2
83+
[11971] = TIER_LFR, -- Veteran 3
84+
[11972] = TIER_LFR, -- Veteran 4
85+
86+
[11973] = TIER_NORMAL, -- Veteran 5
87+
[11974] = TIER_NORMAL, -- Veteran 6
88+
[11975] = TIER_NORMAL, -- Veteran 7
89+
[11976] = TIER_NORMAL, -- Veteran 8
90+
[11977] = TIER_NORMAL, -- Champion 1
91+
[11978] = TIER_NORMAL, -- Champion 2
92+
[11979] = TIER_NORMAL, -- Champion 3
93+
[11980] = TIER_NORMAL, -- Champion 4
94+
95+
[11981] = TIER_HEROIC, -- Champion 5
96+
[11982] = TIER_HEROIC, -- Champion 6
97+
[11983] = TIER_HEROIC, -- Champion 7
98+
[11984] = TIER_HEROIC, -- Champion 8
99+
[11985] = TIER_HEROIC, -- Hero 1
100+
[11986] = TIER_HEROIC, -- Hero 2
101+
[11987] = TIER_HEROIC, -- Hero 3
102+
[11988] = TIER_HEROIC, -- Hero 4
103+
104+
[11989] = TIER_MYTHIC, -- Hero 5
105+
[11990] = TIER_MYTHIC, -- Hero 6
106+
[12371] = TIER_MYTHIC, -- Hero 7 - only exists in some seasons
107+
[12372] = TIER_MYTHIC, -- Hero 8 - only exists in some seasons
108+
[11991] = TIER_MYTHIC, -- Myth 1
109+
[11992] = TIER_MYTHIC, -- Myth 2
110+
[11993] = TIER_MYTHIC, -- Myth 3
111+
[11994] = TIER_MYTHIC, -- Myth 4
112+
[11995] = TIER_MYTHIC, -- Myth 5
113+
[11996] = TIER_MYTHIC, -- Myth 6
114+
[12376] = TIER_MYTHIC, -- Myth 7 - only exists in some seasons
115+
[12375] = TIER_MYTHIC, -- Myth 8 - only exists in some seasons
116+
};
117+
80118
data.constants.conquestItemModID = 159;
81119
data.constants.itemModIDTiers = {
82120
[4] = data.constants.tiers.lfr,
@@ -92,10 +130,10 @@ do
92130
[Enum.ItemCreationContext.RaidMythic] = data.constants.tiers.mythic,
93131
};
94132

95-
local CLOTH = Enum.ItemArmorSubclass.Cloth
96-
local LEATHER = Enum.ItemArmorSubclass.Leather
97-
local MAIL = Enum.ItemArmorSubclass.Mail
98-
local PLATE = Enum.ItemArmorSubclass.Plate
133+
local CLOTH = Enum.ItemArmorSubclass.Cloth;
134+
local LEATHER = Enum.ItemArmorSubclass.Leather;
135+
local MAIL = Enum.ItemArmorSubclass.Mail;
136+
local PLATE = Enum.ItemArmorSubclass.Plate;
99137
data.constants.classArmorTypeMap = {
100138
[1] = PLATE, -- WARRIOR
101139
[2] = PLATE, -- PALADIN
@@ -141,22 +179,6 @@ data.currency = {
141179
[TWW_S3] = 3269,
142180
};
143181

144-
--- @type table<TUM_Season, table<TUM_Tier, number>> # [seasonID][tier] = minimum item level
145-
data.upgradeItemLevels = {
146-
[TWW_S2] = {
147-
[TIER_LFR] = 623,
148-
[TIER_NORMAL] = 636,
149-
[TIER_HEROIC] = 649,
150-
[TIER_MYTHIC] = 662,
151-
},
152-
[TWW_S3] = {
153-
[TIER_LFR] = 668,
154-
[TIER_NORMAL] = 681,
155-
[TIER_HEROIC] = 694,
156-
[TIER_MYTHIC] = 707,
157-
},
158-
};
159-
160182
--- could potentially be extracted from C_TransmogSets.GetAllSets() more or less, but meh, effort, and requires linking to a specific season still anyway
161183
--- @type table<TUM_Season, table<number, {[1]:number, [2]:number, [3]:number, [4]:number}>> [m+ seasonID][classID] = { [1] = lfrSetID, [2] = normalSetID, [3] = heroicSetID, [4] = mythicSetID }
162184
data.sets = {
@@ -189,8 +211,8 @@ data.sets = {
189211
[DRUID] = { 5108, 5107, 5105, 5106 },
190212
[DEMONHUNTER] = { 5104, 5103, 5101, 5102 },
191213
[EVOKER] = { 5112, 5111, 5109, 5110 },
192-
}
193-
}
214+
},
215+
};
194216

195217
--- C_TransmogSets.GetSourceIDsForSlot and C_TransmogSets.GetSourcesForSlot miss information for certain slots, very "fun" -.-
196218
--- @type table<number, table<Enum.InventoryType, number>> # [setID] = { [Enum.InventoryType.Foo] = sourceID }
@@ -301,7 +323,7 @@ data.setSourceIDs = {
301323
[5111] = { [HEAD] = 286110, [SHOULDER] = 286086, [CHEST] = 286146, [WAIST] = 286074, [LEGS] = 286098, [FEET] = 286134, [WRIST] = 286062, [HAND] = 286122, [CLOAK] = 286050 }, -- Evoker
302324
[5109] = { [HEAD] = 286116, [SHOULDER] = 286092, [CHEST] = 286152, [WAIST] = 286080, [LEGS] = 286104, [FEET] = 286140, [WRIST] = 286068, [HAND] = 286128, [CLOAK] = 286056 }, -- Evoker
303325
[5110] = { [HEAD] = 286117, [SHOULDER] = 286093, [CHEST] = 286153, [WAIST] = 286081, [LEGS] = 286105, [FEET] = 286141, [WRIST] = 286069, [HAND] = 286129, [CLOAK] = 286057 }, -- Evoker
304-
}
326+
};
305327

306328
--- @type table<number, table<TUM_Tier, number>> # [itemID] = { [tier] = itemSourceID }
307329
data.itemSourceIDs = {
@@ -1192,7 +1214,7 @@ data.catalystBonusIDMap = {
11921214
[10376] = TWW_S1, [10377] = TWW_S1, [10378] = TWW_S1, [10379] = TWW_S1, [10380] = TWW_S1,
11931215
[11964] = TWW_S2, [11965] = TWW_S2, [11966] = TWW_S2, [11967] = TWW_S2, [11998] = TWW_S2,
11941216
[12239] = TWW_S3, [12240] = TWW_S3, [12241] = TWW_S3, [12242] = TWW_S3, [12243] = TWW_S3,
1195-
}
1217+
};
11961218

11971219
--- @type table<TUM_Season, table<number, table<Enum.InventoryType, number>>> # [m+ seasonID][classID][slotID] = itemID
11981220
data.catalystItems = {
@@ -1315,7 +1337,7 @@ data.catalystItems = {
13151337
[DEMONHUNTER] = { [HEAD] = 237691, [SHOULDER] = 237689, [CHEST] = 237694, [WAIST] = 237688, [LEGS] = 237690, [FEET] = 237693, [WRIST] = 237687, [HAND] = 237692, [CLOAK] = 237686 },
13161338
[EVOKER] = { [HEAD] = 237655, [SHOULDER] = 237653, [CHEST] = 237658, [WAIST] = 237652, [LEGS] = 237654, [FEET] = 237657, [WRIST] = 237651, [HAND] = 237656, [CLOAK] = 237650 },
13171339
},
1318-
}
1340+
};
13191341

13201342
--- @type table<number, TUM_Season> # [itemID] = seasonID
13211343
data.catalystItemByID = {};
@@ -1335,7 +1357,7 @@ local classCombo = {
13351357
pala_priest_shaman = { [PALADIN] = true, [PRIEST] = true, [SHAMAN] = true },
13361358
monk_rogue_warrior = { [MONK] = true, [ROGUE] = true, [WARRIOR] = true },
13371359
evoker_monk_rogue_warrior = { [EVOKER] = true, [MONK] = true, [ROGUE] = true, [WARRIOR] = true },
1338-
}
1360+
};
13391361
--- @type table<number, { season: TUM_Season, slot: Enum.InventoryType, classList: table<number, boolean> }>
13401362
data.tokens = {
13411363
[191005] = { season = SL_S4, slot = HEAD, classList = classCombo.dk_dh_lock }, -- Dreadful Helm Module
@@ -1499,4 +1521,3 @@ data.tokens = {
14991521
[237596] = { season = TWW_S3, slot = LEGS, classList = classCombo.evoker_monk_rogue_warrior }, -- Zenith Silken Offering
15001522
[237588] = { season = TWW_S3, slot = HAND, classList = classCombo.evoker_monk_rogue_warrior }, -- Zenith Binding Agent
15011523
};
1502-

0 commit comments

Comments
 (0)