52e5175 - Fix power bars, remove overlay color for basic unit frames
[wowui.git] / OmaRF / Indicators.lua
index 8dd2ba9..b3c7d07 100644 (file)
@@ -3,36 +3,21 @@ local pairs, ipairs = pairs, ipairs;
 local floor = math.floor;
 local GetTime = GetTime;
 local UnitAura = UnitAura;
-local UnitIsPlayer = UnitIsPlayer;
 local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
 local CTimerAfter = C_Timer.After;
 
-local watchedAuras = {
-    [53563] = "TOPRIGHT",
-    [156910] = "TOPRIGHT",
-    [200025] = "TOPRIGHT",
-    [200654] = "BOTTOMLEFT",
-};
-local majorAuras = {
-    ["Psychic Assault"] = true,
-    ["Everburning Flames"] = true,
-    ["Corrupt"] = true,
-    ["Sleep Canister"] = true,
-    ["Misery"] = true,
-    ["Necrotic Embrace"] = true,
-    ["Fulminating Pulse"] = true,
-    ["Chilled Blood"] = true,
-    ["Soulblight"] = true,
-    ["Soulburst"] = true,
-    ["Soulbomb"] = true,
-    ["Aqua Bomb"] = true,
-};
+local Settings = OmaRFSettings;
+local majorAuras = Settings.MajorAuras;
+local positions = {};
+local watchedAuras = {};
 
 local updaters = {};
 local updating = {};
-local positions = {"TOPRIGHT", "BOTTOMLEFT"};
 local auraFilters = {"HELPFUL", "HARMFUL"};
 
+local M = {};
+OmaRFIndicators = M;
+
 local function remaining(text, expires, current)
     if expires == 0 then
         text:SetText("");
@@ -74,7 +59,7 @@ local function updateIndicators(frame, unit)
     end
 end
 
-function OmaCheckIndicators(frame, unit)
+function M.CheckIndicators(frame, unit)
     for _, pos in pairs(positions) do
         frame.inds[pos].expires = nil;
         frame.inds[pos]:Hide();
@@ -96,7 +81,7 @@ function OmaCheckIndicators(frame, unit)
             name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, filter);
             if not id then break end
             local pos = watchedAuras[id] or watchedAuras[name];
-            if pos and UnitIsPlayer(caster) then
+            if pos and caster == "player" then
                 needUpdate = remaining(frame.inds[pos].text, expires, current);
                 frame.inds[pos].expires = expires;
                 frame.inds[pos]:Show();
@@ -137,3 +122,8 @@ function OmaCheckIndicators(frame, unit)
         frame.major:Hide();
     end
 end
+
+function M.LoadChar()
+    watchedAuras = Settings.Character["WatchedAuras"];
+    positions = Settings.Character.Positions;
+end