Port and adapt 6 main hotfixes to decoupled architecture + small function re-write HealBot_SetSkinColours to adhere to DRY principles

This commit is contained in:
Bluewhale1337
2026-06-28 13:07:19 +02:00
parent 3ae3f26f77
commit b8b6a57ef8
7 changed files with 130 additions and 96 deletions
+88 -84
View File
@@ -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)