Mercurial > wow > itemauditor
diff Modules/Crafting.lua @ 68:2d65db19d3ce
Fixed a bug with the crafting threshold options. Updated /ia queue so that it is a shortcut to using /ia crafting and then clicking export.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Wed, 28 Jul 2010 11:37:43 -0700 |
parents | b6c30a5156f9 |
children | 3930518cb8d9 |
line wrap: on
line diff
--- a/Modules/Crafting.lua Wed Jul 28 07:35:14 2010 -0700 +++ b/Modules/Crafting.lua Wed Jul 28 11:37:43 2010 -0700 @@ -10,6 +10,12 @@ local realData = {} +local queueDestinations = {} + +function Crafting.RegisterQueueDestination(name, destination) + queueDestinations[name] = destination +end + -- TODO: Convert this to a text field. local craftingThresholds = {5000, 10000, 50000} local craftingThresholdsDisplay = {} @@ -19,6 +25,11 @@ -- craftingThresholdsDisplay[key] = value end +function ItemAuditor:GetCraftingThreshold() + local key = ItemAuditor.db.char.crafting_threshold + return craftingThresholds[key] +end + ItemAuditor.Options.args.crafting_options = { name = "Crafting with Skillet", desc = "/ia queue", @@ -75,14 +86,34 @@ }, } -local function ExportToSkillet() +function Crafting.ExportToSkillet(data) + local skillString = select(3, string.find(data.recipeLink, "^|%x+|H(.+)|h%[.+%]")) + local _, skillId = strsplit(":", skillString) + + ItemAuditor:AddToQueue(skillId,tradeSkillIndex, data.queue) +end + +Crafting.RegisterQueueDestination('Skillet', Crafting.ExportToSkillet) + + + +function Crafting.Export(destination) + if type(destination) == 'function' then + -- do nothing + elseif destination == nil then + destination = queueDestinations['Skillet'] + elseif type(destination) == 'string' then + destination = queueDestinations[destination] + else + error('destination must be a function or a string') + end + local index = 1 local data = ItemAuditor:GetCraftingRow(index) while data do - local skillString = select(3, string.find(data.recipeLink, "^|%x+|H(.+)|h%[.+%]")) - local _, skillId = strsplit(":", skillString) - - ItemAuditor:AddToQueue(skillId,tradeSkillIndex, data.queue) + if data.queue > 0 then + destination(data) + end index = index + 1 data = ItemAuditor:GetCraftingRow(index) @@ -318,8 +349,10 @@ end end table.sort(realData, function(a, b) return a.profit*a.queue > b.profit*b.queue end) - craftingTable:SetFilter(tableFilter) - self:RefreshCraftingTable() + if craftingTable then + craftingTable:SetFilter(tableFilter) + self:RefreshCraftingTable() + end end function ItemAuditor:RefreshCraftingTable()