Skip to content

Commit fc038dc

Browse files
committed
Merge PR #134: Resource Bar - custom colours, textures, and Maelstrom/Pain (by Krathe)
# Conflicts: # CHANGELOG.md
2 parents e237486 + 2ee6135 commit fc038dc

7 files changed

Lines changed: 102 additions & 40 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* (Icons) New **in-combat indicator** — a small crossed-swords icon lights up when a unit is in combat, so you can spot who's engaged at a glance. Off by default, with its own position and size controls. (by Krathe)
1717
* (Auto Layouts) Added `/df clearoverride <key|prefix|all>` to **remove a stuck per-layout override** directly — for overrides the settings UI can't reach (e.g. a pinned-players override while not in a raid). (by Krathe)
1818
* (Nicknames) New **Nicknames** feature — show custom names on your party and raid frames. Build a prioritised list from your friends, guild and group, or type names in by hand, and choose how matches are made. Optionally mark nicknamed players with brackets (or other styles) and share your own nickname with the group. Find it under **General → Nicknames**. (by Maelareth)
19+
* (Resource Bar) Added a **Color Mode** (Power Type / Class / **Custom**) with a custom-colour picker, and a **Texture** dropdown so the resource bar can use any statusbar texture. (by Krathe)
1920

2021
### Improvements
2122

@@ -30,6 +31,7 @@
3031
* (Auto Layouts) The **override tooltip and `/df overrides` now read clearly** — each changed setting shows as a breadcrumb path with its value, only values that differ from global are listed, Text Designer elements show their names, and the override counts agree across the badge, status line and chat. (by Krathe)
3132
* (Aura Designer) Expiring health-bar highlights now **pulse in unison** across all frames — and tint and replace modes share one pulse engine — instead of each frame pulsing on its own timing. (by Krathe)
3233
* (Text) The built-in Name, Health, and Status text settings are now handled entirely by the **Text Designer** — the older text pages are hidden and your existing text is converted to Text Designer elements automatically. Customise all frame text under the **Text** tab.
34+
* (Resource Bar) Added **Maelstrom** and **Pain** to the per-power resource colour options, so Shaman and Vengeance Demon Hunter resource bars can be recoloured. (by Krathe)
3335

3436
### Bug Fixes
3537

Config.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,8 @@ DF.PartyDefaults = {
19051905
WARRIOR = true,
19061906
},
19071907
resourceBarClassColor = false,
1908+
resourceBarColorMode = "POWER_TYPE",
1909+
resourceBarCustomColor = {r = 0, g = 0.5, b = 1, a = 1},
19081910
resourceBarEnabled = true,
19091911
resourceBarFrameLevel = 20,
19101912
resourceBarHeight = 4,
@@ -1916,6 +1918,7 @@ DF.PartyDefaults = {
19161918
resourceBarShowInSoloMode = true,
19171919
resourceBarShowTank = false,
19181920
resourceBarSmooth = true,
1921+
resourceBarTexture = "Interface\\AddOns\\DandersFrames\\Media\\DF_Minimalist",
19191922
resourceBarWidth = 60,
19201923
resourceBarX = 0,
19211924
resourceBarY = 1,
@@ -3491,6 +3494,8 @@ DF.RaidDefaults = {
34913494
WARRIOR = true,
34923495
},
34933496
resourceBarClassColor = false,
3497+
resourceBarColorMode = "POWER_TYPE",
3498+
resourceBarCustomColor = {r = 0, g = 0.5, b = 1, a = 1},
34943499
resourceBarEnabled = true,
34953500
resourceBarFrameLevel = 20,
34963501
resourceBarHeight = 4,
@@ -3502,6 +3507,7 @@ DF.RaidDefaults = {
35023507
resourceBarShowInSoloMode = true,
35033508
resourceBarShowTank = false,
35043509
resourceBarSmooth = true,
3510+
resourceBarTexture = "Interface\\AddOns\\DandersFrames\\Media\\DF_Minimalist",
35053511
resourceBarWidth = 60,
35063512
resourceBarX = 0,
35073513
resourceBarY = 1,

Core.lua

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,49 @@ function DF:GetPowerColor(powerToken, powerType)
17771777
return DEFAULT_CLASS_COLOR
17781778
end
17791779

1780+
-- Resolve the resource bar's fill colour for a unit per the configured colour
1781+
-- mode. Returns r, g, b (0-1).
1782+
-- POWER_TYPE → the power-type colour (user override or Blizzard default)
1783+
-- CLASS → the unit's class colour
1784+
-- CUSTOM → the user's resourceBarCustomColor
1785+
-- Honours the legacy resourceBarClassColor boolean when resourceBarColorMode
1786+
-- isn't set yet (pre-migration profiles). Uses the same UnitClass/UnitPowerType
1787+
-- calls the old inline logic did, so it carries no new secret-value risk.
1788+
function DF:GetResourceBarColor(unit, db)
1789+
local mode = db.resourceBarColorMode
1790+
if not mode then
1791+
mode = db.resourceBarClassColor and "CLASS" or "POWER_TYPE"
1792+
end
1793+
1794+
if mode == "CUSTOM" then
1795+
local c = db.resourceBarCustomColor or {r = 0, g = 0.5, b = 1, a = 1}
1796+
return c.r or 0, c.g or 0.5, c.b or 1
1797+
elseif mode == "CLASS" then
1798+
local _, classToken = UnitClass(unit)
1799+
local cc = classToken and DF:GetClassColor(classToken)
1800+
if cc then return cc.r, cc.g, cc.b end
1801+
-- No class colour available — fall through to the power-type colour.
1802+
end
1803+
1804+
-- POWER_TYPE (and the CLASS fallback above)
1805+
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
1806+
local info = DF:GetPowerColor(pToken, pType)
1807+
if info then return info.r, info.g, info.b end
1808+
if altR then return altR, altG, altB end
1809+
return 0, 0, 1
1810+
end
1811+
1812+
-- Migrate the legacy resourceBarClassColor boolean to the new
1813+
-- resourceBarColorMode tri-state. Idempotent; leaves the legacy key in place
1814+
-- (the render helper still honours it as a fallback) — same pattern as the
1815+
-- border-key migrations.
1816+
function DF:MigrateResourceBarColorMode(modeDb)
1817+
if not modeDb then return end
1818+
if modeDb.resourceBarColorMode == nil and modeDb.resourceBarClassColor ~= nil then
1819+
modeDb.resourceBarColorMode = modeDb.resourceBarClassColor and "CLASS" or "POWER_TYPE"
1820+
end
1821+
end
1822+
17801823
-- ============================================================
17811824
-- STATE DRIVERS FOR TEST MODE COMBAT SAFETY
17821825
-- When test mode is active, state drivers are registered on all
@@ -3416,6 +3459,11 @@ DF._MainEventDispatcher = function(self, event, arg1)
34163459
DF:MigrateResourceBarBorderKeys(DF.db.party)
34173460
DF:MigrateResourceBarBorderKeys(DF.db.raid)
34183461
end
3462+
-- Resource Bar: resourceBarClassColor (bool) → resourceBarColorMode (tri-state).
3463+
if DF.MigrateResourceBarColorMode then
3464+
DF:MigrateResourceBarColorMode(DF.db.party)
3465+
DF:MigrateResourceBarColorMode(DF.db.raid)
3466+
end
34193467
-- Aura icons: buff/debuffBorderEnabled → ShowBorder, BorderThickness →
34203468
-- BorderSize (Stage 5.5 Phase 2 — full toolkit for buff/debuff borders).
34213469
if DF.MigrateAuraBorderKeys then

ExportCategories.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ DF.ExportCategories = {
151151

152152
-- Resource/Power Bar
153153
"resourceBarClassColor",
154+
"resourceBarColorMode",
155+
"resourceBarCustomColor",
156+
"resourceBarTexture",
154157
"resourceBarEnabled",
155158
"resourceBarAnchor",
156159
"resourceBarX",

Frames/Bars.lua

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ function DF:ApplyResourceBarLayout(frame)
101101
bar:Show()
102102
bar:ClearAllPoints()
103103

104+
-- Fill texture (configurable; defaults to the DF house texture)
105+
DF:SafeSetStatusBarTexture(bar, db.resourceBarTexture or "Interface\\AddOns\\DandersFrames\\Media\\DF_Minimalist")
106+
104107
-- Orientation & Fill Direction
105108
bar:SetOrientation(db.resourceBarOrientation or "HORIZONTAL")
106109
bar:SetReverseFill(db.resourceBarReverseFill)
@@ -206,19 +209,8 @@ function DF:ApplyResourceBarLayout(frame)
206209
local maxPower = UnitPowerMax(unit)
207210
bar:SetMinMaxValues(0, maxPower)
208211
bar:SetValue(power)
209-
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
210-
local info = DF:GetPowerColor(pToken, pType)
211-
local _, classToken = UnitClass(unit)
212-
local classColor = db.resourceBarClassColor and classToken and DF:GetClassColor(classToken)
213-
if classColor then
214-
bar:SetStatusBarColor(classColor.r, classColor.g, classColor.b, 1)
215-
elseif info then
216-
bar:SetStatusBarColor(info.r, info.g, info.b, 1)
217-
elseif altR then
218-
bar:SetStatusBarColor(altR, altG, altB, 1)
219-
else
220-
bar:SetStatusBarColor(0, 0, 1, 1)
221-
end
212+
local cr, cg, cb = DF:GetResourceBarColor(unit, db)
213+
bar:SetStatusBarColor(cr, cg, cb, 1)
222214
end
223215
end
224216
end
@@ -254,23 +246,9 @@ function DF:UpdateResourceBar(frame)
254246
bar:SetMinMaxValues(0, maxPower)
255247
DF.SetBarValue(bar, power, frame)
256248

257-
-- Get power type for coloring
258-
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
259-
260-
-- Get color from custom overrides or Blizzard defaults
261-
local info = DF:GetPowerColor(pToken, pType)
262-
263-
local _, classToken = UnitClass(unit)
264-
local classColor = db.resourceBarClassColor and classToken and DF:GetClassColor(classToken)
265-
if classColor then
266-
bar:SetStatusBarColor(classColor.r, classColor.g, classColor.b, 1)
267-
elseif info then
268-
bar:SetStatusBarColor(info.r, info.g, info.b, 1)
269-
elseif altR then
270-
bar:SetStatusBarColor(altR, altG, altB, 1)
271-
else
272-
bar:SetStatusBarColor(0, 0, 1, 1) -- Default to blue (mana)
273-
end
249+
-- Resolve fill colour per the configured colour mode (power / class / custom).
250+
local cr, cg, cb = DF:GetResourceBarColor(unit, db)
251+
bar:SetStatusBarColor(cr, cg, cb, 1)
274252
else
275253
bar:Hide()
276254
end

Locales/enUS.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ L["Logged Categories"] = true
973973
L["Low"] = true
974974
L["Low Health (0%)"] = true
975975
L["Lunar Power"] = true
976+
L["Maelstrom"] = true
976977
L["Mage"] = true
977978
L["Magic"] = true
978979
L["Major defensive cooldowns like Divine Shield, Ice Block, or Barkskin."] = true
@@ -1270,6 +1271,8 @@ L["Rows"] = true
12701271
L["Rows Grow From"] = true
12711272
L["Run"] = true
12721273
L["Run Script"] = true
1274+
L["Pain"] = true
1275+
L["Power Type"] = true
12731276
L["Run Setup Wizard"] = true
12741277
L["Runic Power"] = true
12751278
L["Runtime"] = true

Options/Options.lua

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,7 +3678,6 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
36783678
settingsGroup:AddWidget(GUI:CreateCheckbox(self.child, L["DPS"], db, "resourceBarShowDPS", function() DF:UpdateAllFrames() end), 30)
36793679
local showInSolo = settingsGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Show in Solo Mode"], db, "resourceBarShowInSoloMode", function() DF:UpdateAllFrames() end), 30)
36803680
showInSolo.hideOn = function() return GUI.SelectedMode == "raid" end
3681-
settingsGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Smooth Bar Animation"], db, "resourceBarSmooth", function() DF:UpdateAllFrames() end), 30)
36823681
Add(settingsGroup, nil, 1)
36833682

36843683
-- ===== CLASS FILTER GROUP (Column 1) =====
@@ -3730,13 +3729,21 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
37303729
positionGroup:AddWidget(GUI:CreateSlider(self.child, L["Offset Y"], -50, 50, 1, db, "resourceBarY", nil, function() DF:LightweightUpdatePowerBarPosition() end, true), 55)
37313730
Add(positionGroup, nil, 2)
37323731

3733-
-- ===== ORIENTATION GROUP (Column 1) =====
3734-
local orientGroup = GUI:CreateSettingsGroup(self.child, 280)
3735-
orientGroup:AddWidget(GUI:CreateHeader(self.child, L["Orientation"]), 40)
3736-
local orientOptions = { HORIZONTAL= L["Horizontal"], VERTICAL= L["Vertical"] }
3737-
orientGroup:AddWidget(GUI:CreateDropdown(self.child, L["Orientation"], orientOptions, db, "resourceBarOrientation", function() DF:UpdateAllFrames() end), 55)
3738-
orientGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Reverse Fill Direction"], db, "resourceBarReverseFill", function() DF:UpdateAllFrames() end), 30)
3739-
Add(orientGroup, nil, 1)
3732+
-- ===== TEXTURE GROUP (Column 1) — mirrors the Health Bar's Texture group:
3733+
-- Texture, Orientation / Reverse Fill, and Smooth Bar Animation in one place. =====
3734+
local textureGroup = GUI:CreateSettingsGroup(self.child, 280)
3735+
textureGroup:AddWidget(GUI:CreateHeader(self.child, L["Texture"]), 40)
3736+
textureGroup:AddWidget(GUI:CreateTextureDropdown(self.child, L["Texture"], db, "resourceBarTexture", function() DF:UpdateAllFrames() end), 55)
3737+
3738+
-- Keep Orientation (Horizontal/Vertical) and Reverse Fill as two explicit
3739+
-- controls — clearer than a combined "Fill Direction" dropdown, where an
3740+
-- option like "Bottom to Top" silently changes the orientation too.
3741+
local orientOptions = { HORIZONTAL = L["Horizontal"], VERTICAL = L["Vertical"] }
3742+
textureGroup:AddWidget(GUI:CreateDropdown(self.child, L["Orientation"], orientOptions, db, "resourceBarOrientation", function() DF:UpdateAllFrames() end), 55)
3743+
textureGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Reverse Fill Direction"], db, "resourceBarReverseFill", function() DF:UpdateAllFrames() end), 30)
3744+
3745+
textureGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Smooth Bar Animation"], db, "resourceBarSmooth", function() DF:UpdateAllFrames() end), 30)
3746+
Add(textureGroup, nil, 1)
37403747

37413748
-- ===== BACKGROUND GROUP (Column 2) =====
37423749
local bgGroup = GUI:CreateSettingsGroup(self.child, 280)
@@ -3793,8 +3800,21 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
37933800
local colorGroup = GUI:CreateSettingsGroup(self.child, 280)
37943801
colorGroup:AddWidget(GUI:CreateHeader(self.child, L["Resource Colors"]), 40)
37953802
colorGroup:AddWidget(GUI:CreateLabel(self.child, L["Customize resource bar colors per power type. Shared across party and raid frames."], 260), 40)
3796-
colorGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Use Class Color"], db, "resourceBarClassColor", function() DF:RefreshAllVisibleFrames() end), 30)
3797-
3803+
-- Colour mode: Power Type (per-power colours below) / Class / Custom.
3804+
local RESOURCE_COLOR_MODES = {
3805+
POWER_TYPE = L["Power Type"], CLASS = L["Class"], CUSTOM = L["Custom"],
3806+
_order = { "POWER_TYPE", "CLASS", "CUSTOM" },
3807+
}
3808+
colorGroup:AddWidget(GUI:CreateDropdown(self.child, L["Color Mode"], RESOURCE_COLOR_MODES, db, "resourceBarColorMode", function()
3809+
DF:RefreshAllVisibleFrames()
3810+
self:RefreshStates() -- re-evaluate the custom colour picker's hideOn
3811+
end), 54)
3812+
3813+
-- Custom colour — only shown in Custom mode.
3814+
local resourceCustomColor = GUI:CreateColorPicker(self.child, L["Custom Color"], db, "resourceBarCustomColor", false, function() DF:RefreshAllVisibleFrames() end, function() DF:RefreshAllVisibleFrames() end, true)
3815+
resourceCustomColor.hideOn = function() return (db.resourceBarColorMode or "POWER_TYPE") ~= "CUSTOM" end
3816+
colorGroup:AddWidget(resourceCustomColor, 30)
3817+
37983818
local powerColorsDB = DF.db.powerColors
37993819
if not powerColorsDB then
38003820
DF.db.powerColors = {}
@@ -3809,7 +3829,9 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
38093829
{ token = "RUNIC_POWER", name = L["Runic Power"] },
38103830
{ token = "INSANITY", name = L["Insanity"] },
38113831
{ token = "FURY", name = L["Fury"] },
3832+
{ token = "PAIN", name = L["Pain"] },
38123833
{ token = "LUNAR_POWER", name = L["Lunar Power"] },
3834+
{ token = "MAELSTROM", name = L["Maelstrom"] },
38133835
}
38143836

38153837
for _, info in ipairs(POWER_LIST) do

0 commit comments

Comments
 (0)