29d93c0 - change raid frame position as mage
[wowui.git] / OmaCD / Inspect.lua
index d1291da..a37ed63 100644 (file)
@@ -45,7 +45,6 @@ local function inspect(id)
            CheckInteractDistance(id, 1) and CanInspect(id) then
             if not inspecting then
                 inspecting = guid;
-                print("Sending inspect", UnitName(id));
                 NotifyInspect(id);
                 redoGuid = guid;
                 CTimerAfter(20, redo);
@@ -95,8 +94,8 @@ function OmaInspect.Request(guid, id, callback, needItems, force)
     cached.cb = callback;
     cached.needItems = needItems;
     local elapsed = GetTime() - cached.time;
-    if force or (not needItems and (not cached.talent or elapsed > 60)) or
-       (needItems and (not cached.weapon or elapsed > 60)) then
+    if force or (not needItems and (cached.talent == nil or elapsed > 60)) or
+       (needItems and (cached.weapon == nil or elapsed > 60)) then
         if not pending[guid] or inspecting ~= guid then -- don't send multiple inspects
             inspect(id);
         end
@@ -107,7 +106,7 @@ function OmaInspect.Request(guid, id, callback, needItems, force)
 end
 
 local function inspectReady(guid)
-    if not guid or inspecting ~= guid then print("Got inspect from elsewhere"); return end
+    if not guid or inspecting ~= guid then return end
     local cached = cache[guid];
     if cached and cached.id and UnitGUID(cached.id) == guid then
         local time = GetTime();
@@ -119,22 +118,19 @@ local function inspectReady(guid)
             if not inspectui then ClearInspectPlayer() end
         else
             if CanInspect(id) then
-                if time - cached.time > 60 then -- refresh >1min
-                    -- new inspect
-                    cached.time = time;
-                    if cached.needItems then
-                        cached.weapon = GetInventoryItemLink(id, INVSLOT_MAINHAND);
-                        cached.wrist = GetInventoryItemID(id, INVSLOT_WRIST);
-                    end
-                    cached.spec = GetInspectSpecialization(id);
-                    local _, _, _, selected = GetTalentInfo(6, 2, 1, true, id);
-                    cached.talent = selected;
+                -- new inspect
+                cached.time = time;
+                if cached.needItems then
+                    cached.weapon = GetInventoryItemLink(id, INVSLOT_MAINHAND);
+                    cached.wrist = GetInventoryItemID(id, INVSLOT_WRIST);
                 end
+                cached.spec = GetInspectSpecialization(id);
+                local _, _, _, selected = GetTalentInfo(6, 1, 1, true, id);
+                cached.talent = selected;
             end
             if not inspectui then ClearInspectPlayer() end
             if (cached.needItems and cached.weapon) or
                (not cached.needItems and cached.talent ~= nil) then
-                print("Got inspect done", UnitName(id));
                 cached.cb(guid, cached.spec, cached.talent, cached.weapon, cached.wrist);
             else
                 pending[guid] = true;
@@ -176,9 +172,7 @@ local function create()
     tick();
 end
 
-frame:RegisterEvent("PLAYER_LOGIN");
 frame:SetScript("OnEvent", function(self, event)
-    if event == "PLAYER_LOGIN" then
-        return create();
-    end
+    return create();
 end);
+frame:RegisterEvent("PLAYER_LOGIN");