diff Modules/AuctionHouse.lua @ 90:fab2c4341602

Added options when using Auctioneer to use the market price instead of the lowest price on the AH.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 11 Aug 2010 00:09:16 -0700
parents 54b917340283
children 693f664aad2b
line wrap: on
line diff
--- a/Modules/AuctionHouse.lua	Tue Aug 10 23:25:48 2010 -0700
+++ b/Modules/AuctionHouse.lua	Wed Aug 11 00:09:16 2010 -0700
@@ -36,6 +36,23 @@
 	return ItemAuditor.db.profile.auction_addon
 end
 
+local function setAddon(info, value)
+	ItemAuditor.db.profile.auction_addon = value
+end
+
+local function getPricingMethods()
+	if ItemAuditor.db.profile.auction_addon == 'other' then
+		return {
+			low = 'Lowest Price',
+		}
+	else
+		return {
+			low = 'Lowest Price',
+			market = 'Market Price',
+		}
+	end
+end
+
 ItemAuditor.Options.args.auction_house = {
 	name = "Auction House",
 	type = 'group',
@@ -46,9 +63,18 @@
 			desc = "",
 			values = getAddons,
 			get = getSelected,
-			set = function(info, value) ItemAuditor.db.profile.auction_addon = value end,
+			set = setAddon,
 			order = 0,
 		},
+		pricingMethod = {
+			type = "select",
+			name = "Pricing Method",
+			desc = "",
+			values = getPricingMethods,
+			get = function() return ItemAuditor.db.profile.pricing_method end,
+			set = function(info, value) ItemAuditor.db.profile.pricing_method = value end,
+			order = 1,
+		}
 	},
 }
 
@@ -56,11 +82,16 @@
 	local link = select(2, GetItemInfo(itemLink))
 	assert(link, 'Invalid item link: '..itemLink)
 	local addon = getSelected()
+	local prices = ItemAuditor.db.profile.pricing_method or 'low'
 	if GetAuctionBuyout ~= nil and addon == 'other' then
 		return GetAuctionBuyout(link)
 	elseif AucAdvanced and AucAdvanced.Version and addon == 'auctioneer' then
-		local _, _, _, _, _, lowBuy= AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems(link)
-		return lowBuy
+		if prices == 'low' then
+			local _, _, _, _, _, lowBuy= AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems(link)
+			return lowBuy
+		else
+			return AucAdvanced.API.GetMarketValue(link)
+		end
 	end
 	return nil
 end
\ No newline at end of file