From a588019ecd3e1f7fd285a19cb8a04e1361489912 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Sun, 31 Aug 2014 17:48:22 +0200 Subject: [PATCH] Handle the EclipseBar ourselves on WoD until oUF gets updated --- oUF_P3lim.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua index de8c156..c51b8e5 100644 --- a/oUF_P3lim.lua +++ b/oUF_P3lim.lua @@ -87,6 +87,40 @@ local function PostUpdateResurrect(element) end end +local function UpdateEclipse(self, event, unit, powerType) + if(self.unit ~= unit or (event == 'UNIT_POWER' and powerType ~= 'ECLIPSE')) then return end + local element = self.EclipseBar + + local max = UnitPowerMax('player', SPELL_POWER_ECLIPSE) + element.LunarBar:SetMinMaxValues(-max, max) + element.LunarBar:SetValue(UnitPower('player', SPELL_POWER_ECLIPSE)) +end + +local function UpdateEclipseVisibility(self) + local element = self.EclipseBar + + local showBar + local form = GetShapeshiftFormID() + if(not form) then + local specialization = GetSpecialization() + if(specialization and specialization == 1) then + showBar = true + end + elseif(form == MOONKIN_FORM) then + showBar = true + end + + if(UnitHasVehicleUI('player')) then + showBar = false + end + + if(showBar) then + element:Show() + else + element:Hide() + end +end + local function UpdateThreat(self, event, unit) if(unit ~= self.unit) then return @@ -305,6 +339,14 @@ local UnitSpecific = { local SolarBar = EclipseBar:CreateTexture(nil, 'BORDER') SolarBar:SetAllPoints() SolarBar:SetTexture(1/4, 2/5, 5/6) + + if(WoD) then + self:RegisterEvent('PLAYER_TALENT_UPDATE', UpdateEclipseVisibility, true) + self:RegisterEvent('UPDATE_SHAPESHIFT_FORM', UpdateEclipseVisibility, true) + self:RegisterEvent('UNIT_POWER', UpdateEclipse) + else + self.EclipseBar = EclipseBar + end elseif(playerClass == 'WARLOCK') then local BurningEmbers = {} for index = 1, 4 do -- 1.7.9.5