Skip to content
Browse files

Fixed a premature mistake

git-svn-id: svn://svn.wowinterface.com/oUF_BarFader-229/trunk@20 cbe42a47-3b53-4817-a5a9-47e79666164c
  • Loading branch information...
1 parent 9d4f602 commit ecd60ac2fd2d49866be8d735eaa950a84f9fe587 p3lim-52096 committed
Showing with 16 additions and 24 deletions.
  1. +16 −24 oUF_BarFader/oUF_BarFader.lua
View
40 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)

0 comments on commit ecd60ac

Please sign in to comment.
Something went wrong with that request. Please try again.