diff Modules/Options.lua @ 20:ff9a698caebc

Added options for the crafting threshold and auction threshold. I also fixed the queue to use the item cost to determine if there is enough profit instead of the auction (QA) threshold which already has profit built in.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Sun, 04 Jul 2010 09:33:25 -0700
parents c7b3585c73df
children d7f02c84994c
line wrap: on
line diff
--- a/Modules/Options.lua	Sun Jul 04 07:24:12 2010 -0700
+++ b/Modules/Options.lua	Sun Jul 04 09:33:25 2010 -0700
@@ -6,6 +6,14 @@
 local currentFaction = UnitFactionGroup("player")
 local AHFactions = { currentFaction, 'Neutral' }
 
+local craftingThresholds = {5000, 10000, 50000}
+local craftingThresholdsDisplay = {}
+
+for key, value in pairs(craftingThresholds) do
+	craftingThresholdsDisplay[key] = addon:FormatMoney(value, '', true)
+	-- craftingThresholdsDisplay[key] = value
+end
+
 local options = {
 	handler = addon,
 	name = "ItemAuditor",
@@ -33,6 +41,24 @@
 			desc = "Control which messages display in your chat window.",
 			type = 'group',
 			args = {
+				
+				item_cost = {
+					type = "toggle",
+					name = "Item Cost",
+					desc = "Shows a message every time an item's cost changes",
+					get = function() return ItemAuditor.db.profile.messages.cost_updates end,
+					set = function(info, value) ItemAuditor.db.profile.messages.cost_updates = value end,
+					order = 0,
+				},
+				queue_skip = {
+					type = "toggle",
+					name = "Queue Skip",
+					desc = "Displays a message when an item is excluded from the queue.",
+					get = function() return ItemAuditor.db.profile.messages.queue_skip end,
+					set = function(info, value) ItemAuditor.db.profile.messages.queue_skip = value end,
+					disabled = 'IsQADisabled',
+					order = 1,
+				},
 				dbg = {
 					type = "toggle",
 					name = "Debug",
@@ -41,14 +67,6 @@
 					set = "SetDebug",
 					order = 100,
 				},
-				item_cost = {
-					type = "toggle",
-					name = "Item Cost",
-					desc = "Shows a message every time an item's cost changes",
-					get = function() return ItemAuditor.db.profile.messages.cost_updates end,
-					set = function(info, value) ItemAuditor.db.profile.messages.cost_updates = value end,
-					order = 0,
-				},
 			},
 		},
 		
@@ -76,13 +94,44 @@
 					order = 1,
 				},
 				]]
+				auction_threshold = {
+					type = "range",
+					name = "Auction Threshold",
+					desc = "Don't create items that will make less than this amount of profit",
+					min = 0.0,
+					max = 1.0,
+					isPercent = true,
+					get = function() return ItemAuditor.db.char.auction_threshold end,
+					set = function(info, value) ItemAuditor.db.char.auction_threshold = value end,
+					disabled = 'IsQADisabled',
+					order = 1,
+				},
 				refresh_qa = {
 					type = "execute",
 					name = "Refresh QA Thresholds",
 					desc = "Resets all Quick Auctions thresholds",
 					func = "RefreshQAGroups",
 					disabled = 'IsQADisabled',
+					order = 9,
 				},
+				
+				queue_header = {
+					type = "header",
+					name = "Skillet Queue Options",
+					order = 10,
+				},
+				
+				crafting_threshold = {
+					type = "select",
+					name = "Crafting Threshold",
+					desc = "Don't create items that will make less than this amount of profit",
+					values = craftingThresholdsDisplay,
+					get = function() return ItemAuditor.db.char.crafting_threshold end,
+					set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end,
+					disabled = 'IsQADisabled',
+					order = 11,
+				},
+				
 			}
 		},
 		options = {
@@ -123,6 +172,15 @@
 	return iter
 end
 
+function addon:GetCraftingThreshold()
+	local key = ItemAuditor.db.char.crafting_threshold
+	return craftingThresholds[key]
+end
+
+function addon:GetAuctionThreshold()
+	return ItemAuditor.db.char.auction_threshold
+end
+
 function addon:GetAH()
 	return ItemAuditor.db.char.ah
 end