From d63b0348823373d718d1f00d1e1b6b3fa7944925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Thaudal=20B=C3=B8nnerup?= Date: Thu, 29 Jan 2026 13:44:16 +0100 Subject: [PATCH] Implement buff bars from commented out Unhalted implementation. - A few changes from bugs i encountered while testing the bars. Tried to add comments explaining the changes i made and stuff i added --- Core/Defaults.lua | 4 +- Core/GUI.lua | 366 ++++++++++++++++++---- Core/Globals.lua | 19 +- Modules/CooldownManager.lua | 583 +++++++++++++++++++++++++----------- Modules/Data.lua | 4 +- 5 files changed, 729 insertions(+), 247 deletions(-) diff --git a/Core/Defaults.lua b/Core/Defaults.lua index 8365bb7..2262312 100755 --- a/Core/Defaults.lua +++ b/Core/Defaults.lua @@ -135,13 +135,13 @@ local Defaults = { BuffBar = { Width = 300, Height = 24, - Spacing = 1, + Spacing = 2, GrowthDirection = "UP", MatchWidthOfAnchor = true, ColourByClass = true, BackgroundColour = {34/255, 34/255, 34/255, 1}, ForegroundColour = {34/255, 34/255, 34/255, 1}, - Layout = {"BOTTOM", "NONE", "TOP", 0, 1.1}, + Layout = {"BOTTOM", "EssentialCooldownViewer", "TOP", 0, 1.1}, Icon = { Enabled = true, Layout = "LEFT", diff --git a/Core/GUI.lua b/Core/GUI.lua index 6f7e643..d79eeea 100755 --- a/Core/GUI.lua +++ b/Core/GUI.lua @@ -771,6 +771,185 @@ local function CreateEditModeManagerSettings(parentContainer) RefreshSpecializationSettings() end +local function CreateBuffBarIconSettings(parentContainer) + local BuffBarDB = BCDM.db.profile.CooldownManager.BuffBar + + local iconContainer = AG:Create("InlineGroup") + iconContainer:SetTitle("Icon Settings") + iconContainer:SetFullWidth(true) + iconContainer:SetLayout("Flow") + parentContainer:AddChild(iconContainer) + + local iconEnabled = AG:Create("CheckBox") + iconEnabled:SetLabel("Enable Icon") + iconEnabled:SetValue(BuffBarDB.Icon.Enabled) + iconEnabled:SetCallback("OnValueChanged", function(_, _, value) + BuffBarDB.Icon.Enabled = value + BCDM:UpdateCooldownViewer("BuffBar") + RefreshBuffBarIconSettings() + end) + iconEnabled:SetRelativeWidth(1) + iconContainer:AddChild(iconEnabled) + + local iconPosition = AG:Create("Dropdown") + iconPosition:SetLabel("Position") + iconPosition:SetList({LEFT = "Left", RIGHT = "Right"}, {"LEFT", "RIGHT"}) + iconPosition:SetValue(BuffBarDB.Icon.Layout) + iconPosition:SetCallback("OnValueChanged", function(_, _, value) + BuffBarDB.Icon.Layout = value + BCDM:UpdateCooldownViewer("BuffBar") + end) + iconPosition:SetRelativeWidth(0.5) + iconContainer:AddChild(iconPosition) + + local function RefreshBuffBarIconSettings() + iconPosition:SetDisabled(not BuffBarDB.Icon.Enabled) + end + + RefreshBuffBarIconSettings() + + return iconContainer +end + +local function CreateBuffBarTextSettings(parentContainer) + local RefreshBuffBarTextSettings + local BuffBarDB = BCDM.db.profile.CooldownManager.BuffBar.Text + + local textContainer = AG:Create("InlineGroup") + textContainer:SetTitle("Text Settings") + textContainer:SetFullWidth(true) + textContainer:SetLayout("Flow") + parentContainer:AddChild(textContainer) + + -- Spell Name Settings + local spellNameGroup = AG:Create("InlineGroup") + spellNameGroup:SetTitle("Spell Name") + spellNameGroup:SetFullWidth(true) + spellNameGroup:SetLayout("Flow") + textContainer:AddChild(spellNameGroup) + + local spellNameEnabled = AG:Create("CheckBox") + spellNameEnabled:SetLabel("Enable") + spellNameEnabled:SetValue(BuffBarDB.SpellName.Enabled) + spellNameEnabled:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.SpellName.Enabled = value BCDM:UpdateCooldownViewer("BuffBar") RefreshBuffBarTextSettings() end) + spellNameEnabled:SetRelativeWidth(1) + spellNameGroup:AddChild(spellNameEnabled) + + local spellNameAnchorFrom = AG:Create("Dropdown") + spellNameAnchorFrom:SetLabel("Anchor From") + spellNameAnchorFrom:SetList(AnchorPoints[1], AnchorPoints[2]) + spellNameAnchorFrom:SetValue(BuffBarDB.SpellName.Layout[1]) + spellNameAnchorFrom:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.SpellName.Layout[1] = value BCDM:UpdateCooldownViewer("BuffBar") end) + spellNameAnchorFrom:SetRelativeWidth(0.5) + spellNameGroup:AddChild(spellNameAnchorFrom) + + local spellNameAnchorTo = AG:Create("Dropdown") + spellNameAnchorTo:SetLabel("Anchor To") + spellNameAnchorTo:SetList(AnchorPoints[1], AnchorPoints[2]) + spellNameAnchorTo:SetValue(BuffBarDB.SpellName.Layout[2]) + spellNameAnchorTo:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.SpellName.Layout[2] = value BCDM:UpdateCooldownViewer("BuffBar") end) + spellNameAnchorTo:SetRelativeWidth(0.5) + spellNameGroup:AddChild(spellNameAnchorTo) + + local spellNameXOffset = AG:Create("Slider") + spellNameXOffset:SetLabel("X Offset") + spellNameXOffset:SetValue(BuffBarDB.SpellName.Layout[3]) + spellNameXOffset:SetSliderValues(-500, 500, 1) + spellNameXOffset:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.SpellName.Layout[3] = value BCDM:UpdateCooldownViewer("BuffBar") end) + spellNameXOffset:SetRelativeWidth(0.33) + spellNameGroup:AddChild(spellNameXOffset) + + local spellNameYOffset = AG:Create("Slider") + spellNameYOffset:SetLabel("Y Offset") + spellNameYOffset:SetValue(BuffBarDB.SpellName.Layout[4]) + spellNameYOffset:SetSliderValues(-500, 500, 1) + spellNameYOffset:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.SpellName.Layout[4] = value BCDM:UpdateCooldownViewer("BuffBar") end) + spellNameYOffset:SetRelativeWidth(0.33) + spellNameGroup:AddChild(spellNameYOffset) + + local spellNameSize = AG:Create("Slider") + spellNameSize:SetLabel("Font Size") + spellNameSize:SetValue(BuffBarDB.SpellName.FontSize) + spellNameSize:SetSliderValues(8, 32, 1) + spellNameSize:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.SpellName.FontSize = value BCDM:UpdateCooldownViewer("BuffBar") end) + spellNameSize:SetRelativeWidth(0.33) + spellNameGroup:AddChild(spellNameSize) + + -- Duration Settings + local durationGroup = AG:Create("InlineGroup") + durationGroup:SetTitle("Duration") + durationGroup:SetFullWidth(true) + durationGroup:SetLayout("Flow") + textContainer:AddChild(durationGroup) + + local durationEnabled = AG:Create("CheckBox") + durationEnabled:SetLabel("Enable") + durationEnabled:SetValue(BuffBarDB.Duration.Enabled) + durationEnabled:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.Duration.Enabled = value BCDM:UpdateCooldownViewer("BuffBar") RefreshBuffBarTextSettings() end) + durationEnabled:SetRelativeWidth(1) + durationGroup:AddChild(durationEnabled) + + local durationAnchorFrom = AG:Create("Dropdown") + durationAnchorFrom:SetLabel("Anchor From") + durationAnchorFrom:SetList(AnchorPoints[1], AnchorPoints[2]) + durationAnchorFrom:SetValue(BuffBarDB.Duration.Layout[1]) + durationAnchorFrom:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.Duration.Layout[1] = value BCDM:UpdateCooldownViewer("BuffBar") end) + durationAnchorFrom:SetRelativeWidth(0.5) + durationGroup:AddChild(durationAnchorFrom) + + local durationAnchorTo = AG:Create("Dropdown") + durationAnchorTo:SetLabel("Anchor To") + durationAnchorTo:SetList(AnchorPoints[1], AnchorPoints[2]) + durationAnchorTo:SetValue(BuffBarDB.Duration.Layout[2]) + durationAnchorTo:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.Duration.Layout[2] = value BCDM:UpdateCooldownViewer("BuffBar") end) + durationAnchorTo:SetRelativeWidth(0.5) + durationGroup:AddChild(durationAnchorTo) + + local durationXOffset = AG:Create("Slider") + durationXOffset:SetLabel("X Offset") + durationXOffset:SetValue(BuffBarDB.Duration.Layout[3]) + durationXOffset:SetSliderValues(-500, 500, 1) + durationXOffset:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.Duration.Layout[3] = value BCDM:UpdateCooldownViewer("BuffBar") end) + durationXOffset:SetRelativeWidth(0.33) + durationGroup:AddChild(durationXOffset) + + local durationYOffset = AG:Create("Slider") + durationYOffset:SetLabel("Y Offset") + durationYOffset:SetValue(BuffBarDB.Duration.Layout[4]) + durationYOffset:SetSliderValues(-500, 500, 1) + durationYOffset:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.Duration.Layout[4] = value BCDM:UpdateCooldownViewer("BuffBar") end) + durationYOffset:SetRelativeWidth(0.33) + durationGroup:AddChild(durationYOffset) + + local durationSize = AG:Create("Slider") + durationSize:SetLabel("Font Size") + durationSize:SetValue(BuffBarDB.Duration.FontSize) + durationSize:SetSliderValues(8, 32, 1) + durationSize:SetCallback("OnValueChanged", function(_, _, value) BuffBarDB.Duration.FontSize = value BCDM:UpdateCooldownViewer("BuffBar") end) + durationSize:SetRelativeWidth(0.33) + durationGroup:AddChild(durationSize) + + RefreshBuffBarTextSettings = function() + local spellNameOn = BuffBarDB.SpellName.Enabled + spellNameAnchorFrom:SetDisabled(not spellNameOn) + spellNameAnchorTo:SetDisabled(not spellNameOn) + spellNameXOffset:SetDisabled(not spellNameOn) + spellNameYOffset:SetDisabled(not spellNameOn) + spellNameSize:SetDisabled(not spellNameOn) + + local durationOn = BuffBarDB.Duration.Enabled + durationAnchorFrom:SetDisabled(not durationOn) + durationAnchorTo:SetDisabled(not durationOn) + durationXOffset:SetDisabled(not durationOn) + durationYOffset:SetDisabled(not durationOn) + durationSize:SetDisabled(not durationOn) + end + + RefreshBuffBarTextSettings() + + return textContainer +end + local function CreateCooldownViewerTextSettings(parentContainer, viewerType) local textContainer = AG:Create("InlineGroup") textContainer:SetTitle("Text Settings") @@ -1107,7 +1286,7 @@ local function CreateCooldownViewerItemSpellSettings(parentContainer, containerT end local function CreateCooldownViewerSettings(parentContainer, viewerType) - local hasAnchorParent = viewerType == "Utility" or viewerType == "Buffs" or viewerType == "Custom" or viewerType == "AdditionalCustom" or viewerType == "Item" or viewerType == "Trinket" or viewerType == "ItemSpell" + local hasAnchorParent = viewerType == "Utility" or viewerType == "Buffs" or viewerType == "BuffBar" or viewerType == "Custom" or viewerType == "AdditionalCustom" or viewerType == "Item" or viewerType == "Trinket" or viewerType == "ItemSpell" local isCustomViewer = viewerType == "Custom" or viewerType == "AdditionalCustom" or viewerType == "Item" or viewerType == "Trinket" or viewerType == "ItemSpell" local ScrollFrame = AG:Create("ScrollFrame") @@ -1144,47 +1323,49 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) toggleContainer:AddChild(centerBuffsCheckbox) end - -- local foregroundColourPicker; - - -- if viewerType == "BuffBar" then - -- local toggleContainer = AG:Create("InlineGroup") - -- toggleContainer:SetTitle("Buff Bar Viewer Settings") - -- toggleContainer:SetFullWidth(true) - -- toggleContainer:SetLayout("Flow") - -- ScrollFrame:AddChild(toggleContainer) - - -- local matchWidthOfAnchorCheckBox = AG:Create("CheckBox") - -- matchWidthOfAnchorCheckBox:SetLabel("Match Width of Anchor") - -- matchWidthOfAnchorCheckBox:SetValue(BCDM.db.profile.CooldownManager.BuffBar.MatchWidthOfAnchor) - -- matchWidthOfAnchorCheckBox:SetCallback("OnValueChanged", function(_, _, value) BCDM.db.profile.CooldownManager.BuffBar.MatchWidthOfAnchor = value BCDM:UpdateCooldownViewer("BuffBar") RefreshBuffBarGUISettings() end) - -- matchWidthOfAnchorCheckBox:SetRelativeWidth(0.5) - -- toggleContainer:AddChild(matchWidthOfAnchorCheckBox) - - -- local colourByClassCheckbox = AG:Create("CheckBox") - -- colourByClassCheckbox:SetLabel("Colour Bar by Class") - -- colourByClassCheckbox:SetValue(BCDM.db.profile.CooldownManager.BuffBar.ColourByClass) - -- colourByClassCheckbox:SetCallback("OnValueChanged", function(_, _, value) BCDM.db.profile.CooldownManager.BuffBar.ColourByClass = value BCDM:UpdateCooldownViewer("BuffBar") RefreshBuffBarGUISettings() end) - -- colourByClassCheckbox:SetRelativeWidth(0.5) - -- toggleContainer:AddChild(colourByClassCheckbox) - - -- foregroundColourPicker = AG:Create("ColorPicker") - -- foregroundColourPicker:SetLabel("Foreground Colour") - -- local r, g, b = unpack(BCDM.db.profile.CooldownManager.BuffBar.ForegroundColour) - -- foregroundColourPicker:SetColor(r, g, b) - -- foregroundColourPicker:SetCallback("OnValueChanged", function(self, _, r, g, b, a) BCDM.db.profile.CooldownManager.BuffBar.ForegroundColour = {r, g, b, a} BCDM:UpdateCooldownViewer("BuffBar") end) - -- foregroundColourPicker:SetRelativeWidth(0.5) - -- foregroundColourPicker:SetHasAlpha(false) - -- toggleContainer:AddChild(foregroundColourPicker) - - -- local backgroundColourPicker = AG:Create("ColorPicker") - -- backgroundColourPicker:SetLabel("Background Colour") - -- local br, bg, bb = unpack(BCDM.db.profile.CooldownManager.BuffBar.BackgroundColour) - -- backgroundColourPicker:SetColor(br, bg, bb) - -- backgroundColourPicker:SetCallback("OnValueChanged", function(self, _, r, g, b, a) BCDM.db.profile.CooldownManager.BuffBar.BackgroundColour = {r, g, b, a} BCDM:UpdateCooldownViewer("BuffBar") end) - -- backgroundColourPicker:SetRelativeWidth(0.5) - -- backgroundColourPicker:SetHasAlpha(true) - -- toggleContainer:AddChild(backgroundColourPicker) - -- end + local foregroundColourPicker; + local widthSlider; + local RefreshBuffBarGUISettings + + if viewerType == "BuffBar" then + local toggleContainer = AG:Create("InlineGroup") + toggleContainer:SetTitle("Buff Bar Viewer Settings") + toggleContainer:SetFullWidth(true) + toggleContainer:SetLayout("Flow") + ScrollFrame:AddChild(toggleContainer) + + local matchWidthOfAnchorCheckBox = AG:Create("CheckBox") + matchWidthOfAnchorCheckBox:SetLabel("Match Width of Anchor") + matchWidthOfAnchorCheckBox:SetValue(BCDM.db.profile.CooldownManager.BuffBar.MatchWidthOfAnchor) + matchWidthOfAnchorCheckBox:SetCallback("OnValueChanged", function(_, _, value) BCDM.db.profile.CooldownManager.BuffBar.MatchWidthOfAnchor = value BCDM:UpdateCooldownViewer("BuffBar") RefreshBuffBarGUISettings() end) + matchWidthOfAnchorCheckBox:SetRelativeWidth(0.5) + toggleContainer:AddChild(matchWidthOfAnchorCheckBox) + + local colourByClassCheckbox = AG:Create("CheckBox") + colourByClassCheckbox:SetLabel("Colour Bar by Class") + colourByClassCheckbox:SetValue(BCDM.db.profile.CooldownManager.BuffBar.ColourByClass) + colourByClassCheckbox:SetCallback("OnValueChanged", function(_, _, value) BCDM.db.profile.CooldownManager.BuffBar.ColourByClass = value BCDM:UpdateCooldownViewer("BuffBar") RefreshBuffBarGUISettings() end) + colourByClassCheckbox:SetRelativeWidth(0.5) + toggleContainer:AddChild(colourByClassCheckbox) + + foregroundColourPicker = AG:Create("ColorPicker") + foregroundColourPicker:SetLabel("Foreground Colour") + local r, g, b = unpack(BCDM.db.profile.CooldownManager.BuffBar.ForegroundColour) + foregroundColourPicker:SetColor(r, g, b) + foregroundColourPicker:SetCallback("OnValueChanged", function(self, _, r, g, b, a) BCDM.db.profile.CooldownManager.BuffBar.ForegroundColour = {r, g, b, a} BCDM:UpdateCooldownViewer("BuffBar") end) + foregroundColourPicker:SetRelativeWidth(0.5) + foregroundColourPicker:SetHasAlpha(false) + toggleContainer:AddChild(foregroundColourPicker) + + local backgroundColourPicker = AG:Create("ColorPicker") + backgroundColourPicker:SetLabel("Background Colour") + local br, bg, bb = unpack(BCDM.db.profile.CooldownManager.BuffBar.BackgroundColour) + backgroundColourPicker:SetColor(br, bg, bb) + backgroundColourPicker:SetCallback("OnValueChanged", function(self, _, r, g, b, a) BCDM.db.profile.CooldownManager.BuffBar.BackgroundColour = {r, g, b, a} BCDM:UpdateCooldownViewer("BuffBar") end) + backgroundColourPicker:SetRelativeWidth(0.5) + backgroundColourPicker:SetHasAlpha(true) + toggleContainer:AddChild(backgroundColourPicker) + end if viewerType == "Trinket" then local enabledCheckbox = AG:Create("CheckBox") @@ -1201,7 +1382,7 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) layoutContainer:SetLayout("Flow") ScrollFrame:AddChild(layoutContainer) - if viewerType ~= "Custom" and viewerType ~= "AdditionalCustom" and viewerType ~= "Trinket" and viewerType ~= "ItemSpell" and viewerType ~= "Item" then CreateInformationTag(layoutContainer, "|cFFFFCC00Padding|r is handled by |cFF00B0F7Blizzard|r, not |cFF8080FFBetter|rCooldownManager.") end + if viewerType ~= "Custom" and viewerType ~= "AdditionalCustom" and viewerType ~= "Trinket" and viewerType ~= "ItemSpell" and viewerType ~= "Item" and viewerType ~= "BuffBar" then CreateInformationTag(layoutContainer, "|cFFFFCC00Padding|r is handled by |cFF00B0F7Blizzard|r, not |cFF8080FFBetter|rCooldownManager.") end local anchorFromDropdown = AG:Create("Dropdown") anchorFromDropdown:SetLabel("Anchor From") @@ -1212,14 +1393,16 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) layoutContainer:AddChild(anchorFromDropdown) if hasAnchorParent then - BCDMG:AddAnchors("ElvUI", {"Utility", "Custom", "AdditionalCustom", "Item", "ItemSpell", "Trinket"}, { ["ElvUF_Player"] = "|cff1784d1ElvUI|r: Player Frame", ["ElvUF_Target"] = "|cff1784d1ElvUI|r: Target Frame", }) - local anchorToParentDropdown = AG:Create("Dropdown") - anchorToParentDropdown:SetLabel("Anchor To Parent") - anchorToParentDropdown:SetList(AnchorParents[viewerType][1], AnchorParents[viewerType][2]) - anchorToParentDropdown:SetValue(BCDM.db.profile.CooldownManager[viewerType].Layout[2]) - anchorToParentDropdown:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager[viewerType].Layout[2] = value BCDM:UpdateCooldownViewer(viewerType) end) - anchorToParentDropdown:SetRelativeWidth(0.33) - layoutContainer:AddChild(anchorToParentDropdown) + if BCDM.AnchorParents[viewerType] then + BCDMG:AddAnchors("ElvUI", {"Utility", "Custom", "AdditionalCustom", "Item", "ItemSpell", "Trinket", "BuffBar"}, { ["ElvUF_Player"] = "|cff1784d1ElvUI|r: Player Frame", ["ElvUF_Target"] = "|cff1784d1ElvUI|r: Target Frame", }) + local anchorToParentDropdown = AG:Create("Dropdown") + anchorToParentDropdown:SetLabel("Anchor To Parent") + anchorToParentDropdown:SetList(AnchorParents[viewerType][1], AnchorParents[viewerType][2]) + anchorToParentDropdown:SetValue(BCDM.db.profile.CooldownManager[viewerType].Layout[2]) + anchorToParentDropdown:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager[viewerType].Layout[2] = value BCDM:UpdateCooldownViewer(viewerType) end) + anchorToParentDropdown:SetRelativeWidth(0.33) + layoutContainer:AddChild(anchorToParentDropdown) + end end local anchorToDropdown = AG:Create("Dropdown") @@ -1248,6 +1431,40 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) layoutContainer:AddChild(spacingSlider) end + if viewerType == "BuffBar" then + local growthDirectionDropdown = AG:Create("Dropdown") + growthDirectionDropdown:SetLabel("Growth Direction") + growthDirectionDropdown:SetList({["UP"] = "Up", ["DOWN"] = "Down"}, {"UP", "DOWN"}) + growthDirectionDropdown:SetValue(BCDM.db.profile.CooldownManager.BuffBar.GrowthDirection) + growthDirectionDropdown:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager.BuffBar.GrowthDirection = value BCDM:UpdateCooldownViewer("BuffBar") end) + growthDirectionDropdown:SetRelativeWidth(0.5) + layoutContainer:AddChild(growthDirectionDropdown) + + local spacingSlider = AG:Create("Slider") + spacingSlider:SetLabel("Bar Spacing") + spacingSlider:SetValue(BCDM.db.profile.CooldownManager.BuffBar.Spacing) + spacingSlider:SetSliderValues(-1, 32, 0.1) + spacingSlider:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager.BuffBar.Spacing = value BCDM:UpdateCooldownViewer("BuffBar") end) + spacingSlider:SetRelativeWidth(0.5) + layoutContainer:AddChild(spacingSlider) + + widthSlider = AG:Create("Slider") + widthSlider:SetLabel("Width") + widthSlider:SetValue(BCDM.db.profile.CooldownManager.BuffBar.Width) + widthSlider:SetSliderValues(50, 3000, 0.1) + widthSlider:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager.BuffBar.Width = value BCDM:UpdateCooldownViewer("BuffBar") end) + widthSlider:SetRelativeWidth(0.5) + layoutContainer:AddChild(widthSlider) + + local heightSlider = AG:Create("Slider") + heightSlider:SetLabel("Height") + heightSlider:SetValue(BCDM.db.profile.CooldownManager.BuffBar.Height) + heightSlider:SetSliderValues(5, 500, 0.1) + heightSlider:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager.BuffBar.Height = value BCDM:UpdateCooldownViewer("BuffBar") end) + heightSlider:SetRelativeWidth(0.5) + layoutContainer:AddChild(heightSlider) + end + local xOffsetSlider = AG:Create("Slider") xOffsetSlider:SetLabel("X Offset") xOffsetSlider:SetValue(BCDM.db.profile.CooldownManager[viewerType].Layout[hasAnchorParent and 4 or 3]) @@ -1264,13 +1481,15 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) yOffsetSlider:SetRelativeWidth(isCustomViewer and 0.25 or 0.33) layoutContainer:AddChild(yOffsetSlider) - local iconSizeSlider = AG:Create("Slider") - iconSizeSlider:SetLabel("Icon Size") - iconSizeSlider:SetValue(BCDM.db.profile.CooldownManager[viewerType].IconSize) - iconSizeSlider:SetSliderValues(16, 128, 0.1) - iconSizeSlider:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager[viewerType].IconSize = value BCDM:UpdateCooldownViewer(viewerType) end) - iconSizeSlider:SetRelativeWidth(isCustomViewer and 0.25 or 0.33) - layoutContainer:AddChild(iconSizeSlider) + if viewerType ~= "BuffBar" then + local iconSizeSlider = AG:Create("Slider") + iconSizeSlider:SetLabel("Icon Size") + iconSizeSlider:SetValue(BCDM.db.profile.CooldownManager[viewerType].IconSize) + iconSizeSlider:SetSliderValues(16, 128, 0.1) + iconSizeSlider:SetCallback("OnValueChanged", function(self, _, value) BCDM.db.profile.CooldownManager[viewerType].IconSize = value BCDM:UpdateCooldownViewer(viewerType) end) + iconSizeSlider:SetRelativeWidth(isCustomViewer and 0.25 or 0.33) + layoutContainer:AddChild(iconSizeSlider) + end if viewerType == "Essential" or viewerType == "Utility" or viewerType == "Buffs" then local infoTag = CreateInformationTag(layoutContainer, "Updates To Sizes will be applied on closing the |cFF8080FFBetter|rCooldownManager Configuration Window.") @@ -1292,7 +1511,12 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) layoutContainer:AddChild(frameStrataDropdown) end - CreateCooldownViewerTextSettings(ScrollFrame, viewerType) + if viewerType == "BuffBar" then + CreateBuffBarIconSettings(ScrollFrame) + CreateBuffBarTextSettings(ScrollFrame) + else + CreateCooldownViewerTextSettings(ScrollFrame, viewerType) + end if viewerType == "Custom" or viewerType == "AdditionalCustom" then local spellContainer = AG:Create("InlineGroup") @@ -1322,6 +1546,22 @@ local function CreateCooldownViewerSettings(parentContainer, viewerType) CreateCooldownViewerItemSpellSettings(itemSpellContainer, ScrollFrame) end + RefreshBuffBarGUISettings = function() + if viewerType ~= "BuffBar" then return end + if BCDM.db.profile.CooldownManager.BuffBar.ColourByClass then + foregroundColourPicker:SetDisabled(true) + else + foregroundColourPicker:SetDisabled(false) + end + if BCDM.db.profile.CooldownManager.BuffBar.MatchWidthOfAnchor then + widthSlider:SetDisabled(true) + else + widthSlider:SetDisabled(false) + end + end + + RefreshBuffBarGUISettings() + ScrollFrame:DoLayout() parentContainer:DoLayout() @@ -2443,7 +2683,7 @@ function BCDM:CreateGUI() Container:SetWidth(900) Container:SetHeight(600) Container:EnableResize(false) - Container:SetCallback("OnClose", function(widget) AG:Release(widget) LEMO:ApplyChanges() BCDM:UpdateBCDM() isGUIOpen = false BCDM.CAST_BAR_TEST_MODE = false BCDM:CreateTestCastBar() BCDM.EssentialCooldownViewerOverlay:Hide() BCDM.UtilityCooldownViewerOverlay:Hide() BCDM.BuffIconCooldownViewerOverlay:Hide() end) + Container:SetCallback("OnClose", function(widget) AG:Release(widget) LEMO:ApplyChanges() BCDM:UpdateBCDM() isGUIOpen = false BCDM.CAST_BAR_TEST_MODE = false BCDM:CreateTestCastBar() BCDM.EssentialCooldownViewerOverlay:Hide() BCDM.UtilityCooldownViewerOverlay:Hide() BCDM.BuffIconCooldownViewerOverlay:Hide() BCDM.BuffBarCooldownViewerOverlay:Hide() end) local function SelectTab(GUIContainer, _, MainTab) GUIContainer:ReleaseChildren() @@ -2466,6 +2706,8 @@ function BCDM:CreateGUI() CreateCooldownViewerSettings(Wrapper, "Utility") elseif MainTab == "Buffs" then CreateCooldownViewerSettings(Wrapper, "Buffs") + elseif MainTab == "BuffBar" then + CreateCooldownViewerSettings(Wrapper, "BuffBar") elseif MainTab == "Custom" then CreateCooldownViewerSettings(Wrapper, "Custom") elseif MainTab == "AdditionalCustom" then @@ -2485,11 +2727,12 @@ function BCDM:CreateGUI() elseif MainTab == "Profiles" then CreateProfileSettings(Wrapper) end - if MainTab == "Essential" or MainTab == "Utility" or MainTab == "Buffs" then CooldownViewerSettings:Show() else CooldownViewerSettings:Hide() end + if MainTab == "Essential" or MainTab == "Utility" or MainTab == "Buffs" then if CooldownViewerSettings then CooldownViewerSettings:Show() end else if CooldownViewerSettings then CooldownViewerSettings:Hide() end end if MainTab == "CastBar" then BCDM.CAST_BAR_TEST_MODE = true BCDM:CreateTestCastBar() else BCDM.CAST_BAR_TEST_MODE = false BCDM:CreateTestCastBar() end if MainTab == "Essential" then BCDM.EssentialCooldownViewerOverlay:Show() else BCDM.EssentialCooldownViewerOverlay:Hide() end if MainTab == "Utility" then BCDM.UtilityCooldownViewerOverlay:Show() else BCDM.UtilityCooldownViewerOverlay:Hide() end if MainTab == "Buffs" then BCDM.BuffIconCooldownViewerOverlay:Show() else BCDM.BuffIconCooldownViewerOverlay:Hide() end + if MainTab == "BuffBar" then BCDM.BuffBarCooldownViewerOverlay:Show() else BCDM.BuffBarCooldownViewerOverlay:Hide() end GenerateSupportText(Container) end @@ -2503,6 +2746,7 @@ function BCDM:CreateGUI() { text = "Essential", value = "Essential"}, { text = "Utility", value = "Utility"}, { text = "Buffs", value = "Buffs"}, + { text = "Buff Bar", value = "BuffBar"}, { text = "Custom", value = "Custom"}, { text = "Additional Custom", value = "AdditionalCustom"}, { text = "Item", value = "Item"}, diff --git a/Core/Globals.lua b/Core/Globals.lua index 54256e9..0812d12 100755 --- a/Core/Globals.lua +++ b/Core/Globals.lua @@ -4,18 +4,20 @@ BCDMG = BCDMG or {} BCDM.IS_DEATHKNIGHT = select(2, UnitClass("player")) == "DEATHKNIGHT" BCDM.IS_MONK = select(2, UnitClass("player")) == "MONK" -BCDM.CooldownManagerViewers = { "EssentialCooldownViewer", "UtilityCooldownViewer", "BuffIconCooldownViewer", } +BCDM.CooldownManagerViewers = { "EssentialCooldownViewer", "UtilityCooldownViewer", "BuffIconCooldownViewer", "BuffBarCooldownViewer" } BCDM.CooldownManagerViewerToDBViewer = { EssentialCooldownViewer = "Essential", UtilityCooldownViewer = "Utility", BuffIconCooldownViewer = "Buffs", + BuffBarCooldownViewer = "BuffBar", } BCDM.DBViewerToCooldownManagerViewer = { Essential = "EssentialCooldownViewer", Utility = "UtilityCooldownViewer", Buffs = "BuffIconCooldownViewer", + BuffBar = "BuffBarCooldownViewer", } BCDM.LSM = LibStub("LibSharedMedia-3.0") @@ -150,6 +152,7 @@ function BCDM:UpdateBCDM() BCDM:UpdateCooldownViewer("Essential") BCDM:UpdateCooldownViewer("Utility") BCDM:UpdateCooldownViewer("Buffs") + BCDM:UpdateBuffBarStyle() BCDM:UpdatePowerBar() BCDM:UpdateSecondaryPowerBar() BCDM:UpdateCastBar() @@ -194,6 +197,17 @@ function BCDM:CreateCooldownViewerOverlays() BuffIconCooldownViewerOverlay:Hide() BCDM.BuffIconCooldownViewerOverlay = BuffIconCooldownViewerOverlay end + + if _G["BuffBarCooldownViewer"] then + local BuffBarCooldownViewerOverlay = CreateFrame("Frame", "BCDM_BuffBarCooldownViewerOverlay", UIParent, "BackdropTemplate") + BuffBarCooldownViewerOverlay:SetPoint("TOPLEFT", _G["BuffBarCooldownViewer"], "TOPLEFT", -8, 8) + BuffBarCooldownViewerOverlay:SetPoint("BOTTOMRIGHT", _G["BuffBarCooldownViewer"], "BOTTOMRIGHT", 8, -8) + BuffBarCooldownViewerOverlay:SetBackdrop({ edgeFile = "Interface\\AddOns\\BetterCooldownManager\\Media\\Glow.tga", edgeSize = 8, insets = {left = -8, right = -8, top = -8, bottom = -8} }) + BuffBarCooldownViewerOverlay:SetBackdropColor(0, 0, 0, 0) + BuffBarCooldownViewerOverlay:SetBackdropBorderColor(unpack(OVERLAY_COLOUR)) + BuffBarCooldownViewerOverlay:Hide() + BCDM.BuffBarCooldownViewerOverlay = BuffBarCooldownViewerOverlay + end end function BCDM:ClearTicks() @@ -412,12 +426,11 @@ BCDM.AnchorParents = { { ["EssentialCooldownViewer"] = "|cFF00AEF7Blizzard|r: Essential Cooldown Viewer", ["UtilityCooldownViewer"] = "|cFF00AEF7Blizzard|r: Utility Cooldown Viewer", - ["NONE"] = "|cFF00AEF7Blizzard|r: UIParent", ["BCDM_PowerBar"] = "|cFF8080FFBCDM|r: Power Bar", ["BCDM_SecondaryPowerBar"] = "|cFF8080FFBCDM|r: Secondary Power Bar", ["BCDM_CastBar"] = "|cFF8080FFBCDM|r: Cast Bar", }, - { "EssentialCooldownViewer", "UtilityCooldownViewer", "NONE", "BCDM_PowerBar", "BCDM_SecondaryPowerBar", "BCDM_CastBar" }, + { "EssentialCooldownViewer", "UtilityCooldownViewer", "BCDM_PowerBar", "BCDM_SecondaryPowerBar", "BCDM_CastBar" }, }, ["Custom"] = { { diff --git a/Modules/CooldownManager.lua b/Modules/CooldownManager.lua index f001e37..f66950b 100755 --- a/Modules/CooldownManager.lua +++ b/Modules/CooldownManager.lua @@ -1,5 +1,7 @@ local _, BCDM = ... +local buffBarResizeTimer = nil + local function ShouldSkin() if not BCDM.db.profile.CooldownManager.Enable then return false end if C_AddOns.IsAddOnLoaded("ElvUI") and ElvUI[1].private.skins.blizzard.cooldownManager then return false end @@ -24,20 +26,21 @@ local function FetchCooldownTextRegion(cooldown) end end --- local function FetchClassColour() --- local CooldownManagerDB = BCDM.db.profile --- local GeneralDB = CooldownManagerDB.General --- local BuffBarDB = CooldownManagerDB.CooldownManager.BuffBar --- if BuffBarDB then --- if BuffBarDB.ColourByClass then --- local _, class = UnitClass("player") --- local classColour = RAID_CLASS_COLORS[class] --- if classColour then return classColour.r, classColour.g, classColour.b, 1 end --- else --- return BuffBarDB.ForegroundColour[1], BuffBarDB.ForegroundColour[2], BuffBarDB.ForegroundColour[3], BuffBarDB.ForegroundColour[4] --- end --- end --- end +local function FetchClassColour() + local CooldownManagerDB = BCDM.db.profile + local GeneralDB = CooldownManagerDB.General + local BuffBarDB = CooldownManagerDB.CooldownManager.BuffBar + if BuffBarDB then + if BuffBarDB.ColourByClass then + local _, class = UnitClass("player") + local classColour = RAID_CLASS_COLORS[class] + if classColour then return classColour.r, classColour.g, classColour.b, 1 end + else + return BuffBarDB.ForegroundColour[1], BuffBarDB.ForegroundColour[2], BuffBarDB.ForegroundColour[3], + BuffBarDB.ForegroundColour[4] + end + end +end local function ApplyCooldownText(cooldownViewer) local CooldownManagerDB = BCDM.db.profile @@ -58,9 +61,11 @@ local function ApplyCooldownText(cooldownViewer) end textRegion:SetTextColor(CooldownTextDB.Colour[1], CooldownTextDB.Colour[2], CooldownTextDB.Colour[3], 1) textRegion:ClearAllPoints() - textRegion:SetPoint(CooldownTextDB.Layout[1], icon, CooldownTextDB.Layout[2], CooldownTextDB.Layout[3], CooldownTextDB.Layout[4]) + textRegion:SetPoint(CooldownTextDB.Layout[1], icon, CooldownTextDB.Layout[2], CooldownTextDB.Layout[3], + CooldownTextDB.Layout[4]) if GeneralDB.Fonts.Shadow.Enabled then - textRegion:SetShadowColor(GeneralDB.Fonts.Shadow.Colour[1], GeneralDB.Fonts.Shadow.Colour[2], GeneralDB.Fonts.Shadow.Colour[3], GeneralDB.Fonts.Shadow.Colour[4]) + textRegion:SetShadowColor(GeneralDB.Fonts.Shadow.Colour[1], GeneralDB.Fonts.Shadow.Colour[2], + GeneralDB.Fonts.Shadow.Colour[3], GeneralDB.Fonts.Shadow.Colour[4]) textRegion:SetShadowOffset(GeneralDB.Fonts.Shadow.OffsetX, GeneralDB.Fonts.Shadow.OffsetY) else textRegion:SetShadowColor(0, 0, 0, 0) @@ -71,95 +76,139 @@ local function ApplyCooldownText(cooldownViewer) end end --- local function StyleBuffsBars() --- local GeneralDB = BCDM.db.profile.General --- local GeneralCooldownManagerSetting = BCDM.db.profile.CooldownManager.General --- local BuffBarDB = BCDM.db.profile.CooldownManager.BuffBar --- local buffBarChildren = {_G["BuffBarCooldownViewer"]:GetChildren()} - --- for _, childFrame in ipairs(buffBarChildren) do --- local buffBar = childFrame.Bar --- local buffIcon = childFrame.Icon --- if childFrame.DebuffBorder then childFrame.DebuffBorder:SetAlpha(0) end - --- -- if BuffBarDB.MatchWidthOfAnchor then --- -- local anchorFrame = _G[BuffBarDB.Layout[2]] --- -- if anchorFrame then --- -- local anchorWidth = anchorFrame:GetWidth() --- -- childFrame:SetWidth(anchorWidth) --- -- _G["BuffBarCooldownViewer"]:SetWidth(anchorWidth) --- -- end --- -- else --- -- childFrame:SetWidth(BuffBarDB.Width) --- -- _G["BuffBarCooldownViewer"]:SetWidth(BuffBarDB.Width) --- -- end --- -- childFrame:SetHeight(BuffBarDB.Height) - --- if childFrame.Bar then --- childFrame.Bar:ClearAllPoints() --- childFrame.Bar:SetPoint("TOPLEFT", childFrame, "TOPLEFT", 0, 0) --- childFrame.Bar:SetPoint("BOTTOMRIGHT", childFrame, "BOTTOMRIGHT", 0, 0) --- childFrame.Bar:SetStatusBarTexture(BCDM.Media.Foreground) --- childFrame.Bar:SetStatusBarColor(FetchClassColour()) --- childFrame.Bar.Pip:SetAlpha(0) --- end - --- if buffBar then --- buffBar:ClearAllPoints() --- buffBar:SetPoint("TOPLEFT", childFrame, "TOPLEFT", 0, 0) --- buffBar:SetPoint("BOTTOMRIGHT", childFrame, "BOTTOMRIGHT", 0, 0) --- buffBar.BarBG:SetPoint("TOPLEFT", buffBar, "TOPLEFT", 0, 0) --- buffBar.BarBG:SetPoint("BOTTOMRIGHT", buffBar, "BOTTOMRIGHT", 0, 0) --- buffBar.BarBG:SetTexture(BCDM.Media.Background) --- buffBar.BarBG:SetVertexColor(BuffBarDB.BackgroundColour[1], BuffBarDB.BackgroundColour[2], BuffBarDB.BackgroundColour[3], BuffBarDB.BackgroundColour[4]) - --- if buffIcon then --- if not BuffBarDB.Icon.Enabled then buffIcon:Hide() else buffIcon:Show() end --- BCDM:StripTextures(buffIcon.Icon) --- buffIcon.Icon:SetSize(BuffBarDB.Height, BuffBarDB.Height) --- buffIcon.Icon:ClearAllPoints() --- if BuffBarDB.Icon.Layout == "LEFT" then --- buffIcon.Icon:SetPoint("RIGHT", buffBar, "LEFT", 1, 0) --- else --- buffIcon.Icon:SetPoint("LEFT", buffBar, "RIGHT", -1, 0) --- end --- buffIcon.Icon:SetTexCoord(GeneralCooldownManagerSetting.IconZoom * 0.5, 1 - GeneralCooldownManagerSetting.IconZoom * 0.5, GeneralCooldownManagerSetting.IconZoom * 0.5, 1 - GeneralCooldownManagerSetting.IconZoom * 0.5) --- end - --- if buffBar.Name then --- if not BuffBarDB.Text.SpellName.Enabled then buffBar.Name:Hide() else buffBar.Name:Show() end --- buffBar.Name:ClearAllPoints() --- buffBar.Name:SetPoint(BuffBarDB.Text.SpellName.Layout[1], buffBar, BuffBarDB.Text.SpellName.Layout[2], BuffBarDB.Text.SpellName.Layout[3], BuffBarDB.Text.SpellName.Layout[4]) --- buffBar.Name:SetFont(BCDM.Media.Font, BuffBarDB.Text.SpellName.FontSize, GeneralDB.Fonts.FontFlag) --- buffBar.Name:SetTextColor(BuffBarDB.Text.SpellName.Colour[1], BuffBarDB.Text.SpellName.Colour[2], BuffBarDB.Text.SpellName.Colour[3], 1) --- if GeneralDB.Fonts.Shadow.Enabled then --- buffBar.Name:SetShadowColor(GeneralDB.Fonts.Shadow.Colour[1], GeneralDB.Fonts.Shadow.Colour[2], GeneralDB.Fonts.Shadow.Colour[3], GeneralDB.Fonts.Shadow.Colour[4]) --- buffBar.Name:SetShadowOffset(GeneralDB.Fonts.Shadow.OffsetX, GeneralDB.Fonts.Shadow.OffsetY) --- else --- buffBar.Name:SetShadowColor(0, 0, 0, 0) --- buffBar.Name:SetShadowOffset(0, 0) --- end --- end - --- if buffBar.Duration then --- if not BuffBarDB.Text.Duration.Enabled then buffBar.Duration:Hide() else buffBar.Duration:Show() end --- buffBar.Duration:ClearAllPoints() --- buffBar.Duration:SetPoint(BuffBarDB.Text.Duration.Layout[1], buffBar, BuffBarDB.Text.Duration.Layout[2], BuffBarDB.Text.Duration.Layout[3], BuffBarDB.Text.Duration.Layout[4]) --- buffBar.Duration:SetFont(BCDM.Media.Font, BuffBarDB.Text.Duration.FontSize, GeneralDB.Fonts.FontFlag) --- buffBar.Duration:SetTextColor(BuffBarDB.Text.Duration.Colour[1], BuffBarDB.Text.Duration.Colour[2], BuffBarDB.Text.Duration.Colour[3], 1) --- if GeneralDB.Fonts.Shadow.Enabled then --- buffBar.Duration:SetShadowColor(GeneralDB.Fonts.Shadow.Colour[1], GeneralDB.Fonts.Shadow.Colour[2], GeneralDB.Fonts.Shadow.Colour[3], GeneralDB.Fonts.Shadow.Colour[4]) --- buffBar.Duration:SetShadowOffset(GeneralDB.Fonts.Shadow.OffsetX, GeneralDB.Fonts.Shadow.OffsetY) --- else --- buffBar.Duration:SetShadowColor(0, 0, 0, 0) --- buffBar.Duration:SetShadowOffset(0, 0) --- end --- end --- end --- BCDM:AddBorder(buffBar) --- BCDM:AddBorder(buffIcon) --- end --- end +-- Hide stack/charge count elements on a BuffBar frame +-- BuffBar uses custom Name/Duration text instead of Blizzard's charge/stack displays +-- Based on frame structure analysis: childFrame.Icon.Applications is the FontString that displays stack counts +local function HideBuffBarStackCharges(childFrame) + if not childFrame then return end + + -- Hide the stack/charge count FontString on the Icon container + -- This is the ONLY element that displays stacks/charges on BuffBar frames + if childFrame.Icon and childFrame.Icon.Applications then + pcall(function() childFrame.Icon.Applications:Hide() end) + end +end + +local function StyleBuffsBars() + local GeneralDB = BCDM.db.profile.General + local GeneralCooldownManagerSetting = BCDM.db.profile.CooldownManager.General + local BuffBarDB = BCDM.db.profile.CooldownManager.BuffBar + local buffBarChildren = { _G["BuffBarCooldownViewer"]:GetChildren() } + + for _, childFrame in ipairs(buffBarChildren) do + local buffBar = childFrame.Bar + local buffIcon = childFrame.Icon + if childFrame.DebuffBorder then childFrame.DebuffBorder:SetAlpha(0) end + + -- Hide stack/charge counts (BuffBar uses custom Name/Duration text instead) + HideBuffBarStackCharges(childFrame) + + if BuffBarDB.MatchWidthOfAnchor then + local anchorFrame = _G[BuffBarDB.Layout[2]] + if anchorFrame then + local anchorWidth = anchorFrame:GetWidth() + childFrame:SetWidth(anchorWidth) + _G["BuffBarCooldownViewer"]:SetWidth(anchorWidth) + end + else + childFrame:SetWidth(BuffBarDB.Width) + _G["BuffBarCooldownViewer"]:SetWidth(BuffBarDB.Width) + end + childFrame:SetHeight(BuffBarDB.Height) + + if childFrame.Bar then + -- Bar positioning handled in buffIcon section to account for icon placement + childFrame.Bar:SetStatusBarTexture(BCDM.Media.Foreground) + childFrame.Bar:SetStatusBarColor(FetchClassColour()) + childFrame.Bar.Pip:SetAlpha(0) + end + + if buffBar then + -- Bar positioning handled in buffIcon section to account for icon placement + buffBar.BarBG:SetPoint("TOPLEFT", buffBar, "TOPLEFT", 0, 0) + buffBar.BarBG:SetPoint("BOTTOMRIGHT", buffBar, "BOTTOMRIGHT", 0, 0) + buffBar.BarBG:SetTexture(BCDM.Media.Background) + buffBar.BarBG:SetVertexColor(BuffBarDB.BackgroundColour[1], BuffBarDB.BackgroundColour[2], + BuffBarDB.BackgroundColour[3], BuffBarDB.BackgroundColour[4]) + + if buffIcon and buffIcon.Icon then + buffIcon.Icon:ClearAllPoints() + buffBar:ClearAllPoints() + + -- Always strip Blizzard textures (border/glow) regardless of visibility + BCDM:StripTextures(buffIcon.Icon) + + -- Use BCDM setting to control icon visibility (overrides Blizzard's Edit Mode) + if not BuffBarDB.Icon.Enabled then + -- Hide icon, bar fills entire childFrame + buffIcon.Icon:Hide() + buffBar:SetPoint("TOPLEFT", childFrame, "TOPLEFT", 0, 0) + buffBar:SetPoint("BOTTOMRIGHT", childFrame, "BOTTOMRIGHT", 0, 0) + else + -- Show and style icon, position bar accordingly + buffIcon.Icon:Show() + buffIcon.Icon:SetSize(BuffBarDB.Height, BuffBarDB.Height) + + if BuffBarDB.Icon.Layout == "LEFT" then + -- Icon on left side of childFrame + buffIcon.Icon:SetPoint("LEFT", childFrame, "LEFT", 0, 0) + -- Bar fills space from icon's right edge to childFrame's right edge + buffBar:SetPoint("TOPLEFT", buffIcon.Icon, "TOPRIGHT", 0, 0) + buffBar:SetPoint("BOTTOMRIGHT", childFrame, "BOTTOMRIGHT", 0, 0) + else + -- Icon on right side of childFrame + buffIcon.Icon:SetPoint("RIGHT", childFrame, "RIGHT", 0, 0) + -- Bar fills space from childFrame's left edge to icon's left edge + buffBar:SetPoint("TOPLEFT", childFrame, "TOPLEFT", 0, 0) + buffBar:SetPoint("BOTTOMRIGHT", buffIcon.Icon, "BOTTOMLEFT", 0, 0) + end + + buffIcon.Icon:SetTexCoord(GeneralCooldownManagerSetting.IconZoom * 0.5, + 1 - GeneralCooldownManagerSetting.IconZoom * 0.5, GeneralCooldownManagerSetting.IconZoom * 0.5, + 1 - GeneralCooldownManagerSetting.IconZoom * 0.5) + end + end + + if buffBar.Name then + if not BuffBarDB.Text.SpellName.Enabled then buffBar.Name:Hide() else buffBar.Name:Show() end + buffBar.Name:ClearAllPoints() + buffBar.Name:SetPoint(BuffBarDB.Text.SpellName.Layout[1], buffBar, BuffBarDB.Text.SpellName.Layout[2], + BuffBarDB.Text.SpellName.Layout[3], BuffBarDB.Text.SpellName.Layout[4]) + buffBar.Name:SetFont(BCDM.Media.Font, BuffBarDB.Text.SpellName.FontSize, GeneralDB.Fonts.FontFlag) + buffBar.Name:SetTextColor(BuffBarDB.Text.SpellName.Colour[1], BuffBarDB.Text.SpellName.Colour[2], + BuffBarDB.Text.SpellName.Colour[3], 1) + if GeneralDB.Fonts.Shadow.Enabled then + buffBar.Name:SetShadowColor(GeneralDB.Fonts.Shadow.Colour[1], GeneralDB.Fonts.Shadow.Colour[2], + GeneralDB.Fonts.Shadow.Colour[3], GeneralDB.Fonts.Shadow.Colour[4]) + buffBar.Name:SetShadowOffset(GeneralDB.Fonts.Shadow.OffsetX, GeneralDB.Fonts.Shadow.OffsetY) + else + buffBar.Name:SetShadowColor(0, 0, 0, 0) + buffBar.Name:SetShadowOffset(0, 0) + end + end + + if buffBar.Duration then + if not BuffBarDB.Text.Duration.Enabled then buffBar.Duration:Hide() else buffBar.Duration:Show() end + buffBar.Duration:ClearAllPoints() + buffBar.Duration:SetPoint(BuffBarDB.Text.Duration.Layout[1], buffBar, BuffBarDB.Text.Duration.Layout[2], + BuffBarDB.Text.Duration.Layout[3], BuffBarDB.Text.Duration.Layout[4]) + buffBar.Duration:SetFont(BCDM.Media.Font, BuffBarDB.Text.Duration.FontSize, GeneralDB.Fonts.FontFlag) + buffBar.Duration:SetTextColor(BuffBarDB.Text.Duration.Colour[1], BuffBarDB.Text.Duration.Colour[2], + BuffBarDB.Text.Duration.Colour[3], 1) + if GeneralDB.Fonts.Shadow.Enabled then + buffBar.Duration:SetShadowColor(GeneralDB.Fonts.Shadow.Colour[1], GeneralDB.Fonts.Shadow.Colour[2], + GeneralDB.Fonts.Shadow.Colour[3], GeneralDB.Fonts.Shadow.Colour[4]) + buffBar.Duration:SetShadowOffset(GeneralDB.Fonts.Shadow.OffsetX, GeneralDB.Fonts.Shadow.OffsetY) + else + buffBar.Duration:SetShadowColor(0, 0, 0, 0) + buffBar.Duration:SetShadowOffset(0, 0) + end + end + end + BCDM:AddBorder(buffBar) + BCDM:AddBorder(buffIcon) + end +end local function Position() local cooldownManagerSettings = BCDM.db.profile.CooldownManager @@ -167,24 +216,89 @@ local function Position() for _, viewerName in ipairs(BCDM.CooldownManagerViewers) do local viewerSettings = cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]] local viewerFrame = _G[viewerName] - if viewerFrame and (viewerName == "UtilityCooldownViewer" or viewerName == "BuffIconCooldownViewer") then + if viewerFrame then viewerFrame:ClearAllPoints() local anchorParent = viewerSettings.Layout[2] == "NONE" and UIParent or _G[viewerSettings.Layout[2]] - viewerFrame:SetPoint(viewerSettings.Layout[1], anchorParent, viewerSettings.Layout[3], viewerSettings.Layout[4], viewerSettings.Layout[5]) - viewerFrame:SetFrameStrata("LOW") - elseif viewerFrame then - viewerFrame:ClearAllPoints() - viewerFrame:SetPoint(viewerSettings.Layout[1], UIParent, viewerSettings.Layout[3], viewerSettings.Layout[4], viewerSettings.Layout[5]) + -- Safety check: if anchor parent doesn't exist, fall back to UIParent + if not anchorParent then + anchorParent = UIParent + end + viewerFrame:SetPoint(viewerSettings.Layout[1], anchorParent, viewerSettings.Layout[3], + viewerSettings.Layout[4], viewerSettings.Layout[5]) viewerFrame:SetFrameStrata("LOW") + NudgeViewer(viewerName, -0.1, 0) + end + end +end + +local buffBarPositionUpdateThrottle = 0.05 +local nextBuffBarPositionUpdate = 0 + +local function PositionBuffBars() + local currentTime = GetTime() + if currentTime < nextBuffBarPositionUpdate then return end + nextBuffBarPositionUpdate = currentTime + buffBarPositionUpdateThrottle + + local BuffBarDB = BCDM.db.profile.CooldownManager.BuffBar + local buffBarViewer = _G["BuffBarCooldownViewer"] + if not buffBarViewer then return end + + local visibleBuffBars = {} + + -- Collect all visible buff bars + for _, childFrame in ipairs({ buffBarViewer:GetChildren() }) do + if childFrame and childFrame:IsShown() and childFrame.layoutIndex then + table.insert(visibleBuffBars, childFrame) + + -- Hide stack/charge counts on each frame update + -- This catches newly created/recycled frames that Blizzard shows after StyleBuffsBars() runs + HideBuffBarStackCharges(childFrame) + end + end + + -- Sort by layoutIndex to maintain Blizzard's intended order + table.sort(visibleBuffBars, function(a, b) + return (a.layoutIndex or 0) < (b.layoutIndex or 0) + end) + + local visibleCount = #visibleBuffBars + if visibleCount == 0 then return end + + local barHeight = BuffBarDB.Height + local spacing = BuffBarDB.Spacing + local growthDirection = BuffBarDB.GrowthDirection or "UP" + + -- Position each buff bar based on growth direction + for index, barFrame in ipairs(visibleBuffBars) do + barFrame:ClearAllPoints() + + if growthDirection == "UP" then + -- First bar at anchor point (BOTTOM of viewer), stack upward + local yOffset = (index - 1) * (barHeight + spacing) + barFrame:SetPoint("BOTTOM", buffBarViewer, "BOTTOM", 0, yOffset) + elseif growthDirection == "DOWN" then + -- First bar at anchor point (TOP of viewer), stack downward + local yOffset = -(index - 1) * (barHeight + spacing) + barFrame:SetPoint("TOP", buffBarViewer, "TOP", 0, yOffset) end - NudgeViewer(viewerName, -0.1, 0) end + + return visibleCount +end + +local buffBarEventFrame = CreateFrame("Frame") + +local function SetupBuffBarPositioning() + -- Always run the positioning for buff bars + buffBarEventFrame:SetScript("OnUpdate", PositionBuffBars) end --- function BCDM:UpdateBuffBarStyle() --- Position() --- StyleBuffsBars() --- end +function BCDM:UpdateBuffBarStyle() + Position() + StyleBuffsBars() + PositionBuffBars() + BCDM:UpdateBuffBarWidth() +end --[[ local cooldownFrameTbl = {} @@ -204,75 +318,153 @@ local function StyleIcons() if not ShouldSkin() then return end local cooldownManagerSettings = BCDM.db.profile.CooldownManager for _, viewerName in ipairs(BCDM.CooldownManagerViewers) do - for _, childFrame in ipairs({_G[viewerName]:GetChildren()}) do - if childFrame then - if childFrame.Icon then - BCDM:StripTextures(childFrame.Icon) - local iconZoomAmount = cooldownManagerSettings.General.IconZoom * 0.5 - childFrame.Icon:SetTexCoord(iconZoomAmount, 1 - iconZoomAmount, iconZoomAmount, 1 - iconZoomAmount) - end - if childFrame.Cooldown then - local borderSize = cooldownManagerSettings.General.BorderSize - childFrame.Cooldown:ClearAllPoints() - childFrame.Cooldown:SetPoint("TOPLEFT", childFrame, "TOPLEFT", borderSize, -borderSize) - childFrame.Cooldown:SetPoint("BOTTOMRIGHT", childFrame, "BOTTOMRIGHT", -borderSize, borderSize) - childFrame.Cooldown:SetSwipeColor(0, 0, 0, 0.8) - childFrame.Cooldown:SetDrawEdge(false) - childFrame.Cooldown:SetDrawSwipe(true) - childFrame.Cooldown:SetSwipeTexture("Interface\\Buttons\\WHITE8X8") + if viewerName ~= "BuffBarCooldownViewer" then + for _, childFrame in ipairs({ _G[viewerName]:GetChildren() }) do + if childFrame then + if childFrame.Icon then + BCDM:StripTextures(childFrame.Icon) + local iconZoomAmount = cooldownManagerSettings.General.IconZoom * 0.5 + childFrame.Icon:SetTexCoord(iconZoomAmount, 1 - iconZoomAmount, iconZoomAmount, + 1 - iconZoomAmount) + end + if childFrame.Cooldown then + local borderSize = cooldownManagerSettings.General.BorderSize + childFrame.Cooldown:ClearAllPoints() + childFrame.Cooldown:SetPoint("TOPLEFT", childFrame, "TOPLEFT", borderSize, -borderSize) + childFrame.Cooldown:SetPoint("BOTTOMRIGHT", childFrame, "BOTTOMRIGHT", -borderSize, borderSize) + childFrame.Cooldown:SetSwipeColor(0, 0, 0, 0.8) + childFrame.Cooldown:SetDrawEdge(false) + childFrame.Cooldown:SetDrawSwipe(true) + childFrame.Cooldown:SetSwipeTexture("Interface\\Buttons\\WHITE8X8") + end + if childFrame.CooldownFlash then childFrame.CooldownFlash:SetAlpha(0) end + if childFrame.DebuffBorder then childFrame.DebuffBorder:SetAlpha(0) end + childFrame:SetSize( + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].IconSize, + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].IconSize) + BCDM:AddBorder(childFrame) + if not childFrame.layoutIndex then childFrame:SetShown(false) end end - if childFrame.CooldownFlash then childFrame.CooldownFlash:SetAlpha(0) end - if childFrame.DebuffBorder then childFrame.DebuffBorder:SetAlpha(0) end - childFrame:SetSize(cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].IconSize, cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].IconSize) - BCDM:AddBorder(childFrame) - if not childFrame.layoutIndex then childFrame:SetShown(false) end end end end end +function BCDM:UpdateBuffBarWidth() + local BuffBarDB = BCDM.db.profile.CooldownManager.BuffBar + + -- Cancel existing timer to prevent stacking + if buffBarResizeTimer then + buffBarResizeTimer:Cancel() + buffBarResizeTimer = nil + end + + if not BuffBarDB.MatchWidthOfAnchor then return end + + -- Check for invalid anchor (NONE or non-existent frame) + if BuffBarDB.Layout[2] == "NONE" or not _G[BuffBarDB.Layout[2]] then + return + end + + local anchorFrame = _G[BuffBarDB.Layout[2]] + + -- Use timer with cancellation like SecondaryPowerBar + buffBarResizeTimer = C_Timer.After(0.5, function() + local anchorWidth = anchorFrame:GetWidth() + _G["BuffBarCooldownViewer"]:SetWidth(anchorWidth) + for _, childFrame in ipairs({ _G["BuffBarCooldownViewer"]:GetChildren() }) do + childFrame:SetWidth(anchorWidth) + end + buffBarResizeTimer = nil + end) +end + local function SetHooks() - hooksecurefunc(EditModeManagerFrame, "EnterEditMode", function() if InCombatLockdown() then return end Position() end) - hooksecurefunc(EditModeManagerFrame, "ExitEditMode", function() if InCombatLockdown() then return end BCDM.LEMO:LoadLayouts() Position() end) - hooksecurefunc(CooldownViewerSettings, "RefreshLayout", function() if InCombatLockdown() then return end BCDM:UpdateBCDM() end) + hooksecurefunc(EditModeManagerFrame, "EnterEditMode", + function() + if InCombatLockdown() then return end + Position() + BCDM:UpdateBuffBarWidth() + end) + hooksecurefunc(EditModeManagerFrame, "ExitEditMode", + function() + if InCombatLockdown() then return end + BCDM.LEMO:LoadLayouts() + Position() + BCDM:UpdateBuffBarWidth() + end) + hooksecurefunc(CooldownViewerSettings, "RefreshLayout", + function() + if InCombatLockdown() then return end + BCDM:UpdateBCDM() + end) end local function StyleChargeCount() local cooldownManagerSettings = BCDM.db.profile.CooldownManager local generalSettings = BCDM.db.profile.General for _, viewerName in ipairs(BCDM.CooldownManagerViewers) do - for _, childFrame in ipairs({ _G[viewerName]:GetChildren() }) do - if childFrame and childFrame.ChargeCount and childFrame.ChargeCount.Current then - local currentChargeText = childFrame.ChargeCount.Current - currentChargeText:SetFont(BCDM.Media.Font, cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.FontSize, generalSettings.Fonts.FontFlag) - currentChargeText:ClearAllPoints() - currentChargeText:SetPoint(cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[1], childFrame, cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[2], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[3], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[4]) - currentChargeText:SetTextColor(cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[1], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[2], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[3], 1) - if generalSettings.Fonts.Shadow.Enabled then - currentChargeText:SetShadowColor(generalSettings.Fonts.Shadow.Colour[1], generalSettings.Fonts.Shadow.Colour[2], generalSettings.Fonts.Shadow.Colour[3], generalSettings.Fonts.Shadow.Colour[4]) - currentChargeText:SetShadowOffset(generalSettings.Fonts.Shadow.OffsetX, generalSettings.Fonts.Shadow.OffsetY) - else - currentChargeText:SetShadowColor(0, 0, 0, 0) - currentChargeText:SetShadowOffset(0, 0) + -- Skip BuffBar - it has custom text structure (SpellName/Duration) + -- BuffBar stack/charge hiding is handled separately in HideBuffBarStackCharges() + -- Note: BuffBar frames use Icon.Applications for stack counts, not ChargeCount.Current + if viewerName ~= "BuffBarCooldownViewer" then + for _, childFrame in ipairs({ _G[viewerName]:GetChildren() }) do + if childFrame and childFrame.ChargeCount and childFrame.ChargeCount.Current then + local currentChargeText = childFrame.ChargeCount.Current + currentChargeText:SetFont(BCDM.Media.Font, + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.FontSize, + generalSettings.Fonts.FontFlag) + currentChargeText:ClearAllPoints() + currentChargeText:SetPoint( + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[1], childFrame, + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[2], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[3], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[4]) + currentChargeText:SetTextColor( + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[1], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[2], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[3], 1) + if generalSettings.Fonts.Shadow.Enabled then + currentChargeText:SetShadowColor(generalSettings.Fonts.Shadow.Colour[1], + generalSettings.Fonts.Shadow.Colour[2], generalSettings.Fonts.Shadow.Colour[3], + generalSettings.Fonts.Shadow.Colour[4]) + currentChargeText:SetShadowOffset(generalSettings.Fonts.Shadow.OffsetX, + generalSettings.Fonts.Shadow.OffsetY) + else + currentChargeText:SetShadowColor(0, 0, 0, 0) + currentChargeText:SetShadowOffset(0, 0) + end + currentChargeText:SetDrawLayer("OVERLAY") end - currentChargeText:SetDrawLayer("OVERLAY") end - end - for _, childFrame in ipairs({ _G[viewerName]:GetChildren() }) do - if childFrame and childFrame.Applications then - local applicationsText = childFrame.Applications.Applications - applicationsText:SetFont(BCDM.Media.Font, cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.FontSize, generalSettings.Fonts.FontFlag) - applicationsText:ClearAllPoints() - applicationsText:SetPoint(cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[1], childFrame, cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[2], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[3], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[4]) - applicationsText:SetTextColor(cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[1], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[2], cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[3], 1) - if generalSettings.Fonts.Shadow.Enabled then - applicationsText:SetShadowColor(generalSettings.Fonts.Shadow.Colour[1], generalSettings.Fonts.Shadow.Colour[2], generalSettings.Fonts.Shadow.Colour[3], generalSettings.Fonts.Shadow.Colour[4]) - applicationsText:SetShadowOffset(generalSettings.Fonts.Shadow.OffsetX, generalSettings.Fonts.Shadow.OffsetY) - else - applicationsText:SetShadowColor(0, 0, 0, 0) - applicationsText:SetShadowOffset(0, 0) + for _, childFrame in ipairs({ _G[viewerName]:GetChildren() }) do + if childFrame and childFrame.Applications then + local applicationsText = childFrame.Applications.Applications + applicationsText:SetFont(BCDM.Media.Font, + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.FontSize, + generalSettings.Fonts.FontFlag) + applicationsText:ClearAllPoints() + applicationsText:SetPoint( + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[1], childFrame, + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[2], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[3], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Layout[4]) + applicationsText:SetTextColor( + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[1], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[2], + cooldownManagerSettings[BCDM.CooldownManagerViewerToDBViewer[viewerName]].Text.Colour[3], 1) + if generalSettings.Fonts.Shadow.Enabled then + applicationsText:SetShadowColor(generalSettings.Fonts.Shadow.Colour[1], + generalSettings.Fonts.Shadow.Colour[2], generalSettings.Fonts.Shadow.Colour[3], + generalSettings.Fonts.Shadow.Colour[4]) + applicationsText:SetShadowOffset(generalSettings.Fonts.Shadow.OffsetX, + generalSettings.Fonts.Shadow.OffsetY) + else + applicationsText:SetShadowColor(0, 0, 0, 0) + applicationsText:SetShadowOffset(0, 0) + end + applicationsText:SetDrawLayer("OVERLAY") end - applicationsText:SetDrawLayer("OVERLAY") end end end @@ -307,7 +499,8 @@ local function CenterBuffs() for index, iconFrame in ipairs(visibleBuffIcons) do iconFrame:ClearAllPoints() - iconFrame:SetPoint("CENTER", BuffIconCooldownViewer, "CENTER", startX + (index - 1) * (iconWidth + iconSpacing), 0) + iconFrame:SetPoint("CENTER", BuffIconCooldownViewer, "CENTER", startX + (index - 1) * (iconWidth + iconSpacing), + 0) end return visibleCount @@ -336,6 +529,17 @@ function BCDM:SkinCooldownManager() Position() SetHooks() SetupCenterBuffs() + SetupBuffBarPositioning() + + -- Initialize BuffBar styling after a delay to ensure children exist + if _G["BuffBarCooldownViewer"] and ShouldSkin() then + C_Timer.After(0.3, function() + StyleBuffsBars() + PositionBuffBars() + BCDM:UpdateBuffBarWidth() + end) + end + for _, viewerName in ipairs(BCDM.CooldownManagerViewers) do C_Timer.After(0.1, function() ApplyCooldownText(viewerName) end) end @@ -348,22 +552,42 @@ function BCDM:SkinCooldownManager() end function BCDM:UpdateCooldownViewer(viewerType) - -- if viewerType == "BuffBar" then BCDM:UpdateBuffBarStyle() return end + if viewerType == "BuffBar" then + BCDM:UpdateBuffBarStyle() + return + end local cooldownManagerSettings = BCDM.db.profile.CooldownManager local cooldownViewerFrame = _G[BCDM.DBViewerToCooldownManagerViewer[viewerType]] - if viewerType == "Custom" then BCDM:UpdateCustomCooldownViewer() return end - if viewerType == "AdditionalCustom" then BCDM:UpdateAdditionalCustomCooldownViewer() return end - if viewerType == "Item" then BCDM:UpdateCustomItemBar() return end - if viewerType == "Trinket" then BCDM:UpdateTrinketBar() return end - if viewerType == "ItemSpell" then BCDM:UpdateCustomItemsSpellsBar() return end + if viewerType == "Custom" then + BCDM:UpdateCustomCooldownViewer() + return + end + if viewerType == "AdditionalCustom" then + BCDM:UpdateAdditionalCustomCooldownViewer() + return + end + if viewerType == "Item" then + BCDM:UpdateCustomItemBar() + return + end + if viewerType == "Trinket" then + BCDM:UpdateTrinketBar() + return + end + if viewerType == "ItemSpell" then + BCDM:UpdateCustomItemsSpellsBar() + return + end if viewerType == "Buffs" then SetupCenterBuffs() end - for _, childFrame in ipairs({cooldownViewerFrame:GetChildren()}) do + for _, childFrame in ipairs({ cooldownViewerFrame:GetChildren() }) do if childFrame then if childFrame.Icon and ShouldSkin() then BCDM:StripTextures(childFrame.Icon) - childFrame.Icon:SetTexCoord(cooldownManagerSettings.General.IconZoom, 1 - cooldownManagerSettings.General.IconZoom, cooldownManagerSettings.General.IconZoom, 1 - cooldownManagerSettings.General.IconZoom) + childFrame.Icon:SetTexCoord(cooldownManagerSettings.General.IconZoom, + 1 - cooldownManagerSettings.General.IconZoom, cooldownManagerSettings.General.IconZoom, + 1 - cooldownManagerSettings.General.IconZoom) end if childFrame.Cooldown then childFrame.Cooldown:ClearAllPoints() @@ -375,7 +599,8 @@ function BCDM:UpdateCooldownViewer(viewerType) childFrame.Cooldown:SetSwipeTexture("Interface\\Buttons\\WHITE8X8") end if childFrame.CooldownFlash then childFrame.CooldownFlash:SetAlpha(0) end - childFrame:SetSize(cooldownManagerSettings[viewerType].IconSize, cooldownManagerSettings[viewerType].IconSize) + childFrame:SetSize(cooldownManagerSettings[viewerType].IconSize, cooldownManagerSettings[viewerType] + .IconSize) end end diff --git a/Modules/Data.lua b/Modules/Data.lua index d254f22..1074ea8 100755 --- a/Modules/Data.lua +++ b/Modules/Data.lua @@ -371,11 +371,11 @@ function BCDM:FetchEquippedTrinkets() if itemId and C_Item.IsUsableItem(itemId) then trinketProfile.Trinkets[itemId] = { isActive = true, layoutIndex = slotIndex } usableCount = usableCount + 1 - BCDM.TrinketBarContainer:Show() + if BCDM.TrinketBarContainer then BCDM.TrinketBarContainer:Show() end end end - if usableCount == 0 then BCDM.TrinketBarContainer:Hide() return end + if usableCount == 0 then if BCDM.TrinketBarContainer then BCDM.TrinketBarContainer:Hide() end return end BCDM:UpdateCooldownViewer("Trinket") end