From aaf01d7dce96a47da842043c0d06f19cb515496e Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Fri, 6 Feb 2026 08:35:56 +0100 Subject: [PATCH] unitframe powertype for npc`s unitframe powertype for npc`s --- api/unitframes.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 0e8302b8..2a98286a 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -2510,6 +2510,10 @@ function pfUI.uf:RefreshUnit(unit, component) unit.power.bar:SetMinMaxValues(0, powermax, true) unit.power.bar:SetValue(power) + -- Hide power bar text for NPCs without real power (power == 0) + local isNPC = not UnitIsPlayer(unitstr) and not UnitPlayerControlled(unitstr) + local npcNoPower = isNPC and (not power or power == 0) + -- set healthbar color local custom_active = nil local customfullhp = unit.config.defcolor == "0" and unit.config.customfullhp or C.unitframes.customfullhp @@ -2594,10 +2598,25 @@ function pfUI.uf:RefreshUnit(unit, component) unit.hpCenterText:SetText(pfUI.uf:GetStatusValue(unit, "hpcenter")) unit.hpRightText:SetText(pfUI.uf:GetStatusValue(unit, "hpright")) - -- Hide power text for NPCs without power (maxPower == 0) - unit.powerLeftText:SetText(pfUI.uf:GetStatusValue(unit, "powerleft")) - unit.powerCenterText:SetText(pfUI.uf:GetStatusValue(unit, "powercenter")) - unit.powerRightText:SetText(pfUI.uf:GetStatusValue(unit, "powerright")) + -- Hide power text for NPCs without a real power system + local cfgLeft = unit.config.txtpowerleft + local cfgCenter = unit.config.txtpowercenter + local cfgRight = unit.config.txtpowerright + if npcNoPower and cfgLeft and strfind(cfgLeft, "power") then + unit.powerLeftText:SetText("") + else + unit.powerLeftText:SetText(pfUI.uf:GetStatusValue(unit, "powerleft")) + end + if npcNoPower and cfgCenter and strfind(cfgCenter, "power") then + unit.powerCenterText:SetText("") + else + unit.powerCenterText:SetText(pfUI.uf:GetStatusValue(unit, "powercenter")) + end + if npcNoPower and cfgRight and strfind(cfgRight, "power") then + unit.powerRightText:SetText("") + else + unit.powerRightText:SetText(pfUI.uf:GetStatusValue(unit, "powerright")) + end if UnitIsTapped(unitstr) and not UnitIsTappedByPlayer(unitstr) then unit.hp.bar:SetStatusBarColor(.5,.5,.5,.5)