WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF_AuraBars (https://www.wowinterface.com/forums/showthread.php?t=44360)

sirann 09-14-12 04:48 PM

oUF_AuraBars
 
So I tried modifying/adding some code to this plug in. Essentially I'd like 4 aura blocks, player buffs, player debuffs, target buffs, target debuffs.

It seemed to me there was no easy way to separate buff from debuff other than to write a separate function that only chose buffs, and alter the current function to only choose debuffs.

The following is the code that I came up with:

http://pastebin.com/V0uFmRGD

Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:271: Usage: UnitDebuff("unit", [index] or ["name", "rank"][, "filter"])
Time: 09/14/12 18:46:54
Count: 1
Stack: [C]: ?
[C]: ?
Interface\FrameXML\RestrictedFrames.lua:604: in function <Interface\FrameXML\RestrictedFrames.lua:603>
Interface\FrameXML\RestrictedFrames.lua:742: in function `CallMethod'
[string "                local header = self:GetParent()..."]:44: in function <[string "                local header = self:GetParent()..."]:1>
(tail call): ?
[C]: ?
Interface\FrameXML\RestrictedExecution.lua:441: in function <Interface\FrameXML\RestrictedExecution.lua:412>
Interface\FrameXML\SecureGroupHeaders.lua:108: in function <Interface\FrameXML\SecureGroupHeaders.lua:102>
Interface\FrameXML\SecureGroupHeaders.lua:158: in function <Interface\FrameXML\SecureGroupHeaders.lua:115>
Interface\FrameXML\SecureGroupHeaders.lua:393: in function <Interface\FrameXML\SecureGroupHeaders.lua:382>
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:100: in function <Interface\FrameXML\SecureStateDriver.lua:95>
Interface\FrameXML\SecureStateDriver.lua:164: in function <Interface\FrameXML\SecureStateDriver.lua:146>
[C]: in function `SetAttribute'
Interface\FrameXML\SecureStateDriver.lua:11: in function `RegisterAttributeDriver'
Interface\AddOns\oUF\ouf.lua:411: in function `SpawnHeader'
Interface\AddOns\oUF_Skaarj\layout.lua:442: in function `func'
Interface\AddOns\oUF\factory.lua:13: in function <Interface\AddOns\oUF\factory.lua:10>
(tail call): ?

Locals: <none>

Is the error I get upon login. Any help or ideas would be greatly appreciated :)

Phanx 09-14-12 06:05 PM

This is the problem:
Code:

oUF:AddElement('AuraBars', UpdateBuff, UpdateDebuff, EnableBuff, EnableDebuff, DisableBuff, DisableDeuff)
AddElement only accepts four arguments: (1) the element name, (2) the update function, (3) the enable function, and (4) the disable function. You can't register multiple elements in one AddElement call, or change the order of the arguments.

(Also, "DisableDeuff" is misspelled.)

If you want separate elements for buffs and debuffs, you need to add them separately:
Code:

oUF:AddElement('AuraBarsBuff', UpdateBuff, EnableBuff, DisableBuff)
oUF:AddElement('AuraBarsDebuff', UpdateDebuff, EnableDebuff, DisableDebuff)

Also, I'd suggest using the names "BuffBars" and "DebuffBars" instead of "AuraBarsBuff" and "AuraBarsDebuff"; they're shorter, and more descriptive.

Also, a lot of that code is really inefficient; I'm not sure whether that was in the original module, or part of your changes. Creating 2-82 tables every time the unit's auras change (1-41 in each UpdateBuff and UpdateDebuff) is basically a memory leak, and your module will consume memory like a horde of kids in a candy store. Reuse tables as much as possible, instead of simply discarding them and creating new ones.

Consistent indentation, and separating blocks with empty lines, will also help the code be more readable.

Compare your UpdateDebuff function with:
Code:

local debuffs = {} -- Only create one table, and reuse it.

local function UpdateDebuff(self, event, unit)
        if self.unit ~= unit then return end

        local auraBarsDebuff = self.AuraBarsDebuff

        local numDebuffs = 0
        for index = 1, 40 do
                local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitDebuff(unit, index)
                if not name then break end
                if auraBarsDebuff.filter(self, unit, name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID) then
                        local t = debuffs[i] or {} -- Reuse tables where possible.
                        t.name = name
                        t.rank = rank
                        t.icon = icon
                        t.count = count
                        t.debuffType = debuffType
                        t.duration = duration
                        t.expirationTime = expirationTime
                        t.unitCaster = unitCaster
                        t.isStealable = isStealable
                        t.noTime = duration == 0 and expirationTime == 0
                        t.filter = auraBarsDebuff.enemyAuraType
                        t.shouldConsolidate = shouldConsolidate
                        t.spellID = spellID
                        debuffs[i] = t
                        numDebuffs = i
                end
        end

        -- Clear unused debuff slots.
        for i = numDebuffs + 1, #debuffs do
                debuffs[i] = nil
                -- wipe(debuffs[i]) would be better, but then you would need to either:
                -- (a) accomodate empty tables in your sort function, putting them at the end,
                -- or (b) introduce a table pool and recycling scheme.
        end

        if auraBarsDebuff.sort then
                table.sort(debuffs, type(auraBarsDebuff.sort) == 'function' and auraBarsDebuff.sort or nil) -- no need to pass the global "sort"
        end

        local bars = auraBarsDebuff.bars
        for index = 1, #debuffs do
                if auraBarsDebuff:GetWidth() == 0 then
                        break
                end

                local frame = bars[index]
                if not frame then
                        frame = CreateAuraBar(self, index == 1 and auraBarsDebuff or bars[index - 1])
                        bars[index] = frame
                end

                local bar = frame.statusBar
                frame.index = index

                local aura = debuffs[index]
                bar.aura = aura

                if aura.noTime then -- you already have a local aura, no need to spend an extra table lookup getting it out of bar.aura
                        bar:SetMinMaxValues(0, 1)
                        bar:SetValue(1)
                else
                        if auraBarsDebuff.scaleTime then
                                local maxvalue = math.min(auraBarsDebuff.scaleTime, bar.aura.duration)
                                bar:SetMinMaxValues(0, maxvalue)
                                bar:SetWidth((maxvalue/auraBarsDebuff.scaleTime)*((auraBarsDebuff.auraBarWidth or auraBarsDebuff:GetWidth())-(bar:GetHeight()+(auraBarsDebuff.gap or 0))))-- icon size + gap
                        else
                                bar:SetMinMaxValues(0, aura.duration)
                        end
                        bar:SetValue(aura.expirationTime - GetTime())
                end

                bar.icon:SetTexture(aura.icon)

                bar.spellname:SetText(aura.count > 1 and string.format("%s [%d]", bar.aura.name, aura.count) or aura.name)
                bar.spelltime:SetText(not bar.noTime and FormatTime(aura.expirationTime-GetTime()))

                local debuffType = aura.debuffType or 'none'
                r, g, b = DebuffTypeColor[debuffType].r, DebuffTypeColor[debuffType].g, DebuffTypeColor[debuffType].b
                if auraBarsDebuff.debuffColor then
                        r, g, b = unpack(auraBarsDebuff.debuffColor)
                end
                bar:SetStatusBarColor(r, g, b)

                frame:Show()
        end

        for index = #auras + 1, #bars do
                bars[index]:Hide()
        end

        if auraBarsDebuff.PostUpdate then
                auraBarsDebuff:PostUpdate(event, unit)
        end
end

(Might be some drycoded errors in there; I didn't load it in-game.)

sirann 09-15-12 10:33 AM

First off, thank you for taking the time to fix and optimize my code that you'll never use. That's pretty awesome.

Secondly, I put your suggested code in, but I'm getting this pretty frustrating error. I can't seem to put my finger on what causes it. Sometimes I don't get it for a few minutes, sometimes it's as I start attacking something.

Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:331: attempt to index local 'aura' (a nil value)
Time: 09/15/12 19:54:32
Count: 31
Stack: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:331: in function `func'
Interface\AddOns\oUF\events.lua:14: in function <Interface\AddOns\oUF\events.lua:12>
(tail call): ?

and sometimes this:
Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:331: attempt to index local 'aura' (a nil value)
Time: 09/15/12 19:54:29
Count: 2
Stack: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:331: in function `func'
Interface\AddOns\oUF\ouf.lua:117: in function <Interface\AddOns\oUF\ouf.lua:110>
(tail call): ?
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:83: in function <Interface\FrameXML\SecureStateDriver.lua:73>
Interface\FrameXML\SecureStateDriver.lua:137: in function <Interface\FrameXML\SecureStateDriver.lua:119>

Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:331: attempt to index local 'aura' (a nil value)
Time: 09/15/12 19:55:42
Count: 1
Stack: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:331: in function `func'
Interface\AddOns\oUF\ouf.lua:117: in function <Interface\AddOns\oUF\ouf.lua:110>
(tail call): ?
[C]: in function `CameraOrSelectOrMoveStop'
[string "CAMERAORSELECTORMOVE"]:4: in function <[string "CAMERAORSELECTORMOVE"]:1>

Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:163: attempt to index field 'aura' (a nil value)
Time: 09/15/12 19:55:48
Count: 306
Stack: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:163: in function <Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:150>

Attached is the updated code. Please note, the bars work flawlessly (except getting them to grow up and down independently) unless this error happens.

http://pastebin.com/SK47CrRG

Phanx 09-16-12 01:27 AM

Oh, I think I see what the problem is. Try this:
Code:

local debuffs = {}

local function UpdateDebuff(self, event, unit)
        if self.unit ~= unit then return end
        local DebuffBars = self.DebuffBars

        local numDebuffs = 0

        for i = 1, 40 do
                local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitDebuff(unit, i)
                if not name then break end

                if DebuffBars.filter(self, unit, name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID) then
                        numDebuffs = numDebuffs + 1

                        local t = debuffs[numDebuffs]
                        if not t then
                                t = table_create()
                                debuffs[numDebuffs] = t
                        end

                        t.name = name
                        t.rank = rank
                        t.icon = icon
                        t.count = count
                        t.debuffType = debuffType
                        t.duration = duration
                        t.expirationTime = expirationTime
                        t.unitCaster = unitCaster
                        t.isStealable = isStealable
                        t.noTime = duration == 0 and expirationTime == 0
                        t.filter = DebuffBars.enemyAuraType
                        t.shouldConsolidate = shouldConsolidate
                        t.spellID = spellID
                end
        end

        for i = #debuffs, numDebuffs + 1, -1 do
                debuffs[i] = table_delete(debuffs[i])
        end

        table.sort(debuffs, DebuffBars.sort or default_sort)

        local bars = DebuffBars.bars
        for i = 1, numDebuffs do
                if DebuffBars:GetWidth() == 0 then
                        break
                end

                local bar = bars[i]
                if not bar then
                        bar = CreateAuraBar(self, i == 1 and DebuffBars or bars[i - 1])
                        bars[i] = bar
                end
                bar:Show()

                local statusbar = bar.statusBar

                local debuff = debuffs[i]
                bar.aura = debuff

                if debuff.noTime then -- something weird here
                        statusbar:SetMinMaxValues(0, 1)
                        statusbar:SetValue(1)
                else
                        if DebuffBars.scaleTime then
                                local maxvalue = math.min(DebuffBars.scaleTime, debuff.duration)
                                statusbar:SetMinMaxValues(0, maxvalue)
                                statusbar:SetWidth((maxvalue/DebuffBars.scaleTime)*((DebuffBars.auraBarWidth or DebuffBars:GetWidth())-(statusbar:GetHeight()+(DebuffBars.gap or 0))))-- icon size + gap
                        else
                                statusbar:SetMinMaxValues(0, debuff.duration)
                        end
                        statusbar:SetValue(debuff.expirationTime - GetTime())
                end

                statusbar.icon:SetTexture(debuff.icon)
                statusbar.spellname:SetText(debuff.count > 1 and format("%s [%d]", debuff.name, debuff.count) or debuff.name)
                statusbar.spelltime:SetText(not debuff.noTime and FormatTime(debuff.expirationTime - GetTime()))

                local r, g, b
                local color = DebuffBars.debuffColor
                if color then
                        r, g, b = color[1], color[2], color[3] -- don't use unpack; 3 table lookups is faster than 1 function call
                else
                        color = DebuffTypeColor[debuff.debuffType or "none"]
                        r, g, b = color.r, color.g, color.b
                end
                statusbar:SetStatusBarColor(r, g, b)
        end

        for i = numDebuffs + 1, #bars do
                local bar = bars[i]
                bar.aura = table_delete(bar.aura)
                bar:Hide()
        end
end

Also, add this anywhere before the UpdateBuff and UpdateDebuff functions:
Code:

local table_create, table_delete
do
        local pool = { }

        local function table_create()
                local t = next(pool)
                if t then
                        pool[t] = nil
                end
                return t or {}
        end

        local function table_delete(t)
                if type(t) == "table" then
                        for k, v in pairs(t) do
                                t[k] = nil
                        end
                        t[true] = true
                        t[true] = nil
                        pool[t] = true
                end
                return nil
        end
end

local default_sort = function(a, b)
        if a.noTime then
                if b.noTime then
                        -- both timeless, sort by name REVERSE
                        return a.name < b.name
                else
                        -- a timeless, b not
                        return true
                end
        else
                if b.noTime then
                        -- b timeless, a not
                        return false
                else
                        -- neither timeless, sort by expiry time
                        return a.expires > b.expires
                end
        end
end


sirann 09-16-12 11:34 AM

Relevant section(s) can be found here:

http://pastebin.com/53q2b56C

targeting friendly or non-friendly throws this error: Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:257: attempt to call upvalue 'table_create' (a nil value)

Phanx 09-16-12 10:33 PM

Code:

        local pool = { }

        local function table_new()

Change that to table_create... I need more caffeine or sleep or something. >_<

sirann 09-17-12 05:21 AM

I figured that's what it was. I changed it accordingly and still receive the same error.

turning it into "function table_create()" removing the local, throws the following error: Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:163: attempt to index field 'aura' (a nil value), OnUpdate.

sirann 09-17-12 10:45 AM

So if I'm understanding this correctly, we make a table for buffs with: local buffs = {}

We then make a function, for simplicity sake we'll just stick with the buffs. The function is called UpdateBuffs. It only updates when an event fires, which we register with self:RegisterEvent('UNIT_AURA', UpdateBuff). This function is also unit bound, so there can be target buffs, player buffs, focus buff, insert x frame category buffs all shown independently, and they all update independently. IE, when the player gains a buff, it doesn't cause the target buff UpdateBuff function to fire, thus unnecessarily increasing cpu load. Additionally it's set to fire only for HELPFUL aura changes. So it won't update when the unit gains or loses a debuff.

Next we set a variable, numBuffs to 0. We then set up our index to start at unit buff 1 get all the information from the UnitBuff api at that position, and store them in local variables set up. It continues to check each buff until it doesn't receive a name back (aka out of buffs to check) and breaks.

We create a local t and set it to the individual index of our buffs table created earlier (IE buffs[numBuffs]) so why don't we just use buffs[i] since whatever buff data we just got will be buff number i?

We then set up an if statement,
Lua Code:
  1. if not t then
  2.      t = table_create()
  3.      buffs[numBuffs] = t
  4. end

I don't fully understand this, we're checking to see if we have t, or anything in our buffs table. If we don't we create a table?

We then set buffs[i].locals to the locals that were set with the UnitBuff api.

We now set up a new for statement

Lua Code:
  1. for i = #buffs, numBuffs + 1, -1 do
  2.      buffs[i] = table_delete(buffs[i])
  3. end

so basically we start with the number of buffs in our buffs table and go to the total number of buffs found with numBuffs (isn't that the same as #buffs), and then continue till i = -1? I don't understand the 3 part for loop I guess.

We then sort the buffs using either the BuffsBars.sort function or default_sort.

Now we make a for loop starting at 1 and going until we run out of buffs. The loop makes a bar for each buff and breaks if the width of the bars is set to 0. We create and set a local bar = to bars[i] which is essentially BuffBars.bars[i].

If it discovers there's no bar made yet, it makes it, and decreases the i by one to redo the loop for that buff. We then show the bar.

We create a local statusBar and set it to bar.statusBar which is essentially bars[i].statusBar which is BuffBars.bars[i].statusBar.

We also create a local buff and set it to the individual i in our buffs table.

Now we set bar.aura = buff. This I don't understand, we say that BuffBars.bars[i].aura = buff or in other words BuffBars.bars[i].aura = buffs[i]. Where did .aura even come from? I think this may be where a lot of issue is coming from. I don't see the .aura set up anywhere else. I don't know, I'm pretty awful at coding so maybe I'm just misreading this

Phanx 09-17-12 07:27 PM

Please post your current whole file; without it, identifying the cause of any error is pretty much impossible.

Quote:

Originally Posted by sirann (Post 264381)
... why don't we just use buffs[i] since whatever buff data we just got will be buff number i?

Because you are not adding every buff on the unit to the table. You are only adding buffs that pass the filter. If you only add data to the table at indices 1, 3, 7, and 9, for example, there are holes in your table and that breaks ipairs and sort. You need to keep track of how many buffs you are actually putting in the table.

Quote:

Originally Posted by sirann (Post 264381)
We then set up an if statement,
Lua Code:
  1. if not t then
  2.      t = table_create()
  3.      buffs[numBuffs] = t
  4. end

I don't fully understand this, we're checking to see if we have t, or anything in our buffs table. If we don't we create a table?

If there was previously a table at position 3, we can just reuse it, instead of going through the trouble of "deleting" it and getting a "new" one.

Quote:

Originally Posted by sirann (Post 264381)
Lua Code:
  1. for i = #buffs, numBuffs + 1, -1 do
  2.      buffs[i] = table_delete(buffs[i])
  3. end

so basically we start with the number of buffs in our buffs table and go to the total number of buffs found with numBuffs (isn't that the same as #buffs), and then continue till i = -1? I don't understand the 3 part for loop I guess.

A loop normally increments i (or whatever variable name you're using for your counter) by +1 on each iteration. If you want to use some other increment, you can specify it as the third parameter.

So the above code starts with the total number of values in the buffs table, and increments it down by -1 on each iteration, until it reaches the last index we actually used on this pass, and erases all of the unused ones.

A simpler version would be to clear all of the indices first:
Code:

for i = 1, #buffs do
    buffs[i] = table_delete(buffs[i])
end

... and then fill them back up:
Code:

local t = table_create()
buffs[numBuffs] = t

But that requires more function calls, so it's slightly slower.

Quote:

Originally Posted by sirann (Post 264381)
Now we set bar.aura = buff. This I don't understand, we say that BuffBars.bars[i].aura = buff or in other words BuffBars.bars[i].aura = buffs[i]. Where did .aura even come from?

It didn't "come from" anywhere. You are simply attaching the buff's data table to the bar object, using the key name "aura". It's the same as doing:

Code:

local bar = {}
local aura = { name = "Blah" }
bar.aura = aura
print(bar.aura.name)
==> "Blah"

As for why that's being done, it simply makes it easier to tell which buff the bar is displaying later, when the bar is updated in the OnUpdate script, without having to go look up buffs[i] every time.

sirann 09-17-12 09:59 PM

Here's my current code that's still throwing the error every frame for trying to index aura:

http://pastebin.com/Prhi0c52

and this is the error:

http://pastebin.com/5SJTJFPB

I've commented several things in the UpdateBars function as well as in the UpdateBuff function to see if there's a disconnect in the order.

This is the if statement the error is in:

Lua Code:
  1. if statusbar.aura.noTime then --BuffBars.bars[i].statusBar.aura.noTime
  2.     statusbar.spelltime:SetText() --BuffBars.bars[i].statusBar.spelltime
  3. else
  4.     local timeleft = statusbar.aura.expirationTime - timenow ----BuffBars.bars[i].statusBar.aura.expirationTime
  5.     statusbar:SetValue(timeleft) --BuffBars.bars[i].statusBar
  6.     statusbar.spelltime:SetText(FormatTime(timeleft)) --BuffBars.bars[i].statusBar.spelltime
  7. end

Compared to:

Lua Code:
  1. local bar = bars[i] --BuffBars.bars[i]
  2. local statusbar = bar.statusBar --BuffBars.bars[i].statusBar
  3. local buff = buffs[i]
  4. bar.aura = aura --BuffBars.bars[i].aura
  5. if buff.noTime then --buffs[i].noTime

Phanx 09-18-12 12:30 AM

In your last example:
Code:

local buff = buffs[i]
bar.aura = aura --BuffBars.bars[i].aura

would set "bar.aura" to nil, because "aura" isn't defined. I think you meant "bar.aura = buff" there.

In your current file, line 305:
Code:

local bar = bars[i] --unecessary?  se line 267 above
No, because line 267 is not in scope here. Local only exist inside the "if/for/do/function ... end" block where they are defined with the "local something" declaration. The entire file counts as one big "do ... end" block for the purpose of scoping, but each block inside the file gets its own scope, and they nest like those Russian dolls. Each scope can only "see" variables declared in itself, or in a higher scope that contains itself. Line 267 and line 305 are in parallel scopes of equal depth; neither can "see" any variables defined inside the other.

Edit:

Alright, I just ended up rewriting the whole thing. Tested (as far as the BuffBars element with 2 buffs on a level 12 warlock) and working:

http://www.wowace.com/paste/6263/

Example and options in the comment header at the top of the file.

sirann 09-18-12 02:54 PM

I'm pretty sure you're going to hate me..

I c/p'd the code from your link /6263. Here's my file of it: http://pastebin.com/53q2b56C

I put this code into my oUF_Skaarj layout target function: http://pastebin.com/5BQKvyGL

I received this error
Code:

Message: Interface\AddOns\oUF_Skaarj\layout.lua:288: attempt to index global 'frame' (a nil value)
So I changed the code I put into my oUF_Skaarj layout target function to this: http://pastebin.com/kTTfUHDn
(basically just changed all the frame to self, except for the frame inside of the filterFunc.)

I then received this error:
Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:279: attempt to compare number with nil
which is from
Lua Code:
  1. bar.name:SetText(aura.count > 1 and format("%s [%d]", aura.name, aura.count) or aura.name)

So I realized that count must be setting to nil if the buff/debuff doesn't have a stack, ie something like a mount.

So I changed the code from
Lua Code:
  1. bar.icon:SetTexture(aura.icon)
  2. bar.name:SetText(aura.count > 1 and format("%s [%d]", aura.name, aura.count) or aura.name)

to this

Lua Code:
  1. if aura.count == nil then
  2.     aura.count = 0
  3. end
  4.        
  5. bar.icon:SetTexture(aura.icon)
  6. bar.name:SetText(aura.count > 1 and format("%s [%d]", aura.name, aura.count) or aura.name)

And now I receive this error:
Code:

Message: Interface\AddOns\oUF_AuraBars\oUF_AuraBars.lua:292: Usage: <unnamed>:SetMinMaxValues(min, max)
which is from
Lua Code:
  1. if aura.duration == 0 then
  2.     bar.duration, bar.expirationTime = nil, nil
  3.     bar:SetMinMaxValues(0, 1)
  4.     bar:SetValue(1)
  5.     bar.time:SetText(nil)
  6. else
  7.     bar.duration, bar.expirationTime = aura.duration, aura.expirationTime
  8. ->  bar:SetMinMaxValues(0, aura.duration)
  9.     -- No need to set the value or time text here; the OnUpdate will do it.
  10.     numAurasWithDuration = numAurasWithDuration + 1
  11. end

Phanx 09-18-12 09:36 PM

You should really use the entire file I posted; you left half of it out in your paste, and my code was not even remotely designed to be dropped into the middle of some other code. It's a total rewrite from scratch, not just a few changes here and there. If you're using code in your layout based on the example in the file I posted, of course you're going to get endless errors if you're not actually using the file I posted. :o

sirann 09-19-12 05:55 AM

It took me a few minutes to figure out what you could have been referring to, the original pastebin link I have is invalid. That's not what I have as my file. I have this as my file: http://pastebin.com/nLRdQH6y

I apologize for the mix up in the links I sent out.

Phanx 09-19-12 04:38 PM

I have no idea why you changed all of the variable names in my code. Variables are not aware of their names, only their values. You only need to pass in the right value from your code. In your code, the frame object is the value of the variable named "self", so you need to pass "self" into the function. It doesn't matter if the function then refers to that value as "frame" or "kazoo". Only the order of arguments matter.

A more efficient solution to the nil count problem is to store nil counts as 1 in the first place, since that's techincally accurate; a buff with no charges effectively has 1 charge.

Finally, while I'm not really picky about being credited for stuff, I have put a lot of time into helping you with this, and does seem a little insulting that you would remove the "Rewritten by Phanx" comment from the file, when it being there has absolutely no effect on the functionality of the file because it's in a comment. :rolleyes:

Fixed count issue:
http://www.wowace.com/paste/6276/

Don't change random variable names in the module; just pass the right value from your code:
Code:

target = function(self, ...)
        Shared(self, ...)

        local BuffBars = CreateFrame("Frame", nil, self)
        BuffBars:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 20, 10)
        BuffBars:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, 10)
        self.BuffBars = BuffBars

        BuffBars.barHeight = 15
        BuffBars.fontFile = cfg.font
        BuffBars.fontOutline = "MONOCHROMETHINOUTLINE"
        BuffBars.nameSize = 8
        BuffBars.timeSize = 9
        BuffBars.customFilter = function() return true end -- No need to catch incoming arguments and assign them to named variables when you're not using any of them.


sirann 09-19-12 06:13 PM

First let me apologize for the misunderstanding that's seemingly occurred. I never removed your "Rewritten by Phanx" from the beginning instructions. If you look at your first pass at the code, it wasn't there. I must have copied it by mistake and thus it wasn't in my file. I will revise by saying I didn't touch the comment up there, the version I copied (mistakenly) did not have that comment.

Secondly, I want to thank you for the time you've put into writing this addon. It's hard for me to show appreciation, especially when you probably think I'm an idiot who keeps ****ing up your code and posting the oops aftermath.

Thirdly, your latest revision, 6276, you added the "or 0" to count. You also have to do this for duration, as timeless buffs/debuffs are set to nil, this messes with your later if statement and throws an error:
Lua Code:
  1. if aura.duration == 0 then
  2.     bar.duration, bar.expirationTime = nil, nil
  3.     bar:SetMinMaxValues(0, 1)
  4.     bar:SetValue(1)
  5.     bar.time:SetText(nil)
  6. else
  7.     bar.duration, bar.expirationTime = aura.duration, aura.expirationTime
  8.     --print (aura.duration)
  9.     bar:SetMinMaxValues(0, aura.duration)
  10.     -- No need to set the value or time text here; the OnUpdate will do it.
  11.     numAurasWithDuration = numAurasWithDuration + 1
  12. end

Line 46 should read: local format, min, next, pairs, type, sort = format, min, next, pairs, type, sort the type, sort were backwards. I also added if not name then break end to the Update function under the if filterFunc(...

Line 81 should read return a.duration > b.duration or maybe a.expirationTime > b.expirationTime. Either way expires won't work.

Line 221 was a function calling itself causing a stack overflow I believe:
Lua Code:
  1. function table_delete(t)
  2.         if type(t) == "table" then
  3.             for k, v in pairs(t) do
  4.                 --t[k] = table_delete(t)
  5.                 t[k] = nil
  6.             end
  7.             t[true] = true
  8.             t[true] = nil
  9.             pool[t] = true
  10.         end
  11.         return nil
  12.     end

The commented out code was the line you posted in your latest revision, the t[k] = nil was the line that was in your previous table_delete(t) function.

Fourthly, this is working exactly how I wanted it. I don't know what to say besides thank you for making a reality what I've dreamt about for a few years. My final request is to be able to color bars by dispelType, DebuffTypeColor[element.dispelType or "none"] for debuffs but not buffs

Phanx 09-20-12 02:07 AM

UnitAura actually seems to be returning 0 for both count and duration on auras with no charges or duration, respectively, but I've added some more checks just in case.

Quote:

Originally Posted by sirann (Post 264593)
My final request is to be able to color bars by dispelType, DebuffTypeColor[element.dispelType or "none"] for debuffs but not buffs

Set BuffBars.dispelTypeColors = true.

http://www.wowace.com/paste/6279/

sirann 01-19-15 01:01 PM

Holy mother of necros, but, I'm curious if you think it would be possible to edit either the oUF_AuraBars.lua or my oUF layout to check (on PLAYER_TARGET_CHANGED) if the target is the same unit as one of the boss frames, and if so, hide the debuffbar frame associated with the respective boss..n's frame. All attempts thus far have either, a, caused an LUA error, or b, caused it to hide both target and all said boss' debuffbar frame.

I suppose I could write something in the oUF_AuraBars code that would create a frame, registerevent player_target_changed, and then do an on event script of
Lua Code:
  1. for i = 1, 5 if UnitIsUnit('target', 'boss'..i) then
  2.     oUF_TerennaBoss..i.DebuffBars:Hide()
  3. else
  4.     oUF_TerennaBoss..i.DebuffBars:Show()
  5. end

Would that last suggestion even work?

Phanx 01-19-15 04:46 PM

Possible, certainly, but that snippet you posted has a syntax error on almost every line. :p

1. The proper format is "for ... do" just like "if ... then" -- you are missing the "do" keyword.

2. You have an "if ... else ... end" inside of a "do ... (end)" but you are missing the last "end" keyword.

3. The second and third lines will throw errors about attempting to concatenate nil values. You need to (a) put quotes around the "oUF_TerennaBoss" part to make it a string value and (b) wrap that and the "..i" in a _G[...] lookup to actually get a refererence to the global object.

Code:

for i = 1, 5 do
    if UnitIsUnit('target', 'boss'..i) then
        _G["oUF_TerennaBoss"..i].DebuffBars:Hide()
    else
        _G["oUF_TerennaBoss"..i].DebuffBars:Show()
    end
end


sirann 01-19-15 05:13 PM

Quote:

Originally Posted by Phanx (Post 305302)
Possible, certainly, but that snippet you posted has a syntax error on almost every line. :p

Quote:

Originally Posted by Phanx (Post 305302)
has a syntax error on almost every line. :p

Quote:

Originally Posted by Phanx (Post 305302)
almost every

So you're telling me there's a chance

e: where are my manners, thank you very much, as always, Phanx!

Phanx 01-19-15 05:44 PM

Quote:

Originally Posted by sirann (Post 305306)
So you're telling me there's a chance

Yes, your "else" was spot on! :D

Terenna 07-29-18 08:21 AM

I came across this thread, and was interested in your rewrite, Phanx. I was curious if you still had the pastecode you uploaded on curseforge some years back. The links now lead to dead ends, and it looks like no one uploaded the addon officially.

If not, no worries, thank you!

Phanx 07-29-18 06:08 PM

Nope, sorry.

Terenna 07-29-18 08:30 PM

Thank you so very much

neverg 07-30-18 12:54 AM

You can pretty much copy my module from oUF_Lumen.



https://github.com/greven/oUF_Lumen/.../bartimers.lua

Check here on how to call them: https://github.com/greven/oUF_Lumen/...its/player.lua

You'll still need a PostUpdate function and a list of buffs / debuffs to track.

Hope it helps you.

Terenna 07-30-18 05:33 AM

Thanks Neverg, I'll have to try that out, it looks very similar.

Azgaurd 08-28-18 02:12 PM

Quote:

Originally Posted by Terenna (Post 329184)
Thanks Neverg, I'll have to try that out, it looks very similar.

If you wanted to just get oUF AuraBars functioning again i have been keeping my own copy of it working. https://github.com/Wutname1/oUF_AuraBars

Terenna 02-03-19 12:37 AM

So I was able to recover the file. It required a few fixes to make it up to date. But if anyone wants a Phanx's oUF_Aurabars module, here it is:
Lua Code:
  1. --[[--------------------------------------------------------------------
  2. oUF_AuraBars
  3. Provides BuffBars and DebuffBars elements.
  4. Rewritten by Phanx.
  5.  
  6. Example:
  7.  
  8.     local BuffBars = CreateFrame("Frame", nil, frame)
  9.     BuffBars:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 0, 10)
  10.     BuffBars:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 0, 10)
  11.     frame.BuffBars = BuffBars
  12.  
  13. Options:
  14.  
  15.     BuffBars.barHeight
  16.         - height of each bar
  17.         - defaults to 16
  18.         - width is controlled by the element's width
  19.  
  20.     BuffBars.fontFile
  21.         - font file for bar text
  22.         - defaults to health bar value's font or GameFontNormal
  23.     BuffBars.fontOutline
  24.         - outline style for bar text
  25.     BuffBars.nameSize
  26.         - font size for spell names
  27.         - defaults to 10
  28.     BuffBars.timeSize
  29.         - font size for spell durations
  30.         - defaults to 10
  31.     BuffBars.customColor
  32.         - table with r/g/b key values for the element's bars
  33.         - defaults to green buffs and red debuffs
  34.     BuffBars.customFilter
  35.         - function that returns whether or not to show an aura
  36.         - defaults to showing boss debuffs, anything cast by the player or pet, or anything self-applied on an enemy
  37.     BuffBars.customSort
  38.         - function that sorts the auras
  39.         - defaults to showing timeless first, then the rest in descending order by duration
  40.  
  41.     BuffBars.dispelTypeColors
  42.         - use debuff type colors for auras with types (magic, disease, etc)
  43.         - for auras with no type, see the .customColor option above
  44. ----------------------------------------------------------------------]]
  45.  
  46. local _, ns = ...
  47. local oUF = ns.oUF or oUF
  48. assert(oUF, "oUF_AuraBars was unable to locate oUF install.")
  49.  
  50. -- Upvalues for faster access:
  51. local format, min, next, pairs, sort, type = format, min, next, pairs, sort, type
  52. local UnitAura, UnitCanAttack, UnitIsUnit = UnitAura, UnitCanAttack, UnitIsUnit
  53.  
  54. ------------------------------------------------------------------------
  55. --  DEFAULTS
  56.  
  57. --  Override with element.customColor
  58. local defaultColors = {
  59.     HELPFUL = { r = 0, g = 0.6, b = 0 },
  60.     HARMFUL = { r = 0.8, g = 0, b = 0 },
  61. }
  62.  
  63. --  Override with element.customFilter
  64. local function defaultAuraFilter(frame, unit, name, icon, count, dispelType, duration, expirationTime, casterUnit, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3)
  65.     if isBossDebuff then
  66.         return true
  67.     elseif not casterUnit then
  68.         return UnitCanAttack("player", unit)
  69.     else
  70.         return UnitIsUnit(casterUnit, "player") or UnitIsUnit(casterUnit, "pet") or UnitIsUnit(casterUnit, "vehicle")
  71.     end
  72. end
  73.  
  74. --  Override with element.customSort
  75. local function defaultAuraSort(a, b)
  76.     if a.duration == 0 then
  77.         if b.duration == 0 then
  78.             return a.name < b.name
  79.         else
  80.             return true
  81.         end
  82.     else
  83.         if b.duration == 0 then
  84.             return false
  85.         else
  86.             return a.expirationTime > b.expirationTime
  87.         end
  88.     end
  89. end
  90.  
  91. ------------------------------------------------------------------------
  92. --  CREATE BARS
  93.  
  94. local function UpdateLayout(element)
  95.     local bars = element.bars
  96.  
  97.     local a, b, c, d = "BOTTOMLEFT", "TOPLEFT", "BOTTOMRIGHT", "TOPRIGHT"
  98.     if element.growDown then
  99.         a, b, c, d = b, a, d, c
  100.     end
  101.  
  102.     for i = 1, #bars do
  103.         local bar = bars[i]
  104.         bar:ClearAllPoints()
  105.         if i > 1 then
  106.             bar:SetPoint(a, bars[i-1], b, 0, 0)
  107.             bar:SetPoint(c, bars[i-1], d, 0, 0)
  108.         else
  109.             bar:SetPoint(a, element, a, bar:GetHeight(), 0) -- leave room for the icon
  110.             bar:SetPoint(c, element, c, 0, 0)
  111.         end
  112.     end
  113. end
  114.  
  115. local function bar_OnEnter(bar)
  116.     local element = bar:GetParent()
  117.     local aura = element.auras[bar.i]
  118.     GameTooltip:SetOwner(bar, "ANCHOR_TOPLEFT")
  119.     GameTooltip:SetUnitAura(element.__owner.unit, aura.index, element.__filter)
  120.     GameTooltip:Show()
  121. end
  122.  
  123. local function bar_OnLeave(bar)
  124.     GameTooltip:Hide()
  125. end
  126.  
  127. local function CreateBar(element, i)
  128.     local bars = element.bars
  129.     assert(#element.bars + 1 ~= bars, "Bad index passed to CreateBar")
  130.  
  131.     local parent = element.__owner
  132.  
  133.     local bar = CreateFrame("StatusBar", nil, element)
  134.     bar:SetHeight(element.barHeight or 16)
  135.     bar:SetStatusBarTexture([[Interface\AddOns\oUF_Terenna\Texture]] or [[Interface\ChatFrame\ChatFrameBackground]])
  136.  
  137.     bar:EnableMouse(true)
  138.     bar:SetScript("OnEnter", bar_OnEnter)
  139.     bar:SetScript("OnLeave", bar_OnLeave)
  140.  
  141.     bar:SetStatusBarColor(.25, .25, .25, 1)
  142.  
  143.     bars[i] = bar
  144.     bar.i = i
  145.  
  146.     -- Add a background:
  147.     local bg = bar:CreateTexture(nil, "BACKGROUND")
  148.     bg:SetAllPoints(true)
  149.     bg:SetTexture([[Interface\AddOns\oUF_Terenna\Texture]] or [[Interface\ChatFrame\ChatFrameBackground]])
  150.     bg:SetVertexColor(1, 1, 1)
  151.     bg:SetAlpha(.35)
  152.     bar.bg = bg
  153.  
  154.     -- Add the icon:
  155.     local icon = bar:CreateTexture(nil, "ARTWORK")
  156.     icon:SetPoint("RIGHT", bar, "LEFT")
  157.     icon:SetHeight(element.barHeight or 16)
  158.     icon:SetWidth(element.barHeight or 16)
  159.     icon:SetTexCoord(0.06, 0.94, 0.06, 0.94)
  160.     bar.icon = icon
  161.  
  162.     -- Add the time text:
  163.     local time = bar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  164.     time:SetPoint("RIGHT", -2, 1)
  165.     time:SetJustifyH("RIGHT")
  166.     time:SetTextColor(1, 1, 1)
  167.     bar.time = time
  168.  
  169.     -- Add the name text:
  170.     local name = bar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  171.     name:SetPoint("LEFT", 2, 1)
  172.     name:SetPoint("RIGHT", time, "LEFT", -2, 0)
  173.     name:SetJustifyH("LEFT")
  174.     name:SetTextColor(1, 1, 1)
  175.     bar.name = name
  176.  
  177.     -- Override the default font:
  178.     local font = element.fontFile or parent.Health.value and parent.Health.value:GetFont()
  179.     if font then
  180.         local size = select(2, GameFontNormal:GetFont())
  181.         local outline = element.fontOutline or parent.Health.value and select(3,parent.Health.value:GetFont())
  182.         time:SetFont(font, element.timeSize or 10)
  183.         name:SetFont(font, element.nameSize or 10)
  184.     end
  185.  
  186.     -- Update the layout:
  187.     UpdateLayout(element)
  188.  
  189.     -- Return the new bar:
  190.     return bar
  191. end
  192.  
  193. ------------------------------------------------------------------------
  194. --  UPDATE TIMES FOR ACTIVE (DE)BUFFS
  195.  
  196. local function UpdateBars(element, elapsed)
  197.     local bars = element.bars
  198.     local now = GetTime()
  199.     for i = 1, #bars do
  200.         local bar = bars[i]
  201.         if bar.duration then
  202.             local remaining = bar.expirationTime - now
  203.             bar:SetValue(remaining)
  204.             bar.time:SetFormattedText(SecondsToTimeAbbrev(remaining))
  205.         end
  206.     end
  207. end
  208.  
  209. ------------------------------------------------------------------------
  210. --  UTILITY FUNCTIONS
  211.  
  212. local table_create, table_delete
  213. do
  214.     local pool = {}
  215.  
  216.     function table_create()
  217.         local t = next(pool)
  218.         if t then
  219.             pool[t] = nil
  220.         end
  221.         return t or {}
  222.     end
  223.  
  224.     function table_delete(t)
  225.         if type(t) == "table" then
  226.             for k, v in pairs(t) do
  227.                 t[k] = table_delete(v)
  228.             end
  229.             t[true] = true
  230.             t[true] = nil
  231.             pool[t] = true
  232.         end
  233.         return nil
  234.     end
  235. end
  236.  
  237. ------------------------------------------------------------------------
  238. --  UPDATE BARS BASED ON CURRENT (DE)BUFFS
  239.  
  240. local function Update(frame, event, unit, elementName)
  241.     if unit ~= frame.unit then return end
  242.     local element = frame[elementName]
  243.  
  244.     local filterFunc = element.customFilter or defaultAuraFilter
  245.     local filter = element.__filter
  246.     local auras = element.auras
  247.     local numAuras = 0
  248.  
  249.     -- Scan all (de)buffs on the unit:
  250.     for i = 1, 40 do
  251.         local name, icon, count, dispelType, duration, expirationTime, casterUnit, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitAura(unit, i, filter)
  252.         if not name then break end
  253.  
  254.         if filterFunc(frame, unit, name, icon, count, dispelType, duration, expirationTime, casterUnit, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3) then
  255.             numAuras = numAuras + 1
  256.  
  257.             -- Store information about this (de)buff:
  258.             local t = auras[numAuras]
  259.             if not t then
  260.                 t = table_create()
  261.                 auras[numAuras] = t
  262.             end
  263.             t.index, t.name, t.icon, t.count, t.dispelType, t.duration, t.expirationTime, t.casterUnit, t.isStealable, t.shouldConsolidate, t.spellID, t.canApplyAura, t.isBossDebuff, t.value1, t.value2, t.value3 = i, name, icon, count or 1, dispelType, duration or 0, expirationTime, casterUnit, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3
  264.         end
  265.     end
  266.  
  267.     -- Clear old stored information:
  268.     for i = numAuras + 1, #auras do
  269.         auras[i] = table_delete(auras[i])
  270.     end
  271.  
  272.     -- Sort the active (de)buffs:
  273.     sort(auras, element.sort or defaultAuraSort)
  274.  
  275.     local bars = element.bars
  276.     local numAurasWithDuration = 0
  277.  
  278.     -- Update the bars:
  279.     for i = 1, numAuras do
  280.         local aura = auras[i]
  281.  
  282.         local bar = bars[i] or CreateBar(element, i)
  283.  
  284.         bar.icon:SetTexture(aura.icon)
  285.         bar.name:SetText(aura.count > 1 and format("%s [%d]", aura.name, aura.count) or aura.name)
  286.  
  287.         if aura.duration == 0 then
  288.             bar.duration, bar.expirationTime = nil, nil
  289.             bar:SetMinMaxValues(0, 1)
  290.             bar:SetValue(1)
  291.             bar.time:SetText(nil)
  292.         else
  293.             bar.duration, bar.expirationTime, bar.spellID = aura.duration, aura.expirationTime, aura.spellID
  294.             bar:SetMinMaxValues(0, aura.duration)
  295.             -- No need to set the value or time text here; the OnUpdate will do it.
  296.             numAurasWithDuration = numAurasWithDuration + 1
  297.         end
  298.        
  299.         if aura.duration == 0 then
  300.             bar:SetStatusBarColor(1, 1, 1, 0.0001)
  301.         elseif element.dispelTypeColors then
  302.             if aura.dispelType then
  303.                 if aura.dispelType == 'Magic' then
  304.                     bar:SetStatusBarColor(0.2, 0.6, 1)
  305.                 elseif aura.dispelType == 'Curse' then
  306.                     bar:SetStatusBarColor(0.6, 0, 1)
  307.                 elseif aura.dispelType ==  'Disease' then
  308.                     bar:SetStatusBarColor(0.6, 0.4, 0)
  309.                 elseif aura.dispelType == 'Poison' then
  310.                     bar:SetStatusBarColor(0, 0.6, 0)
  311.                 end
  312.             else
  313.                 bar:SetStatusBarColor(0.65, 0.1, 0.1)
  314.             end
  315.             bar:SetStatusBarColor(.25, .25, .25)
  316.         end
  317.        
  318.         bar:Show()
  319.     end
  320.  
  321.     -- Hide unused bars:
  322.     for i = numAuras + 1, #bars do
  323.         local bar = bars[i]
  324.         bar.duration, bar.expirationTime = nil, nil
  325.         bar:SetMinMaxValues(0, 1)
  326.         bar:SetValue(0)
  327.         bar.icon:SetTexture(nil)
  328.         bar.name:SetText(nil)
  329.         bar.time:SetText(nil)
  330.         bar:Hide()
  331.     end
  332.  
  333.     -- Start or stop the OnUpdate as needed:
  334.     if numAurasWithDuration > 0 then
  335.         element:SetScript("OnUpdate", UpdateBars)
  336.     else
  337.         element:SetScript("OnUpdate", nil)
  338.     end
  339.  
  340.     -- Adjust the total height in case there's a backdrop:
  341.     element:SetHeight(numAuras * (element.barHeight or 16))
  342. end
  343.  
  344. ------------------------------------------------------------------------
  345. --  CREATE ELEMENTS
  346.  
  347. local function Enable(self, elementName, updateFunc, auraFilter)
  348.     local element = self[elementName]
  349.     element.__filter = auraFilter
  350.     element.__owner = self
  351.  
  352.     self:RegisterEvent("UNIT_AURA", updateFunc)
  353.  
  354.     element.auras = element.auras or {}
  355.     element.bars = element.bars or {}
  356.  
  357.     return true
  358. end
  359.  
  360. local function Disable(self, elementName, updateFunc)
  361.     local element = self[elementName]
  362.  
  363.     self:UnregisterEvent("UNIT_AURA", updateFunc)
  364.  
  365.     element:SetScript("OnUpdate", nil)
  366.     element:Hide()
  367.  
  368.     for _, bar in pairs(element.bars) do
  369.         bar.duration, bar.expirationTime = nil, nil
  370.         bar:SetMinMaxValues(0, 1)
  371.         bar:SetValue(0)
  372.         bar.icon:SetTexture(nil)
  373.         bar.name:SetText(nil)
  374.         bar.time:SetText(nil)
  375.         bar:Hide()
  376.     end
  377.  
  378.     return true
  379. end
  380.  
  381. ------------------------------------------------------------------------
  382.  
  383. local function UpdateBuffBars(self, event, unit)
  384.     return self.BuffBars and Update(self, event, unit, "BuffBars")
  385. end
  386.  
  387. local function EnableBuffBars(self)
  388.     return self.BuffBars and Enable(self, "BuffBars", UpdateBuffBars, "HELPFUL")
  389. end
  390.  
  391. local function DisableBuffBars(self)
  392.     return self.BuffBars and Disable(self, "BuffBars", UpdateBuffBars)
  393. end
  394.  
  395. oUF:AddElement("BuffBars", UpdateBuffBars, EnableBuffBars, DisableBuffBars)
  396.  
  397. ------------------------------------------------------------------------
  398.  
  399. local function UpdateDebuffBars(self, event, unit)
  400.     return self.DebuffBars and Update(self, event, unit, "DebuffBars")
  401. end
  402.  
  403. local function EnableDebuffBars(self)
  404.     return self.DebuffBars and Enable(self, "DebuffBars", UpdateDebuffBars, "HARMFUL")
  405. end
  406.  
  407. local function DisableDebuffBars(self)
  408.     return self.DebuffBars and Disable(self, "DebuffBars", UpdateDebuffBars)
  409. end
  410.  
  411. oUF:AddElement("DebuffBars", UpdateDebuffBars, EnableDebuffBars, DisableDebuffBars)


All times are GMT -6. The time now is 04:18 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI