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
+22 -1
View File
@@ -268,11 +268,32 @@ end
function HealBot_OnEvent_PlayerRegenDisabled(this) function HealBot_OnEvent_PlayerRegenDisabled(this)
HealBot_RecalcParty(); HealBot_RecalcParty();
if (UnitIsDeadOrGhost("player")) or (UnitOnTaxi("player")) then if (UnitIsDeadOrGhost("player")) or (UnitOnTaxi("player")) then
if HealBot_Config.AutoClose == 1 and HealBot_Config.ActionVisible ~= 0 then HealBot_Action:Hide(); end; if HealBot_Config.AutoClose==1 and HealBot_Config.ActionVisible~=0 then HealBot_Action:Hide(); end;
else else
HealBot_Action:Show(); 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; HealBot_IsFighting = true;
end end
-- HealBot_RecalcHeals();
end end
function HealBot_OnEvent_PlayerRegenEnabled(this) function HealBot_OnEvent_PlayerRegenEnabled(this)
+1 -1
View File
@@ -1,6 +1,6 @@
HealBot_ConfigDefaults = { HealBot_ConfigDefaults = {
ShowManaBars=0, ShowManaBars=0,
ManaBarsHealersOnly=1, ManaBarsHealersOnly=0,
Version = HEALBOT_VERSION, Version = HEALBOT_VERSION,
AlertLevel = 0.95, AlertLevel = 0.95,
AutoClose = 1, AutoClose = 1,
+2 -2
View File
@@ -32,11 +32,11 @@ function HealBot_Model:RegisterObserver(event, callback)
table.insert(self.observers[event], callback) table.insert(self.observers[event], callback)
end end
function HealBot_Model:NotifyObservers(event, unitID, ...) function HealBot_Model:NotifyObservers(event, unitID, arg1, arg2)
if self.observers[event] then if self.observers[event] then
local len = table.getn(self.observers[event]) local len = table.getn(self.observers[event])
for i = 1, len do for i = 1, len do
self.observers[event][i](unitID, ...) self.observers[event][i](unitID, arg1, arg2)
end end
end end
end end
+84 -80
View File
@@ -50,6 +50,7 @@ function HealBot_Options_AbortBarSize_OnValueChanged(this)
end end
function HealBot_Options_ActionAlpha_OnValueChanged(this) function HealBot_Options_ActionAlpha_OnValueChanged(this)
HealBot_Config.backcola[HealBot_Config.Current_Skin] = HealBot_Options_Pct_OnValueChanged(this); HealBot_Config.backcola[HealBot_Config.Current_Skin] = HealBot_Options_Pct_OnValueChanged(this);
HealBot_Action_ResetSkin()
end end
function HealBot_Options_BarAlpha_OnValueChanged(this) function HealBot_Options_BarAlpha_OnValueChanged(this)
HealBot_Config.Barcola[HealBot_Config.Current_Skin] = HealBot_Options_Pct_OnValueChanged(this); HealBot_Config.Barcola[HealBot_Config.Current_Skin] = HealBot_Options_Pct_OnValueChanged(this);
@@ -99,96 +100,99 @@ function HealBot_SkinColorpick_OnClick(SkinType)
end end
end end
function HealBot_SetSkinColours() 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]); -- 1. Set Status Bar Colors (Green with variations based on configuration)
HealBot_EnTextColorpickin:SetStatusBarColor(0,1,0,HealBot_Config.Barcola[HealBot_Config.Current_Skin]*HealBot_Config.BarcolaInHeal[HealBot_Config.Current_Skin]); local alpha = HealBot_Config.Barcola[skin]
HealBot_DisTextColorpick:SetStatusBarColor(0,1,0,HealBot_Config.bardisa[HealBot_Config.Current_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_EnTextColorpickt:SetTextColor(
HealBot_Config.btextenabledcolr[HealBot_Config.Current_Skin], HealBot_Config.btextenabledcolr[skin], HealBot_Config.btextenabledcolg[skin],
HealBot_Config.btextenabledcolg[HealBot_Config.Current_Skin], HealBot_Config.btextenabledcolb[skin], HealBot_Config.btextenabledcola[skin]
HealBot_Config.btextenabledcolb[HealBot_Config.Current_Skin], )
HealBot_Config.btextenabledcola[HealBot_Config.Current_Skin]);
HealBot_DisTextColorpickt:SetTextColor( HealBot_DisTextColorpickt:SetTextColor(
HealBot_Config.btextdisbledcolr[HealBot_Config.Current_Skin], HealBot_Config.btextdisbledcolr[skin], HealBot_Config.btextdisbledcolg[skin],
HealBot_Config.btextdisbledcolg[HealBot_Config.Current_Skin], HealBot_Config.btextdisbledcolb[skin], HealBot_Config.btextdisbledcola[skin]
HealBot_Config.btextdisbledcolb[HealBot_Config.Current_Skin], )
HealBot_Config.btextdisbledcola[HealBot_Config.Current_Skin]);
HealBot_DebTextColorpickt:SetTextColor( HealBot_DebTextColorpickt:SetTextColor(
HealBot_Config.btextcursecolr[HealBot_Config.Current_Skin], HealBot_Config.btextcursecolr[skin], HealBot_Config.btextcursecolg[skin],
HealBot_Config.btextcursecolg[HealBot_Config.Current_Skin], HealBot_Config.btextcursecolb[skin], HealBot_Config.btextcursecola[skin]
HealBot_Config.btextcursecolb[HealBot_Config.Current_Skin], )
HealBot_Config.btextcursecola[HealBot_Config.Current_Skin]);
HealBot_BackgroundColorpick:SetStatusBarColor( -- 3. Set Preview Component Colors
HealBot_Config.backcolr[HealBot_Config.Current_Skin], local bgR, bgG, bgB, bgA = HealBot_Config.backcolr[skin], HealBot_Config.backcolg[skin], HealBot_Config.backcolb[skin], HealBot_Config.backcola[skin]
HealBot_Config.backcolg[HealBot_Config.Current_Skin], local borderR, borderG, borderB, borderA = HealBot_Config.borcolr[skin], HealBot_Config.borcolg[skin], HealBot_Config.borcolb[skin], HealBot_Config.borcola[skin]
HealBot_Config.backcolb[HealBot_Config.Current_Skin],
HealBot_Config.backcola[HealBot_Config.Current_Skin]); HealBot_BackgroundColorpick:SetStatusBarColor(bgR, bgG, bgB, bgA)
HealBot_BorderColorpick:SetStatusBarColor( HealBot_BorderColorpick:SetStatusBarColor(borderR, borderG, borderB, borderA)
HealBot_Config.borcolr[HealBot_Config.Current_Skin], HealBot_AbortColorpick:SetStatusBarColor(
HealBot_Config.borcolg[HealBot_Config.Current_Skin], HealBot_Config.babortcolr[skin], HealBot_Config.babortcolg[skin],
HealBot_Config.borcolb[HealBot_Config.Current_Skin], HealBot_Config.babortcolb[skin], HealBot_Config.babortcola[skin]
HealBot_Config.borcola[HealBot_Config.Current_Skin]); )
HealBot_AbortColorpick:SetStatusBarColor(
HealBot_Config.babortcolr[HealBot_Config.Current_Skin], -- 4. Setup Main Panel Backdrop (Fixed scoping bugs)
HealBot_Config.babortcolg[HealBot_Config.Current_Skin], local borderStyle = HealBot_Config.bborder[skin] or 2
HealBot_Config.babortcolb[HealBot_Config.Current_Skin], local backdrop = {
HealBot_Config.babortcola[HealBot_Config.Current_Skin]); 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 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 elseif borderStyle == 1 then
local bboffset = (HealBot_Config.bboffset and HealBot_Config.bboffset[HealBot_Config.Current_Skin]) or 1 -- Custom flat border
local bpadding = (HealBot_Config.bpadding and HealBot_Config.bpadding[HealBot_Config.Current_Skin]) or 10 local bboffset = (HealBot_Config.bboffset and HealBot_Config.bboffset[skin]) or 1
HealBot_Action:SetBackdrop({ local bpadding = (HealBot_Config.bpadding and HealBot_Config.bpadding[skin]) or 10
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Buttons\\WHITE8X8", backdrop.edgeFile = "Interface\\Buttons\\WHITE8X8"
tile = true, tileSize = 8, edgeSize = bboffset, backdrop.edgeSize = bboffset
insets = { left = bpadding, right = bpadding, top = bpadding, bottom = bpadding } backdrop.insets = { left = bpadding, right = bpadding, top = bpadding, bottom = bpadding }
})
HealBot_Action:SetBackdropColor( HealBot_Action:SetBackdrop(backdrop)
HealBot_Config.backcolr[HealBot_Config.Current_Skin], HealBot_Action:SetBackdropColor(bgR, bgG, bgB, bgA)
HealBot_Config.backcolg[HealBot_Config.Current_Skin], HealBot_Action:SetBackdropBorderColor(borderR, borderG, borderB, borderA)
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]);
else else
HealBot_Action:SetBackdrop({ -- Default Blizzard Tooltip Border
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", backdrop.edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border"
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", backdrop.edgeSize = 16
tile = true, tileSize = 8, edgeSize = 16, backdrop.insets = { left = 4, right = 4, top = 4, bottom = 4 }
insets = { left = 4, right = 4, top = 4, bottom = 4 }
}) HealBot_Action:SetBackdrop(backdrop)
HealBot_Action:SetBackdropColor( HealBot_Action:SetBackdropColor(bgR, bgG, bgB, bgA)
HealBot_Config.backcolr[HealBot_Config.Current_Skin], HealBot_Action:SetBackdropBorderColor(borderR, borderG, borderB, borderA)
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]);
end end
HealBot_EnTextColorpickt:SetTextHeight(btextheight); -- 5. Update Text Labels
HealBot_DisTextColorpickt:SetTextHeight(btextheight); HealBot_EnTextColorpickt:SetTextHeight(btextheight)
HealBot_DebTextColorpickt:SetTextHeight(btextheight); HealBot_DisTextColorpickt:SetTextHeight(btextheight)
HealBot_EnTextColorpickt:SetText(HEALBOT_SKIN_ENTEXT); HealBot_DebTextColorpickt:SetTextHeight(btextheight)
HealBot_DisTextColorpickt:SetText(HEALBOT_SKIN_DISTEXT);
HealBot_DebTextColorpickt:SetText(HEALBOT_SKIN_DEBTEXT); HealBot_EnTextColorpickt:SetText(HEALBOT_SKIN_ENTEXT)
local barScale = HealBot_EnTextColorpick:GetScale(); HealBot_DisTextColorpickt:SetText(HEALBOT_SKIN_DISTEXT)
HealBot_EnTextColorpick:SetScale(barScale + 0.01); HealBot_DebTextColorpickt:SetText(HEALBOT_SKIN_DEBTEXT)
HealBot_EnTextColorpick:SetScale(barScale);
HealBot_DisTextColorpick:SetScale(barScale + 0.01); -- 6. Force UI redraw (Kept the scale hack since it addresses a specific engine quirk)
HealBot_DisTextColorpick:SetScale(barScale); local barScale = HealBot_EnTextColorpick:GetScale()
HealBot_DebTextColorpick:SetScale(barScale + 0.01); HealBot_EnTextColorpick:SetScale(barScale + 0.01); HealBot_EnTextColorpick:SetScale(barScale)
HealBot_DebTextColorpick: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() HealBot_Action_PartyChanged()
end end
+4
View File
@@ -134,6 +134,7 @@ end
function HealBot_Options_Click_OnTextChanged(this) function HealBot_Options_Click_OnTextChanged(this)
local class=UnitClass("Player"); local class=UnitClass("Player");
if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end
local combo = HealBot_Config.KeyCombo[class] local combo = HealBot_Config.KeyCombo[class]
local button = HealBot_Options_ComboClass_Button() local button = HealBot_Options_ComboClass_Button()
combo[button] = this:GetText() combo[button] = this:GetText()
@@ -142,6 +143,7 @@ end
function HealBot_Options_Shift_OnTextChanged(this) function HealBot_Options_Shift_OnTextChanged(this)
local class=UnitClass("Player"); local class=UnitClass("Player");
if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end
local combo = HealBot_Config.KeyCombo[class] local combo = HealBot_Config.KeyCombo[class]
local button = HealBot_Options_ComboClass_Button() local button = HealBot_Options_ComboClass_Button()
combo["Shift"..button] = this:GetText() combo["Shift"..button] = this:GetText()
@@ -150,6 +152,7 @@ end
function HealBot_Options_Ctrl_OnTextChanged(this) function HealBot_Options_Ctrl_OnTextChanged(this)
local class=UnitClass("Player"); local class=UnitClass("Player");
if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end
local combo = HealBot_Config.KeyCombo[class] local combo = HealBot_Config.KeyCombo[class]
local button = HealBot_Options_ComboClass_Button() local button = HealBot_Options_ComboClass_Button()
combo["Ctrl"..button] = this:GetText() combo["Ctrl"..button] = this:GetText()
@@ -158,6 +161,7 @@ end
function HealBot_Options_ShiftCtrl_OnTextChanged(this) function HealBot_Options_ShiftCtrl_OnTextChanged(this)
local class=UnitClass("Player"); local class=UnitClass("Player");
if not HealBot_Config.KeyCombo[class] then HealBot_Config.KeyCombo[class] = {} end
local combo = HealBot_Config.KeyCombo[class] local combo = HealBot_Config.KeyCombo[class]
local button = HealBot_Options_ComboClass_Button() local button = HealBot_Options_ComboClass_Button()
combo["ShiftCtrl"..button] = this:GetText() combo["ShiftCtrl"..button] = this:GetText()
+1 -1
View File
@@ -21,7 +21,7 @@ function HealBot_Action_SetTexture(bar, btexture)
if btexture == 10 then if btexture == 10 then
bar:SetStatusBarTexture("Interface\\Buttons\\WHITE8X8"); bar:SetStatusBarTexture("Interface\\Buttons\\WHITE8X8");
else else
bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar"); bar:SetStatusBarTexture("Interface\\AddOns\\HealBotBlue\\Images\\bar" .. tostring(btexture) .. ".tga");
end end
end end
+7 -2
View File
@@ -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. * **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. * **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. * **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. * **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. * **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** **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. * **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. * **Modern Skin Updates:** Fixed white background bugs in modern skins and brightened debuff indicators.