Quantcast

Add a gradient pet health value to player

Adrian L Lange [06-19-14 - 23:31]
Add a gradient pet health value to player
Filename
oUF_P3lim.lua
tags.lua
diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua
index c9148fa..9a391f2 100644
--- a/oUF_P3lim.lua
+++ b/oUF_P3lim.lua
@@ -279,7 +279,7 @@ local UnitSpecific = {
 		self.Buffs.PostUpdateIcon = PostUpdateBuff
 		self.Buffs.CustomFilter = FilterPlayerBuffs

-		self:Tag(self.HealthValue, '[p3lim:status][p3lim:player]')
+		self:Tag(self.HealthValue, '[p3lim:pet< : ][p3lim:status][p3lim:player]')
 		self:SetWidth(230)
 	end,
 	target = function(self)
diff --git a/tags.lua b/tags.lua
index 919087e..446627d 100644
--- a/tags.lua
+++ b/tags.lua
@@ -144,3 +144,11 @@ tags.Methods['p3lim:shards'] = function(unit)
 		return cur
 	end
 end
+
+tags.Methods['p3lim:pet'] = function()
+	local cur = UnitHealth('pet')
+	if(cur > 0) then
+		local max = UnitHealthMax('pet')
+		return ('%s%d%%|r'):format(Hex(ColorGradient(cur, max, 1, 0, 0, 1, 1, 0, 1, 1, 1)), cur / max * 100)
+	end
+end