unitframes: add option to show self in group

This commit is contained in:
shagu
2017-09-03 18:28:05 +02:00
parent 1d08a7619d
commit e93b52c2ba
4 changed files with 33 additions and 4 deletions
+1
View File
@@ -87,6 +87,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "combosize", "6")
pfUI:UpdateConfig("unitframes", nil, "abbrevnum", "1")
pfUI:UpdateConfig("unitframes", nil, "selfingroup", "0")
pfUI:UpdateConfig("unitframes", nil, "show_hots", "0")
pfUI:UpdateConfig("unitframes", nil, "all_hots", "0")
pfUI:UpdateConfig("unitframes", nil, "show_procs", "0")
+24
View File
@@ -38,6 +38,22 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
local f = CreateFrame("Button", "pf" .. fname, UIParent)
-- show self in group
if unit == "party" and id == "0" then
unit = "player"
id = ""
end
if unit == "partypet" and id == "0" then
unit = "pet"
id = ""
end
if unit == "party0target" then
unit = "target"
id = ""
end
if not pfValidUnits[unit .. id] then
f.unitname = unit
f.RegisterEvent = function() return end
@@ -525,6 +541,14 @@ function pfUI.uf:RefreshUnit(unit, component)
-- break early on misconfigured UF's
if not unit.label then return end
-- hide self in group
if unit.fname == "Group0" or unit.fname == "PartyPet0" or unit.fname == "Party0Target" then
if GetNumPartyMembers() <= 0 then
unit:Hide()
return
end
end
if unit.label == "target" or unit.label == "targettarget" then
if pfScanActive == true then return end
end
+7 -4
View File
@@ -19,10 +19,12 @@ pfUI:RegisterModule("group", function ()
pfUI.uf.group = {}
for i=1, 4 do
local startid = C.unitframes.selfingroup == "1" and 0 or 1
for i=startid, 4 do
pfUI.uf.group[i] = pfUI.uf:CreateUnitFrame("Party", i, C.unitframes.group)
pfUI.uf.group[i]:UpdateFrameSize()
pfUI.uf.group[i]:SetPoint("TOPLEFT", 5, -5 - ((i-1)*75))
pfUI.uf.group[i]:SetPoint("TOPLEFT", 5, -5 - ((i-startid)*75))
UpdateMovable(pfUI.uf.group[i])
pfUI.uf.group[i].target = pfUI.uf:CreateUnitFrame("Party" .. i .. "Target", nil, C.unitframes.grouptarget, 0.2)
@@ -37,8 +39,9 @@ pfUI:RegisterModule("group", function ()
UpdateMovable(pfUI.uf.group[i].pet)
end
pfUI.uf.partytargetScanner = CreateFrame("Button",nil,UIParent)
pfUI.uf.partytargetScanner:SetScript("OnUpdate", function()
pfUI.uf.groupscanner = CreateFrame("Frame", nil, UIParent)
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
pfUI.uf.group[i].target:Show()
+1
View File
@@ -1119,6 +1119,7 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui.tabs.gf.tabs.general = pfUI.gui.tabs.gf.tabs:CreateChildFrame(T["General"], 70)
pfUI.gui.tabs.gf.tabs.general:SetScript("OnShow", function()
if not this.setup then
CreateConfig(this, T["Show Self as Group Member"], C.unitframes, "selfingroup", "checkbox")
CreateConfig(this, T["Show Hots as Buff Indicators"], C.unitframes, "show_hots", "checkbox")
CreateConfig(this, T["Show Hots of all Classes"], C.unitframes, "all_hots", "checkbox")
CreateConfig(this, T["Show Procs as Buff Indicators"], C.unitframes, "show_procs", "checkbox")