Added on and off commands to put processing temporarily on hold and resume it

willneedit [11-18-18 - 10:30]
Added on and off commands to put processing temporarily on hold and resume it
Filename
InventoryManager.lua
Modules/Junker.lua
RulesetsV2.lua
lang/de.lua
lang/en.lua
diff --git a/InventoryManager.lua b/InventoryManager.lua
index e6e2cef..e161804 100644
--- a/InventoryManager.lua
+++ b/InventoryManager.lua
@@ -17,6 +17,7 @@ IM.loadedAddons = {}
 -- The current inventory we're working on
 IM.currentInventory = nil
 IM.currentBagType = nil
+IM.opssuspended = false

 -- The current ruleset we're working with
 IM.currentRuleset = { }
@@ -158,6 +159,8 @@ function IM:help()
 	CHAT_SYSTEM:AddMessage("/im run       - make a pass of the filters over your inventory")
 	CHAT_SYSTEM:AddMessage("/im as-off    - Quickly disable autosell")
 	CHAT_SYSTEM:AddMessage("/im as-on     - Quickly enable autosell")
+	CHAT_SYSTEM:AddMessage("/im off       - Completely suspend operations for this session and until resumed")
+	CHAT_SYSTEM:AddMessage("/im on        - Resume operations")
 	CHAT_SYSTEM:AddMessage("/im settings  - Open up the settings menu")
 end

@@ -188,6 +191,12 @@ function IM:SlashCommand(argv)
 	elseif options[1] == "as-on" then
 		IM.settings.autosell = true
 		self:ReportASState(false)
+	elseif options[1] == "off" then
+		IM.opssuspended = true
+		self:ReportOpsState(false)
+	elseif options[1] == "on" then
+		IM.opssuspended = false
+		self:ReportOpsState(false)
 	else
 		CHAT_SYSTEM:AddMessage("Unknown parameter '" .. argv .. "'")
 	end
diff --git a/Modules/Junker.lua b/Modules/Junker.lua
index c9f7818..ecbcd65 100644
--- a/Modules/Junker.lua
+++ b/Modules/Junker.lua
@@ -18,7 +18,24 @@ function IM:CheckAndDestroy(dryrun)
     IM.settings.statusChangeDelay)
 end

+function IM:ReportOpsState(currently)
+	local currentlystr
+	if(currently) then
+		currentlystr = GetString(IM_LOG_ASSTATE_CURRENTLY)
+	end
+	if(IM.opssuspended) then
+		CHAT_SYSTEM:AddMessage(zo_strformat(GetString(IM_LOG_SUSP_OFF), currentlystr))
+	else
+		CHAT_SYSTEM:AddMessage(zo_strformat(GetString(IM_LOG_SUSP_ON), currentlystr))
+	end
+end
+
 function IM:WorkBackpack(dryrun)
+  if IM.opssuspended then
+	IM:ReportOpsState(true)
+	return
+  end
+
   local action = IM.ACTION_JUNK
   if dryrun then action = nil end

diff --git a/RulesetsV2.lua b/RulesetsV2.lua
index 33abe0e..618d2eb 100644
--- a/RulesetsV2.lua
+++ b/RulesetsV2.lua
@@ -205,6 +205,10 @@ function IMRS2:ResetCounters()
 end

 function IMRS2:Match(data, action)
+  -- Operations completely suspended: Do nothing in any case
+  if IM.opssuspended then
+    return IM.ACTION_KEEP, nil, nil
+  end

   -- Locked: Do nothing in any case
   if data.locked then
diff --git a/lang/de.lua b/lang/de.lua
index 6ef58c0..486a6e4 100644
--- a/lang/de.lua
+++ b/lang/de.lua
@@ -238,6 +238,8 @@ local lang = {
   IM_R2_FORMAT2           = "Nichts von der Liste '<<z:1>>' <<2>>",   -- Rule V2 text, cross reference, negative
   IM_R2_FORMAT3           = "Alles von der Liste '<<z:1>>' <<2>>",    -- Rule V2 text, cross reference, positive

+  IM_LOG_SUSP_ON		  	= "Alle Operationen sind <<1>>aktiv.",
+  IM_LOG_SUSP_OFF	 	 	= "Alle Operationen sind <<1>>PAUSIERT. Mit /im on können sie wieder reaktiviert werden.",
   IM_LOG_ASSTATE_ON		  	= "Autosell ist <<1>>an.",
   IM_LOG_ASSTATE_OFF	  	= "Autosell ist <<1>>AUS. Es kann mit /im as-on wieder eingeschaltet werden.",
   IM_LOG_ASSTATE_CURRENTLY	= "zurzeit "
diff --git a/lang/en.lua b/lang/en.lua
index 50d9a60..f6a0cc2 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -238,6 +238,8 @@ local lang = {
   IM_R2_FORMAT2           = "Nothing from the list '<<z:1>>' <<2>>",      -- Rule V2 text, cross reference, negative
   IM_R2_FORMAT3           = "Everything from the list '<<z:1>>' <<2>>",   	-- Rule V2 text, cross reference, positive

+  IM_LOG_SUSP_ON		  	= "All operations are <<1>>active.",
+  IM_LOG_SUSP_OFF	 	 	= "All operations are <<1>>SUSPENDED. You can use /im on to resume them.",
   IM_LOG_ASSTATE_ON		  	= "Autosell is <<1>>on.",
   IM_LOG_ASSTATE_OFF	  	= "Autosell is <<1>>OFF. You can use /im as-on to switch it back on.",
   IM_LOG_ASSTATE_CURRENTLY	= "currently "