From 3d7ed017570da4acff5cfbddca6b0a83cfcf4116 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 8 Apr 2018 02:10:25 +0200 Subject: [PATCH] unitframes: use unitname for validation --- api/unitframes.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 59f87e9e..0129b68d 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -803,12 +803,14 @@ function pfUI.uf:RefreshUnitState(unitframe) end function pfUI.uf:RefreshUnit(unit, component) + -- break early on misconfigured UF's if not unit.label then return end if not unit.hp then return end if not unit.power then return end local component = component or "" - -- break early on misconfigured UF's + + -- don't update scanner activity if unit.label == "target" or unit.label == "targettarget" then if pfScanActive == true then return end end @@ -838,15 +840,17 @@ function pfUI.uf:RefreshUnit(unit, component) default_border = pfUI_config.appearance.border.unitframes end - local C = pfUI_config - -- hide and return early on unused frames if not ( pfUI.unlock and pfUI.unlock:IsShown() ) then + --keep focus and named frames visible if unit.unitname and unit.unitname ~= "focus" then - --keep focus and named frames visible unit:Show() - elseif UnitExists(unit.label .. unit.id) then + + + -- only update visibility state for existing units + elseif UnitName(unit.label .. unit.id) then + -- hide group while in raid and option is set if pfUI_config["unitframes"]["group"]["hide_in_raid"] == "1" and strsub(unit.label,0,5) == "party" and UnitInRaid("player") then unit:Hide() @@ -869,12 +873,12 @@ function pfUI.uf:RefreshUnit(unit, component) unit:Show() else - -- hide unused frame unit:Hide() return end end + -- create required fields if not unit.cache then unit.cache = {} end if not unit.id then unit.id = "" end