Quantcast

Added auto-resume logic

Kevin Lyles [07-06-10 - 17:44]
Added auto-resume logic
Filename
ItemScanner.lua
diff --git a/ItemScanner.lua b/ItemScanner.lua
index d39992f..a1aa139 100644
--- a/ItemScanner.lua
+++ b/ItemScanner.lua
@@ -185,3 +185,20 @@ end
 SLASH_ITEMSCANNER1="/is"
 SLASH_ITEMSCANNER2="/itemscanner"
 SlashCmdList["ITEMSCANNER"] = commandHandler
+
+-- Autoresumes on login
+local function resume()
+	if IS_status.items.scan_active then
+		if IS_status.items.finished then
+			commandHandler("items next-chunk")
+		else
+			commandHandler("items")
+		end
+	end
+	if not frame.itemco then
+		print("Nothing seems to be active, restarting")
+		commandHandler("items reset")
+	end
+end
+
+frame:SetScript("OnUpdate", resume)