Mercurial > wow > itemauditor
changeset 21:d7f02c84994c
Changed QA to be an option part of /ia queue. If QA is there, IA will queue enough of an item to be created to have 1.25x QA auctino count x QA stack size (rounded up) items. If it is not there, it will create 1 on every profitable item. This commit also adds support for Auctioneer.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Tue, 06 Jul 2010 23:48:54 -0700 |
parents | ff9a698caebc |
children | 66b7c3f5937e |
files | Core.lua ItemAuditor.toc Modules/Options.lua Modules/QuickAuctions.lua |
diffstat | 4 files changed, 94 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Sun Jul 04 09:33:25 2010 -0700 +++ b/Core.lua Tue Jul 06 23:48:54 2010 -0700 @@ -216,6 +216,7 @@ return {count = self.items[link].count, invested = self.items[link].invested} end self.items[link].count = Altoholic:GetItemCount(self:GetIDFromLink(link)) + self.items[link].invested = tonumber(self.items[link].invested) return self.items[link] end
--- a/ItemAuditor.toc Sun Jul 04 09:33:25 2010 -0700 +++ b/ItemAuditor.toc Tue Jul 06 23:48:54 2010 -0700 @@ -1,11 +1,11 @@ ## Interface: 30300 ## Title: Item Auditor -## Notes: This will keep track of how much you have paid per item in your inventory +## Notes: This will keep track of how much you have paid per item in your inventory. Only one of (Auctionator, Auctioneer, AuctionLite, AuctionMaster) is needed to determine which items are profitable to craft. ## Author: Asa Ayers <Asa.Ayers@Gmail.com> ## Version: 0.1 ## SavedVariables: ItemAuditorDB ## Dependencies: Altoholic -## OptionalDeps: QuickAuctions, Skillet, LilSparkysWorkshop, DevTools +## OptionalDeps: QuickAuctions, Skillet, LilSparkysWorkshop, Auctionator, Auctioneer, AuctionLite, AuctionMaster, DevTools embeds.xml
--- a/Modules/Options.lua Sun Jul 04 09:33:25 2010 -0700 +++ b/Modules/Options.lua Tue Jul 06 23:48:54 2010 -0700 @@ -102,7 +102,10 @@ max = 1.0, isPercent = true, get = function() return ItemAuditor.db.char.auction_threshold end, - set = function(info, value) ItemAuditor.db.char.auction_threshold = value end, + set = function(info, value) + ItemAuditor.db.char.auction_threshold = value + ItemAuditor:RefreshQAGroups() + end, disabled = 'IsQADisabled', order = 1, }, @@ -114,13 +117,14 @@ disabled = 'IsQADisabled', order = 9, }, - - queue_header = { - type = "header", - name = "Skillet Queue Options", - order = 10, - }, - + } + }, + crafting_options = { + name = "Crafting with Skillet", + desc = "/ia queue", + type = 'group', + disabled = function() return Skillet == nil end, + args = { crafting_threshold = { type = "select", name = "Crafting Threshold", @@ -128,11 +132,9 @@ values = craftingThresholdsDisplay, get = function() return ItemAuditor.db.char.crafting_threshold end, set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end, - disabled = 'IsQADisabled', order = 11, }, - - } + }, }, options = { type = "execute",
--- a/Modules/QuickAuctions.lua Sun Jul 04 09:33:25 2010 -0700 +++ b/Modules/QuickAuctions.lua Tue Jul 06 23:48:54 2010 -0700 @@ -77,16 +77,29 @@ This is based on KTQ ]] function addon:Queue() - if not addon.IsQAEnabled() then - self:Debug("Refusing to run :Queue() QA is disabled") - return - end if LSW == nil then self:Print("This feature requires LilSparky's Workshop.") return end - self:Debug(format("Auction Threshold: %d%%", self:GetAuctionThreshold()*100 )) + if Skillet == nil then + self:Print("This feature requires Skillet.") + return + end + if GetAuctionBuyout ~= nil then + elseif AucAdvanced and AucAdvanced.Version then + else + self:Print("This feature requires Auctionator, Auctioneer, AuctionLite, or AuctionMaster.") + return + end + + + if addon.IsQAEnabled() then + self:Debug(format("Auction Threshold: %d%%", self:GetAuctionThreshold()*100 )) + end self:Debug(format("Crafting Threshold: %s", self:FormatMoney(self:GetCraftingThreshold()))) + local profitableItems = {} + local profitableIndex = 1 + local numChecked = 0 for i = 1, GetNumTradeSkills() do local itemLink = GetTradeSkillItemLink(i) @@ -104,15 +117,21 @@ local stackSize = 1 if recipeLink ~= nil then _, itemLink= GetItemInfo(itemId) - local QAGroup = QAAPI:GetItemGroup(itemLink) - if QAGroup ~= nil then - stackSize = QAAPI:GetGroupPostCap(QAGroup) * QAAPI:GetGroupPerAuction(QAGroup) - stackSize = stackSize / GetTradeSkillNumMade(i) - - -- bonus - stackSize = ceil(stackSize *1.25) + + + -- if QA isn't enabled, this will just return nil + local QAGroup = nil + if addon.IsQAEnabled() then + QAGroup = QAAPI:GetItemGroup(itemLink) + if QAGroup ~= nil then + stackSize = QAAPI:GetGroupPostCap(QAGroup) * QAAPI:GetGroupPerAuction(QAGroup) + stackSize = stackSize / GetTradeSkillNumMade(i) + + -- bonus + stackSize = ceil(stackSize *1.25) + end end - + local count = Altoholic:GetItemCount(itemId) if count < stackSize and itemLink ~= nil then @@ -130,28 +149,45 @@ local currentInvested, _, currentCount = addon:GetItemCost(itemLink) local newThreshold = (newCost + currentInvested) / (currentCount + toQueue) - - newThreshold = calculateQAThreshold(newThreshold) - local currentPrice = GetAuctionBuyout(itemLink) or 0 - - - -- bonus? + if addon.IsQAEnabled() then + newThreshold = calculateQAThreshold(newThreshold) + else + -- if quick auctions isn't enabled, this will cause the decision to rely + -- completly on the crafting threshold + newThreshold = 0 + end + local currentPrice = addon:GetAuctionPrice(itemLink) or 0 + numChecked = numChecked + 1 if newThreshold < currentPrice and (currentPrice - newCost) > self:GetCraftingThreshold() then - self:Debug(format("Adding %s x%s to skillet queue. Profit: %s", - itemLink, - toQueue, - addon:FormatMoney(currentPrice - newThreshold) - )) - self:AddToQueue(skillId,i, toQueue) + + profitableItems[profitableIndex] = { + itemLink = itemLink, + SkillID = skillId, + Index = i, + toQueue = toQueue, + profit = (currentPrice - newCost) * toQueue + } + profitableIndex = profitableIndex + 1 elseif ItemAuditor.db.profile.messages.queue_skip then - self:Debug(format("Skipping %s x%s. Profit: %s ", itemLink, toQueue, addon:FormatMoney(currentPrice - newCost))) + self:Print(format("Skipping %s x%s. Profit: %s ", itemLink, toQueue, addon:FormatMoney(currentPrice - newCost))) end end - end + end end - - + local numAdded = 0 + table.sort(profitableItems, function(a, b) return a.profit > b.profit end) + for key, data in pairs(profitableItems) do + self:Print(format("Adding %s x%s to skillet queue. Profit: %s", + data.itemLink, + data.toQueue, + self:FormatMoney(data.profit) + )) + self:AddToQueue(data.SkillID, data.Index, data.toQueue) + numAdded = numAdded +1 + end + self:Print(format("%d items checked", numChecked)) + self:Print(format("%d queued", numAdded)) end function addon:GetReagentCost(link, total) @@ -178,14 +214,26 @@ -- If there is none on the auction house, this uses a large enough number -- to prevent us from trying to make the item. - local ahPrice = (GetAuctionBuyout(link) or 99990000) + local ahPrice = (self:GetAuctionPrice(link) or 99990000) + -- local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link); return totalCost + (ahPrice * total) end +function addon:GetAuctionPrice(itemLink) + if GetAuctionBuyout ~= nil then + return GetAuctionBuyout(itemLink) + elseif AucAdvanced and AucAdvanced.Version then + local _, _, _, _, _, lowBuy= AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems(itemLink) + return lowBuy + end + return nil +end + function addon:AddToQueue(skillId,skillIndex, toQueue) if Skillet == nil then self:Print("Skillet not loaded") + return end if Skillet.QueueCommandIterate ~= nil then local queueCommand = Skillet:QueueCommandIterate(tonumber(skillId), toQueue)