Mercurial > wow > itemauditor
diff 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 |
line wrap: on
line diff
--- a/Modules/AuctionHouse.lua Wed Aug 11 21:09:59 2010 -0700 +++ b/Modules/AuctionHouse.lua Wed Aug 11 22:16:59 2010 -0700 @@ -1,6 +1,8 @@ local ItemAuditor = select(2, ...) local AuctionHouse = ItemAuditor:NewModule("AuctionHouse") +local Utils = ItemAuditor:GetModule("Utils") + local addon_options local function getAddons() -- this will ensure that the addons are only scanned once per session. @@ -75,9 +77,53 @@ set = function(info, value) ItemAuditor.db.profile.pricing_method = value end, order = 1, } + }, } +local function clearSnatch() + ItemAuditor:Print('clearing snatch') + local Snatch = AucAdvanced.Modules.Util.SearchUI.Searchers.Snatch + local snatchList = Snatch.Private.snatchList + + for itemLink in pairs(snatchList) do + local link = select(2, GetItemInfo('item:'..itemLink)) + Snatch.RemoveSnatch(link) + end +end + +function AuctionHouse.Snatch() + if not AucAdvanced or not AucAdvanced.Version then + ItemAuditor:Print("The snatch command requires Auctioneer.") + return + end + + local Snatch = AucAdvanced.Modules.Util.SearchUI.Searchers.Snatch + if not Snatch.Private.frame then + ItemAuditor:Print("You must visit the Auction House before you can update Auctioneer's snatch list.") + return + end + clearSnatch() + + local function Export(data) + for id, reagent in pairs(data.reagents) do + ItemAuditor:Print("Adding %s for %s", reagent.link, Utils.FormatMoney(reagent.price)) + Snatch.AddSnatch(reagent.link, reagent.price) + end + end + ItemAuditor:UpdateCraftingTable() + ItemAuditor:GetModule("Crafting").Export(Export) +end + +ItemAuditor.Options.args.snatch = { + type = "execute", + handler = AuctionHouse, + name = "snatch", + desc = "Replace Auctioner's snatch list with all the reagents you need for crafting.", + func = "Snatch", + guiHidden = true, +} + function AuctionHouse:GetAuctionPrice(itemLink) local link = select(2, GetItemInfo(itemLink)) assert(link, 'Invalid item link: '..itemLink)