Added documentation
p3lim-52096 [10-03-08 - 22:02]
Added documentation
Changed the booleans
git-svn-id: svn://svn.wowinterface.com/oUF_BarFader-229/trunk@8 cbe42a47-3b53-4817-a5a9-47e79666164c
diff --git a/oUF_BarFader/oUF_BarFader.lua b/oUF_BarFader/oUF_BarFader.lua
index da75bbd..0f9874e 100644
--- a/oUF_BarFader/oUF_BarFader.lua
+++ b/oUF_BarFader/oUF_BarFader.lua
@@ -1,5 +1,12 @@
+--[[
+
+ Shared:
+ - barFade [boolean]
+ - barFadeAlpha [value] default: 0.25
+
+--]]
local function UpdateElement(self, unit)
- if(unit == 'player' and self.BarFade) then
+ if(unit == 'player' and self.barFade) then
local l, class = UnitClass('player')
local notFull = (UnitHealth('player') ~= UnitHealthMax('player')) or
(UnitPowerType('player') ~= 1 and UnitMana('player') ~= UnitManaMax('player')) or
@@ -12,11 +19,11 @@ local function UpdateElement(self, unit)
elseif(UnitExists('target')) then
self:SetAlpha(1)
elseif(self.Castbar) then
- self:SetAlpha(self.Castbar.casting and 1 or (self.BarFadeAlpha or 0.25))
+ self:SetAlpha(self.Castbar.casting and 1 or (self.barFadeAlpha or 0.25))
else
- self:SetAlpha(self.BarFadeAlpha or 0.25)
+ self:SetAlpha(self.barFadeAlpha or 0.25)
end
- elseif(unit == 'pet' and self.BarFade) then
+ elseif(unit == 'pet' and self.barFade) then
local happiness = GetPetHappiness()
local notFull = (UnitHealth('pet') ~= UnitHealthMax('pet')) or
(UnitMana('pet') ~= UnitManaMax('pet'))
@@ -28,9 +35,9 @@ local function UpdateElement(self, unit)
elseif(UnitExists('pettarget')) then
self:SetAlpha(1)
elseif(happiness) then
- self:SetAlpha((happiness < 3) and 1 or (self.BarFadeAlpha or 0.25))
+ self:SetAlpha((happiness < 3) and 1 or (self.barFadeAlpha or 0.25))
else
- self:SetAlpha(self.BarFadeAlpha or 0.25)
+ self:SetAlpha(self.barFadeAlpha or 0.25)
end
elseif(unit == 'focus' and self.BarFade) then
local notFull = (UnitHealth('focus') ~= UnitHealthMax('focus')) or
@@ -44,29 +51,29 @@ local function UpdateElement(self, unit)
elseif(UnitExists('focustarget')) then
self:SetAlpha(1)
else
- self:SetAlpha(self.BarFadeAlpha or 0.25)
+ self:SetAlpha(self.barFadeAlpha or 0.25)
end
end
end
oUF:RegisterInitCallback(function(self)
- local event = CreateFrame('Frame')
- event:SetScript('OnEvent', function() UpdateElement(self, self.unit) end)
- event:RegisterEvent('PLAYER_LOGIN')
- event:RegisterEvent('PLAYER_REGEN_ENABLED')
- event:RegisterEvent('PLAYER_REGEN_DISABLED')
- event:RegisterEvent('PLAYER_TARGET_CHANGED')
- event:RegisterEvent('PLAYER_FOCUS_CHANGED')
- event:RegisterEvent('UNIT_HAPPINESS')
- event:RegisterEvent('UNIT_HEALTH')
- event:RegisterEvent('UNIT_MANA')
- event:RegisterEvent('UNIT_ENERGY')
- event:RegisterEvent('UNIT_FOCUS')
- event:RegisterEvent('UNIT_RAGE')
- event:RegisterEvent('UNIT_RUNIC_POWER')
- event:RegisterEvent('UNIT_TARGET')
- event:RegisterEvent('UNIT_SPELLCAST_START')
- event:RegisterEvent('UNIT_SPELLCAST_STOP')
- event:RegisterEvent('UNIT_SPELLCAST_CHANNEL_START')
- event:RegisterEvent('UNIT_SPELLCAST_CHANNEL_STOP')
+ local addon = CreateFrame('Frame')
+ addon:SetScript('OnEvent', function() UpdateElement(self, self.unit) end)
+ addon:RegisterEvent('PLAYER_LOGIN')
+ addon:RegisterEvent('PLAYER_REGEN_ENABLED')
+ addon:RegisterEvent('PLAYER_REGEN_DISABLED')
+ addon:RegisterEvent('PLAYER_TARGET_CHANGED')
+ addon:RegisterEvent('PLAYER_FOCUS_CHANGED')
+ addon:RegisterEvent('UNIT_HAPPINESS')
+ addon:RegisterEvent('UNIT_HEALTH')
+ addon:RegisterEvent('UNIT_MANA')
+ addon:RegisterEvent('UNIT_ENERGY')
+ addon:RegisterEvent('UNIT_FOCUS')
+ addon:RegisterEvent('UNIT_RAGE')
+ addon:RegisterEvent('UNIT_RUNIC_POWER')
+ addon:RegisterEvent('UNIT_TARGET')
+ addon:RegisterEvent('UNIT_SPELLCAST_START')
+ addon:RegisterEvent('UNIT_SPELLCAST_STOP')
+ addon:RegisterEvent('UNIT_SPELLCAST_CHANNEL_START')
+ addon:RegisterEvent('UNIT_SPELLCAST_CHANNEL_STOP')
end)
\ No newline at end of file
diff --git a/oUF_BarFader/oUF_BarFader.toc b/oUF_BarFader/oUF_BarFader.toc
index 50b3e6d..b8cb123 100644
--- a/oUF_BarFader/oUF_BarFader.toc
+++ b/oUF_BarFader/oUF_BarFader.toc
@@ -1,6 +1,6 @@
## Interface: 20400
## Author: p3lim
-## Version: Revision wowi:revision
+## Version: 20400.wowi:revision
## Title: oUF BarFader
## Notes: Condition fading support for oUF layouts
## RequiredDeps: oUF