Quantcast

Use a custom cpoints tag with colors

Adrian L Lange [08-19-14 - 17:17]
Use a custom cpoints tag with colors
Filename
elements/tags.lua
oUF_P3lim.lua
diff --git a/elements/tags.lua b/elements/tags.lua
index e611e34..da61eee 100644
--- a/elements/tags.lua
+++ b/elements/tags.lua
@@ -141,3 +141,21 @@ tags.Methods['p3lim:pet'] = function()
 		return [[|TInterface\RaidFrame\Raid-Icon-DebuffDisease:26|t]]
 	end
 end
+
+tags.Events['p3lim:cpoints'] = 'UNIT_COMBO_POINTS PLAYER_TARGET_CHANGED'
+tags.Methods['p3lim:cpoints'] = function()
+	local points
+	if(UnitHasVehicleUI('player')) then
+		points = GetComboPoints('vehicle', 'target')
+	else
+		points = GetComboPoints('player', 'target')
+	end
+
+	if(points == 5) then
+		return '|cffcc3333' .. points .. '|r'
+	elseif(points == 4) then
+		return '|cffff6600' .. points .. '|r'
+	elseif(points > 0) then
+		return '|cffffcc00' .. points .. '|r'
+	end
+end
diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua
index 1df81c5..be9d51a 100644
--- a/oUF_P3lim.lua
+++ b/oUF_P3lim.lua
@@ -300,7 +300,7 @@ local UnitSpecific = {
 		ComboPoints:SetPoint('RIGHT', self, 'LEFT', -9, -2)
 		ComboPoints:SetJustifyH('RIGHT')
 		ComboPoints:SetTextColor(1, 1, 1)
-		self:Tag(ComboPoints, '[cpoints]')
+		self:Tag(ComboPoints, '[p3lim:cpoints]')

 		self.Castbar.PostCastStart = PostUpdateCast
 		self.Castbar.PostCastInterruptible = PostUpdateCast