Quantcast

Lets start off with some renaming

Adrian L Lange [03-02-12 - 10:11]
Lets start off with some renaming
Filename
oUF_BarFader.lua
oUF_BarFader.toc
oUF_Fader.lua
oUF_Fader.toc
diff --git a/oUF_BarFader.lua b/oUF_BarFader.lua
deleted file mode 100644
index aaf791f..0000000
--- a/oUF_BarFader.lua
+++ /dev/null
@@ -1,89 +0,0 @@
---[[
-
-	Shared:
-	 - BarFade [boolean]
-	 - BarFadeMinAlpha [value] default: 0.25
-	 - BarFadeMaxAlpha [value] default: 1
-
---]]
-
-local function pending(self, unit)
-	local num, str = UnitPowerType(unit)
-	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, 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.BarFaderMaxAlpha or 1)
-	end
-end
-
-local function enable(self, unit)
-	if(unit and self.BarFade) then
-		update(self)
-
-		self:RegisterEvent('UNIT_COMBAT', update)
-		self:RegisterEvent('UNIT_HAPPINESS', update)
-		self:RegisterEvent('UNIT_TARGET', update)
-		self:RegisterEvent('UNIT_FOCUS', update)
-		self:RegisterEvent('UNIT_HEALTH', update)
-		self:RegisterEvent('UNIT_POWER', update)
-		self:RegisterEvent('UNIT_ENERGY', update)
-		self:RegisterEvent('UNIT_RAGE', update)
-		self:RegisterEvent('UNIT_MANA', update)
-		self:RegisterEvent('UNIT_RUNIC_POWER', update)
-
-		if(self.Castbar) then
-			self:RegisterEvent('UNIT_SPELLCAST_START', update)
-			self:RegisterEvent('UNIT_SPELLCAST_FAILED', update)
-			self:RegisterEvent('UNIT_SPELLCAST_STOP', update)
-			self:RegisterEvent('UNIT_SPELLCAST_INTERRUPTED', update)
-			self:RegisterEvent('UNIT_SPELLCAST_DELAYED', update)
-			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_START', update)
-			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE', update)
-			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_INTERRUPTED', update)
-			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_STOP', update)
-		end
-
-		return true
-	end
-end
-
-local function disable(self)
-	if(self.BarFade) then
-		self:UnregisterEvent('UNIT_COMBAT', update)
-		self:UnregisterEvent('UNIT_HAPPINESS', update)
-		self:UnregisterEvent('UNIT_TARGET', update)
-		self:UnregisterEvent('UNIT_FOCUS', update)
-		self:UnregisterEvent('UNIT_HEALTH', update)
-		self:UnregisterEvent('UNIT_POWER', update)
-		self:UnregisterEvent('UNIT_ENERGY', update)
-		self:UnregisterEvent('UNIT_RAGE', update)
-		self:UnregisterEvent('UNIT_MANA', update)
-		self:UnregisterEvent('UNIT_RUNIC_POWER', update)
-
-		if(self.Castbar) then
-			self:UnregisterEvent('UNIT_SPELLCAST_START', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_FAILED', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_STOP', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_INTERRUPTED', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_DELAYED', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_START', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_INTERRUPTED', update)
-			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_STOP', update)
-		end
-	end
-end
-
-oUF:AddElement('BarFader', update, enable, disable)
\ No newline at end of file
diff --git a/oUF_BarFader.toc b/oUF_BarFader.toc
deleted file mode 100644
index cb89a46..0000000
--- a/oUF_BarFader.toc
+++ /dev/null
@@ -1,8 +0,0 @@
-## Interface: 30200
-## Author: p3lim
-## Version: Alpha
-## Title: oUF BarFader
-## Notes: Condition fading plug-in for oUF
-## RequiredDeps: oUF
-
-oUF_BarFader.lua
\ No newline at end of file
diff --git a/oUF_Fader.lua b/oUF_Fader.lua
new file mode 100644
index 0000000..afa0d34
--- /dev/null
+++ b/oUF_Fader.lua
@@ -0,0 +1,89 @@
+--[[
+
+	Shared:
+	 - BarFade [boolean]
+	 - BarFadeMinAlpha [value] default: 0.25
+	 - BarFadeMaxAlpha [value] default: 1
+
+--]]
+
+local function pending(self, unit)
+	local num, str = UnitPowerType(unit)
+	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, 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.BarFaderMaxAlpha or 1)
+	end
+end
+
+local function enable(self, unit)
+	if(unit and self.BarFade) then
+		update(self)
+
+		self:RegisterEvent('UNIT_COMBAT', update)
+		self:RegisterEvent('UNIT_HAPPINESS', update)
+		self:RegisterEvent('UNIT_TARGET', update)
+		self:RegisterEvent('UNIT_FOCUS', update)
+		self:RegisterEvent('UNIT_HEALTH', update)
+		self:RegisterEvent('UNIT_POWER', update)
+		self:RegisterEvent('UNIT_ENERGY', update)
+		self:RegisterEvent('UNIT_RAGE', update)
+		self:RegisterEvent('UNIT_MANA', update)
+		self:RegisterEvent('UNIT_RUNIC_POWER', update)
+
+		if(self.Castbar) then
+			self:RegisterEvent('UNIT_SPELLCAST_START', update)
+			self:RegisterEvent('UNIT_SPELLCAST_FAILED', update)
+			self:RegisterEvent('UNIT_SPELLCAST_STOP', update)
+			self:RegisterEvent('UNIT_SPELLCAST_INTERRUPTED', update)
+			self:RegisterEvent('UNIT_SPELLCAST_DELAYED', update)
+			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_START', update)
+			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE', update)
+			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_INTERRUPTED', update)
+			self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_STOP', update)
+		end
+
+		return true
+	end
+end
+
+local function disable(self)
+	if(self.BarFade) then
+		self:UnregisterEvent('UNIT_COMBAT', update)
+		self:UnregisterEvent('UNIT_HAPPINESS', update)
+		self:UnregisterEvent('UNIT_TARGET', update)
+		self:UnregisterEvent('UNIT_FOCUS', update)
+		self:UnregisterEvent('UNIT_HEALTH', update)
+		self:UnregisterEvent('UNIT_POWER', update)
+		self:UnregisterEvent('UNIT_ENERGY', update)
+		self:UnregisterEvent('UNIT_RAGE', update)
+		self:UnregisterEvent('UNIT_MANA', update)
+		self:UnregisterEvent('UNIT_RUNIC_POWER', update)
+
+		if(self.Castbar) then
+			self:UnregisterEvent('UNIT_SPELLCAST_START', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_FAILED', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_STOP', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_INTERRUPTED', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_DELAYED', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_START', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_INTERRUPTED', update)
+			self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_STOP', update)
+		end
+	end
+end
+
+oUF:AddElement('BarFader', update, enable, disable)
\ No newline at end of file
diff --git a/oUF_Fader.toc b/oUF_Fader.toc
new file mode 100644
index 0000000..b501abb
--- /dev/null
+++ b/oUF_Fader.toc
@@ -0,0 +1,8 @@
+## Interface: 30200
+## Author: p3lim
+## Version: Alpha
+## Title: oUF Fader
+## Notes: Condition fading plug-in for oUF
+## RequiredDeps: oUF
+
+oUF_Fader.lua