52e5175 - Fix power bars, remove overlay color for basic unit frames
[wowui.git] / OmaUF / Events.lua
index f745434..7b39aeb 100644 (file)
@@ -23,9 +23,6 @@ local updateAuraFrames = OmaUFAuras.UpdateAuras;
 local Settings = OmaUFSettings;
 local baseColor = Settings.BaseColor;
 local healthColor = Settings.HealthColor;
-local overlayColorDispel = Settings.OverlayColorDispel;
-local overlayColorCharm = Settings.OverlayColorCharm;
-local overlayColorAlert = Settings.OverlayColorAlert;
 local powerColors = Settings.PowerColors;
 local width = Settings.Width;
 
@@ -42,6 +39,8 @@ function M.RegisterEvents(frame)
     frame:RegisterUnitEvent("UNIT_POWER", frame.unit, displayed);
     frame:RegisterUnitEvent("UNIT_MAXPOWER", frame.unit, displayed);
     frame:RegisterUnitEvent("UNIT_DISPLAYPOWER", frame.unit, displayed);
+    frame:RegisterUnitEvent("UNIT_POWER_BAR_SHOW", frame.unit, displayed);
+    frame:RegisterUnitEvent("UNIT_POWER_BAR_HIDE", frame.unit, displayed);
     frame:RegisterUnitEvent("UNIT_NAME_UPDATE", frame.unit, displayed);
     frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed);
     frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", frame.unit, displayed);
@@ -201,26 +200,6 @@ end
 
 local function updateAuras(frame, unit)
     updateAuraFrames(frame, unit);
-    if UnitIsFriend("player", unit) and UnitDebuff(unit, 1, "RAID") ~= nil then
-        -- something dispellable
-        if frame.overlay.color ~= overlayColorDispel then
-            frame.overlay:SetVertexColor(unpack(overlayColorDispel));
-            frame.overlay:Show();
-            frame.overlay.color = overlayColorDispel;
-        end
-    -- don't overlay charmed when in vehicle
-    elseif UnitIsCharmed(unit) and not frame.inVehicle then
-        if frame.overlay.color ~= overlayColorCharm then
-            frame.overlay:SetVertexColor(unpack(overlayColorCharm));
-            frame.overlay:Show();
-            frame.overlay.color = overlayColorCharm;
-        end
-    else
-        if frame.overlay.color ~= nil then
-            frame.overlay:Hide();
-            frame.overlay.color = nil;
-        end
-    end
 end
 
 local function updateAggro(frame, unit)
@@ -403,6 +382,9 @@ local eventFuncs = {
     end,
     ["UNIT_DISPLAYPOWER"] = function(frame)
         updatePowerColor(frame, frame.displayed);
+        updateMaxPower(frame, frame.displayed);
+        updatePower(frame, frame.displayed);
+        updatePowerText(frame, frame.displayed);
     end,
     ["UNIT_NAME_UPDATE"] = function(frame)
         updateName(frame, frame.displayed);
@@ -463,6 +445,8 @@ local eventFuncs = {
     end,
 };
 eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];
+eventFuncs["UNIT_POWER_BAR_SHOW"] = eventFuncs["UNIT_DISPLAYPOWER"];
+eventFuncs["UNIT_POWER_BAR_HIDE"] = eventFuncs["UNIT_DISPLAYPOWER"];
 eventFuncs["UNIT_ENTERED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"];
 eventFuncs["UNIT_EXITED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"];
 eventFuncs["UNIT_PET"] = eventFuncs["UPDATE_ALL_BARS"];