Feat: added customizable unit frame health text and support for non-mana resource tracking

This commit is contained in:
Bluewhale1337
2026-07-10 17:08:50 +02:00
parent 7eb07d724e
commit becb2ddfdb
7 changed files with 137 additions and 11 deletions
+3
View File
@@ -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",
+5
View File
@@ -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);
+24 -2
View File
@@ -102,7 +102,7 @@
</OnLoad>
</Scripts>
<Size>
<AbsDimension y="70"/>
<AbsDimension y="95"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
@@ -156,7 +156,7 @@
<Anchors>
<Anchor point="TOPLEFT" relativeTo="HealBot_Options_ShowManaBars" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="200" y="0" />
<AbsDimension x="180" y="0" />
</Offset>
</Anchor>
</Anchors>
@@ -174,6 +174,28 @@
</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="HealBot_Options_ShowNonManaBars" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="HealBot_Options_ShowManaBars" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-2" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName().."Text"):SetText("Track Non-Mana Resources");
</OnLoad>
<OnClick>
if (this:GetChecked()) then
HealBot_Config.ShowNonManaBars = 1;
else
HealBot_Config.ShowNonManaBars = 0;
end
HealBot_Action_Refresh();
</OnClick>
</Scripts>
</CheckButton>
</Frames>
</Frame>
+27
View File
@@ -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,
+29 -1
View File
@@ -183,6 +183,34 @@
</Scripts>
</Frame>
<Frame name="HealBot_Options_HealthText" inherits="UIDropDownMenuTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="155" y="-271" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="OVERLAY">
<FontString inherits="GameFontNormalSmall" text="Health Text">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-110" y="-7"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
HealBot_Options_HealthText_OnLoad(this)
</OnLoad>
</Scripts>
</Frame>
<Frame name="HealBot_Options_EmergLFrame" inherits="OptionFrameBoxTemplate">
<Scripts>
<OnLoad>
@@ -196,7 +224,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="21" y="-275"/>
<AbsDimension x="21" y="-308"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT">
+40 -5
View File
@@ -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
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
bar.txt:SetText(name);
end
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
+6
View File
@@ -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.