Skip to content

Commit a442f7d

Browse files
committed
Update Renown.lua
* Renown update, hide at max renown now works properly
1 parent f30af7b commit a442f7d

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

Modules/Renown.lua

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ local function BuildRenownFrame()
273273
f:SetSize(FRAME_W, minimized and HEADER_H or totalH)
274274
f:SetBackdropColor(0.02, 0.03, 0.08, 0.97)
275275
f:SetBackdropBorderColor(0.55, 0.42, 0.08, 1)
276+
f.rowSpace = ROW_SPACE
277+
f.layoutPad = PAD
278+
f.headerHeight = HEADER_H
279+
f.headerBottom = headerBottom
276280

277281
RestoreManagedFramePos(f, "renownPos", 300, 0)
278282
f.topAccent = TopAccent(f)
@@ -551,6 +555,10 @@ RefreshRenownFrame = function()
551555
local hideMaxed = db.renownHideMaxed
552556
local showLevel = db.renownShowLevel ~= false
553557
local minimized = db.renownMinimized
558+
local rowSpace = renownFrame.rowSpace or ((db.renownCompact and ((db.renownBarH or 18) + 8)) or ((db.renownBarH or 18) + 34))
559+
local pad = renownFrame.layoutPad or 12
560+
local headerH = renownFrame.headerHeight or ((renownFrame.titleBar and renownFrame.titleBar:GetHeight()) or 24)
561+
local headerBottom = renownFrame.headerBottom == true
554562

555563
if minimized then
556564
for _, row in pairs(renownFrame.factionRows) do
@@ -565,7 +573,11 @@ RefreshRenownFrame = function()
565573
return
566574
end
567575

568-
for _, row in pairs(renownFrame.factionRows) do
576+
local visibleRows = 0
577+
578+
for _, faction in ipairs(GetOrderedFactions()) do
579+
local row = renownFrame.factionRows[faction.key]
580+
if row then
569581
local faction = row.faction
570582
local renown, maxRenown, rep, needed = GetRenownData(faction)
571583
local cr, cg, cb = GetFactionColor(faction)
@@ -574,7 +586,19 @@ RefreshRenownFrame = function()
574586
if hideMaxed and capped then
575587
row.rowFrame:Hide()
576588
else
577-
if row.rowFrame then row.rowFrame:Show() end
589+
visibleRows = visibleRows + 1
590+
if row.rowFrame then
591+
local yOff = headerH + pad + ((visibleRows - 1) * rowSpace)
592+
row.rowFrame:ClearAllPoints()
593+
if headerBottom then
594+
row.rowFrame:SetPoint("BOTTOMLEFT", renownFrame, "BOTTOMLEFT", pad, yOff)
595+
row.rowFrame:SetPoint("BOTTOMRIGHT", renownFrame, "BOTTOMRIGHT", -pad, yOff)
596+
else
597+
row.rowFrame:SetPoint("TOPLEFT", renownFrame, "TOPLEFT", pad, -yOff)
598+
row.rowFrame:SetPoint("TOPRIGHT", renownFrame, "TOPRIGHT", -pad, -yOff)
599+
end
600+
row.rowFrame:Show()
601+
end
578602
end
579603

580604
if row.nameLabel then
@@ -630,10 +654,18 @@ RefreshRenownFrame = function()
630654
row.barLabel:SetTextColor(0.85, 0.85, 0.85)
631655
end
632656
end
657+
end
633658
end
634659

635660
if renownFrame.divider then
636-
renownFrame.divider:Show()
661+
renownFrame.divider:SetShown(visibleRows > 0)
662+
end
663+
664+
SyncManagedFramePos(renownFrame, "renownPos", headerBottom and "bottom" or "top")
665+
if visibleRows > 0 then
666+
renownFrame:SetHeight(headerH + pad + (visibleRows * rowSpace) + pad)
667+
else
668+
renownFrame:SetHeight(headerH)
637669
end
638670
end
639671

0 commit comments

Comments
 (0)