Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion EllesmereUIResourceBars/EUI_ResourceBars_Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 7 additions & 5 deletions EllesmereUIResourceBars/EllesmereUIResourceBars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down