# HG changeset patch # User Asa Ayers # Date 1281590219 25200 # Node ID 693f664aad2b07899cb17168df91de9bc4c095b1 # Parent 71053b1f6c1cefaebc35a1706f5eb44c3e36b67c 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. diff -r 71053b1f6c1c -r 693f664aad2b CHANGELOG.txt --- a/CHANGELOG.txt Wed Aug 11 21:09:59 2010 -0700 +++ b/CHANGELOG.txt Wed Aug 11 22:16:59 2010 -0700 @@ -3,6 +3,7 @@ - Fixed an issue where trading an item and gold in exchange for a different item was not considering the gold in the price of the new item. - Fixed a bug where postage was being counted more than once if you send mail and then open mail in the same session. - Added a warning when sending items with value to characters on other accounts. +- 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. 2010-08-10 Asa Ayers diff -r 71053b1f6c1c -r 693f664aad2b Core.lua --- a/Core.lua Wed Aug 11 21:09:59 2010 -0700 +++ b/Core.lua Wed Aug 11 22:16:59 2010 -0700 @@ -87,7 +87,7 @@ -- ItemAuditor_DebugFrame:Show() -- self:CreateFrame('tab_crafting') self:RegisterEvent("TRADE_SKILL_SHOW", function() - ItemAuditor:CreateFrame('tab_crafting') + ItemAuditor:DisplayCrafting() end) --@end-debug@ end diff -r 71053b1f6c1c -r 693f664aad2b ItemAuditor.toc --- a/ItemAuditor.toc Wed Aug 11 21:09:59 2010 -0700 +++ b/ItemAuditor.toc Wed Aug 11 22:16:59 2010 -0700 @@ -13,8 +13,8 @@ Core.lua +Modules\Utils.lua Modules\AuctionHouse.lua -Modules\Utils.lua Modules\Options.lua Modules\Frames.lua Modules\Events.lua diff -r 71053b1f6c1c -r 693f664aad2b Modules/AuctionHouse.lua --- 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) diff -r 71053b1f6c1c -r 693f664aad2b Modules/Crafting.lua --- a/Modules/Crafting.lua Wed Aug 11 21:09:59 2010 -0700 +++ b/Modules/Crafting.lua Wed Aug 11 22:16:59 2010 -0700 @@ -385,6 +385,7 @@ local reagentLink = GetTradeSkillReagentItemLink(i, reagentId) reagents[reagentId] = { + link = reagentLink, name = reagentName, count = reagentCount, price = self:GetReagentCost(reagentLink, reagentCount),