From becb2ddfdb65f0f5ddbc669f570bb7d4cf7db268 Mon Sep 17 00:00:00 2001 From: Bluewhale1337 <295648290+Bluewhale1337@users.noreply.github.com> Date: Fri, 10 Jul 2026 17:08:50 +0200 Subject: [PATCH] Feat: added customizable unit frame health text and support for non-mana resource tracking --- HealBot_Data.lua | 3 +++ HealBot_Options.lua | 5 ++++ HealBot_Options_General.xml | 26 +++++++++++++++++-- HealBot_Options_Healing.lua | 27 ++++++++++++++++++++ HealBot_Options_Healing.xml | 30 +++++++++++++++++++++- HealBot_View_Layout.lua | 51 +++++++++++++++++++++++++++++++------ README.md | 6 +++++ 7 files changed, 137 insertions(+), 11 deletions(-) diff --git a/HealBot_Data.lua b/HealBot_Data.lua index 6c525e3..0f58f29 100644 --- a/HealBot_Data.lua +++ b/HealBot_Data.lua @@ -25,6 +25,7 @@ HealBot_ConfigDefaults = { HideOptions = 0, HideAbort = 1, ShowTooltip = 1, + ShowHealthText = 0, GrowUpwards = 0, ProtectPvP = 1, QualityRange = 0, @@ -172,7 +173,9 @@ HealBot_ConfigDefaults = { }, }, EnableHealthy = 0, + ShowNonManaBars = 0, ActionVisible = 0, + ActionMouseover = 1, CDCLeftText = {[HEALBOT_PRIEST]="None", [HEALBOT_SHAMAN]="None", [HEALBOT_DRUID]="None", [HEALBOT_PALADIN]="None",}, CDCRightText = {[HEALBOT_PRIEST]="None", [HEALBOT_SHAMAN]="None", [HEALBOT_DRUID]="None", [HEALBOT_PALADIN]="None",}, Current_Skin = "Modern Flat", diff --git a/HealBot_Options.lua b/HealBot_Options.lua index 8245415..0a30e9c 100644 --- a/HealBot_Options.lua +++ b/HealBot_Options.lua @@ -248,6 +248,8 @@ function HealBot_Options_OnShow(this) HealBot_Options_PanelSounds:SetChecked(HealBot_Config.PanelSounds); HealBot_Options_ShowManaBars:SetChecked(HealBot_Config.ShowManaBars); HealBot_Options_ManaBarsHealersOnly:SetChecked(HealBot_Config.ManaBarsHealersOnly); + if HealBot_Config.ShowNonManaBars == nil then HealBot_Config.ShowNonManaBars = 0; end + HealBot_Options_ShowNonManaBars:SetChecked(HealBot_Config.ShowNonManaBars); if HealBot_Config.ActionMouseover == nil then HealBot_Config.ActionMouseover = 1; end HealBot_Options_ActionMouseover:SetChecked(HealBot_Config.ActionMouseover); @@ -261,6 +263,9 @@ function HealBot_Options_OnShow(this) HealBot_Options_TargetHeals:SetChecked(HealBot_Config.TargetHeals); HealBot_Options_EmergencyHeals:SetChecked(HealBot_Config.EmergencyHeals); HealBot_Options_OverHeal:SetValue(HealBot_Config.OverHeal); + if HealBot_Config.ShowHealthText == nil then HealBot_Config.ShowHealthText = 0; end + HealBot_UIDropDownMenu_SetSelectedID(HealBot_Options_HealthText, HealBot_Config.ShowHealthText + 1); + UIDropDownMenu_SetText(HealBot_Options_HealthText_List[HealBot_Config.ShowHealthText + 1], HealBot_Options_HealthText); HealBot_Options_CastNotify_OnClick(nil,HealBot_Config.CastNotify); HealBot_Options_SetBuffs(); HealBot_Options_HideOptions:SetChecked(HealBot_Config.HideOptions); diff --git a/HealBot_Options_General.xml b/HealBot_Options_General.xml index 9ac7bca..0193047 100644 --- a/HealBot_Options_General.xml +++ b/HealBot_Options_General.xml @@ -102,7 +102,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -174,6 +174,28 @@ + + + + + + + + + + + getglobal(this:GetName().."Text"):SetText("Track Non-Mana Resources"); + + + if (this:GetChecked()) then + HealBot_Config.ShowNonManaBars = 1; + else + HealBot_Config.ShowNonManaBars = 0; + end + HealBot_Action_Refresh(); + + + diff --git a/HealBot_Options_Healing.lua b/HealBot_Options_Healing.lua index 708ccea..ce20d92 100644 --- a/HealBot_Options_Healing.lua +++ b/HealBot_Options_Healing.lua @@ -85,6 +85,33 @@ function HealBot_Options_EFClass_OnClick(this) HealBot_Action_PartyChanged(); end end +HealBot_Options_HealthText_List = { + "Name Only", + "Health Percentage", + "Real Health", + "Health Deficit", +} + +function HealBot_Options_HealthText_DropDown() + for i=1, getn(HealBot_Options_HealthText_List), 1 do + local info = {}; + info.text = HealBot_Options_HealthText_List[i]; + info.func = HealBot_Options_HealthText_OnSelect; + UIDropDownMenu_AddButton(info); + end +end + +function HealBot_Options_HealthText_OnLoad(this) + UIDropDownMenu_Initialize(this, HealBot_Options_HealthText_DropDown); + UIDropDownMenu_SetWidth(110, this); +end + +function HealBot_Options_HealthText_OnSelect() + HealBot_Config.ShowHealthText = this:GetID() - 1; + HealBot_UIDropDownMenu_SetSelectedID(HealBot_Options_HealthText, this:GetID()) + HealBot_Action_RefreshButtons(); +end + local HealBot_Options_EmergencyFClass_List = { HEALBOT_CLASSES_MELEE, HEALBOT_CLASSES_RANGES, diff --git a/HealBot_Options_Healing.xml b/HealBot_Options_Healing.xml index c2a5b4f..007a5c3 100644 --- a/HealBot_Options_Healing.xml +++ b/HealBot_Options_Healing.xml @@ -183,6 +183,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + HealBot_Options_HealthText_OnLoad(this) + + + + @@ -196,7 +224,7 @@ - + diff --git a/HealBot_View_Layout.lua b/HealBot_View_Layout.lua index ebcc433..9884ca8 100644 --- a/HealBot_View_Layout.lua +++ b/HealBot_View_Layout.lua @@ -132,16 +132,25 @@ function HealBot_Action_EnableButton(button) local pt = state.powerType local showMana = false - if HealBot_Config.ShowManaBars == 1 and state.maxMana > 0 and pt == 0 then - if HealBot_Config.ManaBarsHealersOnly == 1 then - if isHealer then showMana = true end - else + local pr, pg, pb = 0, 0, 1 -- Default Blue for Mana + + if HealBot_Config.ShowManaBars == 1 and state.maxMana > 0 then + if pt == 0 then + if HealBot_Config.ManaBarsHealersOnly == 1 then + if isHealer then showMana = true end + else + showMana = true + end + elseif HealBot_Config.ShowNonManaBars == 1 then showMana = true + if pt == 1 then pr, pg, pb = 1, 0, 0 -- Rage (Red) + elseif pt == 3 then pr, pg, pb = 1, 1, 0 -- Energy (Yellow) + elseif pt == 2 then pr, pg, pb = 1, 0.5, 0 -- Focus (Orange) + end end end if showMana then - local pr, pg, pb = 0, 0, 1 if bar3 then bar3:SetMinMaxValues(0, state.maxMana) bar3:SetValue(state.mana) @@ -193,10 +202,36 @@ function HealBot_Action_EnableButton(button) bar:SetStatusBarColor(r, g, b, HealBot_Config.bardisa[HealBot_Config.Current_Skin]); bar2:SetStatusBarColor(r, g, b, HealBot_Config.bardisa[HealBot_Config.Current_Skin]); end - if string.len(name) > textlen then - name = string.sub(name, 1, textlen - 3) .. '...'; + local healthTextOpt = HealBot_Config.ShowHealthText or 0 + local displayText = name + if healthTextOpt == 1 then + local pct = 0 + if maxhlth > 0 then pct = math.floor((hlth / maxhlth) * 100) end + displayText = name .. " - " .. pct .. "%" + elseif healthTextOpt == 2 then + displayText = name .. " - " .. hlth .. "/" .. maxhlth + elseif healthTextOpt == 3 then + local deficit = maxhlth - hlth + if deficit > 0 then + displayText = name .. " - -" .. deficit + end end - bar.txt:SetText(name); + + if string.len(displayText) > textlen then + if healthTextOpt > 0 then + -- If we have numbers, just truncate the name part so the numbers still show. + -- Find where " - " starts. + local dashIndex = string.find(displayText, " %- ") + if dashIndex then + local numbersPart = string.sub(displayText, dashIndex) + local namePart = string.sub(name, 1, math.max(1, textlen - string.len(numbersPart) - 3)) .. "..." + displayText = namePart .. numbersPart + end + else + displayText = string.sub(name, 1, textlen - 3) .. '...'; + end + end + bar.txt:SetText(displayText); bar.txt:SetTextColor(sr, sg, sb, sa); local fontName, fontHeight, fontFlags = bar.txt:GetFont() local fontOutline = HealBot_Config.bfontoutline[HealBot_Config.Current_Skin] or 0 diff --git a/README.md b/README.md index 1570314..0eb1f5a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,12 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\ ### Change Log +**v1.4** +* **Extra Frame support for pets and familiars added:** Togglable from healing tab - Extra frames option selected & pets selected from dropdown. +* **Customizable Health Text:** Added a new dropdown in the Healing Options tab that allows users to choose how health text is displayed on unit frames (`Name Only`, `Health Percentage`, `Real Health`, or `Health Deficit`). Includes a smart truncation algorithm to preserve critical health numbers even if the unit name is too long. +* **Non-Mana Resource Tracking:** Added a new toggle in the General Options tab to track secondary resources (Energy, Rage, Focus) for non-mana classes. Bars are dynamically color-coded based on the resource type. +* **Dropdown UI Initialization Fix:** Resolved a Vanilla API bug where dropdown menus sharing an ID (like the new Health Text dropdown) would temporarily inherit text from previously loaded dropdowns (e.g., "Modern Flat"). + **1.3.3** * **Chat Panel Refactor:** Completely replaced the spell selection dropdowns in the Chat tab with manual text input boxes, allowing users to type exact spell names (with or without ranks) directly, matching the behavior of the key-bindings configuration. Fixed a string matching bug caused by Vanilla WoW's hidden trailing spaces when comparing spell names, ensuring that both rankless (e.g. `Flash Heal`) and ranked inputs trigger correctly.