f92b14e - Add a coordinate frame
[wowui.git] / OmaCD / Cooldowns.lua
index 3663615..6e3ce70 100644 (file)
@@ -169,6 +169,7 @@ local function getFrame()
     return frame;
 end
 local function updateCD(guid, specid, spellid)
     return frame;
 end
 local function updateCD(guid, specid, spellid)
+    if not guidToId[guid] then return end
     -- update cd value
     local cd = trackedcds[specid][spellid];
     if cdfixes[guid] then cd = cd + cdfixes[guid] end
     -- update cd value
     local cd = trackedcds[specid][spellid];
     if cdfixes[guid] then cd = cd + cdfixes[guid] end
@@ -196,7 +197,7 @@ end
 
 local function updateUnitCD(guid)
     local specid = guidToSpecid[guid];
 
 local function updateUnitCD(guid)
     local specid = guidToSpecid[guid];
-    if specid then
+    if specid and trackedcds[specid] then
         for spellid, _ in pairs(trackedcds[specid]) do
             updateCD(guid, specid, spellid);
         end
         for spellid, _ in pairs(trackedcds[specid]) do
             updateCD(guid, specid, spellid);
         end
@@ -232,7 +233,7 @@ local function monkTick()
     if not InCombatLockdown() then
         for guid, _ in pairs(monks) do
             local id = guidToId[guid];
     if not InCombatLockdown() then
         for guid, _ in pairs(monks) do
             local id = guidToId[guid];
-            if id then OmaInspect.Request(guid, id, updateMonk) end
+            if id then OmaInspect.Request(guid, id, updateMonk, true) end
         end
     end
     CTimerAfter(10, monkTick);
         end
     end
     CTimerAfter(10, monkTick);
@@ -253,7 +254,7 @@ end
 local function updatePriest(guid, specid)
     local id = guidToId[guid];
     if id then
 local function updatePriest(guid, specid)
     local id = guidToId[guid];
     if id then
-        if guidToSpecid[guid] ~= specid then
+        if guidToSpecid[guid] ~= specid and frames[guid] then
             for _, frame in pairs(frames[guid]) do
                 removeFrame(frame);
             end
             for _, frame in pairs(frames[guid]) do
                 removeFrame(frame);
             end
@@ -282,8 +283,10 @@ local function updatePlayer()
         idToGuid["player"] = guid;
     else
         idToGuid["player"] = nil;
         idToGuid["player"] = guid;
     else
         idToGuid["player"] = nil;
-        for _, frame in pairs(frames[guid]) do
-            removeFrame(frame);
+        if frames[guid] then
+            for _, frame in pairs(frames[guid]) do
+                removeFrame(frame);
+            end
         end
     end
 end
         end
     end
 end
@@ -378,25 +381,10 @@ end
 
 -- just check removals, don't cause inspects
 local function fastUpdateUnitids()
 
 -- just check removals, don't cause inspects
 local function fastUpdateUnitids()
-    local size = 0;
-    local prefix = "solo";
-    if IsInGroup() then
-        if IsInRaid() then
-            size = 40;
-            prefix = "raid";
-        else
-            size = 4;
-            prefix = "party";
-        end
-    end
-    for i = 1,size do
-        local id = format("%s%i", prefix, i);
-        if not UnitExists(id) or UnitGroupRolesAssigned(id) ~= "HEALER" then
-            idToGuid[id] = nil;
-            if frames[guid] then
-                for _, frame in pairs(frames[guid]) do
-                    removeFrame(frame);
-                end
+    for guid, unitFrames in pairs(frames) do
+        if UnitGUID(guidToId[guid]) ~= guid then
+            for _, frame in pairs(unitFrames) do
+                removeFrame(frame);
             end
         end
     end
             end
         end
     end