Skip to content

Commit 53ae9aa

Browse files
committed
get data on initial login delayed to make sure data is available
1 parent bd2b36e commit 53ae9aa

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

BestTimesUI.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ function MPT:CreatePBFrame()
356356

357357
-- Delete Button
358358
F.DeleteButton = CreateFrame("Button", nil, F.PBDataFrame)
359-
F.DeleteButton:SetSize(100, 32)
359+
F.DeleteButton:SetSize(120, 32)
360360
F.DeleteButton:SetPoint("TOPRIGHT", F.PBDataFrame, "TOPRIGHT", -20, -20)
361361
F.DeleteButton.BG = F.DeleteButton:CreateTexture(nil, "BACKGROUND")
362362
F.DeleteButton.BG:SetAllPoints()

EventHandler.lua

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ function MPT:EventHandler(e, ...) -- internal checks whether the event comes fro
7171
end
7272
end
7373
elseif e == "PLAYER_ENTERING_WORLD" then
74+
local login, reload = ...
75+
if login then
76+
C_Timer.After(10, function() self:EventHandler("PLAYER_ENTERING_WORLD", false, true) end) -- re initiate after 10 seconds as a lot of this data is not available on initial login
77+
end
7478
if self.HideTracker and not self.Hooked then
7579
self.Hooked = true
7680
local frame = C_AddOns.IsAddOnLoaded("!KalielsTracker") and _G["!KalielsTrackerFrame"] or ObjectiveTrackerFrame
@@ -87,19 +91,14 @@ function MPT:EventHandler(e, ...) -- internal checks whether the event comes fro
8791
self:ShowFrame(false)
8892
self:ToggleEventRegister(false)
8993
end
90-
if seasonID > 0 then
94+
if seasonID > 0 and (login or reload) then
9195
if not MPTSV.BestTime then MPTSV.BestTime = {} end
9296
if not MPTSV.History then MPTSV.History = {} end
9397
if not MPTSV.BestTime[seasonID] then MPTSV.BestTime[seasonID] = {} end
9498
if not MPTSV.History[seasonID] then MPTSV.History[seasonID] = {} end
9599
self.seasonID = seasonID
96-
end
97-
local G = UnitGUID("player")
98-
if MPTSV.History and MPTSV.History[seasonID] and not MPTSV.History[seasonID][G] then
99-
local login, reload = ...
100-
if login then
101-
C_Timer.After(10, function() self:AddCharacterHistory() end) -- wait 10 seconds because data is weird on initial login
102-
elseif reload then
100+
local G = UnitGUID("player")
101+
if MPTSV.History and MPTSV.History[seasonID] and not MPTSV.History[seasonID][G] then
103102
self:AddCharacterHistory()
104103
end
105104
end

0 commit comments

Comments
 (0)