Mercurial > wow > itemauditor
comparison Modules/AuctionHouse.lua @ 89:54b917340283
Ticket 27 - Added the ability to select your preferred auction adodn if multiple are available.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Tue, 10 Aug 2010 23:25:48 -0700 |
| parents | |
| children | fab2c4341602 |
comparison
equal
deleted
inserted
replaced
| 88:2112f71c4237 | 89:54b917340283 |
|---|---|
| 1 local ItemAuditor = select(2, ...) | |
| 2 local AuctionHouse = ItemAuditor:NewModule("AuctionHouse") | |
| 3 | |
| 4 local addon_options | |
| 5 local function getAddons() | |
| 6 -- this will ensure that the addons are only scanned once per session. | |
| 7 if not addon_options then | |
| 8 addon_options = {} | |
| 9 local total = 0 | |
| 10 local lastKey | |
| 11 if AucAdvanced and AucAdvanced.Version then | |
| 12 addon_options['auctioneer'] = 'Auctioneer' | |
| 13 total = total + 1 | |
| 14 lastKey = 'auctioneer' | |
| 15 end | |
| 16 if GetAuctionBuyout ~= nil then | |
| 17 addon_options['other'] = 'Other (GetAuctionBuyout compatibile)' | |
| 18 total = total + 1 | |
| 19 lastKey = 'other' | |
| 20 end | |
| 21 | |
| 22 if total == 1 or not ItemAuditor.db.profile.auction_addon then | |
| 23 ItemAuditor.db.profile.auction_addon = lastKey | |
| 24 end | |
| 25 end | |
| 26 | |
| 27 return addon_options | |
| 28 end | |
| 29 | |
| 30 local function getSelected() | |
| 31 -- just making sure ItemAuditor.db.profile.auction_addon is set if there is only one addon | |
| 32 if not addon_options then | |
| 33 getAddons() | |
| 34 end | |
| 35 | |
| 36 return ItemAuditor.db.profile.auction_addon | |
| 37 end | |
| 38 | |
| 39 ItemAuditor.Options.args.auction_house = { | |
| 40 name = "Auction House", | |
| 41 type = 'group', | |
| 42 args = { | |
| 43 ah_addon = { | |
| 44 type = "select", | |
| 45 name = "Addon", | |
| 46 desc = "", | |
| 47 values = getAddons, | |
| 48 get = getSelected, | |
| 49 set = function(info, value) ItemAuditor.db.profile.auction_addon = value end, | |
| 50 order = 0, | |
| 51 }, | |
| 52 }, | |
| 53 } | |
| 54 | |
| 55 function AuctionHouse:GetAuctionPrice(itemLink) | |
| 56 local link = select(2, GetItemInfo(itemLink)) | |
| 57 assert(link, 'Invalid item link: '..itemLink) | |
| 58 local addon = getSelected() | |
| 59 if GetAuctionBuyout ~= nil and addon == 'other' then | |
| 60 return GetAuctionBuyout(link) | |
| 61 elseif AucAdvanced and AucAdvanced.Version and addon == 'auctioneer' then | |
| 62 local _, _, _, _, _, lowBuy= AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems(link) | |
| 63 return lowBuy | |
| 64 end | |
| 65 return nil | |
| 66 end |
