X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/77a41d614353918e7331bfceb354e58eae086e82..fa6bbd0c83a29683f8646d735ae08ba60f8b4fd6:/OmaCD/Inspect.lua diff --git a/OmaCD/Inspect.lua b/OmaCD/Inspect.lua index ff0c85f..5c5fb5e 100644 --- a/OmaCD/Inspect.lua +++ b/OmaCD/Inspect.lua @@ -4,6 +4,7 @@ local next, print = next, print; local format = string.format; local InCombatLockdown = InCombatLockdown; local CTimerAfter = C_Timer.After; +local UnitIsDeadOrGhost = UnitIsDeadOrGhost; local IsInGroup, IsInRaid = IsInGroup, IsInRaid; local CheckInteractDistance = CheckInteractDistance; local GetTime, UnitGUID, UnitName = GetTime, UnitGUID, UnitName; @@ -40,10 +41,10 @@ local function inspect(id) -- not necessary, but there's too many issues with inspect, -- try to hope being nearby makes it more likely to work -- no need to inspect people not in range before pull anyway - if CheckInteractDistance(id, 1) and CanInspect(id) then + if not UnitIsDeadOrGhost("player") and + 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); @@ -105,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(); @@ -117,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, 2, 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;