Quantcast

Show Glyph of Shred stacks on Rip

Adrian L Lange [07-31-11 - 20:42]
Show Glyph of Shred stacks on Rip
Filename
oUF_P3lim.lua
diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua
index 7be577d..4b4a4fc 100644
--- a/oUF_P3lim.lua
+++ b/oUF_P3lim.lua
@@ -36,19 +36,59 @@ local function PostCreateAura(element, button)
 	button.icon:SetDrawLayer('ARTWORK')
 end

-local function PostUpdateDebuff(element, unit, button, index)
-	local _, _, _, _, type, _, _, owner = UnitAura(unit, index, button.filter)
-	local color = DebuffTypeColor[type or 'none']
+local CLEU, PostUpdateDebuff
+do
+	local stack = 0
+	function PostUpdateDebuff(element, unit, button, index)
+		local _, _, _, count, type, _, _, owner, _, _, id = UnitAura(unit, index, button.filter)
+		local color = DebuffTypeColor[type or 'none']
+
+		if(owner == 'player') then
+			button:SetBackdropColor(color.r * 3/5, color.g * 3/5, color.b * 3/5)
+			button.icon:SetDesaturated(false)
+		else
+			button:SetBackdropColor(0, 0, 0)
+			button.icon:SetDesaturated(true)
+		end

-	if(owner == 'player') then
-		button:SetBackdropColor(color.r * 3/5, color.g * 3/5, color.b * 3/5)
-		button.icon:SetDesaturated(false)
-	else
-		button:SetBackdropColor(0, 0, 0)
-		button.icon:SetDesaturated(true)
+		if(id == 1079 and owner == 'player') then
+			if(stack) then
+				button.count:SetText(stack > 0 and stack or '')
+			end
+		elseif(not count or count < 2) then
+			button.count:SetText()
+		end
 	end
-end

+	local player
+	function CLEU(self, ...)
+		if(not player) then
+			player = UnitGUID('player')
+		end
+
+		local _, _, event, _, source, _, _, _, _, _, _, _, spell = ...
+		if(source ~= player) then return end
+
+		if(spell == 1079) then
+			if(event == 'SPELL_AURA_APPLIED' or event == 'SPELL_AURA_REFRESH') then
+				stack = 0
+				self.Debuffs:ForceUpdate()
+			end
+		end
+
+		if(event == 'SPELL_DAMAGE') then
+			if(spell == 5221 and stack < 3) then
+				stack = stack + 1
+				self.Debuffs:ForceUpdate()
+			elseif(spell == 22568) then
+				if(UnitHealth('target') / UnitHealthMax('target') <= 0.25) then
+					stack = 0
+					self.Debuffs:ForceUpdate()
+				end
+			end
+		end
+	end
+end

 local FilterPlayerBuffs
 do