Thread Tools Display Modes
04-09-11, 06:01 PM   #1
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
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.
  Reply With Quote
04-09-11, 06:47 PM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
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
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."


Last edited by Dawn : 04-09-11 at 06:56 PM.
  Reply With Quote
04-10-11, 09:49 AM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Dawn View Post
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? ^^
  Reply With Quote
04-10-11, 10:29 AM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
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
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
04-10-11, 10:32 AM   #5
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Dawn View Post
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 zz
  Reply With Quote
04-10-11, 10:37 AM   #6
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Hmm, doesn't seem to work... no

http://pastebin.com/xjnxCceE

No errors, or taints.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Flash on buffs/debuffs


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off