View Single Post
01-25-13, 05:26 PM   #15
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Would it be possible to incorporate this in a tag?

I'm currently trying to get my head around it, but can't really get to it. Thing is I don't use any bars and therefore no hp or pp functions at all, just tags.

Code:
For instance, this is my health percent tag

oUF.Tags.Methods['GhostHPPerc'] = function(u)
	local m = UnitHealthMax(u)	
	local hp_perc = math.floor(UnitHealth(u)/m*100+.5)

	-- set text color and info
	if(UnitIsDead(u)) then
		return "|CFFB80D20".. "RIP" .."|r"
	elseif(UnitIsGhost(u)) then
		return "|CFFB80D20".. "GHO" .."|r"
	elseif(not UnitIsConnected(u)) then	
		return "|CFFFFFFFF".. "OFF" .."|r"
	elseif(UnitIsTapped(u) and not UnitIsTappedByPlayer(u)) then
		return "|CFF969696".. "TPD" .."|r"	
	elseif(hp_perc <= 60 and hp_perc > 35) then
		return format('|CFFF7F774 %d|r', hp_perc)			
	elseif(hp_perc <= 35 and hp_perc >= 25) then
		return format('|CFFFDEE50 %d|r', hp_perc)
	elseif(hp_perc < 25 and hp_perc >= 20) then
		return format('|CFFFA8200 %d|r', hp_perc)	
	elseif(hp_perc < 20) then
		return format('|CFFB80D20 %d|r', hp_perc)	
	else
		return format('|CFFFFFFFF %d|r', hp_perc)
	end	
	
end
oUF.Tags.Events['GhostHPPerc'] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION"
__________________
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 : 01-25-13 at 05:29 PM.
  Reply With Quote