Quantcast

Simplify the eclipse element

Adrian L Lange [08-19-14 - 16:47]
Simplify the eclipse element
Filename
oUF_P3lim.lua
diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua
index 8ef44b3..081524d 100644
--- a/oUF_P3lim.lua
+++ b/oUF_P3lim.lua
@@ -54,28 +54,6 @@ local function UpdateEmbersVisibility(self)
 	end
 end

-local function PostUpdateEclipse(element)
-	local direction = GetEclipseDirection()
-	if(direction == 'sun') then
-		element.SolarBar:SetStatusBarColor(1/4, 2/5, 5/6)
-		element.LunarBar:SetStatusBarColor(1/3, 1/3, 1/3)
-	elseif(direction == 'moon') then
-		element.LunarBar:SetStatusBarColor(4/5, 3/5, 0)
-		element.SolarBar:SetStatusBarColor(1/3, 1/3, 1/3)
-	else
-		element.LunarBar:SetStatusBarColor(4/5, 3/5, 0)
-		element.SolarBar:SetStatusBarColor(1/4, 2/5, 5/6)
-	end
-end
-
-local function UpdateEclipseVisibility(self)
-	if(UnitHasVehicleUI('player') or UnitIsDeadOrGhost('player')) then
-		self.EclipseBar:Hide()
-	else
-		self.EclipseBar:ForceUpdate()
-	end
-end
-
 local function UpdateAura(self, elapsed)
 	if(self.expiration) then
 		if(self.expiration < 60) then
@@ -223,27 +201,22 @@ local UnitSpecific = {
 			self.colors.runes[4] = {0.5, 0.27, 0.68}
 		elseif(playerClass == 'DRUID') then
 			local EclipseBar = CreateFrame('Frame', nil, self)
-			EclipseBar:SetPoint('BOTTOM', 0, -10)
+			EclipseBar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -4)
 			EclipseBar:SetSize(230, 6)
 			EclipseBar:SetBackdrop(BACKDROP)
 			EclipseBar:SetBackdropColor(0, 0, 0)
-			EclipseBar.PostDirectionChange = PostUpdateEclipse
 			self.EclipseBar = EclipseBar

 			local LunarBar = CreateFrame('StatusBar', nil, EclipseBar)
 			LunarBar:SetPoint('LEFT')
 			LunarBar:SetSize(230, 6)
 			LunarBar:SetStatusBarTexture(TEXTURE)
+			LunarBar:SetStatusBarColor(4/5, 3/5, 0)
 			EclipseBar.LunarBar = LunarBar

-			local SolarBar = CreateFrame('StatusBar', nil, EclipseBar)
-			SolarBar:SetPoint('LEFT', LunarBar:GetStatusBarTexture(), 'RIGHT')
-			SolarBar:SetSize(230, 6)
-			SolarBar:SetStatusBarTexture(TEXTURE)
-			EclipseBar.SolarBar = SolarBar
-
-			self:RegisterEvent('UNIT_EXITED_VEHICLE', UpdateEclipseVisibility)
-			self:RegisterEvent('UNIT_ENTERED_VEHICLE', UpdateEclipseVisibility)
+			local SolarBar = Eclipse:CreateTexture(nil, 'BORDER')
+			SolarBar:SetAllPoints()
+			SolarBar:SetTexture(1/4, 2/5, 5/6)
 		elseif(playerClass == 'WARLOCK') then
 			local BurningEmbers = CreateFrame('Frame', nil, self)
 			BurningEmbers:SetPoint('BOTTOM', 0, -10)