diff --git a/aard_inventory.xml b/aard_inventory.xml index 809ccb9..b822b21 100644 --- a/aard_inventory.xml +++ b/aard_inventory.xml @@ -85,7 +85,7 @@ dbot.callback : Module to help manage callback functions and parameters save_state="y" date_written="2017-08-12 08:45:15" requires="4.98" - version="2.0003" + version="2.0004" > @W") then an automatic refresh +refresh will trigger 5 seconds after an item is added to your inventory and every N minutes since +the previous automatic refresh (if N is not supplied, it will default to 5 minutes.) If nothing +has changed since the last refresh, the refresh simply returns. The plugin will skip a refresh or halt it early if you go to sleep, go AFK, enter combat, or hit a paging prompt. In this case, any changes that were missed will be picked up the next time a refresh is in progress. You may also execute a refresh that performs a full scan of all worn items, items in your main -inventory, and items in containers. The plugin performs a full scan at startup to ensure that -everything is in the expected place. Otherwise, your inventory table would become out of sync -if you logged in with another client and moved items around. The full scan guarantees that the -plugin knows where everything is. +inventory, and items in containers. Your first refresh after starting up will be a full scan to +ensure that everything is in the expected place. Otherwise, your inventory table could become +out of sync if you logged in with another client and moved items around. The full scan guarantees +that the plugin knows where everything is. Examples: 1) Perform a manual refresh @@ -4882,6 +4886,8 @@ function inv.items.fini(doSaveState) end -- if end -- if + inv.items.fullScanCompleted = false + return retval end -- inv.items.fini @@ -5753,6 +5759,7 @@ invStatePaused = "paused" invStateHalted = "halted" inv.items.refreshPkg = nil +inv.items.fullScanCompleted = false function inv.items.refresh(maxNumItems, refreshLocations, endTag, tagProxy) local retval = DRL_RET_SUCCESS @@ -5822,6 +5829,14 @@ function inv.items.refresh(maxNumItems, refreshLocations, endTag, tagProxy) inv.items.refreshPkg.endTag = endTag inv.items.refreshPkg.tagModule = tagModule + -- If we haven't performed a full scan yet since we initialized the plugin, make this a + -- full scan. We want to run at least one full scan so that we handle orphan equipment + -- and detect if the user moved stuff around in another client or in this client when the + -- plugin was disabled. + if (not inv.items.fullScanCompleted) then + inv.items.refreshPkg.refreshLocations = invItemsRefreshLocAll + end -- if + wait.make(inv.items.refreshCR) retval = DRL_RET_SUCCESS end -- if @@ -5915,6 +5930,12 @@ function inv.items.refreshCR() inv.state = invStateIdle + -- We want at least one full scan after the plugin loads. If we've successfully completed a full + -- scan, remember it so that we don't need to do it again until the plugin reloads. + if (retval == DRL_RET_SUCCESS) and (inv.items.refreshPkg.refreshLocations == invItemsRefreshLocAll) then + inv.items.fullScanCompleted = true + end -- if + return inv.tags.stop(inv.items.refreshPkg.tagModule, inv.items.refreshPkg.endTag, retval) end -- inv.items.refreshCR @@ -16119,7 +16140,7 @@ function dbot.update.callback(retval, page, status, headers, fullStatus, request local retval = DRL_RET_SUCCESS if (dbot.update.pkg == nil) or (dbot.update.pkg.mode == nil) then - dbot.warn("dbot.update.callback: Missing or invalid update package detected") + dbot.error("dbot.update.callback: Missing or invalid update package detected") return inv.tags.stop(invTagsVersion, "end tag is nil", DRL_RET_INVALID_PARAM) end -- if @@ -16136,7 +16157,7 @@ function dbot.update.callback(retval, page, status, headers, fullStatus, request local remoteVersion = tonumber(remoteVerStr or "") or 0 if (remoteVersion == currentVersion) then - dbot.info("You are running the most recent plugin (v" .. currentVersion .. ")") + dbot.info("You are running the most recent plugin (v" .. currentVerStr .. ")") elseif (remoteVersion < currentVersion) then dbot.warn("Your current plugin (v" .. currentVerStr .. ") " .. @@ -16190,7 +16211,7 @@ function dbot.updateCR() end -- while if (retval ~= DRL_RET_SUCCESS) then - retval, page, status, headers, full_status = urlThread:join() + updateRet, page, status, headers, fullStatus = urlThread:join() end -- if end -- if