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