WoWInterface SVN oUF_AuraBars

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 15 to Rev 16
    Reverse comparison

Rev 15 → Rev 16

trunk/oUF_AuraBars/oUF_AuraBars.lua
136,10 → 136,13
if(not bar:IsVisible()) then
break
end
 
local timeleft = bar.aura.expirationTime - timenow
bar:SetValue(timeleft)
bar.spelltime:SetText(FormatTime(timeleft))
if bar.aura.noTime then
bar.spelltime:SetText()
else
local timeleft = bar.aura.expirationTime - timenow
bar:SetValue(timeleft)
bar.spelltime:SetText(FormatTime(timeleft))
end
end
end
 
155,17 → 158,18
Main update function, gathers the buffs/debuffs base on a filter. Then for each buff/debuff a status bar is shown
monitoring it's remaining time.
]]--
local auras = {}
 
local function Update(self, event, unit)
if(self.unit ~= unit) then return end
local helpOrHarm = UnitIsFriend("player",unit) and "HELPFUL" or "HARMFUL"
 
-- Create a table of auras to display
local auras = {}
local lastAuraIndex = 0
for index = 1, 40 do
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(unit, index, helpOrHarm)
if(not name) then break end
 
 
if((self.AuraBars.filter or DefaultFilter)(name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable)) then
lastAuraIndex = lastAuraIndex + 1
-- Is all this info really necessary?
179,6 → 183,7
auras[lastAuraIndex].expirationTime = expirationTime
auras[lastAuraIndex].unitCaster = unitCaster
auras[lastAuraIndex].isStealable = isStealable
auras[lastAuraIndex].noTime = ( duration == 0 and expirationTime == 0)
end
end
 
200,26 → 205,40
bar.aura = aura
 
-- Configure
bar:SetMinMaxValues(0, aura.duration)
bar:SetValue(aura.expirationTime - GetTime())
if bar.aura.noTime then
bar:SetMinMaxValues(0, 1)
bar:SetValue(1)
else
if self.AuraBars.scaleTime then
local maxvalue = math.min(self.AuraBars.scaleTime, bar.aura.duration)
bar:SetMinMaxValues(0, maxvalue)
bar:SetWidth(
( maxvalue / self.AuraBars.scaleTime ) *
( ( self.AuraBars.auraBarWidth or self.AuraBars:GetWidth() ) -
( bar:GetHeight() + self.AuraBars.gap or 0 ) ) ) -- icon size + gap
else
bar:SetMinMaxValues(0, bar.aura.duration)
end
bar:SetValue(bar.aura.expirationTime - GetTime())
end
 
bar.icon:SetTexture(aura.icon)
bar.icon:SetTexture(bar.aura.icon)
 
local spellText
if(aura.count > 1) then
spellText = string.format("%s [%d]", ShortenedSpellName(aura.name,20), aura.count)
if(bar.aura.count > 1) then
spellText = string.format("%s [%d]", ShortenedSpellName(aura.name,20), bar.aura.count)
else
spellText = ShortenedSpellName(aura.name,20)
spellText = ShortenedSpellName(bar.aura.name,20)
end
 
bar.spellname:SetText(spellText)
bar.spelltime:SetText(FormatTime(aura.expirationTime-GetTime()))
bar.spelltime:SetText(FormatTime(bar.aura.expirationTime-GetTime()))
 
-- Colour bars
local r, g, b = 0.2, 0.6, 1.0 -- Colour for buffs (This is Magic Blue)
local bgMod = 0.5
if(helpOrHarm == "HARMFUL") then
local debuffType = aura.debuffType and aura.debuffType or "none"
local debuffType = bar.aura.debuffType and bar.aura.debuffType or "none"
r, g, b = DebuffTypeColor[debuffType].r, DebuffTypeColor[debuffType].g, DebuffTypeColor[debuffType].b
end
bar:SetStatusBarColor(r, g, b)