Mercurial > wow > inventory
comparison Modules/Queue.lua @ 209:1ed7ce9b1c5d
Cleaned up Queue; errors should now stop a queue all loop rather than occur at every single group.
author | Zerotorescue |
---|---|
date | Sat, 05 Feb 2011 20:09:03 +0100 |
parents | 5d6b3d116b80 |
children | 2e4e52a589e5 |
comparison
equal
deleted
inserted
replaced
208:8cecfea6a254 | 209:1ed7ce9b1c5d |
---|---|
25 }, | 25 }, |
26 ["LOW_VALUE"] = { | 26 ["LOW_VALUE"] = { |
27 "|cffff6633Underpriced|r", -- orange | 27 "|cffff6633Underpriced|r", -- orange |
28 "The recorded auction value of this item is below your price threshold.", | 28 "The recorded auction value of this item is below your price threshold.", |
29 15, | 29 15, |
30 }, | |
31 ["NO_ITEMCOUNT_ADDON"] = { | |
32 "|cffff0000No itemcount addon|r", -- red | |
33 "No compatible item count could be found.", | |
34 20, | |
35 }, | 30 }, |
36 ["REMOVED"] = { -- because this is updated realtime, it is most useful around the top of the list | 31 ["REMOVED"] = { -- because this is updated realtime, it is most useful around the top of the list |
37 "|cffff0000Removed|r", -- red | 32 "|cffff0000Removed|r", -- red |
38 "You manually removed this item from the queue.", | 33 "You manually removed this item from the queue.", |
39 45, | 34 45, |
417 | 412 |
418 function mod:QueueAll() | 413 function mod:QueueAll() |
419 -- Prepare a table with all possible tradeskill craftables | 414 -- Prepare a table with all possible tradeskill craftables |
420 local craftables = self:GetTradeskillCraftables(); | 415 local craftables = self:GetTradeskillCraftables(); |
421 | 416 |
422 if not craftables then | |
423 addon:Print("No tradeskill window detected. Please open a profession before trying to queue.", addon.Colors.Red); | |
424 return; | |
425 end | |
426 | |
427 -- Forget old queue | 417 -- Forget old queue |
428 twipe(queue); | 418 twipe(queue); |
429 twipe(skipped); | 419 twipe(skipped); |
430 | 420 |
431 local playerName = UnitName("player"); | 421 local playerName = UnitName("player"); |
433 -- Go through all groups | 423 -- Go through all groups |
434 for groupName, values in pairs(addon.db.profile.groups) do | 424 for groupName, values in pairs(addon.db.profile.groups) do |
435 local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters"); | 425 local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters"); |
436 | 426 |
437 if trackAt[playerName] then | 427 if trackAt[playerName] then |
438 self:QueueGroup(groupName, craftables); | 428 if not self:QueueGroup(groupName, craftables) then |
429 return; | |
430 end | |
439 end | 431 end |
440 end | 432 end |
441 | 433 |
442 mod:BuildQueue(); | 434 mod:BuildQueue(); |
443 end | 435 end |
448 craftables = self:GetTradeskillCraftables(); -- nil when no tradeskill window is open | 440 craftables = self:GetTradeskillCraftables(); -- nil when no tradeskill window is open |
449 end | 441 end |
450 | 442 |
451 if not craftables then | 443 if not craftables then |
452 addon:Print("No tradeskill window detected. Please open a profession before trying to queue.", addon.Colors.Red); | 444 addon:Print("No tradeskill window detected. Please open a profession before trying to queue.", addon.Colors.Red); |
453 return; | 445 return false; -- exit |
454 elseif not addon.db.profile.groups[groupName] then | 446 elseif not addon.db.profile.groups[groupName] then |
455 addon:Print(sformat("Tried to queue items from a group named \"%s\", but no such group exists.", groupName), addon.Colors.Red); | 447 addon:Print(sformat("Tried to queue items from a group named \"%s\", but no such group exists.", groupName), addon.Colors.Red); |
456 return; | 448 return false; -- exit |
457 elseif not addon.db.profile.groups[groupName].items then | 449 elseif not addon.db.profile.groups[groupName].items then |
458 addon:Debug("This group (%s) has no items.", groupName); | 450 addon:Debug("This group (%s) has no items.", groupName); |
459 return; | 451 return true; -- continue with next group |
460 end | 452 end |
461 | 453 |
462 -- Retrieve group settings | 454 -- Retrieve group settings |
463 local restockTarget = addon:GetOptionByKey(groupName, "restockTarget"); | 455 local restockTarget = addon:GetOptionByKey(groupName, "restockTarget"); |
464 local bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue"); | 456 local bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue"); |
508 self:Skip(itemId, skipReasons.MIN_CRAFTING_QUEUE); | 500 self:Skip(itemId, skipReasons.MIN_CRAFTING_QUEUE); |
509 end | 501 end |
510 end | 502 end |
511 else | 503 else |
512 -- No item count addon | 504 -- No item count addon |
513 self:Skip(itemId, skipReasons.NO_ITEMCOUNT_ADDON); | 505 addon:Print("No usable itemcount addon found.", addon.Colors.Red); |
514 addon:Print("No usable itemcount addon found."); | 506 return false; -- exit |
515 return; | |
516 end | 507 end |
517 else | 508 else |
518 self:Skip(itemId, skipReasons.NOT_CRAFTABLE); | 509 self:Skip(itemId, skipReasons.NOT_CRAFTABLE); |
519 end | 510 end |
520 end | 511 end |
521 | 512 |
522 if displayQueue then | 513 if displayQueue then |
523 mod:BuildQueue(); | 514 mod:BuildQueue(); |
524 end | 515 end |
516 | |
517 return true; -- continue | |
525 end | 518 end |
526 | 519 |
527 function mod:Queue(itemId, amount, bonus, craft, groupName) | 520 function mod:Queue(itemId, amount, bonus, craft, groupName) |
528 tinsert(queue, { | 521 tinsert(queue, { |
529 ["itemId"] = itemId, -- needed to display the queued item in the queue window | 522 ["itemId"] = itemId, -- needed to display the queued item in the queue window |