Version 2.1.0

willneedit [06-30-17 - 16:44]
Version 2.1.0
 * Added progress report switch
 * Added switches to apply currencly limits to bank
Filename
InventoryManager.lua
InventoryManager.txt
Modules/Banking.lua
UI/Settings.lua
lang/de.lua
lang/en.lua
diff --git a/InventoryManager.lua b/InventoryManager.lua
index fe32149..e7f4f82 100644
--- a/InventoryManager.lua
+++ b/InventoryManager.lua
@@ -29,6 +29,8 @@ end
 function IM:ReportAction(data, dryrun, action, rIndex, rString)
   if not rIndex then return end

+	if not dryrun and not IM.settings.progressreport then return end
+
 	local index = (dryrun and 0) or 1
 	if self.FCOISL:IsProtectedAction(data.action, data.bagId, data.slotId) then
 		index = 2
@@ -271,6 +273,7 @@ function IM:Init()
 			["maxTV"]			      	= 10,
 			["minTV"]			      	= 0,
 			["autosell"]	    		= true,
+			["progressreport"]		= true,
       ["Version"]           = 3,
 		}
 	}
@@ -317,9 +320,9 @@ function IM:Save()
 	self.charVariables.settings		      = self.settings
 	self.charVariables.currentRuleset	  = self.currentRuleset
 	self.charVariables.Profiles		      = nil
+	self.charVariables.currentRules	    = nil

 	self.accVariables.Profiles 		      = self.Profiles
-	self.accVariables.currentRules	    = nil
 end

 local function OnAddOnLoaded(eventCode, addonName)
diff --git a/InventoryManager.txt b/InventoryManager.txt
index 4663acc..1281941 100644
--- a/InventoryManager.txt
+++ b/InventoryManager.txt
@@ -2,7 +2,7 @@
 ## APIVersion: 100019
 ## OptionalDependsOn: LibAddonMenu-2.0
 ## SavedVariables: IMSavedVars
-## Version: 2.0.0
+## Version: 2.1.0
 ## Author: iwontsay
 ## Description: iwontsay's Inventory Manager

diff --git a/Modules/Banking.lua b/Modules/Banking.lua
index 8b00dbd..57e2308 100644
--- a/Modules/Banking.lua
+++ b/Modules/Banking.lua
@@ -282,9 +282,17 @@ function InventoryManager:FinishMoves()
 	end
 end

-function InventoryManager:BalanceCurrency(currencyType, minCur, maxCur, curName)
-	local carried = GetCarriedCurrencyAmount(currencyType)
-	local banked = GetBankedCurrencyAmount(currencyType)
+function InventoryManager:BalanceCurrency(currencyType, minCur, maxCur, bankCur, curName)
+	local carried
+	local banked
+
+	if bankCur then
+		carried 	= GetBankedCurrencyAmount(currencyType)
+		banked 		= GetCarriedCurrencyAmount(currencyType)
+	else
+		carried 	= GetCarriedCurrencyAmount(currencyType)
+		banked 		= GetBankedCurrencyAmount(currencyType)
+	end

 	if minCur < 0 then minCur = 0 end

@@ -297,9 +305,17 @@ function InventoryManager:BalanceCurrency(currencyType, minCur, maxCur, curName)
 		move = carried - maxCur
 	end

+	if bankCur then
+		move = -move
+	end
+
+  carried 	= GetCarriedCurrencyAmount(currencyType)
+  banked 		= GetBankedCurrencyAmount(currencyType)
+
 	if move == 0 then
 		return
 	elseif move > 0 then
+    if move > carried then move = carried end
 		CHAT_SYSTEM:AddMessage(
 			zo_strformat(GetString(IM_CUR_DEPOSIT), move, curName))
 		DepositCurrencyIntoBank(currencyType, move)
@@ -332,8 +348,8 @@ function InventoryManager:OnBankOpened()
 		moves[(#moves+1) - i] = tmp
 	end

-	self:BalanceCurrency(CURT_MONEY, self.settings.minGold, self.settings.maxGold, GetString(IM_CUR_GOLD))
-	self:BalanceCurrency(CURT_TELVAR_STONES, self.settings.minTV, self.settings.maxTV, GetString(IM_CUR_TVSTONES))
+	self:BalanceCurrency(CURT_MONEY, self.settings.minGold, self.settings.maxGold, self.settings.bankGold, GetString(IM_CUR_GOLD))
+	self:BalanceCurrency(CURT_TELVAR_STONES, self.settings.minTV, self.settings.maxTV, self.settings.bankTV, GetString(IM_CUR_TVSTONES))

 	zo_callLater(
 		function()
diff --git a/UI/Settings.lua b/UI/Settings.lua
index d6e5bd3..ac063d9 100644
--- a/UI/Settings.lua
+++ b/UI/Settings.lua
@@ -14,6 +14,13 @@ local SE = IM.UI.Settings
 function SE:GetControls()
 	return {
 		{
+			type = "checkbox",
+			name = GetString(IM_SET_BANK_LIMITS_GOLD),
+			tooltip = GetString(IM_SET_BANK_LIMITS_TT),
+			getFunc = function() return IM.settings.bankGold end,
+			setFunc = function(value) IM.settings.bankGold = value end,
+		},
+		{
 			type = "slider",
 			name = GetString(IM_SET_MIN_GOLD),
 			tooltip = GetString(IM_SET_MIN_GOLD_TOOLTIP),
@@ -36,6 +43,13 @@ function SE:GetControls()
 			width = "half",	--or "half" (optional)
 		},
 		{
+			type = "checkbox",
+			name = GetString(IM_SET_BANK_LIMITS_TV),
+			tooltip = GetString(IM_SET_BANK_LIMITS_TT),
+			getFunc = function() return IM.settings.bankTV end,
+			setFunc = function(value) IM.settings.bankTV = value end,
+		},
+		{
 			type = "slider",
 			name = GetString(IM_SET_MIN_TV),
 			tooltip = GetString(IM_SET_MIN_TV_TOOLTIP),
@@ -111,6 +125,13 @@ function SE:GetControls()
 			width = "half",
 		},
 		{
+			type = "checkbox",
+			name = GetString(IM_SET_PROGRESS),
+			tooltip = GetString(IM_SET_PROGRESS_TT),
+			getFunc = function() return IM.settings.progressreport end,
+			setFunc = function(value) IM.settings.progressreport = value end,
+		},
+		{
 			type = "button",
 			name = GetString(IM_SET_LIST),
 			tooltip = GetString(IM_SET_LIST_TOOLTIP),
diff --git a/lang/de.lua b/lang/de.lua
index 7eee38d..ab3d572 100644
--- a/lang/de.lua
+++ b/lang/de.lua
@@ -163,6 +163,11 @@ local lang = {
   IM_SET_XREF_TT        = "Wenn gesetzt, verweist es auf eine andere Regelliste, die zu Rate gezogen wird",
   IM_SET_TXTMATCH       = "Filtertext",
   IM_SET_TXTMATCH_TT    = "Wenn nicht leer, bezeichnet es den Namen oder einen Namensteil von dem passenden Objekt. Reguläre Ausdrücke sind zulässig.",
+  IM_SET_BANK_LIMITS_GOLD = "Gold-Limits auf Bank anwenden",
+  IM_SET_BANK_LIMITS_TV   = "Tel-Var-Stein-Linits auf Bank anwenden",
+  IM_SET_BANK_LIMITS_TT   = "Wenn gesetzt, werden die unten angegebenen Werte auf die Bank anstatt auf den Charakter angewendet",
+  IM_SET_PROGRESS         = "Fortschrittsbericht",
+  IM_SET_PROGRESS_TT      = "Wenn Aktionen ausgeführt werden, wird im Chatfenster ein Fortschrittsbericht angezeigt.",

 	IM_PM_PROFILENAME_TOOLTIP	= "Namen vom Profil hier eingeben",
 	IM_RM_PRESETRULES			= "--- Voreingestellte Profile ---",
diff --git a/lang/en.lua b/lang/en.lua
index d685e78..993608f 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -164,6 +164,11 @@ local lang = {
   IM_SET_XREF_TT        = "When set, refer to another rule list to determine the course of action",
   IM_SET_TXTMATCH       = "Filter text",
   IM_SET_TXTMATCH_TT    = "When not empty, it states a name or the part of the name of the item to match. Note: Regular expressions do work here.",
+  IM_SET_BANK_LIMITS_GOLD = "Apply gold limits to bank",
+  IM_SET_BANK_LIMITS_TV   = "Apply Tel Var stones limits to bank",
+  IM_SET_BANK_LIMITS_TT   = "When set, limits set below will be applied to the bank rather than the character",
+  IM_SET_PROGRESS         = "Progress report",
+  IM_SET_PROGRESS_TT      = "When performing actions, list the progress in the chat window",

 	IM_PM_PROFILENAME_TOOLTIP	= "Enter the name of the new profile here",
 	IM_RM_PRESETRULES			= "--- Preset profiles ---",