From b8b6a57ef8d866bb825db4b71c5d7706995ce597 Mon Sep 17 00:00:00 2001 From: Bluewhale1337 <295648290+Bluewhale1337@users.noreply.github.com> Date: Sun, 28 Jun 2026 13:07:19 +0200 Subject: [PATCH] Port and adapt 6 main hotfixes to decoupled architecture + small function re-write HealBot_SetSkinColours to adhere to DRY principles --- HealBot_Controller_Events.lua | 33 +++++-- HealBot_Data.lua | 2 +- HealBot_Model.lua | 4 +- HealBot_Options_General.lua | 172 +++++++++++++++++----------------- HealBot_Options_Spells.lua | 4 + HealBot_View_Layout.lua | 2 +- README.md | 9 +- 7 files changed, 130 insertions(+), 96 deletions(-) diff --git a/HealBot_Controller_Events.lua b/HealBot_Controller_Events.lua index 7bd90f4..bbe67f1 100644 --- a/HealBot_Controller_Events.lua +++ b/HealBot_Controller_Events.lua @@ -266,13 +266,34 @@ function HealBot_OnEvent_ZoneChanged(this) end function HealBot_OnEvent_PlayerRegenDisabled(this) - HealBot_RecalcParty(); - if (UnitIsDeadOrGhost("player")) or (UnitOnTaxi("player")) then - if HealBot_Config.AutoClose == 1 and HealBot_Config.ActionVisible ~= 0 then HealBot_Action:Hide(); end; - else - HealBot_Action:Show(); - HealBot_IsFighting = true; + HealBot_RecalcParty(); + if (UnitIsDeadOrGhost("player")) or (UnitOnTaxi("player")) then + if HealBot_Config.AutoClose==1 and HealBot_Config.ActionVisible~=0 then HealBot_Action:Hide(); end; + else + HealBot_Action:Show(); + + -- Reapply user settings to override the engine's white default + if HealBot_Config and HealBot_Config.Current_Skin then + local skin = HealBot_Config.Current_Skin; + if HealBot_Config.backcolr and HealBot_Config.backcolr[skin] then + HealBot_Action:SetBackdropColor( + HealBot_Config.backcolr[skin], + HealBot_Config.backcolg[skin], + HealBot_Config.backcolb[skin], + HealBot_Config.backcola[skin] + ); + HealBot_Action:SetBackdropBorderColor( + HealBot_Config.borcolr[skin], + HealBot_Config.borcolg[skin], + HealBot_Config.borcolb[skin], + HealBot_Config.borcola[skin] + ); + end end + + HealBot_IsFighting = true; + end +-- HealBot_RecalcHeals(); end function HealBot_OnEvent_PlayerRegenEnabled(this) diff --git a/HealBot_Data.lua b/HealBot_Data.lua index a23db35..d6696d8 100644 --- a/HealBot_Data.lua +++ b/HealBot_Data.lua @@ -1,6 +1,6 @@ HealBot_ConfigDefaults = { ShowManaBars=0, - ManaBarsHealersOnly=1, + ManaBarsHealersOnly=0, Version = HEALBOT_VERSION, AlertLevel = 0.95, AutoClose = 1, diff --git a/HealBot_Model.lua b/HealBot_Model.lua index 38294e9..0154eb1 100644 --- a/HealBot_Model.lua +++ b/HealBot_Model.lua @@ -32,11 +32,11 @@ function HealBot_Model:RegisterObserver(event, callback) table.insert(self.observers[event], callback) end -function HealBot_Model:NotifyObservers(event, unitID, ...) +function HealBot_Model:NotifyObservers(event, unitID, arg1, arg2) if self.observers[event] then local len = table.getn(self.observers[event]) for i = 1, len do - self.observers[event][i](unitID, ...) + self.observers[event][i](unitID, arg1, arg2) end end end diff --git a/HealBot_Options_General.lua b/HealBot_Options_General.lua index 253906f..3e43f92 100644 --- a/HealBot_Options_General.lua +++ b/HealBot_Options_General.lua @@ -50,6 +50,7 @@ function HealBot_Options_AbortBarSize_OnValueChanged(this) end function HealBot_Options_ActionAlpha_OnValueChanged(this) HealBot_Config.backcola[HealBot_Config.Current_Skin] = HealBot_Options_Pct_OnValueChanged(this); + HealBot_Action_ResetSkin() end function HealBot_Options_BarAlpha_OnValueChanged(this) HealBot_Config.Barcola[HealBot_Config.Current_Skin] = HealBot_Options_Pct_OnValueChanged(this); @@ -99,97 +100,100 @@ function HealBot_SkinColorpick_OnClick(SkinType) end end function HealBot_SetSkinColours() - local btextheight=HealBot_Config.btextheight[HealBot_Config.Current_Skin] or 10; + -- Cache the current skin configuration for performance and readability + local skin = HealBot_Config.Current_Skin + local btextheight = HealBot_Config.btextheight[skin] or 10 - HealBot_EnTextColorpick:SetStatusBarColor(0,1,0,HealBot_Config.Barcola[HealBot_Config.Current_Skin]); - HealBot_EnTextColorpickin:SetStatusBarColor(0,1,0,HealBot_Config.Barcola[HealBot_Config.Current_Skin]*HealBot_Config.BarcolaInHeal[HealBot_Config.Current_Skin]); - HealBot_DisTextColorpick:SetStatusBarColor(0,1,0,HealBot_Config.bardisa[HealBot_Config.Current_Skin]); - HealBot_EnTextColorpickt:SetTextColor( - HealBot_Config.btextenabledcolr[HealBot_Config.Current_Skin], - HealBot_Config.btextenabledcolg[HealBot_Config.Current_Skin], - HealBot_Config.btextenabledcolb[HealBot_Config.Current_Skin], - HealBot_Config.btextenabledcola[HealBot_Config.Current_Skin]); - HealBot_DisTextColorpickt:SetTextColor( - HealBot_Config.btextdisbledcolr[HealBot_Config.Current_Skin], - HealBot_Config.btextdisbledcolg[HealBot_Config.Current_Skin], - HealBot_Config.btextdisbledcolb[HealBot_Config.Current_Skin], - HealBot_Config.btextdisbledcola[HealBot_Config.Current_Skin]); - HealBot_DebTextColorpickt:SetTextColor( - HealBot_Config.btextcursecolr[HealBot_Config.Current_Skin], - HealBot_Config.btextcursecolg[HealBot_Config.Current_Skin], - HealBot_Config.btextcursecolb[HealBot_Config.Current_Skin], - HealBot_Config.btextcursecola[HealBot_Config.Current_Skin]); - HealBot_BackgroundColorpick:SetStatusBarColor( - HealBot_Config.backcolr[HealBot_Config.Current_Skin], - HealBot_Config.backcolg[HealBot_Config.Current_Skin], - HealBot_Config.backcolb[HealBot_Config.Current_Skin], - HealBot_Config.backcola[HealBot_Config.Current_Skin]); - HealBot_BorderColorpick:SetStatusBarColor( - HealBot_Config.borcolr[HealBot_Config.Current_Skin], - HealBot_Config.borcolg[HealBot_Config.Current_Skin], - HealBot_Config.borcolb[HealBot_Config.Current_Skin], - HealBot_Config.borcola[HealBot_Config.Current_Skin]); - HealBot_AbortColorpick:SetStatusBarColor( - HealBot_Config.babortcolr[HealBot_Config.Current_Skin], - HealBot_Config.babortcolg[HealBot_Config.Current_Skin], - HealBot_Config.babortcolb[HealBot_Config.Current_Skin], - HealBot_Config.babortcola[HealBot_Config.Current_Skin]); + -- 1. Set Status Bar Colors (Green with variations based on configuration) + local alpha = HealBot_Config.Barcola[skin] + local inHealAlpha = alpha * (HealBot_Config.BarcolaInHeal[skin] or 1) + local disabledAlpha = HealBot_Config.bardisa[skin] + + HealBot_EnTextColorpick:SetStatusBarColor(0, 1, 0, alpha) + HealBot_EnTextColorpickin:SetStatusBarColor(0, 1, 0, inHealAlpha) + HealBot_DisTextColorpick:SetStatusBarColor(0, 1, 0, disabledAlpha) + + -- 2. Set Text Colors + HealBot_EnTextColorpickt:SetTextColor( + HealBot_Config.btextenabledcolr[skin], HealBot_Config.btextenabledcolg[skin], + HealBot_Config.btextenabledcolb[skin], HealBot_Config.btextenabledcola[skin] + ) + HealBot_DisTextColorpickt:SetTextColor( + HealBot_Config.btextdisbledcolr[skin], HealBot_Config.btextdisbledcolg[skin], + HealBot_Config.btextdisbledcolb[skin], HealBot_Config.btextdisbledcola[skin] + ) + HealBot_DebTextColorpickt:SetTextColor( + HealBot_Config.btextcursecolr[skin], HealBot_Config.btextcursecolg[skin], + HealBot_Config.btextcursecolb[skin], HealBot_Config.btextcursecola[skin] + ) + + -- 3. Set Preview Component Colors + local bgR, bgG, bgB, bgA = HealBot_Config.backcolr[skin], HealBot_Config.backcolg[skin], HealBot_Config.backcolb[skin], HealBot_Config.backcola[skin] + local borderR, borderG, borderB, borderA = HealBot_Config.borcolr[skin], HealBot_Config.borcolg[skin], HealBot_Config.borcolb[skin], HealBot_Config.borcola[skin] + + HealBot_BackgroundColorpick:SetStatusBarColor(bgR, bgG, bgB, bgA) + HealBot_BorderColorpick:SetStatusBarColor(borderR, borderG, borderB, borderA) + HealBot_AbortColorpick:SetStatusBarColor( + HealBot_Config.babortcolr[skin], HealBot_Config.babortcolg[skin], + HealBot_Config.babortcolb[skin], HealBot_Config.babortcola[skin] + ) + + -- 4. Setup Main Panel Backdrop (Fixed scoping bugs) + local borderStyle = HealBot_Config.bborder[skin] or 2 + local backdrop = { + bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + tile = true, + tileSize = 8, + } - local borderStyle = HealBot_Config.bborder[HealBot_Config.Current_Skin] or 2 if borderStyle == 0 then - HealBot_Action:SetBackdropBorderColor(0,0,0,0); + -- No border + backdrop.edgeFile = "Interface\\Buttons\\WHITE8X8" + backdrop.edgeSize = 1 + backdrop.insets = { left = 1, right = 1, top = 1, bottom = 1 } + HealBot_Action:SetBackdrop(backdrop) + HealBot_Action:SetBackdropBorderColor(0, 0, 0, 0) + HealBot_Action:SetBackdropColor(bgR, bgG, bgB, bgA) + elseif borderStyle == 1 then - local bboffset = (HealBot_Config.bboffset and HealBot_Config.bboffset[HealBot_Config.Current_Skin]) or 1 - local bpadding = (HealBot_Config.bpadding and HealBot_Config.bpadding[HealBot_Config.Current_Skin]) or 10 - HealBot_Action:SetBackdrop({ - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile = "Interface\\Buttons\\WHITE8X8", - tile = true, tileSize = 8, edgeSize = bboffset, - insets = { left = bpadding, right = bpadding, top = bpadding, bottom = bpadding } - }) - HealBot_Action:SetBackdropColor( - HealBot_Config.backcolr[HealBot_Config.Current_Skin], - HealBot_Config.backcolg[HealBot_Config.Current_Skin], - HealBot_Config.backcolb[HealBot_Config.Current_Skin], - HealBot_Config.backcola[HealBot_Config.Current_Skin]); - HealBot_Action:SetBackdropBorderColor( - HealBot_Config.borcolr[HealBot_Config.Current_Skin], - HealBot_Config.borcolg[HealBot_Config.Current_Skin], - HealBot_Config.borcolb[HealBot_Config.Current_Skin], - HealBot_Config.borcola[HealBot_Config.Current_Skin]); + -- Custom flat border + local bboffset = (HealBot_Config.bboffset and HealBot_Config.bboffset[skin]) or 1 + local bpadding = (HealBot_Config.bpadding and HealBot_Config.bpadding[skin]) or 10 + + backdrop.edgeFile = "Interface\\Buttons\\WHITE8X8" + backdrop.edgeSize = bboffset + backdrop.insets = { left = bpadding, right = bpadding, top = bpadding, bottom = bpadding } + + HealBot_Action:SetBackdrop(backdrop) + HealBot_Action:SetBackdropColor(bgR, bgG, bgB, bgA) + HealBot_Action:SetBackdropBorderColor(borderR, borderG, borderB, borderA) + else - HealBot_Action:SetBackdrop({ - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", - edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", - tile = true, tileSize = 8, edgeSize = 16, - insets = { left = 4, right = 4, top = 4, bottom = 4 } - }) - HealBot_Action:SetBackdropColor( - HealBot_Config.backcolr[HealBot_Config.Current_Skin], - HealBot_Config.backcolg[HealBot_Config.Current_Skin], - HealBot_Config.backcolb[HealBot_Config.Current_Skin], - HealBot_Config.backcola[HealBot_Config.Current_Skin]); - HealBot_Action:SetBackdropBorderColor( - HealBot_Config.borcolr[HealBot_Config.Current_Skin], - HealBot_Config.borcolg[HealBot_Config.Current_Skin], - HealBot_Config.borcolb[HealBot_Config.Current_Skin], - HealBot_Config.borcola[HealBot_Config.Current_Skin]); + -- Default Blizzard Tooltip Border + backdrop.edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border" + backdrop.edgeSize = 16 + backdrop.insets = { left = 4, right = 4, top = 4, bottom = 4 } + + HealBot_Action:SetBackdrop(backdrop) + HealBot_Action:SetBackdropColor(bgR, bgG, bgB, bgA) + HealBot_Action:SetBackdropBorderColor(borderR, borderG, borderB, borderA) end - HealBot_EnTextColorpickt:SetTextHeight(btextheight); - HealBot_DisTextColorpickt:SetTextHeight(btextheight); - HealBot_DebTextColorpickt:SetTextHeight(btextheight); - HealBot_EnTextColorpickt:SetText(HEALBOT_SKIN_ENTEXT); - HealBot_DisTextColorpickt:SetText(HEALBOT_SKIN_DISTEXT); - HealBot_DebTextColorpickt:SetText(HEALBOT_SKIN_DEBTEXT); - local barScale = HealBot_EnTextColorpick:GetScale(); - HealBot_EnTextColorpick:SetScale(barScale + 0.01); - HealBot_EnTextColorpick:SetScale(barScale); - HealBot_DisTextColorpick:SetScale(barScale + 0.01); - HealBot_DisTextColorpick:SetScale(barScale); - HealBot_DebTextColorpick:SetScale(barScale + 0.01); - HealBot_DebTextColorpick:SetScale(barScale); - + -- 5. Update Text Labels + HealBot_EnTextColorpickt:SetTextHeight(btextheight) + HealBot_DisTextColorpickt:SetTextHeight(btextheight) + HealBot_DebTextColorpickt:SetTextHeight(btextheight) + + HealBot_EnTextColorpickt:SetText(HEALBOT_SKIN_ENTEXT) + HealBot_DisTextColorpickt:SetText(HEALBOT_SKIN_DISTEXT) + HealBot_DebTextColorpickt:SetText(HEALBOT_SKIN_DEBTEXT) + + -- 6. Force UI redraw (Kept the scale hack since it addresses a specific engine quirk) + local barScale = HealBot_EnTextColorpick:GetScale() + HealBot_EnTextColorpick:SetScale(barScale + 0.01); HealBot_EnTextColorpick:SetScale(barScale) + HealBot_DisTextColorpick:SetScale(barScale + 0.01); HealBot_DisTextColorpick:SetScale(barScale) + HealBot_DebTextColorpick:SetScale(barScale + 0.01); HealBot_DebTextColorpick:SetScale(barScale) + HealBot_Action_PartyChanged() end function HealBot_Options_AlertLevel_OnValueChanged(this) diff --git a/HealBot_Options_Spells.lua b/HealBot_Options_Spells.lua index 0607d7c..e877905 100644 --- a/HealBot_Options_Spells.lua +++ b/HealBot_Options_Spells.lua @@ -134,6 +134,7 @@ end function HealBot_Options_Click_OnTextChanged(this) local class=UnitClass("Player"); + if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end local combo = HealBot_Config.KeyCombo[class] local button = HealBot_Options_ComboClass_Button() combo[button] = this:GetText() @@ -142,6 +143,7 @@ end function HealBot_Options_Shift_OnTextChanged(this) local class=UnitClass("Player"); + if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end local combo = HealBot_Config.KeyCombo[class] local button = HealBot_Options_ComboClass_Button() combo["Shift"..button] = this:GetText() @@ -150,6 +152,7 @@ end function HealBot_Options_Ctrl_OnTextChanged(this) local class=UnitClass("Player"); + if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end local combo = HealBot_Config.KeyCombo[class] local button = HealBot_Options_ComboClass_Button() combo["Ctrl"..button] = this:GetText() @@ -158,6 +161,7 @@ end function HealBot_Options_ShiftCtrl_OnTextChanged(this) local class=UnitClass("Player"); + if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end local combo = HealBot_Config.KeyCombo[class] local button = HealBot_Options_ComboClass_Button() combo["ShiftCtrl"..button] = this:GetText() diff --git a/HealBot_View_Layout.lua b/HealBot_View_Layout.lua index b5d9079..9b5c415 100644 --- a/HealBot_View_Layout.lua +++ b/HealBot_View_Layout.lua @@ -21,7 +21,7 @@ function HealBot_Action_SetTexture(bar, btexture) if btexture == 10 then bar:SetStatusBarTexture("Interface\\Buttons\\WHITE8X8"); else - bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar"); + bar:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\Images\\bar" .. tostring(btexture) .. ".tga"); end end diff --git a/README.md b/README.md index 2b28092..a8bb016 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,16 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\ * **Core Options Layout Correction:** Relocated the "Defaults" and "Close" buttons back into the parent options frame's container, ensuring they display consistently at the bottom of all configuration tabs. * **Skins Grid Alignment:** Fixed layout overlaps on the Skins panel by setting explicit width/height sizes (`123 x 17`) on the opacity sliders and reorganizing all 13 sliders into a clean, uniform 2-column grid. * **Startup Refresh Optimization:** Resolved initial loading lag where action bars would be missing by forcing an immediate UI refresh (`HealBot_RecalcSpells()`) once spell data loads. - -**v1.2.1** * **UI Layout Fixes:** Fixed slider width constraints in the Skin menu causing layout overlaps. Realigned Chat tab buttons to ensure they do not exceed the window bounds. Fixed Color Picker anchors. * **Menu Cleanup:** Fixed Options panel checkboxes overlapping due to incorrect vertical spacing offsets. +**v1.2.2** +* **White background fix** Fixed issue where white background would persist while alpha channel got changes. +* **Alpha slider** Fixed bug where alpha slider wouldn't apply changes instantly. + +**v1.2.1** +* **Initialization bug** Fixed issue where Action module would get stuck on infinite loop causing stack overflow. + **v1.2** * **Class Colors & Dimming:** Frame text now inherits class colors with black outline for better visibility. Missing buffs intelligently dim the class color and turn the text yellow. * **Modern Skin Updates:** Fixed white background bugs in modern skins and brightened debuff indicators.