diff Core.lua @ 31:e732843b16d2 v0.1.6-BETA

Added an info box to the top of the general group. Removed the ?Don't queue when below threshold?, this is now default (can?t make it too complicated). Implemented working functionality for virtual groups. ?Include in local item data? can now be overridden in every group. Added help text at the replenishing stock indicating how auction values are used when queueing. The tabs ?add items? and ?current items? will now be hidden rather than disabled when you have a virtual group selected. The auction value/price threshold for items will now be used when queueing items.
author Zerotorescue
date Sat, 30 Oct 2010 23:04:45 +0200
parents 8177b5bcb883
children 31e5da6a2b16
line wrap: on
line diff
--- a/Core.lua	Fri Oct 29 13:43:41 2010 +0200
+++ b/Core.lua	Sat Oct 30 23:04:45 2010 +0200
@@ -35,6 +35,10 @@
 				priceThreshold = 0,
 				summaryHidePriceThreshold = false,
 				trackAtCharacters = {},
+				localItemData = {
+					["Bag"] = true,
+					["Auction House"] = true,
+				},
 				summary = {
 					speed = 5,
 					width = 650,
@@ -503,8 +507,25 @@
 		name = "General",
 		desc = "Change general Inventorium settings.",
 		args = {
+			info = {
+				order = 1,
+				type = "group",
+				inline = true,
+				name = "BETA Information",
+				args = {
+					description = {
+						order = 5,
+						type = "description",
+						name = "Please note that all multi-select |cfffed000dropdown|r boxes were turned into multi-select |cfffed000toggle|r boxes. I do not intend to keep it this way, however it can not yet be reverted due to a major bug in one of the libraries used by Inventorium. The layout of this config may look terribly organized in it's current state.\n\n" .. 
+								"Since this is a beta some functionality might not be implemented yet while the options are available (usually - but not always - tagged as \"NYI\"). These options are used to indicate a feature is on the way and will be implemented before Inventorium is tagged as a release.\n\n" .. 
+								"Please request things you want and report anything that's clunky, weird, vague or otherwise buggy at |cfffed000the Inventorium development addon page|r. You can find this by searching for \"|cfffed000Inventorium|r\" at |cfffed000CurseForge.com|r.\n\n" .. 
+								"Tutorials for Inventorium will be created after the first stable release. If you require any help before that you can always contact me in the |cfffed000#JMTC|r IRC channel at |cfffed000QuakeNet.org|r. You may also report issues and request things there if you wish.\n\n" .. 
+								"You might notice the summary window currently gets very slow when refreshed once you get over 100-200 items in the list, this is a known issue and will be fixed in version 1.1 (which is after the initial release).",
+					},
+				},
+			},
 			general = {
-				order = 0,
+				order = 1,
 				type = "group",
 				inline = true,
 				name = "General",
@@ -570,7 +591,7 @@
 					localItemData = {
 						order = 40,
 						type = "multiselect",
-						name = "Include in local item data NYI | PH",
+						name = "Include in local item data",
 						desc = "Select which data should be included in the local item data.",
 						values = {
 							["Bag"] = "Bag",
@@ -727,19 +748,11 @@
 						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",
 						name = "Always show auction value",
-						desc = "Always cache and show the auction value of items, even if the price threshold is set to 0.",
+						desc = "Always cache and show the auction value of items, even if the price threshold is set to 0|cffeda55fc|r.",
 						get = function() return self.db.global.defaults.alwaysGetAuctionValue; end,
 						set = function(i, v) self.db.global.defaults.alwaysGetAuctionValue = v; end,
 					},
@@ -823,7 +836,7 @@
 	local optionName = info[#info];
 	
 	-- Special treatment for override toggle boxes
-	if not info.arg:find("override") then
+	if optionName:find("override") then
 		if not value and info.arg then
 			-- If this override was disabled and a saved variable name was provided, set it to nil rather than false
 			
@@ -852,7 +865,13 @@
 
 function addon:GetOptionByKey(groupName, optionName, noDefault)
 	if groupName and self.db.global.groups[groupName] and self.db.global.groups[groupName][optionName] ~= nil then
+		-- If this option exists within the settings of this group
+		
 		return self.db.global.groups[groupName][optionName];
+	elseif groupName and self.db.global.groups[groupName] and self.db.global.groups[groupName].virtualGroup ~= "" and not noDefault then
+		-- If a virtual group was selected
+		
+		return self:GetOptionByKey(self.db.global.groups[groupName].virtualGroup, optionName, noDefault);
 	elseif self.db.global.defaults[optionName] and not noDefault then
 		return self.db.global.defaults[optionName];
 	else
@@ -864,7 +883,13 @@
 	local groupName = groupIdToName[info[2]];
 	local optionName = info[#info];
 	
-	return addon:GetOptionByKey(groupName, optionName);
+	local noDefault;
+	
+	if optionName:find("override") then
+		noDefault = true;
+	end
+	
+	return addon:GetOptionByKey(groupName, optionName, noDefault);
 end
 
 local function GetMultiOption(info, value)
@@ -881,13 +906,13 @@
 end
 
 local function GetDisabled(info)
-	if not info.arg or not info.arg:find("override") then
+	local groupName = groupIdToName[info[2]];
+	local optionName = info[#info];
+	
+	if optionName:find("override") then
 		return false;
 	end
 	
-	local groupName = groupIdToName[info[2]];
-	local optionName = info[#info];
-	
 	return (addon:GetOptionByKey(groupName, info.arg, true) == nil);
 end
 
@@ -1187,20 +1212,53 @@
 							end,
 							arg = "overrideCraftingAddon",
 						},
+						overrideLocalItemData = {
+							order = 39,
+							type = "toggle",
+							name = "Override local item data",
+							desc = "Allows you to override the local item data setting for this group.",
+							arg = "localItemData",
+						},
+						localItemData = {
+							order = 40,
+							type = "multiselect",
+							name = "Include in local item data",
+							desc = "Select which data should be included in the local item data.",
+							values = {
+								["Bag"] = "Bag",
+								["Bank"] = "Bank",
+								["Auction House"] = "Auction House",
+								["Mailbox"] = "Mailbox",
+							},
+							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 = "overrideLocalItemData",
+						},
 						virtualGroup = {
-							order = 40,
+							order = 50,
 							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()
+							values = function(info)
+								local groupName = groupIdToName[info[2]];
+								
 								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";
+								for name, values in pairs(addon.db.global.groups) do
+									if values.isVirtual and name ~= groupName then
+										temp[name] = name;
+									end
+								end
 								
 								return temp;
 							end,
+							set = function(info, value)
+								local groupName = groupIdToName[info[2]];
+								local optionName = info[#info];
+								
+								addon.db.global.groups[groupName][optionName] = value ~= "" and value;
+							end,
 						},
 					},
 				},
@@ -1216,7 +1274,7 @@
 						description = {
 							order = 0,
 							type = "description",
-							name = "Here you can specify the minimum amount of items you wish to keep in stock and related settings for the currently selected group.",
+							name = "Here you can specify the minimum amount of items you wish to keep in stock and related settings for the currently selected group. Please note the values entered here do not affect the queued quantities, you must set settings for that in the area below.",
 						},
 						header = {
 							order = 5,
@@ -1316,7 +1374,13 @@
 								local groupName = groupIdToName[info[2]];
 								local r = "Here you can specify the amount of items to which you wish to restock when you are collecting new items for the currently selected group. This may be higher than the minimum stock.\n\n";
 								
-								r = r .. "When restocking the target amount is |cfffed000" .. addon:GetOptionByKey(groupName, "restockTarget") .. "|r of every item. Not queueing craftable items when only missing |cfffed000" .. floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * addon:GetOptionByKey(groupName, "restockTarget") ) .. "|r (|cfffed000" .. ( addon:GetOptionByKey(groupName, "minCraftingQueue") * 100 ) .. "%|r) of the restock target and making |cfffed000" .. floor( ( addon:GetOptionByKey(groupName, "bonusQueue") * addon:GetOptionByKey(groupName, "restockTarget") ) + .5 ) .. "|r (|cfffed000" .. ( addon:GetOptionByKey(groupName, "bonusQueue") * 100 ) .. "%|r) extra items when you completely ran out.";
+								r = r .. "When restocking the target amount is |cfffed000" .. addon:GetOptionByKey(groupName, "restockTarget") .. "|r of every item. Not queueing craftable items when only missing |cfffed000" .. floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * addon:GetOptionByKey(groupName, "restockTarget") ) .. "|r (|cfffed000" .. ( addon:GetOptionByKey(groupName, "minCraftingQueue") * 100 ) .. "%|r) of the restock target and making |cfffed000" .. floor( ( addon:GetOptionByKey(groupName, "bonusQueue") * addon:GetOptionByKey(groupName, "restockTarget") ) + .5 ) .. "|r (|cfffed000" .. ( addon:GetOptionByKey(groupName, "bonusQueue") * 100 ) .. "%|r) extra items when you completely ran out. ";
+								
+								if addon:GetOptionByKey(groupName, "priceThreshold") == 0 then
+									r = r .. "Queueing items at |cfffed000any|r auction value.";
+								else
+									r = r .. "Queueing items worth |cfffed000" .. addon:ReadableMoney(addon:GetOptionByKey(groupName, "priceThreshold")) .. "|r or more.";
+								end
 								
 								return r;
 							end,
@@ -1411,32 +1475,18 @@
 							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",
 							name = "Override auction value showing",
-							desc = "Allows you to override if the auction value of items in this group should be cached and displayed even when the price threshold is set to 0.",
+							desc = "Allows you to override if the auction value of items in this group should be cached and displayed even when the price threshold is set to 0|cffeda55fc|r.",
 							arg = "alwaysGetAuctionValue",
 						},
 						alwaysGetAuctionValue = {
 							order = 60,
 							type = "toggle",
 							name = "Always show auction value",
-							desc = "Always cache and show the auction value of items in this group, even if the price threshold is set to 0.",
+							desc = "Always cache and show the auction value of items in this group, even if the price threshold is set to 0|cffeda55fc|r.",
 							arg = "overrideAlwaysGetAuctionValue",
 						},
 					},
@@ -1551,7 +1601,7 @@
 			type = "group",
 			name = "Add items",
 			desc = "Add new items to this group.",
-			disabled = function(info) return groupIsVirtual[info[2]]; end,
+			hidden = function(info) return groupIsVirtual[info[2]]; end,
 			args = {
 				singleAdd = {
 					order = 10,
@@ -1751,7 +1801,7 @@
 			type = "group",
 			name = "Current items",
 			desc = "View, export or remove items from this group.",
-			disabled = function(info) return groupIsVirtual[info[2]]; end,
+			hidden = function(info) return groupIsVirtual[info[2]]; end,
 			args = {
 				help = {
 					order = 10,