Mercurial > wow > inventory
diff Modules/Queue.lua @ 225:2e4e52a589e5
Added onQueueStart and onQueueEnd events to crafting addon registering.
GnomeWorks queue frame should automatically be closed before adding items to the queue and opened afterwards to speed this process up.
author | Zerotorescue |
---|---|
date | Mon, 07 Feb 2011 15:06:41 +0100 |
parents | 1ed7ce9b1c5d |
children |
line wrap: on
line diff
--- a/Modules/Queue.lua Mon Feb 07 00:06:07 2011 +0100 +++ b/Modules/Queue.lua Mon Feb 07 15:06:41 2011 +0100 @@ -373,6 +373,12 @@ -- Prepare a table with all possible tradeskill craftables local craftables = self:GetTradeskillCraftables(); + local craftingAddon = self:GetCraftingAddon(group); + + if craftingAddon.OnQueueStart then + craftingAddon.OnQueueStart(); + end + for _, q in pairs(queue) do if craftables[q.itemId] then if self:QueueWithAddon(craftables[q.itemId].no, ceil(q.amount / craftables[q.itemId].quantity), q.groupName) == -1 then @@ -394,6 +400,10 @@ end end + if craftingAddon.OnQueueEnd then + craftingAddon.OnQueueEnd(); + end + self:QueueHide(); end @@ -534,28 +544,38 @@ }); end +function mod:GetCraftingAddon(group) + local selectedExternalAddon = addon:GetOptionByKey(group, "craftingAddon"); + + if addon.supportedAddons.crafting[selectedExternalAddon] and addon.supportedAddons.crafting[selectedExternalAddon].IsEnabled() then + -- Try to use the default auction pricing addon + + return addon.supportedAddons.crafting[selectedExternalAddon], selectedExternalAddon; + else + -- Default not available, get the first one then + + for name, value in pairs(addon.supportedAddons.crafting) do + if value.IsEnabled() then + return value, name; + end + end + end + + return; +end + function mod:QueueWithAddon(tradeSkillIndex, amount, group) -- Sanity check tradeSkillIndex = tonumber(tradeSkillIndex); amount = tonumber(amount); - local selectedExternalAddon = addon:GetOptionByKey(group, "craftingAddon"); + local craftingAddon = self:GetCraftingAddon(group); - if addon.supportedAddons.crafting[selectedExternalAddon] and addon.supportedAddons.crafting[selectedExternalAddon].IsEnabled() then - -- Try to use the default auction pricing addon - - return addon.supportedAddons.crafting[selectedExternalAddon].Queue(tradeSkillIndex, amount); + if craftingAddon then + return craftingAddon.Queue(tradeSkillIndex, amount); else - -- Default not available, get the first one then - - for name, value in pairs(addon.supportedAddons.crafting) do - if value.IsEnabled() then - return value.Queue(tradeSkillIndex, amount); - end - end + return -1; end - - return -1; end function mod:OnEnable()