comparison Modules/Queue.lua @ 140:cd461a41723c

Now keeping track how many times an item has been queued into your favorite crafting addon.
author Zerotorescue
date Tue, 18 Jan 2011 11:34:48 +0100
parents 396c2960d54d
children 8eb0f5b5a885
comparison
equal deleted inserted replaced
139:e336a94359d8 140:cd461a41723c
31 if mod:QueueWithAddon(craftables[q.itemId].no, ceil(q.amount / craftables[q.itemId].quantity), q.groupName) == -1 then 31 if mod:QueueWithAddon(craftables[q.itemId].no, ceil(q.amount / craftables[q.itemId].quantity), q.groupName) == -1 then
32 addon:Print("Couldn't queue, no supported crafting addon found.", addon.Colors.Red); 32 addon:Print("Couldn't queue, no supported crafting addon found.", addon.Colors.Red);
33 33
34 OnQueueCancel(); 34 OnQueueCancel();
35 return; 35 return;
36 else
37 -- Update the crafted-item count
38 for groupName, values in pairs(addon.db.profile.groups) do
39 if values.items and values.items[q.itemId] then
40 values.items[q.itemId] = tonumber(values.items[q.itemId]) + 1;
41 break;
42 end
43 end
36 end 44 end
37 else 45 else
38 addon:Debug("Lost %s", IdToItemLink(q.itemId)); 46 addon:Debug("Lost %s", IdToItemLink(q.itemId));
39 end 47 end
40 end 48 end
271 local restockTarget = addon:GetOptionByKey(groupName, "restockTarget"); 279 local restockTarget = addon:GetOptionByKey(groupName, "restockTarget");
272 local bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue"); 280 local bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue");
273 local minCraftingQueue = floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * restockTarget ); -- If the minCraftingQueue is 5% and restockTarget is 60, this will result in 3 281 local minCraftingQueue = floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * restockTarget ); -- If the minCraftingQueue is 5% and restockTarget is 60, this will result in 3
274 local priceThreshold = addon:GetOptionByKey(groupName, "priceThreshold"); 282 local priceThreshold = addon:GetOptionByKey(groupName, "priceThreshold");
275 283
276 for itemId in pairs(addon.db.profile.groups[groupName].items) do 284 for itemId, count in pairs(addon.db.profile.groups[groupName].items) do
277 if craftables[itemId] then 285 if craftables[itemId] then
278 local currentStock = addon:GetItemCount(itemId, groupName); 286 local currentStock = addon:GetItemCount(itemId, groupName);
279 287
280 if currentStock >= 0 then 288 if currentStock >= 0 then
281 -- Current stock will be -1 when no itemcount addon was found 289 -- Current stock will be -1 when no itemcount addon was found