From e8798da1d0d4c6b84a515dfd95de337f0f3a5b29 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Tue, 19 Aug 2014 19:25:45 +0200 Subject: [PATCH] Color the resurrect icon red if the unit has a combatres debuff --- oUF_P3lim.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua index 228a527..bdc4cbb 100644 --- a/oUF_P3lim.lua +++ b/oUF_P3lim.lua @@ -43,6 +43,35 @@ local function PostUpdateClassIcon(element, cur, max, diff) end end +local function PostUpdateResurrect(element) + if(not element.__owner) then + element = element.ResurrectIcon + end + + local unit = element.__owner.unit + + local hasResurrectDebuff + for index = 1, 40 do + local _, _, _, _, _, _, _, _, _, _, spellID = UnitAura(unit, index, 'HARMFUL') + if(spellID and spellID == 160029) then + hasResurrectDebuff = true + break + elseif(not spellID) then + break + end + end + + if(hasResurrectDebuff) then + element:Show() + element:SetVertexColor(1, 0, 0) + elseif(not UnitHasIncomingResurrection(unit)) then + element:Hide() + element:SetVertexColor(1, 1, 1) + else + element:SetVertexColor(1, 1, 1) + end +end + local function UpdateAura(self, elapsed) if(self.expiration) then if(self.expiration < 60) then @@ -481,7 +510,10 @@ local function Shared(self, unit) local Resurrect = Health:CreateTexture(nil, 'OVERLAY') Resurrect:SetPoint('CENTER', 0, -1) Resurrect:SetSize(16, 16) + Resurrect.PostUpdate = PostUpdateResurrect self.ResurrectIcon = Resurrect + + self:RegisterEvent('UNIT_AURA', PostUpdateResurrect) end if(UnitSpecific[unit]) then -- 1.7.9.5