comparison 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
comparison
equal deleted inserted replaced
19:67f4151d535c 20:ff9a698caebc
3 3
4 local utils = addonTable.utils 4 local utils = addonTable.utils
5 5
6 local currentFaction = UnitFactionGroup("player") 6 local currentFaction = UnitFactionGroup("player")
7 local AHFactions = { currentFaction, 'Neutral' } 7 local AHFactions = { currentFaction, 'Neutral' }
8
9 local craftingThresholds = {5000, 10000, 50000}
10 local craftingThresholdsDisplay = {}
11
12 for key, value in pairs(craftingThresholds) do
13 craftingThresholdsDisplay[key] = addon:FormatMoney(value, '', true)
14 -- craftingThresholdsDisplay[key] = value
15 end
8 16
9 local options = { 17 local options = {
10 handler = addon, 18 handler = addon,
11 name = "ItemAuditor", 19 name = "ItemAuditor",
12 type = 'group', 20 type = 'group',
31 messages = { 39 messages = {
32 name = "Messages", 40 name = "Messages",
33 desc = "Control which messages display in your chat window.", 41 desc = "Control which messages display in your chat window.",
34 type = 'group', 42 type = 'group',
35 args = { 43 args = {
44
45 item_cost = {
46 type = "toggle",
47 name = "Item Cost",
48 desc = "Shows a message every time an item's cost changes",
49 get = function() return ItemAuditor.db.profile.messages.cost_updates end,
50 set = function(info, value) ItemAuditor.db.profile.messages.cost_updates = value end,
51 order = 0,
52 },
53 queue_skip = {
54 type = "toggle",
55 name = "Queue Skip",
56 desc = "Displays a message when an item is excluded from the queue.",
57 get = function() return ItemAuditor.db.profile.messages.queue_skip end,
58 set = function(info, value) ItemAuditor.db.profile.messages.queue_skip = value end,
59 disabled = 'IsQADisabled',
60 order = 1,
61 },
36 dbg = { 62 dbg = {
37 type = "toggle", 63 type = "toggle",
38 name = "Debug", 64 name = "Debug",
39 desc = "Toggles debug messages in chat", 65 desc = "Toggles debug messages in chat",
40 get = "GetDebug", 66 get = "GetDebug",
41 set = "SetDebug", 67 set = "SetDebug",
42 order = 100, 68 order = 100,
43 },
44 item_cost = {
45 type = "toggle",
46 name = "Item Cost",
47 desc = "Shows a message every time an item's cost changes",
48 get = function() return ItemAuditor.db.profile.messages.cost_updates end,
49 set = function(info, value) ItemAuditor.db.profile.messages.cost_updates = value end,
50 order = 0,
51 }, 69 },
52 }, 70 },
53 }, 71 },
54 72
55 qa_options = { 73 qa_options = {
74 get = "IsQAEnabled", 92 get = "IsQAEnabled",
75 set = "SetQAEnabled", 93 set = "SetQAEnabled",
76 order = 1, 94 order = 1,
77 }, 95 },
78 ]] 96 ]]
97 auction_threshold = {
98 type = "range",
99 name = "Auction Threshold",
100 desc = "Don't create items that will make less than this amount of profit",
101 min = 0.0,
102 max = 1.0,
103 isPercent = true,
104 get = function() return ItemAuditor.db.char.auction_threshold end,
105 set = function(info, value) ItemAuditor.db.char.auction_threshold = value end,
106 disabled = 'IsQADisabled',
107 order = 1,
108 },
79 refresh_qa = { 109 refresh_qa = {
80 type = "execute", 110 type = "execute",
81 name = "Refresh QA Thresholds", 111 name = "Refresh QA Thresholds",
82 desc = "Resets all Quick Auctions thresholds", 112 desc = "Resets all Quick Auctions thresholds",
83 func = "RefreshQAGroups", 113 func = "RefreshQAGroups",
84 disabled = 'IsQADisabled', 114 disabled = 'IsQADisabled',
85 }, 115 order = 9,
116 },
117
118 queue_header = {
119 type = "header",
120 name = "Skillet Queue Options",
121 order = 10,
122 },
123
124 crafting_threshold = {
125 type = "select",
126 name = "Crafting Threshold",
127 desc = "Don't create items that will make less than this amount of profit",
128 values = craftingThresholdsDisplay,
129 get = function() return ItemAuditor.db.char.crafting_threshold end,
130 set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end,
131 disabled = 'IsQADisabled',
132 order = 11,
133 },
134
86 } 135 }
87 }, 136 },
88 options = { 137 options = {
89 type = "execute", 138 type = "execute",
90 name = "options", 139 name = "options",
121 end 170 end
122 end 171 end
123 return iter 172 return iter
124 end 173 end
125 174
175 function addon:GetCraftingThreshold()
176 local key = ItemAuditor.db.char.crafting_threshold
177 return craftingThresholds[key]
178 end
179
180 function addon:GetAuctionThreshold()
181 return ItemAuditor.db.char.auction_threshold
182 end
183
126 function addon:GetAH() 184 function addon:GetAH()
127 return ItemAuditor.db.char.ah 185 return ItemAuditor.db.char.ah
128 end 186 end
129 187
130 function addon:SetAH(info, value) 188 function addon:SetAH(info, value)