From ecd60ac2fd2d49866be8d735eaa950a84f9fe587 Mon Sep 17 00:00:00 2001 From: p3lim-52096 Date: Sun, 10 May 2009 23:34:08 +0000 Subject: [PATCH] Fixed a premature mistake git-svn-id: svn://svn.wowinterface.com/oUF_BarFader-229/trunk@20 cbe42a47-3b53-4817-a5a9-47e79666164c --- oUF_BarFader/oUF_BarFader.lua | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/oUF_BarFader/oUF_BarFader.lua b/oUF_BarFader/oUF_BarFader.lua index d37625b..965fd82 100644 --- a/oUF_BarFader/oUF_BarFader.lua +++ b/oUF_BarFader/oUF_BarFader.lua @@ -7,37 +7,29 @@ --]] -local function Validation(self, unit) +local function pending(self, unit) local num, str = UnitPowerType(unit) - if(self.Castbar and (self.Castbar.casting or self.Castbar.channeling)) then - return false - elseif(UnitAffectingCombat(unit)) then - return false - elseif(unit == 'pet' and GetPetHappiness() and GetPetHappiness() < 3) then - return false - elseif(UnitExists(unit..'target')) then - return false - elseif(UnitHealth(unit) < UnitHealthMax(unit)) then - return false - elseif((str == 'RAGE' or str == 'RUNIC_POWER') and UnitPower(unit) > 0) then - return false - elseif((str ~= 'RAGE' and str ~= 'RUNIC_POWER') and UnitMana(unit) < UnitManaMax(unit)) then - return false - end - - return true + if(self.Castbar and (self.Castbar.casting or self.Castbar.channeling)) then return true end + if(UnitAffectingCombat(unit)) then return true end + if(unit == 'pet' and GetPetHappiness() and GetPetHappiness() < 3) then return true end + if(UnitExists(unit..'target')) then return true end + if(UnitHealth(unit) < UnitHealthMax(unit)) then return true end + if((str == 'RAGE' or str == 'RUNIC_POWER') and UnitPower(unit) > 0) then return true end + if((str ~= 'RAGE' and str ~= 'RUNIC_POWER') and UnitMana(unit) < UnitManaMax(unit)) then return true end end -local function Update(self) - if(Validation(self, self.unit)) then - self:SetAlpha(self.BarFadeMinAlpha or 0.25) +local function Update(self, event, unit) + if(unit and unit ~= self.unit) then return end + + if(not pending(self, self.unit)) then + self:SetAlpha(self.BarFaderMinAlpha or 0.25) else - self:SetAlpha(self.BarFadeMaxAlpha or 1) + self:SetAlpha(self.BarFaderMaxAlpha or 1) end end -local function Enable(self) - if(self.BarFade and self.unit) then +local function Enable(self, unit) + if(unit and self.BarFade) then Update(self) self:RegisterEvent('UNIT_COMBAT', Update) -- 1.7.9.5