Introduced additional currencies. Thanks Fedix

willneedit [11-18-18 - 09:59]
Introduced additional currencies. Thanks Fedix
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 78b8407..e1fc3c0 100644
--- a/InventoryManager.lua
+++ b/InventoryManager.lua
@@ -21,6 +21,9 @@ IM.currentBagType = nil
 -- The current ruleset we're working with
 IM.currentRuleset = { }

+local ADDON_VERSION = "2.3.0"
+local ADDON_WEBSITE = "https://www.esoui.com/downloads/info1642-InventoryManager.html"
+
 function IM:ProcessSingleItem(dryrun, data)
 	if not dryrun then IM.actionfunctions[data.action](data) end
 	IM:ReportAction(data, dryrun, data.action, data.index, data.text)
@@ -190,10 +193,16 @@ local ProfileEdit = IM.UI.ProfileEdit
 local Settings = IM.UI.Settings

 function IM:InitializeUI()
+
 	local panelData = {
 		type = "panel",
 		name = "InventoryManager",
+		author = "iwontsay & iFedix",
+		version = ADDON_VERSION,
+		slashCommand = "/im",
 		registerForRefresh = true,	--boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown)
+		registerForDefaults = true,
+		website = ADDON_WEBSITE,
 	}

 	local mainPanel = {
@@ -272,6 +281,10 @@ function IM:Init()
 			["minGold"]		    		= 1000,
 			["maxTV"]			      	= 10,
 			["minTV"]			      	= 0,
+			["maxAP"]		    		= 10,
+			["minAP"]		    		= 0,
+			["maxVW"]			      	= 10,
+			["minVW"]			      	= 0,
 			["autosell"]	    		= true,
 			["progressreport"]		= true,
       ["Version"]           = 3,
diff --git a/InventoryManager.txt b/InventoryManager.txt
index cfba3c0..b67e2bb 100644
--- a/InventoryManager.txt
+++ b/InventoryManager.txt
@@ -2,9 +2,9 @@
 ## APIVersion: 100025
 ## OptionalDependsOn: LibAddonMenu-2.0
 ## SavedVariables: IMSavedVars
-## Version: 2.2.0
-## Author: iwontsay
-## Description: iwontsay's Inventory Manager
+## Version: 2.3.0
+## Author: iwontsay & iFedix
+## Description: Automatically stash, retrieve and dispose your items with custom rules!

 libs/LibStub/LibStub.lua

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

-function InventoryManager:BalanceCurrency(currencyType, minCur, maxCur, bankCur, curName)
+function InventoryManager:BalanceCurrency(currencyType, minCur, maxCur, bankCur)
 	local carried
 	local banked

@@ -317,14 +317,14 @@ function InventoryManager:BalanceCurrency(currencyType, minCur, maxCur, bankCur,
 	elseif move > 0 then
     if move > carried then move = carried end
 		CHAT_SYSTEM:AddMessage(
-			zo_strformat(GetString(IM_CUR_DEPOSIT), move, curName))
+			zo_strformat(GetString(IM_CUR_DEPOSIT), ZO_Currency_FormatPlatform(currencyType, move, ZO_CURRENCY_FORMAT_AMOUNT_ICON)))
 		DepositCurrencyIntoBank(currencyType, move)
 	else
 		move = -move
 		if move > banked then move = banked end
 		if move == 0 then return end
 		CHAT_SYSTEM:AddMessage(
-			zo_strformat(GetString(IM_CUR_WITHDRAW), move, curName))
+			zo_strformat(GetString(IM_CUR_WITHDRAW), ZO_Currency_FormatPlatform(currencyType, move, ZO_CURRENCY_FORMAT_AMOUNT_ICON)))
 		WithdrawCurrencyFromBank(currencyType, move)
 	end
 end
@@ -348,8 +348,10 @@ function InventoryManager:OnBankOpened()
 		moves[(#moves+1) - i] = tmp
 	end

-	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))
+	self:BalanceCurrency(CURT_MONEY, self.settings.minGold, self.settings.maxGold, self.settings.bankGold)
+	self:BalanceCurrency(CURT_TELVAR_STONES, self.settings.minTV, self.settings.maxTV, self.settings.bankTV)
+	self:BalanceCurrency(CURT_ALLIANCE_POINTS, self.settings.minAP, self.settings.maxAP, self.settings.bankAP)
+	self:BalanceCurrency(CURT_WRIT_VOUCHERS, self.settings.minVW, self.settings.maxVW, self.settings.bankVW)

 	zo_callLater(
 		function()
diff --git a/UI/Settings.lua b/UI/Settings.lua
index ac063d9..95bf7d8 100644
--- a/UI/Settings.lua
+++ b/UI/Settings.lua
@@ -72,6 +72,64 @@ function SE:GetControls()
 			width = "half",	--or "half" (optional)
 		},
 		{
+			type = "checkbox",
+			name = GetString(IM_SET_BANK_LIMITS_AP),
+			tooltip = GetString(IM_SET_BANK_LIMITS_AP),
+			getFunc = function() return IM.settings.bankAP end,
+			setFunc = function(value) IM.settings.bankAP = value end,
+		},
+		{
+			type = "slider",
+			name = GetString(IM_SET_MIN_AP),
+			tooltip = GetString(IM_SET_MIN_AP_TOOLTIP),
+			min = 0,
+			max = 100000,
+			getFunc = function() return IM.settings.minAP end,
+			setFunc = function(value) IM.settings.minAP = value end,
+			clampInput = false,
+			width = "half",	--or "half" (optional)
+		},
+		{
+			type = "slider",
+			name = GetString(IM_SET_MAX_AP),
+			tooltip = GetString(IM_SET_MAX_AP_TOOLTIP),
+			min = 0,
+			max = 100000,
+			getFunc = function() return IM.settings.maxAP end,
+			setFunc = function(value) IM.settings.maxAP = value end,
+			clampInput = false,
+			width = "half",	--or "half" (optional)
+		},
+		{
+			type = "checkbox",
+			name = GetString(IM_SET_BANK_LIMITS_WV),
+			tooltip = GetString(IM_SET_BANK_LIMITS_WV),
+			getFunc = function() return IM.settings.bankWV end,
+			setFunc = function(value) IM.settings.bankWV = value end,
+		},
+		{
+			type = "slider",
+			name = GetString(IM_SET_MIN_VW),
+			tooltip = GetString(IM_SET_MIN_VW_TOOLTIP),
+			min = 0,
+			max = 100000,
+			getFunc = function() return IM.settings.minVW end,
+			setFunc = function(value) IM.settings.minVW = value end,
+			clampInput = false,
+			width = "half",	--or "half" (optional)
+		},
+		{
+			type = "slider",
+			name = GetString(IM_SET_MAX_VW),
+			tooltip = GetString(IM_SET_MAX_GOLD_VW),
+			min = 0,
+			max = 100000,
+			getFunc = function() return IM.settings.maxVW end,
+			setFunc = function(value) IM.settings.maxVW = value end,
+			clampInput = false,
+			width = "half",	--or "half" (optional)
+		},
+		{
 			type = "slider",
 			name = GetString(IM_SET_BANK),
 			tooltip = GetString(IM_SET_BANK_TOOLTIP),
diff --git a/lang/de.lua b/lang/de.lua
index c3ec7f0..80c0de6 100644
--- a/lang/de.lua
+++ b/lang/de.lua
@@ -134,6 +134,15 @@ local lang = {
 	IM_SET_MIN_TV_TOOLTIP		= "Wieviele Steine mindestens beim Charakter behalten werden",
 	IM_SET_MAX_TV				= "Maximum Tel Var stones",
 	IM_SET_MAX_TV_TOOLTIP		= "Wieviele Steine höchstens beim Charakter behalten werden",
+	IM_SET_MIN_AP				= "Minimum Alliance Points",
+	IM_SET_MIN_AP_TOOLTIP		= "Wieviele Allianzpunkte mindestens beim Charakter behalten werden",
+	IM_SET_MAX_AP				= "Maximum Alliance Points",
+	IM_SET_MAX_AP_TOOLTIP		= "Wieviele Allianzpunkte höchstens beim Charakter behalten werden",
+	IM_SET_MIN_VW				= "Minimum Writ Vouchers",
+	IM_SET_MIN_VW_TOOLTIP		= "Wieviele Schriebscheine mindestens beim Charakter behalten werden",
+	IM_SET_MAX_VW				= "Maximum Writ Vouchers",
+	IM_SET_MAX_VW_TOOLTIP		= "Wieviele Schriebscheine höchstens beim Charakter behalten werden",
+
 	IM_SET_BANK					= "Bank-Verzögerung",
 	IM_SET_BANK_TOOLTIP			= "Zeit in Millisekunden zwischen einzelnen Bankbewegungen",
 	IM_SET_DEST					= "Zerstörungsschwelle",
@@ -165,6 +174,8 @@ local lang = {
   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_AP = "Alliance-Points auf Bank anwenden",
+  IM_SET_BANK_LIMITS_WV   = "Writ-Vouchers 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.",
@@ -183,8 +194,6 @@ local lang = {
 	IM_CUR_SOLDJUNK				= "Gegenstände verkauft, Erlös <<1>> Münzen.",
 	IM_CUR_DEPOSIT				= "Zahle <<1>> <<2>> ein.",
 	IM_CUR_WITHDRAW				= "Hebe <<1>> <<2>> ab.",
-	IM_CUR_GOLD					= "Goldmnünzen",
-	IM_CUR_TVSTONES				= "Tel Var Steine",

 	IM_FCOIS_CHOICE			= "FCO ItemSaver Markierung",
 	IM_FCOIS_UNMARKED			= "unmarkiert(es)",
diff --git a/lang/en.lua b/lang/en.lua
index 814e5cf..8d66cbd 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -1,4 +1,3 @@
-
 -- Check Behavior of GetString
 local lang = {

@@ -135,6 +134,15 @@ local lang = {
 	IM_SET_MIN_TV_TOOLTIP		= "Minimum amount of Tel Var stones to keep on character",
 	IM_SET_MAX_TV				= "Maximum Tel Var stones",
 	IM_SET_MAX_TV_TOOLTIP		= "Maximum amount of Tel Var stones to keep on character",
+	IM_SET_MIN_AP				= "Minimum Alliance Points",
+	IM_SET_MIN_AP_TOOLTIP		= "Minimum amount of Alliance Points to keep on character",
+	IM_SET_MAX_AP				= "Maximum Alliance Points",
+	IM_SET_MAX_AP_TOOLTIP		= "Maximum amount of Alliance Points to keep on character",
+	IM_SET_MIN_VW				= "Minimum Writ Vouchers",
+	IM_SET_MIN_VW_TOOLTIP		= "Minimum amount of Writ Vouchers to keep on character",
+	IM_SET_MAX_VW				= "Maximum Writ Vouchers",
+	IM_SET_MAX_VW_TOOLTIP		= "Maximum amount of Writ Vouchers to keep on character",
+
 	IM_SET_BANK					= "Delay between bank moves",
 	IM_SET_BANK_TOOLTIP			= "Time in milliseconds to wait between bank moves",
 	IM_SET_DEST					= "Destroy Threshold",
@@ -166,6 +174,8 @@ local lang = {
   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_AP = "Apply Alliance Points limits to bank",
+  IM_SET_BANK_LIMITS_WV   = "Apply Writ Vouchers 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",
@@ -182,10 +192,8 @@ local lang = {
 	IM_UI_SETTINGS				= "Settings",
 	IM_UI_SETTINGS_TOOLTIP		= "Adapt the general behavior",
 	IM_CUR_SOLDJUNK				= "Sold items, Revenue is <<1>> gold coins.",
-	IM_CUR_DEPOSIT				= "Depositing <<1>> <<2>>.",
-	IM_CUR_WITHDRAW				= "Withdrawing <<1>> <<2>>.",
-	IM_CUR_GOLD					= "gold coins",
-	IM_CUR_TVSTONES				= "Tel Var stones",
+	IM_CUR_DEPOSIT				= "Depositing <<1>> <<2>> <<3>>.",
+	IM_CUR_WITHDRAW				= "Withdrawing <<1>> <<2>> <<3>>.",

 	IM_FCOIS_CHOICE				= "FCO ItemSaver Marking",
 	IM_FCOIS_UNMARKED			= "unmarked",