unitframes: option to change buffs per row

This commit is contained in:
shagu
2017-06-02 18:01:50 +02:00
parent b16d47f1ce
commit eb6130e6c9
3 changed files with 54 additions and 9 deletions
+21 -1
View File
@@ -104,9 +104,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "buffs", "top")
pfUI:UpdateConfig("unitframes", "player", "buffsize", "20") -- TODO migrate uf.buffsize
pfUI:UpdateConfig("unitframes", "player", "bufflimit", "32")
pfUI:UpdateConfig("unitframes", "player", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "player", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "player", "debuffsize", "20") -- TODO migrate uf.debuffsize
pfUI:UpdateConfig("unitframes", "player", "debufflimit", "32")
pfUI:UpdateConfig("unitframes", "player", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "player", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "player", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "player", "debuff_indicator", "0")
@@ -129,9 +131,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "buffs", "top")
pfUI:UpdateConfig("unitframes", "target", "buffsize", "20") -- TODO migrate uf.buffsize
pfUI:UpdateConfig("unitframes", "target", "bufflimit", "32")
pfUI:UpdateConfig("unitframes", "target", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "target", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "target", "debuffsize", "20") -- TODO migrate uf.debuffsize
pfUI:UpdateConfig("unitframes", "target", "debufflimit", "32")
pfUI:UpdateConfig("unitframes", "target", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "target", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "target", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "target", "debuff_indicator", "0")
@@ -151,9 +155,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "focus", "buffs", "top")
pfUI:UpdateConfig("unitframes", "focus", "buffsize", "12")
pfUI:UpdateConfig("unitframes", "focus", "bufflimit", "32")
pfUI:UpdateConfig("unitframes", "focus", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "focus", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "focus", "debuffsize", "12")
pfUI:UpdateConfig("unitframes", "focus", "debufflimit", "32")
pfUI:UpdateConfig("unitframes", "focus", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "focus", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "focus", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "focus", "debuff_indicator", "0")
@@ -172,9 +178,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "group", "buffs", "bottom")
pfUI:UpdateConfig("unitframes", "group", "buffsize", "8")
pfUI:UpdateConfig("unitframes", "group", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "group", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "group", "debuffs", "bottom")
pfUI:UpdateConfig("unitframes", "group", "debuffsize", "8")
pfUI:UpdateConfig("unitframes", "group", "debufflimit", "8")
pfUI:UpdateConfig("unitframes", "group", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "group", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "group", "buff_indicator", "1")
pfUI:UpdateConfig("unitframes", "group", "debuff_indicator", "1")
@@ -194,9 +202,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouptarget", "buffs", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouptarget", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "debuff_indicator", "0")
@@ -215,9 +225,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouppet", "buffs", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouppet", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "grouppet", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "grouppet", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "debuff_indicator", "0")
@@ -236,9 +248,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "buffs", "off")
pfUI:UpdateConfig("unitframes", "raid", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "raid", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "raid", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "raid", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "raid", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "raid", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "raid", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "raid", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "raid", "buff_indicator", "1")
pfUI:UpdateConfig("unitframes", "raid", "debuff_indicator", "1")
@@ -257,9 +271,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ttarget", "buffs", "off")
pfUI:UpdateConfig("unitframes", "ttarget", "buffsize", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "ttarget", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "ttarget", "debuffsize", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "ttarget", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "ttarget", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "debuff_indicator", "0")
@@ -278,9 +294,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "buffs", "off")
pfUI:UpdateConfig("unitframes", "pet", "buffsize", "12")
pfUI:UpdateConfig("unitframes", "pet", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "pet", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "pet", "debuffs", "off")
pfUI:UpdateConfig("unitframes", "pet", "debuffsize", "12")
pfUI:UpdateConfig("unitframes", "pet", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "pet", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "pet", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "pet", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "pet", "debuff_indicator", "0")
@@ -299,9 +317,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "fallback", "buffs", "top")
pfUI:UpdateConfig("unitframes", "fallback", "buffsize", "20")
pfUI:UpdateConfig("unitframes", "fallback", "bufflimit", "16")
pfUI:UpdateConfig("unitframes", "fallback", "buffperrow", "8")
pfUI:UpdateConfig("unitframes", "fallback", "debuffs", "top")
pfUI:UpdateConfig("unitframes", "fallback", "debuffsize", "20")
pfUI:UpdateConfig("unitframes", "fallback", "debufflimit", "16")
pfUI:UpdateConfig("unitframes", "fallback", "debuffperrow", "8")
pfUI:UpdateConfig("unitframes", "fallback", "invert_healthbar", "0")
pfUI:UpdateConfig("unitframes", "fallback", "buff_indicator", "0")
pfUI:UpdateConfig("unitframes", "fallback", "debuff_indicator", "0")
+12 -8
View File
@@ -334,7 +334,8 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
for i=1, f.config.bufflimit do
local id = i
local row = floor((i-1) / 8)
local perrow = f.config.buffperrow
local row = floor((i-1) / perrow)
f.buffs[i] = CreateFrame("Button", "pfUIPlayerBuff" .. i, f)
f.buffs[i]:SetID(i)
@@ -369,7 +370,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
end
f.buffs[i]:SetPoint(af, f, as,
(i-1-row*8)*((2*default_border) + f.config.buffsize + 1),
(i-1-row*perrow)*((2*default_border) + f.config.buffsize + 1),
invert * (row)*((2*default_border) + f.config.buffsize + 1) + invert*(2*default_border + 1))
f.buffs[i]:SetWidth(f.config.buffsize)
@@ -640,14 +641,17 @@ function pfUI.uf:RefreshUnit(unit, component)
-- Debuffs
if unit.debuffs and ( component == "all" or component == "aura" ) then
for i=1, unit.config.debufflimit do
local row = floor((i-1) / 8)
local perrow = unit.config.debuffperrow
local bperrow = unit.config.buffperrow
local row = floor((i-1) / unit.config.debuffperrow)
local buffrow = 0
if unit.config.buffs == unit.config.debuffs then
if unit.buffs[1] and unit.buffs[1]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[9] and unit.buffs[9]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[17] and unit.buffs[17]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[25] and unit.buffs[25]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[0*bperrow+1] and unit.buffs[0*bperrow+1]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[1*bperrow+1] and unit.buffs[1*bperrow+1]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[2*bperrow+1] and unit.buffs[2*bperrow+1]:IsShown() then buffrow = buffrow + 1 end
if unit.buffs[3*bperrow+1] and unit.buffs[3*bperrow+1]:IsShown() then buffrow = buffrow + 1 end
end
local invert, af, as
@@ -662,7 +666,7 @@ function pfUI.uf:RefreshUnit(unit, component)
end
unit.debuffs[i]:SetPoint(af, unit, as,
(i-1-(row)*8)*((2*default_border) + unit.config.debuffsize + 1),
(i-1-(row)*perrow)*((2*default_border) + unit.config.debuffsize + 1),
invert * (row+buffrow)*((2*default_border) + unit.config.debuffsize + 1) + invert*(2*default_border + 1))
local texture, stacks, dtype