d9a8d3f - Fix small issues, use StateDrivers instead of reimplementing
[wowui.git] / OmaRF / Indicators.lua
index 8dd2ba9..b3ad0ef 100644 (file)
@@ -3,10 +3,12 @@ local pairs, ipairs = pairs, ipairs;
 local floor = math.floor;
 local GetTime = GetTime;
 local UnitAura = UnitAura;
 local floor = math.floor;
 local GetTime = GetTime;
 local UnitAura = UnitAura;
-local UnitIsPlayer = UnitIsPlayer;
 local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
 local CTimerAfter = C_Timer.After;
 
 local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
 local CTimerAfter = C_Timer.After;
 
+local Frames = OmaFrames;
+local positions = Frames.Positions;
+
 local watchedAuras = {
     [53563] = "TOPRIGHT",
     [156910] = "TOPRIGHT",
 local watchedAuras = {
     [53563] = "TOPRIGHT",
     [156910] = "TOPRIGHT",
@@ -30,9 +32,11 @@ local majorAuras = {
 
 local updaters = {};
 local updating = {};
 
 local updaters = {};
 local updating = {};
-local positions = {"TOPRIGHT", "BOTTOMLEFT"};
 local auraFilters = {"HELPFUL", "HARMFUL"};
 
 local auraFilters = {"HELPFUL", "HARMFUL"};
 
+local M = {};
+OmaIndicators = M;
+
 local function remaining(text, expires, current)
     if expires == 0 then
         text:SetText("");
 local function remaining(text, expires, current)
     if expires == 0 then
         text:SetText("");
@@ -74,7 +78,7 @@ local function updateIndicators(frame, unit)
     end
 end
 
     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();
     for _, pos in pairs(positions) do
         frame.inds[pos].expires = nil;
         frame.inds[pos]:Hide();
@@ -96,7 +100,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];
             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();
                 needUpdate = remaining(frame.inds[pos].text, expires, current);
                 frame.inds[pos].expires = expires;
                 frame.inds[pos]:Show();