From 96256a59e517a377eabfaad5b8dbdbd43c786d78 Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 19 Apr 2019 16:13:08 +0200 Subject: [PATCH] unitframes: options to hide raid, loot and leader icon --- api/config.lua | 33 +++++++++++++++++++++++++++++++++ api/unitframes.lua | 44 ++++++++++++++++++++++++++++---------------- modules/gui.lua | 3 +++ 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/api/config.lua b/api/config.lua index 4cd30703..3cfbe7a3 100644 --- a/api/config.lua +++ b/api/config.lua @@ -202,6 +202,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "player", "visible", "1") pfUI:UpdateConfig("unitframes", "player", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "player", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "player", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "player", "looticon", "1") pfUI:UpdateConfig("unitframes", "player", "portrait", "bar") pfUI:UpdateConfig("unitframes", "player", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "player", "width", "200") @@ -245,6 +248,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "target", "visible", "1") pfUI:UpdateConfig("unitframes", "target", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "target", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "target", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "target", "looticon", "1") pfUI:UpdateConfig("unitframes", "target", "portrait", "bar") pfUI:UpdateConfig("unitframes", "target", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "target", "width", "200") @@ -289,6 +295,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "focus", "visible", "1") pfUI:UpdateConfig("unitframes", "focus", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "focus", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "focus", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "focus", "looticon", "1") pfUI:UpdateConfig("unitframes", "focus", "portrait", "bar") pfUI:UpdateConfig("unitframes", "focus", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "focus", "width", "120") @@ -332,6 +341,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "group", "visible", "1") pfUI:UpdateConfig("unitframes", "group", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "group", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "group", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "group", "looticon", "1") pfUI:UpdateConfig("unitframes", "group", "portrait", "off") pfUI:UpdateConfig("unitframes", "group", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "group", "width", "164") @@ -376,6 +388,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1") pfUI:UpdateConfig("unitframes", "grouptarget", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "grouptarget", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "grouptarget", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "grouptarget", "looticon", "1") pfUI:UpdateConfig("unitframes", "grouptarget", "portrait", "off") pfUI:UpdateConfig("unitframes", "grouptarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "grouptarget", "width", "120") @@ -419,6 +434,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1") pfUI:UpdateConfig("unitframes", "grouppet", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "grouppet", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "grouppet", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "grouppet", "looticon", "1") pfUI:UpdateConfig("unitframes", "grouppet", "portrait", "off") pfUI:UpdateConfig("unitframes", "grouppet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "grouppet", "width", "100") @@ -462,6 +480,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "raid", "visible", "1") pfUI:UpdateConfig("unitframes", "raid", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "raid", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "raid", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "raid", "looticon", "1") pfUI:UpdateConfig("unitframes", "raid", "portrait", "off") pfUI:UpdateConfig("unitframes", "raid", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "raid", "width", "50") @@ -505,6 +526,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1") pfUI:UpdateConfig("unitframes", "ttarget", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "ttarget", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "ttarget", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "ttarget", "looticon", "1") pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar") pfUI:UpdateConfig("unitframes", "ttarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "ttarget", "width", "100") @@ -548,6 +572,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "pet", "visible", "1") pfUI:UpdateConfig("unitframes", "pet", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "pet", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "pet", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "pet", "looticon", "1") pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar") pfUI:UpdateConfig("unitframes", "pet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "pet", "width", "100") @@ -591,6 +618,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "ptarget", "visible", "0") pfUI:UpdateConfig("unitframes", "ptarget", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "ptarget", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "ptarget", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "ptarget", "looticon", "1") pfUI:UpdateConfig("unitframes", "ptarget", "portrait", "bar") pfUI:UpdateConfig("unitframes", "ptarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "ptarget", "width", "100") @@ -634,6 +664,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "fallback", "visible", "1") pfUI:UpdateConfig("unitframes", "fallback", "showPVP", "0") + pfUI:UpdateConfig("unitframes", "fallback", "raidicon", "1") + pfUI:UpdateConfig("unitframes", "fallback", "leadericon", "1") + pfUI:UpdateConfig("unitframes", "fallback", "looticon", "1") pfUI:UpdateConfig("unitframes", "fallback", "portrait", "bar") pfUI:UpdateConfig("unitframes", "fallback", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("unitframes", "fallback", "width", "200") diff --git a/api/unitframes.lua b/api/unitframes.lua index b3842d48..6f350a53 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -1102,36 +1102,48 @@ function pfUI.uf:RefreshUnit(unit, component) -- Raid Icon if unit.raidIcon and ( component == "all" or component == "raidIcon" ) then - local raidIcon = GetRaidTargetIndex(unitstr) - if raidIcon and UnitName(unitstr) then - SetRaidTargetIconTexture(unit.raidIcon.texture, raidIcon) - unit.raidIcon:Show() - else + if unit.config.raidicon == "0" then unit.raidIcon:Hide() + else + local raidIcon = GetRaidTargetIndex(unitstr) + if raidIcon and UnitName(unitstr) then + SetRaidTargetIconTexture(unit.raidIcon.texture, raidIcon) + unit.raidIcon:Show() + else + unit.raidIcon:Hide() + end end end -- Leader Icon if unit.leaderIcon and ( component == "all" or component == "leaderIcon" ) then - if GetNumPartyMembers() == 0 and GetNumRaidMembers() == 0 then + if unit.config.leadericon == "0" then unit.leaderIcon:Hide() - elseif UnitIsPartyLeader(unitstr) then - unit.leaderIcon:Show() else - unit.leaderIcon:Hide() + if GetNumPartyMembers() == 0 and GetNumRaidMembers() == 0 then + unit.leaderIcon:Hide() + elseif UnitIsPartyLeader(unitstr) then + unit.leaderIcon:Show() + else + unit.leaderIcon:Hide() + end end end -- Loot Icon if unit.lootIcon and ( component == "all" or component == "lootIcon" ) then - -- no third return value here.. but leaving this as a hint - local method, group, raid = GetLootMethod() - local name = group and UnitName(group == 0 and "player" or "party"..group) or raid and UnitName("raid"..raid) or nil - - if name and name == UnitName(unitstr) then - unit.lootIcon:Show() - else + if unit.config.looticon == "0" then unit.lootIcon:Hide() + else + -- no third return value here.. but leaving this as a hint + local method, group, raid = GetLootMethod() + local name = group and UnitName(group == 0 and "player" or "party"..group) or raid and UnitName("raid"..raid) or nil + + if name and name == UnitName(unitstr) then + unit.lootIcon:Show() + else + unit.lootIcon:Hide() + end end end diff --git a/modules/gui.lua b/modules/gui.lua index 79688536..fd4ecb93 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1497,6 +1497,9 @@ pfUI:RegisterModule("gui", 20400, function () CreateConfig(U[c], T["Status Bar Texture"], C.unitframes[c], "bartexture", "dropdown", pfUI.gui.dropdowns.uf_bartexture) CreateConfig(U[c], T["UnitFrame Spacing"], C.unitframes[c], "pspace") CreateConfig(U[c], T["Show PvP-Flag"], C.unitframes[c], "showPVP", "checkbox") + CreateConfig(U[c], T["Show Raid Mark"], C.unitframes[c], "raidicon", "checkbox") + CreateConfig(U[c], T["Show Loot Icon"], C.unitframes[c], "looticon", "checkbox") + CreateConfig(U[c], T["Show Leader Icon"], C.unitframes[c], "leadericon", "checkbox") CreateConfig(U[c], T["Display Class Buffs"], C.unitframes[c], "buff_indicator", "checkbox") CreateConfig(U[c], T["Healthbar"], nil, nil, "header")