5e453fc - Optimize CheckIndicators
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Thu, 15 Mar 2018 09:15:07 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Thu, 15 Mar 2018 09:15:07 +0000
New limitations:
- major frames only track debuffs
- indicators cannot use spellIDs

OmaRF/DruidIndicators.lua
OmaRF/Indicators.lua
OmaRF/PaladinIndicators.lua
OmaRF/ShamanIndicators.lua

index 82f3a48..9aeefbc 100644 (file)
@@ -8,13 +8,13 @@ local square = "Interface\\AddOns\\OmaRF\\images\\square";
 local M = {};
 OmaRFIndicators.Class["DRUID"] = M;
 M.Auras = {
 local M = {};
 OmaRFIndicators.Class["DRUID"] = M;
 M.Auras = {
-    [33763] = "TOPLEFT", -- Lifebloom
-    [774] = "TR1", -- Rejuvenation
-    [102352] = "TR2", -- Cenarion Ward (102351 is the 30-sec buff before the HoT)
-    [207386] = "TR3", -- Spring Blossoms (207385 is the talent)
-    [155777] = "TR3", -- Germination (either Spring Blossoms or this taken)
-    [8936] = "TR4", -- Regrowth
-    [200389] = "TR5", -- Cultivation
+    ["Lifebloom"] = "TOPLEFT",
+    ["Rejuvenation"] = "TR1",
+    ["Cenarion Ward"] = "TR2",
+    ["Spring Blossoms"] = "TR3",
+    ["Rejuvenation (Germination)"] = "TR3",
+    ["Regrowth"] = "TR4",
+    ["Cultivation"] = "TR5",
 }
 
 function M.Setup(base)
 }
 
 function M.Setup(base)
index f90ff60..d37383a 100644 (file)
@@ -13,7 +13,6 @@ local watchedAuras = {};
 
 local updaters = {};
 local updating = {};
 
 local updaters = {};
 local updating = {};
-local auraFilters = {"HELPFUL", "HARMFUL"};
 
 local M = {};
 OmaRFIndicators = M;
 
 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();
     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
         end
+        i = i + 1;
     end
     end
+
     if showInds or showMajors then
         frame.indBase:Show();
         frame.majorBase:Show();
     if showInds or showMajors then
         frame.indBase:Show();
         frame.majorBase:Show();
index e81954b..762a525 100644 (file)
@@ -7,10 +7,10 @@ local rhomb = "Interface\\AddOns\\OmaRF\\images\\rhomb";
 local M = {};
 OmaRFIndicators.Class["PALADIN"] = M;
 M.Auras = {
 local M = {};
 OmaRFIndicators.Class["PALADIN"] = M;
 M.Auras = {
-    [53563] = "TOPRIGHT", -- Beacon of Light
-    [156910] = "TOPRIGHT", -- Beacon of Faith
-    [200025] = "TOPRIGHT", -- Beacon of Virtue
-    [200654] = "BOTTOMLEFT", -- Tyr's Deliverance
+    ["Beacon of Light"] = "TOPRIGHT",
+    ["Beacon of Faith"] = "TOPRIGHT",
+    ["Beacon of Virtue"] = "TOPRIGHT",
+    ["Tyr's Deliverance"] = "BOTTOMLEFT",
 }
 
 function M.Setup(base)
 }
 
 function M.Setup(base)
index 20820d6..17034d2 100644 (file)
@@ -7,7 +7,7 @@ local rhomb = "Interface\\AddOns\\OmaRF\\images\\rhomb";
 local M = {};
 OmaRFIndicators.Class["SHAMAN"] = M;
 M.Auras = {
 local M = {};
 OmaRFIndicators.Class["SHAMAN"] = M;
 M.Auras = {
-    [61295] = "TOPRIGHT", -- Riptide
+    ["Riptide"] = "TOPRIGHT",
 }
 
 function M.Setup(base)
 }
 
 function M.Setup(base)