From 99ddd679eb79518ec4d74a9ef53ede17778f2a6b Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 7 Apr 2018 19:24:46 +0200 Subject: [PATCH] unitframes: ignore non existing partypet events --- api/unitframes.lua | 15 +++++++++------ modules/group.lua | 2 +- pfUI.toc | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 770f5e2f..59f87e9e 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -842,19 +842,22 @@ function pfUI.uf:RefreshUnit(unit, component) -- hide and return early on unused frames if not ( pfUI.unlock and pfUI.unlock:IsShown() ) then - -- check existing units or focus frames + if unit.unitname and unit.unitname ~= "focus" then + --keep focus and named frames visible unit:Show() - elseif UnitName(unit.label .. unit.id) then + elseif UnitExists(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() return - -- hide existing but too far away pet - elseif strsub(unit.label,0,8) == "partypet" and not UnitIsVisible(unit.label .. unit.id) then - unit:Hide() - return + -- hide existing but too far away pet and pets of old group members + elseif unit.label == "partypet" then + if not UnitIsVisible(unit.label .. unit.id) or not UnitExists("party" .. unit.id) then + unit:Hide() + return + end -- hide self in group if solo or hide in raid is set elseif unit.fname == "Group0" or unit.fname == "PartyPet0" or unit.fname == "Party0Target" then diff --git a/modules/group.lua b/modules/group.lua index 697fe206..23e10b90 100644 --- a/modules/group.lua +++ b/modules/group.lua @@ -66,7 +66,7 @@ pfUI:RegisterModule("group", function () pfUI.uf.groupscanner:SetScript("OnUpdate", function() if ( this.limit or 1) > GetTime() then return else this.limit = GetTime() + .2 end for i=1, 4 do - if UnitExists("party" .. i .. "target") or (pfUI.unlock and pfUI.unlock:IsShown()) then + if (UnitExists("party" .. i) and UnitExists("party" .. i .. "target")) or (pfUI.unlock and pfUI.unlock:IsShown()) then pfUI.uf.group[i].target:Show() else pfUI.uf.group[i].target:Hide() diff --git a/pfUI.toc b/pfUI.toc index cfc3b0c6..3da9c71b 100644 --- a/pfUI.toc +++ b/pfUI.toc @@ -2,7 +2,7 @@ ## Title: |cff33ffccpf|cffffffffUI ## Author: Shagu ## Notes: A complete user interface replacement. -## Version: 3.8.4 +## Version: 3.8.5 ## SavedVariables: pfUI_profiles, pfUI_gold ## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB