From ad90e2d2e9d76be9d2088e68da91a41c0980e115 Mon Sep 17 00:00:00 2001 From: Liam Cooper Date: Sun, 24 May 2026 00:01:23 +0100 Subject: [PATCH] Add Show % toggle for class resource bar text. Lets players hide the percent suffix on bar-type class resources while keeping the numeric value, matching the existing power bar option. --- EllesmereUIResourceBars/EUI_ResourceBars_Options.lua | 12 +++++++++++- EllesmereUIResourceBars/EllesmereUIResourceBars.lua | 12 +++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/EllesmereUIResourceBars/EUI_ResourceBars_Options.lua b/EllesmereUIResourceBars/EUI_ResourceBars_Options.lua index d9357821..45b4f9c4 100644 --- a/EllesmereUIResourceBars/EUI_ResourceBars_Options.lua +++ b/EllesmereUIResourceBars/EUI_ResourceBars_Options.lua @@ -517,7 +517,8 @@ initFrame:SetScript("OnEvent", function(self) pc._countText:ClearAllPoints() pc._countText:SetPoint("CENTER", pc, "CENTER", sp.textXOffset or 0, sp.textYOffset or 0) if isBar then - pc._countText:SetText(tostring(_previewBarFillPct)) + local percentSuffix = (sp.showPercent == false) and "" or "%" + pc._countText:SetText(tostring(_previewBarFillPct) .. percentSuffix) else local _pvTsE3 = _G._ERB_ResolveThresholdSpecEntry and _G._ERB_ResolveThresholdSpecEntry(sp) or nil local _pvE3Enabled = _pvTsE3 and (_pvTsE3.thresholdEnabled ~= false) or false @@ -2333,6 +2334,15 @@ initFrame:SetScript("OnEvent", function(self) local _, cogShow = EllesmereUI.BuildCogPopup({ title = "Resource Text", rows = { + { type = "toggle", label = "Show %", + get = function() + local p = DB() + return (not p) or p.secondary.showPercent ~= false + end, + set = function(v) + local p = DB(); if not p then return end + p.secondary.showPercent = v; RefreshClass() + end }, { type = "slider", label = "Size", min = 8, max = 24, step = 1, get = function() local p = DB(); return p and p.secondary.textSize or 11 end, set = function(v) diff --git a/EllesmereUIResourceBars/EllesmereUIResourceBars.lua b/EllesmereUIResourceBars/EllesmereUIResourceBars.lua index 0a3e1433..4882862e 100644 --- a/EllesmereUIResourceBars/EllesmereUIResourceBars.lua +++ b/EllesmereUIResourceBars/EllesmereUIResourceBars.lua @@ -630,6 +630,7 @@ local DEFAULTS = { fillR = 0.95, fillG = 0.90, fillB = 0.60, fillA = 1, bgR = 1, bgG = 1, bgB = 1, bgA = 0.1, showText = true, + showPercent = true, textSize = 11, textR = 1, textG = 1, textB = 1, textXOffset = 0, @@ -2920,11 +2921,12 @@ local function UpdateSecondaryResource() end -- Count text if sp.showText and secondaryFrame._countText then + local percentSuffix = (sp.showPercent == false) and "" or "%" if not tainted then if powerType == "BREWMASTER_STAGGER" then -- Show stagger as percentage of max health local pct = maxC > 0 and (cur / maxC * 100) or 0 - secondaryFrame._countText:SetText(format("%d", pct) .. "%") + secondaryFrame._countText:SetText(format("%d", pct) .. percentSuffix) else secondaryFrame._countText:SetText(tostring(cur) .. " / " .. tostring(maxC)) end @@ -2933,28 +2935,28 @@ local function UpdateSecondaryResource() if powerType == "MAELSTROM_BAR" then local pct = UnitPowerPercent and UnitPowerPercent("player", PT.MAELSTROM) or 0 if not issecretvalue(pct) then - secondaryFrame._countText:SetText(format("%d", pct) .. "%") + secondaryFrame._countText:SetText(format("%d", pct) .. percentSuffix) else secondaryFrame._countText:SetText(tostring(cur)) end elseif powerType == "INSANITY_BAR" then local pct = UnitPowerPercent and UnitPowerPercent("player", PT.INSANITY) or 0 if not issecretvalue(pct) then - secondaryFrame._countText:SetText(format("%d", pct) .. "%") + secondaryFrame._countText:SetText(format("%d", pct) .. percentSuffix) else secondaryFrame._countText:SetText(tostring(cur)) end elseif powerType == "FOCUS_BAR" then local pct = UnitPowerPercent and UnitPowerPercent("player", PT.FOCUS) or 0 if not issecretvalue(pct) then - secondaryFrame._countText:SetText(format("%d", pct) .. "%") + secondaryFrame._countText:SetText(format("%d", pct) .. percentSuffix) else secondaryFrame._countText:SetText(tostring(cur)) end elseif powerType == "LUNAR_POWER_BAR" then local pct = UnitPowerPercent and UnitPowerPercent("player", PT.LUNAR_POWER) or 0 if not issecretvalue(pct) then - secondaryFrame._countText:SetText(format("%d", pct) .. "%") + secondaryFrame._countText:SetText(format("%d", pct) .. percentSuffix) else secondaryFrame._countText:SetText(tostring(cur)) end