From d90f11e2cc3213d8ce6af40c70fd25829da9a9e1 Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 6 Apr 2019 13:03:20 +0200 Subject: [PATCH] unitframes: add option to always show self in raid --- api/config.lua | 1 + api/unitframes.lua | 31 ++++++++++++++++--------------- modules/gui.lua | 5 +++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/api/config.lua b/api/config.lua index 71f4bf5c..79cc7548 100644 --- a/api/config.lua +++ b/api/config.lua @@ -179,6 +179,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", nil, "abbrevnum", "1") pfUI:UpdateConfig("unitframes", nil, "selfingroup", "0") + pfUI:UpdateConfig("unitframes", nil, "selfinraid", "0") pfUI:UpdateConfig("unitframes", nil, "raidforgroup", "0") pfUI:UpdateConfig("unitframes", nil, "show_hots", "0") pfUI:UpdateConfig("unitframes", nil, "all_hots", "0") diff --git a/api/unitframes.lua b/api/unitframes.lua index 018c9a0a..970d1775 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -992,22 +992,23 @@ function pfUI.uf:RefreshUnit(unit, component) local C = pfUI_config -- show groupframes as raid - if C["unitframes"]["raidforgroup"] == "1" then - if strsub(unit:GetName(),0,6) == "pfRaid" then - local id = tonumber(strsub(unit:GetName(),7,8)) + if strsub(unit:GetName(),0,6) == "pfRaid" then + local id = tonumber(strsub(unit:GetName(),7,8)) - if not UnitInRaid("player") and GetNumPartyMembers() > 0 then - if id == 1 then - unit.id = "" - unit.label = "player" - elseif id <= 5 then - unit.id = id - 1 - unit.label = "party" - end - elseif unit.label == "party" or unit.label == "player" then - unit.id = id - unit.label = "raid" + if not UnitInRaid("player") and GetNumPartyMembers() == 0 and C.unitframes.selfinraid == "1" and id == 1 then + unit.id = "" + unit.label = "player" + elseif not UnitInRaid("player") and GetNumPartyMembers() > 0 and C.unitframes.raidforgroup == "1" then + if id == 1 then + unit.id = "" + unit.label = "player" + elseif id <= 5 then + unit.id = id - 1 + unit.label = "party" end + elseif unit.label == "party" or unit.label == "player" then + unit.id = id + unit.label = "raid" end end @@ -1049,7 +1050,7 @@ function pfUI.uf:RefreshUnit(unit, component) -- 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 - if ( GetNumPartyMembers() <= 0 ) or ( C["unitframes"]["group"]["hide_in_raid"] == "1" and UnitInRaid("player") ) then + if ( C["unitframes"]["group"]["hide_in_raid"] == "1" and UnitInRaid("player") ) then unit:Hide() return end diff --git a/modules/gui.lua b/modules/gui.lua index 5e45d908..eab78bf2 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1425,9 +1425,10 @@ pfUI:RegisterModule("gui", function () end) CreateGUIEntry(T["Group Frames"], T["General"], function() - CreateConfig(U["group"], T["Show Self in Group Frames"], C.unitframes, "selfingroup", "checkbox") - CreateConfig(nil, T["Hide Group Frames While In Raid"], C.unitframes.group, "hide_in_raid", "checkbox") CreateConfig(nil, T["Use Raid Frames To Display Group Members"], C.unitframes, "raidforgroup", "checkbox") + CreateConfig(nil, T["Always Show Self In Raid Frames"], C.unitframes, "selfinraid", "checkbox") + CreateConfig(nil, T["Always Show Self In Group Frames"], C.unitframes, "selfingroup", "checkbox") + CreateConfig(nil, T["Hide Group Frames While In Raid"], C.unitframes.group, "hide_in_raid", "checkbox") CreateConfig(nil, T["Show Hots as Buff Indicators"], C.unitframes, "show_hots", "checkbox") CreateConfig(nil, T["Show Hots of all Classes"], C.unitframes, "all_hots", "checkbox") CreateConfig(nil, T["Show Procs as Buff Indicators"], C.unitframes, "show_procs", "checkbox")