From 6a016ad7cafc1ffeb67ddeacf259f0100a01c03d Mon Sep 17 00:00:00 2001 From: Vitali Date: Wed, 27 Dec 2017 23:51:44 +0300 Subject: [PATCH] unitframes: add MobInfo2 support --- api/unitframes.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/unitframes.lua b/api/unitframes.lua index 6439ed30..f1bbb687 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -1427,12 +1427,18 @@ function pfUI.uf:GetStatusValue(unit, pos) if unit.label == "target" and MobHealth3 then local hp, hpmax = MobHealth3:GetUnitHealth(unit.label) return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) + elseif unit.label == "target" and MobHealthFrame and MobHealth_GetTargetCurHP() then + local hp = MobHealth_GetTargetCurHP() + return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) end return unit:GetColor("health") .. pfUI.api.Abbreviate(UnitHealth(unitstr)) elseif config == "healthmax" then if unit.label == "target" and MobHealth3 then local hp, hpmax = MobHealth3:GetUnitHealth(unit.label) return unit:GetColor("health") .. pfUI.api.Abbreviate(hpmax) + elseif unit.label == "target" and MobHealthFrame and MobHealth_GetTargetMaxHP() then + local hpmax = MobHealth_GetTargetMaxHP() + return unit:GetColor("health") .. pfUI.api.Abbreviate(hpmax) end return unit:GetColor("health") .. pfUI.api.Abbreviate(UnitHealthMax(unitstr)) elseif config == "healthperc" then @@ -1449,12 +1455,18 @@ function pfUI.uf:GetStatusValue(unit, pos) if unit.label == "target" and MobHealth3 then local hp, hpmax = MobHealth3:GetUnitHealth(unit.label) return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) .. " - " .. ceil(hp / hpmax * 100) .. "%" + elseif unit.label == "target" and MobHealthFrame and MobHealth_GetTargetCurHP() then + local hp, hpmax = MobHealth_GetTargetCurHP(),MobHealth_GetTargetMaxHP() + return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) .. " - " .. ceil(hp / hpmax * 100) .. "%" end return unit:GetColor("health") .. pfUI.api.Abbreviate(UnitHealth(unitstr)) .. " - " .. ceil(UnitHealth(unitstr) / UnitHealthMax(unitstr) * 100) .. "%" else if unit.label == "target" and MobHealth3 then local hp, hpmax = MobHealth3:GetUnitHealth(unit.label) return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) + elseif unit.label == "target" and MobHealthFrame and MobHealth_GetTargetCurHP() then + local hp = MobHealth_GetTargetCurHP() + return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) end return unit:GetColor("health") .. pfUI.api.Abbreviate(UnitHealth(unitstr)) end @@ -1462,6 +1474,8 @@ function pfUI.uf:GetStatusValue(unit, pos) local hp, hpmax = UnitHealth(unitstr), UnitHealthMax(unitstr) if unit.label == "target" and MobHealth3 then hp, hpmax = MobHealth3:GetUnitHealth(unit.label) + elseif unit.label == "target" and MobHealthFrame and MobHealth_GetTargetCurHP() then + local hp, hpmax = MobHealth_GetTargetCurHP(), MobHealth_GetTargetMaxHP() end return unit:GetColor("health") .. pfUI.api.Abbreviate(hp) .. "/" .. pfUI.api.Abbreviate(hpmax)