Skip to content

Commit de2ed69

Browse files
committed
Small Updates
* Updated so all the saved information is now run from Theme.lua * Updated how we are grabbing certain information for quests/weeklys
1 parent 00390b6 commit de2ed69

8 files changed

Lines changed: 540 additions & 525 deletions

File tree

Modules/Delves.lua

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,71 @@ MR:RegisterModule({
187187
labelColor = "#c8956c",
188188
resetType = "weekly",
189189
defaultOpen = false,
190+
scanReturnsChanged = true,
190191

191192
onScan = function(mod)
192193
local now = GetTime()
193194
local db = MR.db.char.progress
194195
if not db[mod.key] then db[mod.key] = {} end
195196
local mdb = db[mod.key]
197+
local beforeProgress = {}
198+
for key, value in pairs(mdb) do
199+
beforeProgress[key] = value
200+
end
201+
local beforeRows = {
202+
bountiful_count = bountifulRow and {
203+
countText = bountifulRow.countText,
204+
countColor = bountifulRow.countColor and { unpack(bountifulRow.countColor) } or nil,
205+
max = bountifulRow.max,
206+
note = bountifulRow.note,
207+
} or nil,
208+
delve_bounty = bountyRow and {
209+
countText = bountyRow.countText,
210+
countColor = bountyRow.countColor and { unpack(bountyRow.countColor) } or nil,
211+
max = bountyRow.max,
212+
note = bountyRow.note,
213+
} or nil,
214+
gilded_stash = gildedStashRow and {
215+
countText = gildedStashRow.countText,
216+
countColor = gildedStashRow.countColor and { unpack(gildedStashRow.countColor) } or nil,
217+
max = gildedStashRow.max,
218+
note = gildedStashRow.note,
219+
} or nil,
220+
}
221+
local function HasChanges()
222+
for key, value in pairs(mdb) do
223+
if beforeProgress[key] ~= value then
224+
return true
225+
end
226+
end
227+
for key in pairs(beforeProgress) do
228+
if mdb[key] ~= beforeProgress[key] then
229+
return true
230+
end
231+
end
232+
for rowKey, beforeRow in pairs(beforeRows) do
233+
local row = rowKey == "bountiful_count" and bountifulRow
234+
or rowKey == "delve_bounty" and bountyRow
235+
or gildedStashRow
236+
if beforeRow and row then
237+
local beforeColor = beforeRow.countColor
238+
local afterColor = row.countColor
239+
local sameColor = (beforeColor == afterColor)
240+
or (type(beforeColor) == "table" and type(afterColor) == "table"
241+
and (beforeColor[1] or 0) == (afterColor[1] or 0)
242+
and (beforeColor[2] or 0) == (afterColor[2] or 0)
243+
and (beforeColor[3] or 0) == (afterColor[3] or 0)
244+
and (beforeColor[4] or 0) == (afterColor[4] or 0))
245+
if beforeRow.countText ~= row.countText
246+
or beforeRow.max ~= row.max
247+
or beforeRow.note ~= row.note
248+
or not sameColor then
249+
return true
250+
end
251+
end
252+
end
253+
return false
254+
end
196255

197256
local exp = GetPlayerExpansion()
198257
if exp then
@@ -214,7 +273,7 @@ MR:RegisterModule({
214273
bountifulRow.countColor = nil
215274
end
216275

217-
if (now - lastScan) < SCAN_THROTTLE then return end
276+
if (now - lastScan) < SCAN_THROTTLE then return HasChanges() end
218277
lastScan = now
219278

220279
local buckets = MR.GetWeeklyRewardActivityBuckets and MR:GetWeeklyRewardActivityBuckets() or nil
@@ -261,6 +320,7 @@ MR:RegisterModule({
261320
end
262321

263322
UpdateGildedStashProgress(mdb, gildedStashRow)
323+
return HasChanges()
264324
end,
265325

266326
rows = {

Modules/ProfessionKnowledge.lua

Lines changed: 12 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ local MR = ns.MR
44
local FONT_HEADERS = ns.FONT_HEADERS
55
local FONT_ROWS = ns.FONT_ROWS
66
local StyledFrame = ns.StyledFrame
7-
local RestoreFramePos = ns.RestoreFramePos
7+
local RestoreManagedFramePos = ns.RestoreManagedFramePos
8+
local SaveManagedFramePos = ns.SaveManagedFramePos
9+
local SyncManagedFramePos = ns.SyncManagedFramePos
10+
local AnimateManagedFrameHeight = ns.AnimateManagedFrameHeight
11+
local IsManagedHeaderBottom = ns.IsManagedHeaderBottom
812
local LeftAccent = ns.LeftAccent
913
local TopAccent = ns.TopAccent
1014
local TitleBar = ns.TitleBar
@@ -437,42 +441,20 @@ local function BuildGatheringLocationsFrame(isRetry)
437441
local width = db.gatheringWidth or DEFAULT_W
438442
local height = db.gatheringHeight or DEFAULT_H
439443
local minimized = db.gatheringMinimized or false
440-
local headerBottom = MR.GetManagedHeaderPosition and MR:GetManagedHeaderPosition() == "bottom"
444+
local headerBottom = IsManagedHeaderBottom()
441445
gatheringMinimized = minimized
442446

443447
local function ApplyFrameHeight(frame, targetHeight)
444-
if not (MR.IsManagedAnimatedMinimizeEnabled and MR:IsManagedAnimatedMinimizeEnabled()) then
445-
frame:SetHeight(targetHeight)
446-
return
447-
end
448-
449-
local startHeight = frame:GetHeight() or targetHeight
450-
local delta = targetHeight - startHeight
451-
if math.abs(delta) < 1 then
452-
frame:SetHeight(targetHeight)
453-
return
454-
end
455-
456-
frame._mrAnimTick = 0
457-
frame:SetScript("OnUpdate", function(self, dt)
458-
self._mrAnimTick = (self._mrAnimTick or 0) + (dt or 0)
459-
local duration = math.min(0.18, math.max(0.06, math.abs(delta) / 1600))
460-
local progress = math.min(self._mrAnimTick / duration, 1)
461-
local eased = 1 - ((1 - progress) * (1 - progress) * (1 - progress))
462-
self:SetHeight(startHeight + (delta * eased))
463-
if progress >= 1 then
464-
self:SetHeight(targetHeight)
465-
self._mrAnimTick = nil
466-
self:SetScript("OnUpdate", nil)
467-
end
448+
AnimateManagedFrameHeight(frame, targetHeight, function(self)
449+
self:SetScript("OnUpdate", nil)
468450
end)
469451
end
470452

471453
local frame = StyledFrame(UIParent, nil, "MEDIUM", 10)
472454
frame:SetSize(width, minimized and TITLE_H or height)
473455
frame:SetBackdropColor(0.03, 0.05, 0.08, 0.97 * alpha)
474456
frame:SetBackdropBorderColor(0.22, 0.18, 0.28, alpha)
475-
RestoreFramePos(frame, "gatheringLocPos", 860, 0)
457+
RestoreManagedFramePos(frame, "gatheringLocPos", 860, 0)
476458
frame.leftAccent = nil
477459
frame.topAccent = TopAccent(frame, 0.80, 0.53, 0.20)
478460
if frame.leftAccent then frame.leftAccent:SetAlpha(alpha) end
@@ -492,26 +474,7 @@ local function BuildGatheringLocationsFrame(isRetry)
492474
titleBar:SetScript("OnDragStart", function() if not db.gatheringLocked then frame:StartMoving() end end)
493475
titleBar:SetScript("OnDragStop", function()
494476
frame:StopMovingOrSizing()
495-
if headerBottom then
496-
local left = frame:GetLeft()
497-
local bottom = frame:GetBottom()
498-
if left and bottom and MR.db then
499-
MR:SetWindowLayoutValue("gatheringLocPos", { point = "BOTTOMLEFT", relPoint = "BOTTOMLEFT", x = left, y = bottom })
500-
return
501-
end
502-
else
503-
local left = frame:GetLeft()
504-
local top = frame:GetTop()
505-
if left and top and MR.db then
506-
MR:SetWindowLayoutValue("gatheringLocPos", { point = "TOPLEFT", relPoint = "BOTTOMLEFT", x = left, y = top })
507-
return
508-
end
509-
end
510-
511-
local point, _, relPoint, x, y = frame:GetPoint()
512-
if MR.db then
513-
MR:SetWindowLayoutValue("gatheringLocPos", { point = point, relPoint = relPoint, x = x, y = y })
514-
end
477+
SaveManagedFramePos(frame, "gatheringLocPos", headerBottom and "bottom" or "top")
515478
end)
516479
if MR.ApplyPanelHeaderAutoHide then MR:ApplyPanelHeaderAutoHide(frame, titleBar) end
517480

@@ -858,40 +821,13 @@ local function BuildGatheringLocationsFrame(isRetry)
858821
if minBtn.RefreshLabel then minBtn:RefreshLabel() end
859822

860823
if gatheringMinimized then
861-
if headerBottom then
862-
local left = frame:GetLeft()
863-
local bottom = frame:GetBottom()
864-
if left and bottom then
865-
frame:ClearAllPoints()
866-
frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", left, bottom)
867-
if MR.db then
868-
MR:SetWindowLayoutValue("gatheringLocPos", { point = "BOTTOMLEFT", relPoint = "BOTTOMLEFT", x = left, y = bottom })
869-
end
870-
end
871-
else
872-
local left = frame:GetLeft()
873-
local top = frame:GetTop()
874-
if left and top then
875-
frame:ClearAllPoints()
876-
frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", left, top)
877-
if MR.db then
878-
MR:SetWindowLayoutValue("gatheringLocPos", { point = "TOPLEFT", relPoint = "BOTTOMLEFT", x = left, y = top })
879-
end
880-
end
881-
end
824+
SyncManagedFramePos(frame, "gatheringLocPos", headerBottom and "bottom" or "top")
882825
if frame._scroll then frame._scroll:Hide() end
883826
if frame._scrollTrack then frame._scrollTrack:Hide() end
884827
if frame._dragger then frame._dragger:Hide() end
885828
ApplyFrameHeight(frame, TITLE_H)
886829
else
887-
if headerBottom then
888-
local left = frame:GetLeft()
889-
local bottom = frame:GetBottom()
890-
if left and bottom then
891-
frame:ClearAllPoints()
892-
frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", left, bottom)
893-
end
894-
end
830+
SyncManagedFramePos(frame, "gatheringLocPos", headerBottom and "bottom" or "top")
895831
if frame._scroll then frame._scroll:Show() end
896832
if frame._scrollTrack then frame._scrollTrack:Show() end
897833
if frame._dragger then frame._dragger:Show() end

Modules/PvP.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ MR:RegisterModule({
266266
labelColor = "#cc3333",
267267
resetType = "weekly",
268268
defaultOpen = true,
269+
scanReturnsChanged = true,
269270
onScan = function(mod)
270271
local progress = MR.db.char.progress
271272
if not progress[mod.key] then

Modules/Rares.lua

Lines changed: 12 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ local MR = ns.MR
44
local FONT_HEADERS = ns.FONT_HEADERS
55
local FONT_ROWS = ns.FONT_ROWS
66
local StyledFrame = ns.StyledFrame
7-
local RestoreFramePos = ns.RestoreFramePos
7+
local RestoreManagedFramePos = ns.RestoreManagedFramePos
8+
local SaveManagedFramePos = ns.SaveManagedFramePos
9+
local SyncManagedFramePos = ns.SyncManagedFramePos
10+
local AnimateManagedFrameHeight = ns.AnimateManagedFrameHeight
11+
local IsManagedHeaderBottom = ns.IsManagedHeaderBottom
812
local LeftAccent = ns.LeftAccent
913
local TopAccent = ns.TopAccent
1014
local TitleBar = ns.TitleBar
@@ -351,41 +355,19 @@ BuildRaresFrame = function()
351355
local singleZone = #visible == 1
352356
local cols = (W >= 220) and COLS or 1
353357
local ROW_H = GetRowH()
354-
local headerBottom = MR.GetManagedHeaderPosition and MR:GetManagedHeaderPosition() == "bottom"
358+
local headerBottom = IsManagedHeaderBottom()
355359

356360
local function ApplyFrameHeight(frame, targetHeight)
357-
if not (MR.IsManagedAnimatedMinimizeEnabled and MR:IsManagedAnimatedMinimizeEnabled()) then
358-
frame:SetHeight(targetHeight)
359-
return
360-
end
361-
362-
local startHeight = frame:GetHeight() or targetHeight
363-
local delta = targetHeight - startHeight
364-
if math.abs(delta) < 1 then
365-
frame:SetHeight(targetHeight)
366-
return
367-
end
368-
369-
frame._mrAnimTick = 0
370-
frame:SetScript("OnUpdate", function(self, dt)
371-
self._mrAnimTick = (self._mrAnimTick or 0) + (dt or 0)
372-
local duration = math.min(0.18, math.max(0.06, math.abs(delta) / 1600))
373-
local progress = math.min(self._mrAnimTick / duration, 1)
374-
local eased = 1 - ((1 - progress) * (1 - progress) * (1 - progress))
375-
self:SetHeight(startHeight + (delta * eased))
376-
if progress >= 1 then
377-
self:SetHeight(targetHeight)
378-
self._mrAnimTick = nil
379-
ApplyRaresFrameUpdater(self)
380-
end
361+
AnimateManagedFrameHeight(frame, targetHeight, function(self)
362+
ApplyRaresFrameUpdater(self)
381363
end)
382364
end
383365

384366
local f = StyledFrame(UIParent, nil, "MEDIUM", 10)
385367
f:SetSize(W, minimized and TITLE_H or H)
386368
f:SetBackdropColor(0.03, 0.02, 0.09, 0.97 * alpha)
387369
f:SetBackdropBorderColor(0.18, 0.10, 0.30, alpha)
388-
RestoreFramePos(f, "raresPos", 580, 0)
370+
RestoreManagedFramePos(f, "raresPos", 580, 0)
389371

390372
f.leftAccent = nil
391373
f.topAccent = TopAccent(f, 0.55, 0.28, 0.95)
@@ -407,16 +389,7 @@ BuildRaresFrame = function()
407389
titleBar:SetScript("OnDragStart", function() if not db.raresLocked then f:StartMoving() end end)
408390
titleBar:SetScript("OnDragStop", function()
409391
f:StopMovingOrSizing()
410-
if headerBottom then
411-
local left = f:GetLeft()
412-
local bottom = f:GetBottom()
413-
if left and bottom and MR.db then
414-
MR:SetWindowLayoutValue("raresPos", { point = "BOTTOMLEFT", relPoint = "BOTTOMLEFT", x = left, y = bottom })
415-
return
416-
end
417-
end
418-
local pt, _, rp, x, y = f:GetPoint()
419-
if MR.db then MR:SetWindowLayoutValue("raresPos", { point = pt, relPoint = rp, x = x, y = y }) end
392+
SaveManagedFramePos(f, "raresPos", headerBottom and "bottom" or "top")
420393
end)
421394
if MR.ApplyPanelHeaderAutoHide then MR:ApplyPanelHeaderAutoHide(f, titleBar) end
422395

@@ -476,33 +449,10 @@ BuildRaresFrame = function()
476449
if isMin then
477450
if f._scroll then f._scroll:Hide() end
478451
if f._dragger then f._dragger:Hide() end
479-
if headerBottom then
480-
local left = f:GetLeft()
481-
local bottom = f:GetBottom()
482-
if left and bottom then
483-
f:ClearAllPoints()
484-
f:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", left, bottom)
485-
if MR.db then MR:SetWindowLayoutValue("raresPos", { point = "BOTTOMLEFT", relPoint = "BOTTOMLEFT", x = left, y = bottom }) end
486-
end
487-
else
488-
local left = f:GetLeft()
489-
local top = f:GetTop()
490-
if left and top then
491-
f:ClearAllPoints()
492-
f:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", left, top)
493-
if MR.db then MR:SetWindowLayoutValue("raresPos", { point = "TOPLEFT", relPoint = "BOTTOMLEFT", x = left, y = top }) end
494-
end
495-
end
452+
SyncManagedFramePos(f, "raresPos", headerBottom and "bottom" or "top")
496453
ApplyFrameHeight(f, TITLE_H)
497454
else
498-
if headerBottom then
499-
local left = f:GetLeft()
500-
local bottom = f:GetBottom()
501-
if left and bottom then
502-
f:ClearAllPoints()
503-
f:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", left, bottom)
504-
end
505-
end
455+
SyncManagedFramePos(f, "raresPos", headerBottom and "bottom" or "top")
506456
if f._scroll then f._scroll:Show() end
507457
if f._dragger then f._dragger:Show() end
508458
ApplyFrameHeight(f, MR.db and MR.db.profile.raresHeight or DEFAULT_H)

0 commit comments

Comments
 (0)