changeset 72:8e9beb8a0330

Added options to enable or disable crafting deciders.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 28 Jul 2010 23:17:30 -0700
parents aaf9a155995b
children cd00b87fad31
files CHANGELOG.txt Core.lua Modules/Crafting.lua
diffstat 3 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.txt	Wed Jul 28 22:46:13 2010 -0700
+++ b/CHANGELOG.txt	Wed Jul 28 23:17:30 2010 -0700
@@ -5,6 +5,7 @@
 - Added integration with ArkInventory. You can set up rules that use "itemauditor('profitable')" or "itemauditor('qa')" to find items managed by QuickAuctions.
 - Added a public API so other addon developers can register themselves as a queue destination and added a UI so users can select that destination.
 - Added a config option to control how many extra copies of an item are created if its being managed with QA. The previous behaveior was to add 25% to whatever QA would normally post. Now it defaults to 0% and is user configurable.
+- Added options to enable or disable crafting deciders.
 
 2010-07-27  Asa Ayers  <Asa.Ayers@Gmail.com>
 
--- a/Core.lua	Wed Jul 28 22:46:13 2010 -0700
+++ b/Core.lua	Wed Jul 28 23:17:30 2010 -0700
@@ -60,6 +60,7 @@
 			},
 			ItemAuditor_enabled = true,
 			queue_destination = nil,
+			disabled_deciders = {},
 		},
 		factionrealm = {
 			item_account = {},
--- a/Modules/Crafting.lua	Wed Jul 28 22:46:13 2010 -0700
+++ b/Modules/Crafting.lua	Wed Jul 28 23:17:30 2010 -0700
@@ -65,7 +65,7 @@
 			values = craftingThresholdsDisplay,
 			get = function() return ItemAuditor.db.char.crafting_threshold end,
 			set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end,
-			order = 11,
+			order = 0,
 		},
 		queue_destination = {
 			type = "select",
@@ -74,8 +74,14 @@
 			values = displayCraftingDestinations,
 			get = function() return select(2, Crafting.GetQueueDestination()) end,
 			set = function(info, value) ItemAuditor.db.profile.queue_destination = value end,
-			order = 11,
+			order = 1,
 		},
+		deciders = {
+			type="header",
+			name="Crafting Deciders",
+			order = 10,
+		},
+		
 	},
 }
 
@@ -261,15 +267,32 @@
 
 local craftingDeciders = {}
 
-function Crafting.RegisterCraftingDecider(name, decider)
+function Crafting.RegisterCraftingDecider(name, decider, options)
 	craftingDeciders[name] = decider
+	
+	ItemAuditor.Options.args.crafting_options.args['chk'..name] = {
+		type = "toggle",
+		name = "Enable "..name,
+		get = function() return not ItemAuditor.db.profile.disabled_deciders[name] end,
+		set = function(info, value) ItemAuditor.db.profile.disabled_deciders[name] = not value end,
+		order = 11,
+	}
+	
+	if options then
+		ItemAuditor.Options.args.crafting_options.args['decider_'..name] = {
+			handler = {},
+			name = name,
+			type = 'group',
+			args = options,
+		}
+	end
 end
 
 local lastWinnder = ""
 local function Decide(data)
 	local newDecision = 0
 	for name, decider in pairs(craftingDeciders) do
-		if name ~= lastWinner then
+		if not ItemAuditor.db.profile.disabled_deciders[name] and name ~= lastWinner then
 			newDecision = decider(data)
 			if newDecision > data.queue then
 				data.queue = newDecision
@@ -294,6 +317,7 @@
 	end
 	return -1
 end
+
 Crafting.RegisterCraftingDecider('Is Profitable', isProfitable)
 
 local function tableFilter(self, row, ...)