WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Flash on buffs/debuffs (https://www.wowinterface.com/forums/showthread.php?t=39578)

Aftermathhqt 04-09-11 06:01 PM

Flash on buffs/debuffs
 
Hello, there i was woudering, if anybody knows if you can get the debuffs/buffs to flash, on oUF if they are about to expire, like the blizzards buffs.

Dawn 04-09-11 06:47 PM

It's possible, I had this working about a year ago or something like that. But I stopped using it shortly after. I'll see if I can find it, again. :)


EDIT:
This is the code. However, I copy and pasted the whole function, which also contains code to add aura timers. You would have to get rid of that part (more or less the red text).


Code:

-- create aura timer
local CreateAuraTimer = function(self, elapsed)
        local t = self.updateTimer
        local tl = self.timeLeft-GetTime()
        if tl > 0 then
                if (floor(tl+0.5) <= cfg.AuraTIME) then
                self.BuffFrameFlashTime = self.BuffFrameFlashTime - elapsed
                        if ( self.BuffFrameFlashTime < 0 ) then
                        local overtime = -self.BuffFrameFlashTime
                                if ( self.BuffFrameFlashState == 0 ) then
                                self.BuffFrameFlashState = 1
                                self.BuffFrameFlashTime = cfg.AuraFlashON
                                else
                                self.BuffFrameFlashState = 0
                                self.BuffFrameFlashTime = cfg.AuraFlashOFF
                                end
                        if ( overtime < self.BuffFrameFlashTime ) then
                        self.BuffFrameFlashTime = self.BuffFrameFlashTime - overtime
                        end
                end
     
                if ( self.BuffFrameFlashState == 1 ) then
                self.BuffAlphaValue = (cfg.AuraFlashON - self.BuffFrameFlashTime) / cfg.AuraFlashON
                else
                self.BuffAlphaValue = self.BuffFrameFlashTime / cfg.AuraFlashON
                end
                       
                self.BuffAlphaValue = (self.BuffAlphaValue * (1 - cfg.AuraMinAlpha)) + cfg.AuraMinAlpha
                self:SetAlpha(self.BuffAlphaValue)
        else
                self:SetAlpha(1.0)
        end     
     
        if (not t) then
        self.updateTimer = 0
                return
        end
       
        t = t + elapsed
        if (t < 0.1) then
        self.updateTimer = t
        return
        else
        self.updateTimer = 0
        if self.count:GetText() == "0" then
          self.count:SetAlpha(0)
        else
          self.count:SetAlpha(1)
        end
                        if tl < 5 then
                                self.time:SetTextColor(1, 0, 0)
                                self.time:SetText(FormatTime(tl))
                        elseif tl > cfg.HideAuraTimer then
                                self.time:SetText('')
                        else
                                self.time:SetText(FormatTime(tl))
                                self.time:SetTextColor(unpack(cfg.sndcolor))
                        end
                end 
    else
                self.time:Hide()
        end

end


-- icon style
local PostCreateIcon = function(Auras, button)
...               
    button.BuffFrameFlashTime = 0
    button.BuffFrameFlashState = 1
    button.BuffAlphaValue = 1
...
end


Aftermathhqt 04-10-11 09:49 AM

Quote:

Originally Posted by Dawn (Post 234187)
It's possible, I had this working about a year ago or something like that. But I stopped using it shortly after. I'll see if I can find it, again. :)


EDIT:
This is the code. However, I copy and pasted the whole function, which also contains code to add aura timers. You would have to get rid of that part (more or less the red text).


Code:

-- create aura timer
local CreateAuraTimer = function(self, elapsed)
        local t = self.updateTimer
        local tl = self.timeLeft-GetTime()
        if tl > 0 then
                if (floor(tl+0.5) <= cfg.AuraTIME) then
                self.BuffFrameFlashTime = self.BuffFrameFlashTime - elapsed
                        if ( self.BuffFrameFlashTime < 0 ) then
                        local overtime = -self.BuffFrameFlashTime
                                if ( self.BuffFrameFlashState == 0 ) then
                                self.BuffFrameFlashState = 1
                                self.BuffFrameFlashTime = cfg.AuraFlashON
                                else
                                self.BuffFrameFlashState = 0
                                self.BuffFrameFlashTime = cfg.AuraFlashOFF
                                end
                        if ( overtime < self.BuffFrameFlashTime ) then
                        self.BuffFrameFlashTime = self.BuffFrameFlashTime - overtime
                        end
                end
     
                if ( self.BuffFrameFlashState == 1 ) then
                self.BuffAlphaValue = (cfg.AuraFlashON - self.BuffFrameFlashTime) / cfg.AuraFlashON
                else
                self.BuffAlphaValue = self.BuffFrameFlashTime / cfg.AuraFlashON
                end
                       
                self.BuffAlphaValue = (self.BuffAlphaValue * (1 - cfg.AuraMinAlpha)) + cfg.AuraMinAlpha
                self:SetAlpha(self.BuffAlphaValue)
        else
                self:SetAlpha(1.0)
        end     
     
        if (not t) then
        self.updateTimer = 0
                return
        end
       
        t = t + elapsed
        if (t < 0.1) then
        self.updateTimer = t
        return
        else
        self.updateTimer = 0
        if self.count:GetText() == "0" then
          self.count:SetAlpha(0)
        else
          self.count:SetAlpha(1)
        end
                        if tl < 5 then
                                self.time:SetTextColor(1, 0, 0)
                                self.time:SetText(FormatTime(tl))
                        elseif tl > cfg.HideAuraTimer then
                                self.time:SetText('')
                        else
                                self.time:SetText(FormatTime(tl))
                                self.time:SetTextColor(unpack(cfg.sndcolor))
                        end
                end 
    else
                self.time:Hide()
        end

end


-- icon style
local PostCreateIcon = function(Auras, button)
...               
    button.BuffFrameFlashTime = 0
    button.BuffFrameFlashState = 1
    button.BuffAlphaValue = 1
...
end


Thanks, but anyways whats cfg.AuraFlashON / cfg.AuraFlashOFF? ^^

Dawn 04-10-11 10:29 AM

Time values, replace with numbers. I had those values as part of my config, therefore the variable.

E:

Code:

        cfg.AuraFlashON = 0.8                                        -- time to fade in (in seconds)
        cfg.AuraFlashOFF = 0.8                                        -- time to fade out (in seconds)
        cfg.AuraMinAlpha = 0.4                                        -- min alpha of faded auras
        cfg.AuraTIME = 10                                                -- aura duration (in seconds) at which flashing starts


Aftermathhqt 04-10-11 10:32 AM

Quote:

Originally Posted by Dawn (Post 234219)
Time values, replace with numbers. I had those values as part of my config, therefore the variable.

E:

Code:

        cfg.AuraFlashON = 0.8                                        -- time to fade in (in seconds)
        cfg.AuraFlashOFF = 0.8                                        -- time to fade out (in seconds)
        cfg.AuraMinAlpha = 0.4                                        -- min alpha of faded auras
        cfg.AuraTIME = 10                                                -- aura duration (in seconds) at which flashing starts


Thanks :D zz

Aftermathhqt 04-10-11 10:37 AM

Hmm, doesn't seem to work... no :(

http://pastebin.com/xjnxCceE

No errors, or taints.


All times are GMT -6. The time now is 10:59 AM.

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