diff --git a/IceBarElement.lua b/IceBarElement.lua index d21ec5b..059a80f 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -1155,6 +1155,7 @@ function IceBarElement.prototype:SetBottomText1(text, color) alpha = 1 end + self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha)) self.frame.bottomUpperText:SetText(text) self.frame.bottomUpperText:SetWidth(0) end diff --git a/modules/EclipseBar.lua b/modules/EclipseBar.lua index 935f742..0530456 100644 --- a/modules/EclipseBar.lua +++ b/modules/EclipseBar.lua @@ -1,12 +1,20 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local EclipseBar = IceCore_CreateClass(IceBarElement) + EclipseBar.prototype.barUpdateColor = "EclipseLunar" +EclipseBar.prototype.direction = "none" + +local DirectionToColorMapping = { + none = "Text", + sun = "EclipseSolar", + moon = "EclipseLunar", +} function EclipseBar.prototype:init() EclipseBar.super.prototype.init(self, "EclipseBar") - self:SetDefaultColor("EclipseLunar", 31, 31, 231) - self:SetDefaultColor("EclipseLunarActive", 0, 0, 255) + self:SetDefaultColor("EclipseLunar", 35, 104, 231) + self:SetDefaultColor("EclipseLunarActive", 35, 104, 231) self:SetDefaultColor("EclipseSolar", 190, 210, 31) self:SetDefaultColor("EclipseSolarActive", 238, 251, 31) end @@ -46,9 +54,12 @@ function EclipseBar.prototype:Enable(core) self:RegisterEvent("PLAYER_TALENT_UPDATE", "UpdateShown") self:RegisterEvent("MASTERY_UPDATE", "UpdateShown") self:RegisterEvent("UNIT_AURA", "UpdateEclipseBuffs") + self:RegisterEvent("ECLIPSE_DIRECTION_CHANGE", "UpdateEclipseDirection") self.frame:SetScript("OnUpdate", function() self:Update() end) + self:UpdateEclipseDirection(nil, GetEclipseDirection() == "sun", GetEclipseDirection() == "none") + self:UpdateEclipseBuffs() self:UpdateShown() end @@ -56,6 +67,12 @@ function EclipseBar.prototype:Disable(core) EclipseBar.super.prototype.Disable(self, core) end +-- note that isNone is not passed by the ECLIPSE_DIRECTION_CHANGE event, only manually via :Enable +function EclipseBar.prototype:UpdateEclipseDirection(event, isLunar, isNone) + self.direction = isLunar and "sun" or isNone and "none" or "moon" + self:UpdateEclipsePower() +end + function EclipseBar.prototype:SetBarVisibility(visible) EclipseBar.super.prototype.SetBarVisibility(self, visible) @@ -170,8 +187,19 @@ function EclipseBar.prototype:UpdateEclipsePower() return end - self:SetBottomText1(abs((power/maxPower) * 100)) + self:SetBottomText1(abs((power/maxPower) * 100), DirectionToColorMapping[self.direction]) +-- i'm rather fond of this solution so i'm keeping it around...the correct fix was in IceBarElement to set the upper text color +-- but hey, this would have been sweet. +--[[ + local r,g,b = self:GetColor(DirectionToColorMapping[self.direction]) + self:SetBottomText1(string.format("|c%x%x%x%x%d|r", + self.alpha * 255, + r * 255, + g * 255, + b * 255, + abs((power/maxPower) * 100))) +]] local pos = (power/maxPower) / 2 self:PositionMarker(1, pos) end @@ -180,7 +208,7 @@ function EclipseBar.prototype:Update() EclipseBar.super.prototype.Update(self) self:UpdateEclipsePower() - self:UpdateBar(0.5, self.barUpdateColor) + self:UpdateBar(0.5, self.barUpdateColor, 1) self:UpdateAlpha() end