5e453fc - Optimize CheckIndicators
[wowui.git] / OmaRF / Indicators.lua
index f90ff60..d37383a 100644 (file)
@@ -13,7 +13,6 @@ local watchedAuras = {};
 
 local updaters = {};
 local updating = {};
-local auraFilters = {"HELPFUL", "HARMFUL"};
 
 local M = {};
 OmaRFIndicators = M;
@@ -132,26 +131,28 @@ function M.CheckIndicators(frame, unit)
     local majorPos = 1;
     local alert = false; -- color the whole bar
     local current = GetTime();
-    for _, filter in ipairs(auraFilters) do
-        local i = 1;
-        while true do
-            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 caster == "player" then
-                needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate;
-                showInds = true;
-            end
-            local major = majorAuras[id] or majorAuras[name];
-            if major and majorPos <= 3 then
-                needUpdate = showInd(frame.majors[majorPos], expires, current, count, icon) or needUpdate;
-                if major.bar then alert = true end
-                showMajors = true;
-                majorPos = majorPos + 1;
-            end
-            i = i + 1;
+    for spell, pos in pairs(watchedAuras) do
+        name, _, icon, count, _, _, expires = UnitAura(unit, spell, nil, "PLAYER HELPFUL");
+        if name then
+            needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate;
+            showInds = true;
+        end
+    end
+
+    local i = 1;
+    while true do
+        name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, "HARMFUL");
+        if not id or majorPos > 3 then break end
+        local major = majorAuras[id] or majorAuras[name];
+        if major then
+            needUpdate = showInd(frame.majors[majorPos], expires, current, count, icon) or needUpdate;
+            if major.bar then alert = true end
+            showMajors = true;
+            majorPos = majorPos + 1;
         end
+        i = i + 1;
     end
+
     if showInds or showMajors then
         frame.indBase:Show();
         frame.majorBase:Show();