/trunk/CompactBars
end |
end |
end |
local function iterateFixedText() |
local bars = sb:GetBars() |
if not bars or #bars == 0 then return end |
for i = 1, 10 do |
-- find a bar for that position |
for _, bar in pairs(bars) do |
if bar.pos and bar.pos == i then |
if bar.data and bar.data.typ and (bar.data.typ == "Dots" or bar.data.typ == "CCs" or bar.data.typ == "Debuffs") then |
if not CompactBars.db.profile.owndots then |
if not CompactBars.db.profile.ehidetext then |
sb:SetFixedText(bar.data.name, i) |
break |
end |
end |
end |
end |
end |
end |
end |
local function findFirstEmptyBar(init) |
local bars = sb:GetBars() |
if not bars then return init end |
bars = sb:GetBars() |
if not bars or #bars == 0 then return end |
for k,v in pairs(bars) do v.order = nil end |
for k,v in pairs(bars) do |
v.order = nil |
if v.pos then sb:SetFixedText(nil, v.pos) end |
end |
local curpos = 0 |
local firstdebuff, firstshortbuff, firstcooldown, firstbossmod = true, true, true, true |
for i = 1, 4 do |
if positions[i] == "Debuffs" and bar.data and (bar.data.typ == "Debuffs" or bar.data.typ == "CCs" or bar.data.typ == "Dots") then |
local ftext |
if firstdebuff then |
ftext = sb:GetFixedText(bar.pos) |
sb:SetFixedText(nil, bar.pos) |
sb:SetFixedText(ftext, curpos) |
--ftext = sb:GetFixedText(bar.pos) |
--sb:SetFixedText(nil, bar.pos) |
--sb:SetFixedText(ftext, curpos) |
bar.pos = curpos |
bar.order = true |
curpos = curpos + 1 |
else |
-- try to find a bar that fits |
for _, b in pairs(bars) do |
if b.order and not bar.order and b.data.dguid == bar.data.dguid then |
if b.order and not bar.order and b.data and bar.data.dguid == b.data.dguid and (bar.data.typ == "Debuffs" or bar.data.typ == "CCs" or bar.data.typ == "Dots") then |
bar.pos = b.pos |
bar.order = true |
break |
end |
end |
if not bar.order then |
ftext = sb:GetFixedText(bar.pos) |
sb:SetFixedText(nil, bar.pos) |
sb:SetFixedText(ftext, curpos) |
--ftext = sb:GetFixedText(bar.pos) |
--sb:SetFixedText(nil, bar.pos) |
--sb:SetFixedText(ftext, curpos) |
bar.pos = curpos |
bar.order = true |
curpos = curpos + 1 |
firstshortbuff = nil |
else |
for _, b in pairs(bars) do |
if b.order and not bar.order and b.data.typ == bar.data.typ then |
if b.order and not bar.order and b.data and b.data.typ == bar.data.typ then |
bar.pos = b.pos |
bar.order = true |
break |
firstbossmod = nil |
else |
for _, b in pairs(bars) do |
if b.order and not bar.order and b.data.typ == bar.data.typ then |
if b.order and not bar.order and b.data and b.data.typ == bar.data.typ then |
bar.pos = b.pos |
bar.order = true |
break |
end |
end |
end |
elseif positions[i] == "Cooldowns" and bar.data and (bar.data.typ == "Cooldowns" or bar.data.typ == "ItemCooldowns" or bar.data.typ == "InternalCooldowns") then |
if firstcooldown then |
bar.pos = curpos |
firstcooldown = nil |
else |
for _, b in pairs(bars) do |
if b.order and not bar.order and b.data.typ == bar.data.typ then |
if b.order and not bar.order and b.data and (b.data.typ == "Cooldowns" or b.data.typ == "ItemCooldowns" or b.data.typ == "InternalCooldowns") then |
bar.pos = b.pos |
bar.order = true |
break |
end |
end |
end |
iterateFixedText() |
end |
local function getBarPos(uid, typ) |
local positions = {strsplit(",", CompactBars.db.profile.barorder)} |
if CompactBars.db.profile.eshortbuffs then |
if pos["Shortbuffs"] < debuffpos then |
if typ == "Shortbuffs" then |
return init |
return 0--init |
end |
init = init + 1 |
else |
if CompactBars.db.profile.ecooldowns then |
if pos["Cooldowns"] < debuffpos then |
if typ == "Cooldowns" then |
return init |
return 0--init |
end |
else |
if typ == "Cooldowns" then |
if CompactBars.db.profile.einternalcooldowns then |
if pos["Cooldowns"] < debuffpos then |
if typ == "InternalCooldowns" then |
return init |
return 0--init |
end |
else |
if typ == "InternalCooldowns" then |
if CompactBars.db.profile.ebossmods then |
if pos["Bossmods"] < debuffpos then |
if typ == "Bossmods" then |
return init |
return 0--init |
end |
init = init + 1 |
else |
for _, bar in pairs(bars) do |
if bar.data then |
if bar.data.dguid == uid and bar.data.typ == typ then |
return bar.pos |
return 0--bar.pos |
end |
end |
end |
for _, bar in pairs(bars) do |
if bar.data then |
if bar.data.dguid == uid then |
return bar.pos |
return 0--bar.pos |
end |
end |
end |
if findflag then |
return findFirstEmptyBar(init) |
end |
return findFirstEmptyBar(debuffpos) |
return 0--findFirstEmptyBar(debuffpos) |
end |
function CompactBars:GetBarPos(uid, typ) |
return getBarPos(uid, typ) |
return "Debuffs" |
elseif CompactBars:GetSpellInfo("CCs", spellid) then |
return "CCs" |
elseif CompactBars:GetSpellInfo("Shortbuffs", spellid) then |
elseif CompactBars:GetSpellInfo("Shortbuffs",spellid) then |
return "Shortbuffs" |
elseif CompactBars:GetSpellInfo("InternalCooldowns", spellid) then |
return "InternalCooldowns" |
return "SharedDebuffs" |
else return false end |
end |
local function createSpellInfo(dguid, spellid, typ) |
local function createSpellInfo(dguid, spellid, typ, name) |
if not typ then return false end |
local infos = newList() |
infos.dguid = dguid |
infos.spellid = spellid |
infos.typ = typ |
infos.name = name |
return infos |
end |
local link = GetSpellLink(name, rank) |
if link then |
local spellid = string.match(link, "Hspell:(%d+)") |
local info = createSpellInfo(UnitGUID("target"), spellid, CompactBars:getTyp(spellid)) |
local info = createSpellInfo(UnitGUID("target"), spellid, CompactBars:getTyp(spellid), UnitName("target")) |
if info and (info.typ == "SharedDebuffs" or ismine) then |
if info then |
spellid = tonumber(spellid) |
local info, dur, appl, color, colorzero |
if auraType == "BUFF" then |
if event == "SPELL_AURA_APPLIED" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid), dname) |
if not info then return end |
dur, appl, color, colorzero = CompactBars:GetSpellInfo("Shortbuffs", spellid) |
if not dur then return end |
if not tonumber(dur) then return end |
if not color then |
color, colorzero = schoolColor(spellschool) |
if dur then |
if tonumber(dur) then |
if not color then |
color, colorzero = schoolColor(spellschool) |
end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if appl then |
color.a = (1/appl) * (color.a or 1) |
end |
if not isBarActive(info) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), tonumber(dur), 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, self.db.profile.bartexture) |
CompactBars:updateBarPos() |
end |
end |
end |
if not colorzero then colorzero = deepCopy(color); colorzero.a = 0.1 end |
if appl then |
color.a = (1/appl) * (color.a or 1) |
if info then |
deepDel(info) |
end |
if not isBarActive(info) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), tonumber(dur), 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, self.db.profile.bartexture) |
CompactBars:updateBarPos() |
end |
deepDel(info) |
info = nil |
-- internal cooldowns |
info = createSpellInfo(UnitGUID("player"), spellid, "InternalCooldowns") |
info = createSpellInfo(UnitGUID("player"), spellid, "InternalCooldowns", dname) |
dur, appl, color, colorzero = CompactBars:GetSpellInfo("InternalCooldowns", spellid) |
if not dur then return end |
if not tonumber(dur) then return end |
end |
-- ic end |
elseif event == "SPELL_AURA_REMOVED" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid), dname) |
if not info then return end |
if not (info.typ == "InternalCooldowns") then |
hideBar(info) |
end |
elseif event == "SPELL_AURA_APPLIED_DOSE" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid), dname) |
if not info then return end |
dur, appl, color, colorzero = self:GetSpellInfo("Shortbuffs", spellid) |
if not color then |
setBarDur(deepCopy(info), self:GetSpellInfo("Shortbuffs", spellid)) |
setBarColor(info, color, colorzero) |
elseif event == "SPELL_AURA_REFRESH" and (dguid == UnitGUID("player") or dguid == UnitGUID("pet")) then |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid)) |
info = createSpellInfo(UnitGUID("player"), spellid, self:getTyp(spellid), dname) |
if not info then return end |
dur, appl, color, colorzero = self:GetSpellInfo("Shortbuffs", spellid) |
setBarDur(deepCopy(info), dur) |
if event == "SPELL_AURA_APPLIED" then |
if CompactBars:GetSpellInfo("SharedDebuffs", spellid) or (sguid == UnitGUID("player")) then |
if (self.db.profile.owndots and dguid == UnitGUID("target")) or (not self.db.profile.owndots) then |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid), dname) |
if not info then return end |
expT[spellid..dguid] = select(7, debuffCheck(spellname, spellid)) |
dur, appl, color, colorzero = self:GetSpellInfo(info.typ, spellid) |
if not isBarActive(info) and getBarPos(info.dguid, info.typ) then |
sb:CreateBar(deepCopy(info), dur, 0, nil, select(3, GetSpellInfo(spellid)), getBarPos(info.dguid, info.typ), color, colorzero, self.db.profile.bartexture) |
CompactBars:updateBarPos() |
if not self.db.profile.owndots then |
if not self.db.profile.ehidetext then |
sb:SetFixedText(dname, getBarPos(info.dguid, info.typ)) |
end |
end |
--if not self.db.profile.owndots then |
-- if not self.db.profile.ehidetext then |
--sb:SetFixedText(dname, getBarPos(info.dguid, info.typ)) |
-- end |
--end |
CompactBars.colorcache[spellid] = deepCopy(color) |
end |
end |
-- temorary fix end! |
-- |
------------------------------------------ |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid), dname) |
if not info then return end |
setBarDur(deepCopy(info), self:GetSpellInfo(info.typ, spellid)) |
-- this event does not provide sguid! returns 0 |
-- temorary fix end! |
-- |
------------------------------------------ |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid), dname) |
if not info then return end |
dur, appl, color, colorzero = self:GetSpellInfo(info.typ, spellid) |
if not color then |
setBarDur(deepCopy(info), self:GetSpellInfo(info.typ, spellid)) |
setBarColor(info, color, colorzero) |
elseif event == "SPELL_AURA_REMOVED" and (sguid == UnitGUID("player") or CompactBars:getTyp(spellid) == "SharedDebuffs") then |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid)) |
info = createSpellInfo(dguid, spellid, self:getTyp(spellid), dname) |
if not info then return end |
expT[spellid..dguid] = nil |
hideBar(info) |
L["Warlock"] = "Hexenmeister" |
L["Warrior"] = "Krieger" |
L["General"] = "Allgemein" |
L["General"] = "Allgemein" |
L["Shared debuffs are things that can be refreshed from other people (eg Sunder Armor)"] = "Geteilte Debuffs sind debuffs die von anderen Personen erneuert werden können (z.B. Rüstung zerreiÃen)" |
L["This should return the time. For example if you want that this spell is 10 seconds then type: return 10 (you can use any lua code here)"] = "Sollte die Zeit zurück geben. Wenn man einen Zauber will, der 10 Sekunden lang ist, dann muss man hier return 10 eintippen" |
L["The class which uses the spell"] = "Die Klasse welche den Zauber benutzt" |
local function bwWipeBars() |
local wpos = CompactBars:GetBarPos(0, "Bossmods") |
local bars = CompactBars.sb:GetBars() |
if not bars or #bars == 0 then return end |
for _, bar in bars do |
if bar and bar.pos and bar.pos == wpos then |
bar.start = nil |