mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 05:50:50 +00:00
unitframes: use libhealth values if existing
This commit is contained in:
+15
-10
@@ -1964,10 +1964,15 @@ function pfUI.uf:GetStatusValue(unit, pos)
|
|||||||
config = "unit"
|
config = "unit"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local mp, mpmax = UnitMana(unitstr), UnitManaMax(unitstr)
|
local mp, mpmax = UnitMana(unitstr), UnitManaMax(unitstr)
|
||||||
local hp, hpmax = UnitHealth(unitstr), UnitHealthMax(unitstr)
|
local hp, hpmax = UnitHealth(unitstr), UnitHealthMax(unitstr)
|
||||||
if unit.label == "target" and (MobHealth3 or MobHealthFrame) and MobHealth_GetTargetCurHP() then
|
local rhp, rhpmax = hp, hpmax
|
||||||
hp, hpmax = MobHealth_GetTargetCurHP(), MobHealth_GetTargetMaxHP()
|
|
||||||
|
if pfUI.libhealth and pfUI.libhealth.enabled then
|
||||||
|
rhp, rhpmax = pfUI.libhealth:GetUnitHealth(unitstr)
|
||||||
|
elseif unit.label == "target" and (MobHealth3 or MobHealthFrame) and MobHealth_GetTargetCurHP() then
|
||||||
|
rhp, rhpmax = MobHealth_GetTargetCurHP(), MobHealth_GetTargetMaxHP()
|
||||||
end
|
end
|
||||||
|
|
||||||
if config == "unit" then
|
if config == "unit" then
|
||||||
@@ -1985,13 +1990,13 @@ function pfUI.uf:GetStatusValue(unit, pos)
|
|||||||
|
|
||||||
-- health
|
-- health
|
||||||
elseif config == "health" then
|
elseif config == "health" then
|
||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(hp)
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(rhp)
|
||||||
elseif config == "healthmax" then
|
elseif config == "healthmax" then
|
||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(hpmax)
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(rhpmax)
|
||||||
elseif config == "healthperc" then
|
elseif config == "healthperc" then
|
||||||
return unit:GetColor("health") .. ceil(hp / hpmax * 100)
|
return unit:GetColor("health") .. ceil(hp / hpmax * 100)
|
||||||
elseif config == "healthmiss" then
|
elseif config == "healthmiss" then
|
||||||
local health = ceil(hp - hpmax)
|
local health = ceil(rhp - rhpmax)
|
||||||
if UnitIsDead(unitstr) then
|
if UnitIsDead(unitstr) then
|
||||||
return unit:GetColor("health") .. DEAD
|
return unit:GetColor("health") .. DEAD
|
||||||
elseif health == 0 then
|
elseif health == 0 then
|
||||||
@@ -2001,12 +2006,12 @@ function pfUI.uf:GetStatusValue(unit, pos)
|
|||||||
end
|
end
|
||||||
elseif config == "healthdyn" then
|
elseif config == "healthdyn" then
|
||||||
if hp ~= hpmax then
|
if hp ~= hpmax then
|
||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) .. " - " .. ceil(hp / hpmax * 100) .. "%"
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(rhp) .. " - " .. ceil(hp / hpmax * 100) .. "%"
|
||||||
else
|
else
|
||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(hp)
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(rhp)
|
||||||
end
|
end
|
||||||
elseif config == "namehealth" then
|
elseif config == "namehealth" then
|
||||||
local health = ceil(hp - hpmax)
|
local health = ceil(rhp - rhpmax)
|
||||||
if UnitIsDead(unitstr) then
|
if UnitIsDead(unitstr) then
|
||||||
return unit:GetColor("health") .. DEAD
|
return unit:GetColor("health") .. DEAD
|
||||||
elseif health == 0 then
|
elseif health == 0 then
|
||||||
@@ -2015,7 +2020,7 @@ function pfUI.uf:GetStatusValue(unit, pos)
|
|||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(health)
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(health)
|
||||||
end
|
end
|
||||||
elseif config == "shortnamehealth" then
|
elseif config == "shortnamehealth" then
|
||||||
local health = ceil(hp - hpmax)
|
local health = ceil(rhp - rhpmax)
|
||||||
if UnitIsDead(unitstr) then
|
if UnitIsDead(unitstr) then
|
||||||
return unit:GetColor("health") .. DEAD
|
return unit:GetColor("health") .. DEAD
|
||||||
elseif health == 0 then
|
elseif health == 0 then
|
||||||
@@ -2024,7 +2029,7 @@ function pfUI.uf:GetStatusValue(unit, pos)
|
|||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(health)
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(health)
|
||||||
end
|
end
|
||||||
elseif config == "healthminmax" then
|
elseif config == "healthminmax" then
|
||||||
return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) .. "/" .. pfUI.api.Abbreviate(hpmax)
|
return unit:GetColor("health") .. pfUI.api.Abbreviate(rhp) .. "/" .. pfUI.api.Abbreviate(rhpmax)
|
||||||
|
|
||||||
-- mana/power/focus
|
-- mana/power/focus
|
||||||
elseif config == "power" then
|
elseif config == "power" then
|
||||||
|
|||||||
Reference in New Issue
Block a user