Fixed a premature mistake
p3lim-52096 [05-10-09 - 23:34]
Fixed a premature mistake
git-svn-id: svn://svn.wowinterface.com/oUF_BarFader-229/trunk@20 cbe42a47-3b53-4817-a5a9-47e79666164c
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)