changeset 30:8177b5bcb883

Added tag ?NYI? to the ?Alert when below minimum? option. Added ?Don't queue when below threshold? option. This isn?t functional yet, just a place holder to indicate it will be implemented at a later time. Added initial functionality for ?virtual? groups (feel free to suggest a better name :P), with these groups you can override the defaults for multiple groups. By default, settings will be retrieved as CURRENT_GROUP -> DEFAULTS, with this it can become CURRENT_GROUP -> VIRTUAL_GROUP -> DEFAULTS. This will come in handy when managing a lot of groups. Full functionality is not yet implemented, it is just a placeholder to indicate it will be added. Reduced the softmax for the restock target option from 1000 to 100 to make the slider actually useful. You can still enter a value of upto 100.000 in the edit box below.
author Zerotorescue
date Fri, 29 Oct 2010 13:43:41 +0200
parents 661a59cdcb18
children e732843b16d2
files Core.lua
diffstat 1 files changed, 79 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Thu Oct 28 19:33:17 2010 +0200
+++ b/Core.lua	Fri Oct 29 13:43:41 2010 +0200
@@ -5,8 +5,7 @@
 local AceGUI = LibStub("AceGUI-3.0");
 
 local AceConfigDialog, AceConfigRegistry, AceSerializer;
-local groupIdToName = {};
-local options = {};
+local groupIdToName, groupIsVirtual, options = {}, {}, {};
 local includeTradeSkillItems = 500;
 
 --  All modules must be able to retrieve our supported addons database, thus keep it public
@@ -629,7 +628,7 @@
 					alertBelowMinimum = {
 						order = 30,
 						type = "toggle",
-						name = "Alert when below minimum",
+						name = "NYI | Alert when below minimum",
 						desc = "Show an alert when this item gets below this threshold.",
 						get = function() return self.db.global.defaults.alertBelowMinimum; end,
 						set = function(i, v) self.db.global.defaults.alertBelowMinimum = v; end,
@@ -680,10 +679,10 @@
 						type = "range",
 						min = 0,
 						max = 100000,
-						softMax = 1000,
+						softMax = 100,
 						step = 1,
 						name = "Restock target",
-						desc = "You can manually enter a value between 1.000 and 100.000 in the edit box if the provided range is insufficient.",
+						desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
 						get = function() return self.db.global.defaults.restockTarget; end,
 						set = function(i, v) self.db.global.defaults.restockTarget = v; end,
 					},
@@ -728,6 +727,14 @@
 						get = function() return self.db.global.defaults.summaryHidePriceThreshold; end,
 						set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end,
 					},
+					queueSkipPriceThreshild = {
+						order = 55,
+						type = "toggle",
+						name = "NYI | Don't queue when below threshold",
+						desc = "Do not queue items when their value is below the set price threshold.",
+						get = function() return self.db.global.defaults.queueSkipPriceThreshild; end,
+						set = function(i, v) self.db.global.defaults.queueSkipPriceThreshild = v; end,
+					},
 					alwaysGetAuctionValue = {
 						order = 60,
 						type = "toggle",
@@ -1075,7 +1082,18 @@
 	type = "group",
 	childGroups = "tab",
 	name = function(info)
-		return groupIdToName[info[#info]];
+		local groupId = info[#info];
+		if groupIsVirtual[groupId] then
+			return ("%s  |cfffed000Virtual|r"):format(groupIdToName[groupId]);
+		else
+			return groupIdToName[groupId];
+		end
+	end,
+	desc = function(info)
+		local groupId = info[#info];
+		if groupIsVirtual[groupId] then
+			return "This is a virtual group, you can use it to override the defaults for other groups.";
+		end
 	end,
 	args = {
 		general = {
@@ -1169,6 +1187,21 @@
 							end,
 							arg = "overrideCraftingAddon",
 						},
+						virtualGroup = {
+							order = 40,
+							type = "select",
+							name = "Use virtual group settings", 
+							desc = "Use the settings from a virtual group before using the general defaults.\n\n|cffff9933This is an advanced option, you will probably not need it unless you manage a lot of groups.|r\n\n|cfffed000Off|r: Use the overridden options in this group and then the defaults.\n\n|cfffed000On|r: Use the overridden options in this group, then the ones in the selected virtual group and then the defaults.",
+							values = function()
+								local temp = {};
+								
+								--TODO: Build list based on virtual groups we have, exclude the currently selected virtual group (allow endless linking, e.g. Normal group -> virtual1 -> virtual2 -> virtual3 -> ... -> defaults, do this by calling the "GetOptionByKey" function whenever a virtual group is enabled)
+								temp[""] = "";
+								temp["NYI"] = "Not Yet Implemented";
+								
+								return temp;
+							end,
+						},
 					},
 				},
 				minimumStock = {
@@ -1237,7 +1270,7 @@
 						alertBelowMinimum = {
 							order = 30,
 							type = "toggle",
-							name = "Alert when below minimum",
+							name = "NYI | Alert when below minimum",
 							desc = "Show an alert when an item in this group gets below the minimum stock threshold.",
 							arg = "overrideAlertBelowMinimum",
 						},
@@ -1305,10 +1338,10 @@
 							type = "range",
 							min = 0,
 							max = 100000,
-							softMax = 1000,
+							softMax = 100,
 							step = 1,
 							name = "Restock target",
-							desc = "You can manually enter a value between 1.000 and 100.000 in the edit box if the provided range is insufficient.",
+							desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
 							arg = "overrideRestockTarget",
 						},
 						overrideMinCraftingQueue = {
@@ -1378,6 +1411,20 @@
 							desc = "Hide items from the summary when their value is below the set price threshold.",
 							arg = "overrideSummaryHidePriceThreshold",
 						},
+						overrideQueueSkipPriceThreshild = {
+							order = 54,
+							type = "toggle",
+							name = "Override queue skipping",
+							desc = "Allows you to override if items in this group should be skipped when queueing while their value is below the price threshold.",
+							arg = "queueSkipPriceThreshild",
+						},
+						queueSkipPriceThreshild = {
+							order = 55,
+							type = "toggle",
+							name = "NYI | Don't queue when below threshold",
+							desc = "Do not queue items when their value is below the set price threshold.",
+							arg = "overrideQueueSkipPriceThreshild",
+						},
 						overrideAlwaysGetAuctionValue = {
 							order = 59,
 							type = "toggle",
@@ -1504,6 +1551,7 @@
 			type = "group",
 			name = "Add items",
 			desc = "Add new items to this group.",
+			disabled = function(info) return groupIsVirtual[info[2]]; end,
 			args = {
 				singleAdd = {
 					order = 10,
@@ -1703,6 +1751,7 @@
 			type = "group",
 			name = "Current items",
 			desc = "View, export or remove items from this group.",
+			disabled = function(info) return groupIsVirtual[info[2]]; end,
 			args = {
 				help = {
 					order = 10,
@@ -1823,6 +1872,7 @@
 	},
 };
 
+local currentGroupType = "Normal";
 function addon:MakeGroupOptions()
 	options.args.groups = {
 		order = 1100,
@@ -1844,12 +1894,27 @@
 						validate = ValidateGroupName,
 						set = function(_, value)
 							self.db.global.groups[value] = {};
-								
+							if currentGroupType == "Virtual" then
+								self.db.global.groups[value].isVirtual = true;
+							end
+							
 							addon:FillGroupOptions();
 						end,
 						get = false,
 						width = "double",
 					},
+					type = {
+						order = 20,
+						type = "select",
+						name = "Type (advanced)",
+						desc = "The type of the new group. This can not be changed at a later time.\n\n|cffff9933This is an advanced option, you will probably not need it unless you manage a lot of groups.|r\n\n|cfffed000Normal|r: A normal group with complete functionality.\n\n|cfffed000Virtual|r: A virtual group which you can use to override the defaults for a set of groups. You can not add items to virtual groups.",
+						values = {
+							["Normal"] = "Normal",
+							["Virtual"] = "Virtual",
+						},
+						set = function(_, value) currentGroupType = value; end,
+						get = function() return currentGroupType; end,
+					},
 				},
 			},
 			import = {
@@ -1925,6 +1990,7 @@
 			options.args.groups.args[id] = nil;
 			groupIdToName[id] = nil;
 			groupIdToName[name] = nil;
+			groupIsVirtual[id] = nil;
 		end
 	end
 	
@@ -1934,6 +2000,9 @@
 			
 			groupIdToName[tostring(count)] = name;
 			groupIdToName[name] = true;
+			if values.isVirtual then
+				groupIsVirtual[tostring(count)] = true;
+			end
 			
 			count = ( count + 1 );
 		end