Skip to content

Commit 6fa0e53

Browse files
committed
The internal cache is now saved and reused after logging in/reloading, this allows the tooltips to show their information much faster, and allows addons like Syndicator to retrieve the data earlier too
1 parent 847f2e0 commit 6fa0e53

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

TransmogUpgradeMaster.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function TUM:InitItemSourceMap()
124124
self.itemSourceMapInitialized = false
125125
self.itemSourceMapProgress = 0
126126
self.itemSourceMapTotal = 0
127-
self.itemSourceIDs = itemSourceIDs
127+
self.itemSourceIDs = TransmogUpgradeMasterCacheDB or itemSourceIDs
128128
--- @type table<number, TransmogCategoryAppearanceInfo[]>
129129
local categoryAppearances = {}
130130
for _, category in pairs(Enum.TransmogCollectionType) do
@@ -154,6 +154,8 @@ function TUM:InitItemSourceMap()
154154
end
155155
end
156156
self.itemSourceMapInitialized = true
157+
self.itemSourceIDs = itemSourceIDs
158+
TransmogUpgradeMasterCacheDB = itemSourceIDs
157159
end
158160
local resumeFunc = coroutine.wrap(iterateAppearances)
159161
local ticker
@@ -261,6 +263,7 @@ function TUM:IsAppearanceMissing(itemLink, classID, debugLines)
261263

262264
return nil, nil, nil, nil, nil
263265
end
266+
classID = classID or playerClassID
264267
local canCatalyse, canUpgradeToNextBreakpoint = false, false
265268
local catalystMissing, catalystUpgradeMissing, upgradeMissing = nil, nil, nil
266269

@@ -424,16 +427,17 @@ end
424427
--- @return boolean isCacheWarmedUp
425428
--- @return number progress # a number between 0 and 1, where 1 means caching has finished
426429
function TUM:IsCacheWarmedUp()
427-
if not self.itemSourceMapInitialized then
430+
if not TransmogUpgradeMasterCacheDB and not self.itemSourceMapInitialized then
428431
return false, self.itemSourceMapProgress / self.itemSourceMapTotal
429432
end
430433
return true, 1
431434
end
432435

433436
--- @return boolean loading
434437
function TUM:ShowLoadingTooltipIfLoading(tooltip)
435-
if self.itemSourceMapInitialized then return false end
436-
local _, progress = self:IsCacheWarmedUp()
438+
local warmedUp, progress = self:IsCacheWarmedUp()
439+
if warmedUp then return false end
440+
437441
local text = string.format("TransmogUpgradeMaster is loading (%.0f%%)", progress * 100)
438442
tooltip:AddLine(text, nil, nil, nil, true)
439443

TransmogUpgradeMaster.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Author: Numy
55
## IconTexture: Interface\Addons\TransmogUpgradeMaster\media\icon
66
## Version: @project-version@
7-
## SavedVariables: TransmogUpgradeMasterDB
7+
## SavedVariables: TransmogUpgradeMasterDB, TransmogUpgradeMasterCacheDB
88
## X-Curse-Project-ID: 1265598
99
## X-Wago-ID: 4N2mjQGL
1010
## Category-enUS: Collections

0 commit comments

Comments
 (0)