2b9e2c1 - Fix channeling color
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sun, 4 Feb 2018 19:22:58 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sun, 4 Feb 2018 19:22:58 +0000
OmaUF/CastBar.lua

index 1cb98bc..7485a8a 100644 (file)
@@ -15,6 +15,7 @@ local channelingColor = {0.32, 0.3, 1};
 local M = {};
 OmaUFCastBar = M;
 
+-- TODO trade skill bar updates as well, check Quartz modules/Tradeskill.lua
 local function onUpdate(bar)
     if not bar:IsShown() then return end -- TODO little fadeout possibly
     local width = bar.icon:IsShown() and bar.cast.width or bar.cast.width; -- TODO fullwidth
@@ -43,7 +44,7 @@ local function toggleInterruptible(bar, nointr)
         bar.cast:SetVertexColor(unpack(nointerruptColor));
         bar.shield:Show();
     else
-        bar.cast:SetVertexColor(unpack(castingColor));
+        bar.cast:SetVertexColor(unpack(bar.cast.color));
         bar.shield:Hide();
     end
 end
@@ -53,9 +54,11 @@ local function startCast(bar, unit, channeling)
     if channeling then
         name, _, _, icon, startTime, endTime, _, noInterrupt = UnitChannelInfo(unit);
         bar.channeling = true;
+        bar.cast.color = channelingColor;
     else
         _, _, name, icon, startTime, endTime, _, _, noInterrupt, id = UnitCastingInfo(unit);
         bar.channeling = nil;
+        bar.cast.color = castingColor;
     end
     if not startTime or not endTime then return nil end
     bar.startTime = startTime / 1000;
@@ -71,6 +74,7 @@ local function startCast(bar, unit, channeling)
     end
     bar.spell:SetText(ssub(name, 1, bar.spell.count));
     bar.time:SetFormattedText("%.1f", (endTime - startTime)/1000);
+    bar.cast:SetVertexColor(unpack(bar.cast.color));
     bar:Show();
     toggleInterruptible(bar, noInterrupt);
     return true;
@@ -173,7 +177,7 @@ function M.CreateCastBar(parent, unit, yoffset)
     bar.cast.fullwidth = bar:GetWidth() - 2; -- for casts without icon
     bar.cast:SetWidth(bar.cast.width);
     bar.cast:SetTexture(barTexture);
-    bar.cast:SetVertexColor(unpack(castingColor));
+    bar.cast.color = castingColor;
     bar.spell = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
     bar.spell:SetPoint("LEFT", bar.icon, "RIGHT", 2, 0);
     bar.spell.count = ceil(bar.cast:GetWidth()/10);