Skip to content

Commit fd1c599

Browse files
committed
Improved compatibility with Midnight
1 parent 3d82222 commit fd1c599

File tree

10 files changed

+711
-247
lines changed

10 files changed

+711
-247
lines changed

TransmogUpgradeMaster.lua

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
local name, ns = ...
1+
local name = ...;
2+
--- @class TUM_NS
3+
local ns = select(2, ...);
24

35
--- @class TransmogUpgradeMaster
46
local TUM = {}
@@ -8,9 +10,7 @@ _G.TUM = TUM
810
--@end-debug@
911
ns.core = TUM
1012

11-
--- @type TransmogUpgradeMasterData
1213
TUM.data = ns.data
13-
--- @type TransmogUpgradeMasterConfig
1414
TUM.Config = ns.Config
1515

1616
--- @alias TUM_LearnedFromOtherItem "learnedFromOtherItem"
@@ -44,22 +44,26 @@ end
4444

4545
EventUtil.ContinueOnAddOnLoaded(name, function()
4646
--- @type TransmogUpgradeMaster_CollectionUI
47-
TUM.UI = ns.UI
48-
TUM.db = TUM.Config:Init()
49-
TUM.UI:Init()
50-
local currentSeason = C_MythicPlus.GetCurrentSeason()
47+
TUM.UI = ns.UI;
48+
TUM.db = TUM.Config:Init();
49+
TUM.UI:Init();
50+
local currentSeason = C_MythicPlus.GetCurrentSeason();
5151
if currentSeason and currentSeason > 0 then
52-
TUM.currentSeason = (currentSeason and currentSeason > 0) and currentSeason or TUM.data.currentSeason
53-
TUM.UI:InitSeason(TUM.currentSeason)
52+
TUM.currentSeason = (currentSeason and currentSeason > 0 and TUM:IsSeasonSupported(currentSeason))
53+
and currentSeason
54+
or TUM.data.currentSeason;
55+
TUM.UI:InitSeason(TUM.currentSeason);
5456
else
5557
RunNextFrame(function()
56-
C_MythicPlus.RequestMapInfo()
57-
end)
58+
C_MythicPlus.RequestMapInfo();
59+
end);
5860
EventUtil.RegisterOnceFrameEventAndCallback('CHALLENGE_MODE_MAPS_UPDATE', function()
59-
local currentSeason = C_MythicPlus.GetCurrentSeason()
60-
TUM.currentSeason = (currentSeason and currentSeason > 0) and currentSeason or TUM.data.currentSeason
61-
TUM.UI:InitSeason(TUM.currentSeason)
62-
end)
61+
currentSeason = C_MythicPlus.GetCurrentSeason();
62+
TUM.currentSeason = (currentSeason and currentSeason > 0 and TUM:IsSeasonSupported(currentSeason))
63+
and currentSeason
64+
or TUM.data.currentSeason;
65+
TUM.UI:InitSeason(TUM.currentSeason);
66+
end);
6367
end
6468

6569
RunNextFrame(function()
@@ -110,6 +114,10 @@ do
110114
end
111115
end
112116

117+
function TUM:IsSeasonSupported(seasonID)
118+
return not not TUM.data.catalystItems[seasonID];
119+
end
120+
113121
---@param classID number
114122
---@param seasonID number?
115123
---@return nil | { [1]: number, [2]: number, [3]: number, [4]: number } # lfrSetID, normalSetID, heroicSetID, mythicSetID

TransmogUpgradeMaster.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Interface: @toc-version-retail@
1+
## Interface: @toc-version-retail@,@toc-version-midnight@
22
## Title: Transmog Upgrade Master
33
## Notes: Shows whether you can learn a new appearance by upgrading or catalysing an item.
44
## Author: Numy

api.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
local _, ns = ...
1+
--- @type TUM_NS
2+
local ns = select(2, ...);
23

3-
--- @type TransmogUpgradeMaster
44
local TUM = ns.core
55

66
--- The function signatures in this file will remain stable, though no guarantees are made.

collectionUi.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
local addonName, ns = ...;
1+
local addonName = ...;
2+
--- @class TUM_NS
3+
local ns = select(2, ...);
24

3-
--- @type TransmogUpgradeMaster
45
local TUM = ns.core;
56

67
local isSyndicatorLoaded = C_AddOns.IsAddOnLoaded('Syndicator');

0 commit comments

Comments
 (0)