Mercurial > wow > itemauditor
comparison Modules/AuctionHouse.lua @ 93:693f664aad2b
Added '/ia snatch'. This new command works with your queue (/ia crafting) to replace your snatch list with the materials you need for crafting. NOTE: Auctioneer requires visiting the AH before you can modify the snatch list.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Wed, 11 Aug 2010 22:16:59 -0700 |
| parents | fab2c4341602 |
| children | 4ec8611d9466 |
comparison
equal
deleted
inserted
replaced
| 92:71053b1f6c1c | 93:693f664aad2b |
|---|---|
| 1 local ItemAuditor = select(2, ...) | 1 local ItemAuditor = select(2, ...) |
| 2 local AuctionHouse = ItemAuditor:NewModule("AuctionHouse") | 2 local AuctionHouse = ItemAuditor:NewModule("AuctionHouse") |
| 3 | |
| 4 local Utils = ItemAuditor:GetModule("Utils") | |
| 3 | 5 |
| 4 local addon_options | 6 local addon_options |
| 5 local function getAddons() | 7 local function getAddons() |
| 6 -- this will ensure that the addons are only scanned once per session. | 8 -- this will ensure that the addons are only scanned once per session. |
| 7 if not addon_options then | 9 if not addon_options then |
| 73 values = getPricingMethods, | 75 values = getPricingMethods, |
| 74 get = function() return ItemAuditor.db.profile.pricing_method end, | 76 get = function() return ItemAuditor.db.profile.pricing_method end, |
| 75 set = function(info, value) ItemAuditor.db.profile.pricing_method = value end, | 77 set = function(info, value) ItemAuditor.db.profile.pricing_method = value end, |
| 76 order = 1, | 78 order = 1, |
| 77 } | 79 } |
| 80 | |
| 78 }, | 81 }, |
| 82 } | |
| 83 | |
| 84 local function clearSnatch() | |
| 85 ItemAuditor:Print('clearing snatch') | |
| 86 local Snatch = AucAdvanced.Modules.Util.SearchUI.Searchers.Snatch | |
| 87 local snatchList = Snatch.Private.snatchList | |
| 88 | |
| 89 for itemLink in pairs(snatchList) do | |
| 90 local link = select(2, GetItemInfo('item:'..itemLink)) | |
| 91 Snatch.RemoveSnatch(link) | |
| 92 end | |
| 93 end | |
| 94 | |
| 95 function AuctionHouse.Snatch() | |
| 96 if not AucAdvanced or not AucAdvanced.Version then | |
| 97 ItemAuditor:Print("The snatch command requires Auctioneer.") | |
| 98 return | |
| 99 end | |
| 100 | |
| 101 local Snatch = AucAdvanced.Modules.Util.SearchUI.Searchers.Snatch | |
| 102 if not Snatch.Private.frame then | |
| 103 ItemAuditor:Print("You must visit the Auction House before you can update Auctioneer's snatch list.") | |
| 104 return | |
| 105 end | |
| 106 clearSnatch() | |
| 107 | |
| 108 local function Export(data) | |
| 109 for id, reagent in pairs(data.reagents) do | |
| 110 ItemAuditor:Print("Adding %s for %s", reagent.link, Utils.FormatMoney(reagent.price)) | |
| 111 Snatch.AddSnatch(reagent.link, reagent.price) | |
| 112 end | |
| 113 end | |
| 114 ItemAuditor:UpdateCraftingTable() | |
| 115 ItemAuditor:GetModule("Crafting").Export(Export) | |
| 116 end | |
| 117 | |
| 118 ItemAuditor.Options.args.snatch = { | |
| 119 type = "execute", | |
| 120 handler = AuctionHouse, | |
| 121 name = "snatch", | |
| 122 desc = "Replace Auctioner's snatch list with all the reagents you need for crafting.", | |
| 123 func = "Snatch", | |
| 124 guiHidden = true, | |
| 79 } | 125 } |
| 80 | 126 |
| 81 function AuctionHouse:GetAuctionPrice(itemLink) | 127 function AuctionHouse:GetAuctionPrice(itemLink) |
| 82 local link = select(2, GetItemInfo(itemLink)) | 128 local link = select(2, GetItemInfo(itemLink)) |
| 83 assert(link, 'Invalid item link: '..itemLink) | 129 assert(link, 'Invalid item link: '..itemLink) |
