unitframes: option to show up to 32 buffs

This commit is contained in:
shagu
2017-04-24 22:20:09 +02:00
parent 1fb55fa433
commit b16d47f1ce
3 changed files with 57 additions and 19 deletions
+14 -15
View File
@@ -332,10 +332,9 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
if f.config.buffs ~= "off" then
f.buffs = {}
for i=1, 16 do
for i=1, f.config.bufflimit do
local id = i
local row = 0
if i <= 8 then row = 0 else row = 1 end
local row = floor((i-1) / 8)
f.buffs[i] = CreateFrame("Button", "pfUIPlayerBuff" .. i, f)
f.buffs[i]:SetID(i)
@@ -370,7 +369,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
end
f.buffs[i]:SetPoint(af, f, as,
(i-1-8*row)*((2*default_border) + f.config.buffsize + 1),
(i-1-row*8)*((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)
@@ -424,7 +423,7 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
if f.config.debuffs ~= "off" then
f.debuffs = {}
for i=1, 16 do
for i=1, f.config.debufflimit do
local id = i
f.debuffs[i] = CreateFrame("Button", "pfUIPlayerDebuff" .. i, f)
f.debuffs[i]:SetID(i)
@@ -610,7 +609,7 @@ function pfUI.uf:RefreshUnit(unit, component)
-- Buffs
if unit.buffs and ( component == "all" or component == "aura" ) then
for i=1, 16 do
for i=1, unit.config.bufflimit do
local texture, stacks
if unit.label == "player" then
stacks = GetPlayerBuffApplications(GetPlayerBuff(i-1,"HELPFUL"))
@@ -640,14 +639,15 @@ function pfUI.uf:RefreshUnit(unit, component)
-- Debuffs
if unit.debuffs and ( component == "all" or component == "aura" ) then
for i=1, 16 do
local row = 0
local top = 0
if i > 8 then row = 1 end
for i=1, unit.config.debufflimit do
local row = floor((i-1) / 8)
local buffrow = 0
if unit.config.buffs == unit.config.debuffs then
if unit.buffs[1]:IsShown() then top = top + 1 end
if unit.buffs[9]:IsShown() then top = top + 1 end
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
end
local invert, af, as
@@ -662,9 +662,8 @@ function pfUI.uf:RefreshUnit(unit, component)
end
unit.debuffs[i]:SetPoint(af, unit, as,
(i-1-8*row)*((2*default_border) + unit.config.debuffsize + 1),
invert * (top)*((2*default_border) + unit.config.buffsize + 1) +
invert * (row)*((2*default_border) + unit.config.debuffsize + 1) + invert*(2*default_border + 1))
(i-1-(row)*8)*((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
if unit.label == "player" then