diff Modules/Config.lua @ 176:26c750a10b14

Renamed Inventorium debug channel to IMDebug (so it?s easier to recognize only IM changes, not from other addons), write /im d to register this new channel. Implemented stock alerts. Added ?don?t alert at characters? option which allows you to track groups at characters without being bothered about low stock. You can change the speed of the stock alert at the extra config tab.
author Zerotorescue
date Sun, 30 Jan 2011 15:39:18 +0100
parents e31b68c119df
children dd0e7e00bb9d
line wrap: on
line diff
--- a/Modules/Config.lua	Thu Jan 27 22:51:55 2011 +0100
+++ b/Modules/Config.lua	Sun Jan 30 15:39:18 2011 +0100
@@ -329,14 +329,14 @@
 							order = 19,
 							type = "toggle",
 							name = "Override track at",
-							desc = "Allows you to override at which characters items in this group should appear in the summary and generate alerts.",
+							desc = "Allows you to override at which characters groups should be tracked, appear in the summary or generate alerts.",
 							arg = "trackAtCharacters",
 						},
 						trackAtCharacters = {
 							order = 20,
 							type = "multiselect",
 							name = "Track at",
-							desc = "Select at which characters this should appear in the summary and generate alerts.",
+							desc = "Select at which characters groups should be tracked, appear in the summary or generate alerts.",
 							values = function()
 								local temp = {};
 								for charName in pairs(addon.db.factionrealm.characters) do
@@ -349,6 +349,30 @@
 							dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
 							arg = "overrideTrackAtCharacters",
 						},
+						overrideDontAlertAtCharacters = {
+							order = 29,
+							type = "toggle",
+							name = "Override not alerting at",
+							desc = "Allows you to override at which characters items in groups should |cffff0000not|r generate alerts when they are below the required stock.",
+							arg = "dontAlertAtCharacters",
+						},
+						dontAlertAtCharacters = {
+							order = 30,
+							type = "multiselect",
+							name = "Do |cffff0000not|r alert at",
+							desc = "Select at which characters items in groups should |cffff0000not|r generate alerts when they are below the required stock.",
+							values = function()
+								local temp = {};
+								for charName in pairs(addon.db.factionrealm.characters) do
+									temp[charName] = charName;
+								end
+								
+								return temp;
+							end,
+							get = GetMultiOption,
+							dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
+							arg = "overrideDontAlertAtCharacters",
+						},
 						overrideLocalItemData = {
 							order = 39,
 							type = "toggle",
@@ -1307,6 +1331,8 @@
 	temp.name = groupName;
 	temp.trackAtCharacters = nil;
 	temp.overrideTrackAtCharacters = nil;
+	temp.dontAlertAtCharacters = nil;
+	temp.overrideDontAlertAtCharacters = nil;
 
 	if not AceSerializer then
 		AceSerializer = LibStub("AceSerializer-3.0");
@@ -1415,9 +1441,8 @@
 					trackAtCharacters = {
 						order = 10,
 						type = "multiselect",
-						width = "double",
-						name = "Track at these characters:",
-						desc = "Select at which characters this should appear in the summary and generate alerts.",
+						name = "Track at",
+						desc = "Select at which characters groups should be tracked, appear in the summary or generate alerts.",
 						values = function()
 							local temp = {};
 							for charName in pairs(addon.db.factionrealm.characters) do
@@ -1434,10 +1459,48 @@
 						end,
 						dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
 					},
+					dontAlertAtCharacters = {
+						order = 15,
+						type = "multiselect",
+						name = "Do |cffff0000not|r alert at:",
+						desc = "Select at which characters items in groups should |cffff0000not|r generate alerts when they are below the required stock.",
+						values = function()
+							local temp = {};
+							for charName in pairs(addon.db.factionrealm.characters) do
+								temp[charName] = charName;
+							end
+							
+							return temp;
+						end,
+						get = function(i, v)
+							return addon.db.profile.defaults.dontAlertAtCharacters[v];
+						end,
+						set = function(i, v, e)
+							addon.db.profile.defaults.dontAlertAtCharacters[v] = e or nil;
+						end,
+						dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
+					},
+					--[[stockLevelAlertScanRepeatInterval = {
+						order = 17,
+						type = "multiselect",
+						name = "Stock scan repeat interval",
+						desc = "Select when or how often your stock levels should be checked and show alerts.",
+						values = {
+							["00Login"] = "At login",
+							["01Repeat5"] = "Every 5 minutes",
+							["02Repeat10"] = "Every 10 minutes",
+							["03Repeat15"] = "Every 15 minutes",
+							["04Repeat30"] = "Every 30 minutes",
+							["05Repeat60"] = "Every 1 hour",
+							["06Repeat120"] = "Every 2 hours",
+						},
+						get = function(i, v) return addon.db.profile.defaults.scanRepeatInterval and addon.db.profile.defaults.scanRepeatInterval[v]; end,
+						set = function(i, v, e) addon.db.profile.defaults.scanRepeatInterval[v] = e; end, -- can't be nil or the defaults will be used
+						dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
+					},]]
 					localItemData = {
 						order = 20,
 						type = "multiselect",
-						width = "double",
 						name = "Include in local item data",
 						desc = "Select which data should be included in the local item data.",
 						values = {
@@ -1470,6 +1533,7 @@
 						name = "",
 						hidden = function() return addon.db.profile.defaults.hideHelp; end,
 					},
+					
 					minLocalStock = {
 						order = 10,
 						type = "range",
@@ -1498,6 +1562,7 @@
 						get = function() return addon.db.profile.defaults.autoRefill; end,
 						set = function(i, v) addon.db.profile.defaults.autoRefill = v; end,
 					},
+					
 					minGlobalStock = {
 						order = 20,
 						type = "range",
@@ -1518,6 +1583,7 @@
 						get = function() return addon.db.profile.defaults.alertBelowGlobalMinimum; end,
 						set = function(i, v) addon.db.profile.defaults.alertBelowGlobalMinimum = v; end,
 					},
+					
 					summaryThresholdShow = {
 						order = 30,
 						type = "range",
@@ -1738,7 +1804,7 @@
 							
 							local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
 							
-							if currentAddon.GetGuildNames then
+							if currentAddon and currentAddon.GetGuildNames then
 								local guilds = currentAddon.GetGuildNames();
 								
 								if guilds and type(guilds) == "table" then
@@ -1759,7 +1825,7 @@
 						get = function(i, v)
 							local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
 							
-							return currentAddon.GetGuildNames and currentAddon.GetGuildNames()[v];
+							return currentAddon and currentAddon.GetGuildNames and currentAddon.GetGuildNames()[v];
 						end,
 						set = function(i, v, e)
 							local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
@@ -1771,7 +1837,7 @@
 								addon.db.profile.defaults.itemCountGuildsExcluded[v] = true; -- this is excluded, excluded is indicated by true
 							end
 							
-							if currentAddon.SetGuildState then
+							if currentAddon and currentAddon.SetGuildState then
 								currentAddon.SetGuildState(v, e);
 							end
 						end, -- can't be nil or the defaults will be used
@@ -1815,6 +1881,30 @@
 						get = function() return addon.db.profile.defaults.autoRefillSkipConfirm; end,
 						set = function(i, v) addon.db.profile.defaults.autoRefillSkipConfirm = v; end,
 					},
+					stockAlertScanInterval = {
+						order = 25,
+						type = "select",
+						width = "double",
+						name = "Stock scan speed",
+						desc = "Select the speed at which items should be scanned for stock alerts. Faster requires more resources and may drastically reduce your frame rate during a scan.",
+						values = {
+							["0"] = "Instant", -- chains everything, no delay used
+							["0.01"] = "Very fast", -- < 100 fps: once every frame, >= 100 fps, 100 scans per second
+							["0.05"] = "Fast",
+							["0.1"] = "Default",
+							["0.2"] = "Medium",
+							["0.3"] = "Slow",
+							["0.5"] = "Very slow",
+						},
+						get = function() return addon.db.profile.defaults.scanInterval; end,
+						set = function(i, v) addon.db.profile.defaults.scanInterval = v; end,
+					},
+					spacer = {
+						order = 26,
+						type = "description",
+						name = "",
+						width = "double",
+					},
 					removeCharacter = {
 						order = 30,
 						type = "select",
@@ -1839,10 +1929,15 @@
 							if value and value ~= "" then
 								addon.db.factionrealm.characters[value] = nil;
 								addon.db.profile.defaults.trackAtCharacters[value] = nil;
+								addon.db.profile.defaults.dontAlertAtCharacters[value] = nil;
 								for name, values in pairs(addon.db.profile.groups) do
 									if values.trackAtCharacters then
 										values.trackAtCharacters[name] = nil;
 									end
+									
+									if values.dontAlertAtCharacters then
+										values.dontAlertAtCharacters[name] = nil;
+									end
 								end
 							end
 						end,
@@ -2242,6 +2337,8 @@
 										-- Ensure this data isn't received (this would be silly/buggy as exports from other accounts - with different characters - won't know what to do with this)
 										temp.trackAtCharacters = nil;
 										temp.overrideTrackAtCharacters = nil;
+										temp.dontAlertAtCharacters = nil;
+										temp.overrideDontAlertAtCharacters = nil;
 										
 										addon.db.profile.groups[name] = temp;
 									end