comparison Queue.lua @ 62:fee06221176f

Seperated the config from Core.lua. Many other code cleaning up for readability. Added local references for much used globals. Moved widgets to a different file for readability. Re-added global function for slash command handling since we do need it for our chat-hyperlinks. Fixed queueing to properly use the track at property of virtual groups. Fixed queueing to display the item id instead of the item link if the item link could not be loaded. Speed slider at the summary now has an interval of 1% down from 5% and rounds rather than ceils it?s value so 101% will become 100% rather than 105%. Now using the right stock properties at the summary. Added a help group to the config.
author Zerotorescue
date Wed, 22 Dec 2010 19:56:55 +0100
parents d903b0a151d3
children 2127ab01ed4a
comparison
equal deleted inserted replaced
61:d903b0a151d3 62:fee06221176f
1 local addon = select(2, ...); 1 local addon = select(2, ...);
2 local mod = addon:NewModule("Queue", "AceEvent-3.0", "AceTimer-3.0"); 2 local mod = addon:NewModule("Queue", "AceEvent-3.0", "AceTimer-3.0");
3 3
4 local pairs = pairs;
5
4 function mod:OnEnable() 6 function mod:OnEnable()
5 -- Register our own slash commands 7 -- Register our own slash commands
8 -- /im queue
6 addon:RegisterSlash(function() 9 addon:RegisterSlash(function()
7 mod:QueueAll(); 10 mod:QueueAll();
8 end, { "q", "que", "queue" }, "|Hfunction:InventoriumCommandHandler:queue|h|cff00fff7/im queue|r|h (or /im q) - Queue all items found in the currently opened profession that are within the groups tracked at this current character."); 11 end, { "q", "que", "queue" }, "|Hfunction:InventoriumCommandHandler:queue|h|cff00fff7/im queue|r|h (or /im q) - Queue all items found in the currently opened profession that are within the groups tracked at this current character.");
9 12
10 self:RegisterMessage("IM_QUEUE_ALL"); 13 self:RegisterMessage("IM_QUEUE_ALL");
22 function mod:QueueAll() 25 function mod:QueueAll()
23 local playerName = UnitName("player"); 26 local playerName = UnitName("player");
24 27
25 -- Go through all groups 28 -- Go through all groups
26 for groupName, values in pairs(addon.db.profile.groups) do 29 for groupName, values in pairs(addon.db.profile.groups) do
27 local trackAt = (values.trackAtCharacters or (values.trackAtCharacters == nil and addon.db.profile.defaults.trackAtCharacters)); 30 local trackAt = addon:GetOptionByKey(groupName, "trackAtCharacters");
28 31
29 if trackAt[playerName] then 32 if trackAt[playerName] then
30 self:QueueGroup(groupName); 33 self:QueueGroup(groupName);
31 end 34 end
32 end 35 end
49 if addon.db.profile.groups[groupName].items then 52 if addon.db.profile.groups[groupName].items then
50 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do 53 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do
51 if not temp[itemId] then 54 if not temp[itemId] then
52 local itemLink = select(2, GetItemInfo(itemId)); 55 local itemLink = select(2, GetItemInfo(itemId));
53 56
54 print("Couldn't queue " .. itemLink .. " (not part of this profession)"); 57 print("Couldn't queue " .. (itemLink or itemId or "???") .. " (not part of this profession)");
55 end 58 end
56 end 59 end
57 end 60 end
58 end 61 end
59 62