comparison Modules/QuickAuctions.lua @ 111:1cb0027da35c

Added an absolute Auction Threshold option. This will allow you to set your threshold at 10g (or whatever you choose) over your cost for all items.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Mon, 30 Aug 2010 19:52:41 -0700
parents 54b917340283
children 619ee0a1ff3b
comparison
equal deleted inserted replaced
110:cf160210433c 111:1cb0027da35c
65 copper = 1 65 copper = 1
66 end 66 end
67 67
68 -- add my minimum profit margin 68 -- add my minimum profit margin
69 -- GetAuctionThreshold returns a percent as a whole number. This will convert 25 to 1.25 69 -- GetAuctionThreshold returns a percent as a whole number. This will convert 25 to 1.25
70 copper = copper * (1+ItemAuditor:GetAuctionThreshold()) 70 local min_by_percent = copper * (1+ItemAuditor:GetAuctionThreshold())
71 local min_by_value = copper + ItemAuditor.db.char.auction_threshold_value
72 copper = max(min_by_percent, min_by_value)
71 73
72 -- add AH Cut 74 -- add AH Cut
73 local keep = 1 - ItemAuditor:GetAHCut() 75 local keep = 1 - ItemAuditor:GetAHCut()
74 return copper/keep 76 return copper/keep
75 end 77 end
195 desc = "This will enable or disable Quick Auctions integration", 197 desc = "This will enable or disable Quick Auctions integration",
196 get = "IsQAEnabled", 198 get = "IsQAEnabled",
197 set = "SetQAEnabled", 199 set = "SetQAEnabled",
198 order = 0, 200 order = 0,
199 }, 201 },
202 enable_percent = {
203 type = "toggle",
204 name = "Use percent to calculate threshold.",
205 get = function() return ItemAuditor.db.char.auction_threshold > 0 end,
206 set = function(info, value)
207 value = value and 0.15 or 0
208 ItemAuditor.db.char.auction_threshold = value
209 end,
210 order = 1,
211 },
200 auction_threshold = { 212 auction_threshold = {
201 type = "range", 213 type = "range",
202 name = "Auction Threshold", 214 name = "Auction Threshold",
203 desc = "Don't create items that will make less than this amount of profit", 215 desc = "Don't sell items for less than this amount of profit.",
204 min = 0.0, 216 min = 0.0,
205 max = 1.0, 217 max = 1.0,
206 isPercent = true, 218 isPercent = true,
219 hidden = function() return ItemAuditor.db.char.auction_threshold == 0 end,
207 get = function() return ItemAuditor.db.char.auction_threshold end, 220 get = function() return ItemAuditor.db.char.auction_threshold end,
208 set = function(info, value) 221 set = function(info, value)
209 ItemAuditor.db.char.auction_threshold = value 222 ItemAuditor.db.char.auction_threshold = value
210 -- ItemAuditor:RefreshQAGroups() 223 -- ItemAuditor:RefreshQAGroups()
211 end, 224 end,
212 disabled = 'IsQADisabled', 225 disabled = 'IsQADisabled',
213 order = 1, 226 order = 2,
227 },
228 enable_absolute = {
229 type = "toggle",
230 name = "Use value to calculate threshold.",
231 get = function() return ItemAuditor.db.char.auction_threshold_value > 0 end,
232 set = function(info, value)
233 value = value and 100000 or 0
234 ItemAuditor.db.char.auction_threshold_value = value
235 end,
236 order = 3,
237 },
238 auction_threshold_absolute = {
239 type = "input",
240 name = "Auction Threshold",
241 desc = "Don't sell items for less than this amount of profit.",
242 hidden = function() return ItemAuditor.db.char.auction_threshold_value == 0 end,
243 get = function() return
244 Utils.FormatMoney(ItemAuditor.db.char.auction_threshold_value , '', true)
245 end,
246 validate = function(info, value)
247 if not Utils.validateMoney(value) then
248 return "Invalid money format"
249 end
250 return true
251 end,
252 set = function(info, value)
253 ItemAuditor.db.char.auction_threshold_value = Utils.parseMoney(value)
254 end,
255 usage = "###g ##s ##c",
256 disabled = 'IsQADisabled',
257 order = 4,
258 },
259 header = {
260 type = 'header',
261 name = '',
262 order = 9,
214 }, 263 },
215 extra = { 264 extra = {
216 type = "range", 265 type = "range",
217 name = "Create Extra", 266 name = "Create Extra",
218 desc = "This is the amount of an item that should be created above what you sell in one post in QuickAuctions.".. 267 desc = "This is the amount of an item that should be created above what you sell in one post in QuickAuctions."..
223 get = function() return ItemAuditor.db.char.qa_extra end, 272 get = function() return ItemAuditor.db.char.qa_extra end,
224 set = function(info, value) 273 set = function(info, value)
225 ItemAuditor.db.char.qa_extra = value 274 ItemAuditor.db.char.qa_extra = value
226 end, 275 end,
227 disabled = 'IsQADisabled', 276 disabled = 'IsQADisabled',
228 order = 1, 277 order = 10,
229 }, 278 },
230 refresh_qa = { 279 refresh_qa = {
231 type = "execute", 280 type = "execute",
232 name = "Refresh QA Thresholds", 281 name = "Refresh QA Thresholds",
233 desc = "Resets all Quick Auctions thresholds", 282 desc = "Resets all Quick Auctions thresholds",
234 func = "RefreshQAGroups", 283 func = "RefreshQAGroups",
235 disabled = 'IsQADisabled', 284 disabled = 'IsQADisabled',
236 order = 9, 285 order = 15,
237 }, 286 },
238 } 287 }
239 } 288 }
240 289
241 ItemAuditor.Options.args.queue = { 290 ItemAuditor.Options.args.queue = {