comparison Queue.lua @ 13:5006cb0e97c6

Removed sound media registrations since we don?t use them. Added an option to include tadeskill items above a certain item level threshold in the add items config tab. Renamed the variable for toggling hiding from summary when below price threshold-option. You will have to re-set it. Summary size and processing speed will now be remembered. Processing speed slider can now go up to 500% (up from 100%). Silver will be hidden from money when it includes more than 10 gold (down from 100g) and copper will be hidden if it includes more than 1 gold (down from 10g). Auction addons, crafting addons and itemcount addons can now register themselves through a few global functions. The most used addons have been included in the addon folder. You can now select the prefered default pricing, item count and crafting addons. Temporarily removed the ?dialogControl = ?DropDown?? from the track at select boxes. This functionality is broken within the Ace3 library and until it is fixed I wish to keep these options somewhat functional. The item list will now be truncated before rebuilding. Previously items disappearing from your inventory would still appear in this list. Mass add is now functional. All buttons and sliders that were meant to receive a tooltip (including the sort-headers), now have one. Added spacers between all buttons and sliders of the summary window. Added a ?queue all? button to the summary window. This button is not yet functional. If the value of an item is not retrieved from the auction prices database, it will appear as a dash (-) rather than ?0c?. If no item count is enabled, item counts will appear as ?Unknown? instead of breaking (or defaulting to 0).
author Zerotorescue
date Mon, 18 Oct 2010 15:26:42 +0200
parents
children 0fc8a54516d7
comparison
equal deleted inserted replaced
12:417c3cfb9623 13:5006cb0e97c6
1 local addon = LibStub("AceAddon-3.0"):GetAddon("Inventorium");
2 local mod = addon:NewModule("Queue", "AceEvent-3.0", "AceTimer-3.0");
3
4 local scrollIds = {
5 [27951] = 37603,
6 [7418] = 38679,
7 [7420] = 38766,
8 [7426] = 38767,
9 [7428] = 38768,
10 [7443] = 38769,
11 [7454] = 38770,
12 [7457] = 38771,
13 [7745] = 38772,
14 [7748] = 38773,
15 [7766] = 38774,
16 [7771] = 38775,
17 [7776] = 38776,
18 [7779] = 38777,
19 [7782] = 38778,
20 [7786] = 38779,
21 [7788] = 38780,
22 [7793] = 38781,
23 [7857] = 38782,
24 [7859] = 38783,
25 [7861] = 38784,
26 [7863] = 38785,
27 [7867] = 38786,
28 [13378] = 38787,
29 [13380] = 38788,
30 [13419] = 38789,
31 [13421] = 38790,
32 [13464] = 38791,
33 [13485] = 38792,
34 [13501] = 38793,
35 [13503] = 38794,
36 [13522] = 38795,
37 [13529] = 38796,
38 [13536] = 38797,
39 [13538] = 38798,
40 [13607] = 38799,
41 [13612] = 38800,
42 [13617] = 38801,
43 [13620] = 38802,
44 [13622] = 38803,
45 [13626] = 38804,
46 [13631] = 38805,
47 [13635] = 38806,
48 [13637] = 38807,
49 [13640] = 38808,
50 [13642] = 38809,
51 [13644] = 38810,
52 [13646] = 38811,
53 [13648] = 38812,
54 [13653] = 38813,
55 [13655] = 38814,
56 [13657] = 38815,
57 [13659] = 38816,
58 [13661] = 38817,
59 [13663] = 38818,
60 [13687] = 38819,
61 [13689] = 38820,
62 [13693] = 38821,
63 [13695] = 38822,
64 [13698] = 38823,
65 [13700] = 38824,
66 [13746] = 38825,
67 [13794] = 38826,
68 [13815] = 38827,
69 [13817] = 38828,
70 [13822] = 38829,
71 [13836] = 38830,
72 [13841] = 38831,
73 [13846] = 38832,
74 [13858] = 38833,
75 [13868] = 38834,
76 [13882] = 38835,
77 [13887] = 38836,
78 [13890] = 38837,
79 [13898] = 38838,
80 [13905] = 38839,
81 [13915] = 38840,
82 [13917] = 38841,
83 [13931] = 38842,
84 [13933] = 38843,
85 [13935] = 38844,
86 [13937] = 38845,
87 [13939] = 38846,
88 [13941] = 38847,
89 [13943] = 38848,
90 [13945] = 38849,
91 [13947] = 38850,
92 [13948] = 38851,
93 [20008] = 38852,
94 [20009] = 38853,
95 [20010] = 38854,
96 [20011] = 38855,
97 [20012] = 38856,
98 [20013] = 38857,
99 [20014] = 38858,
100 [20015] = 38859,
101 [20016] = 38860,
102 [20017] = 38861,
103 [20020] = 38862,
104 [20023] = 38863,
105 [20024] = 38864,
106 [20025] = 38865,
107 [20026] = 38866,
108 [20028] = 38867,
109 [20029] = 38868,
110 [20030] = 38869,
111 [20031] = 38870,
112 [20032] = 38871,
113 [20033] = 38872,
114 [20034] = 38873,
115 [20035] = 38874,
116 [20036] = 38875,
117 [21931] = 38876,
118 [22749] = 38877,
119 [22750] = 38878,
120 [23799] = 38879,
121 [23800] = 38880,
122 [23801] = 38881,
123 [23802] = 38882,
124 [23803] = 38883,
125 [23804] = 38884,
126 [25072] = 38885,
127 [25073] = 38886,
128 [25074] = 38887,
129 [25078] = 38888,
130 [25079] = 38889,
131 [25080] = 38890,
132 [25081] = 38891,
133 [25082] = 38892,
134 [25083] = 38893,
135 [25084] = 38894,
136 [25086] = 38895,
137 [27837] = 38896,
138 [27899] = 38897,
139 [27905] = 38898,
140 [27906] = 38899,
141 [27911] = 38900,
142 [27913] = 38901,
143 [27914] = 38902,
144 [27917] = 38903,
145 [27944] = 38904,
146 [27945] = 38905,
147 [27946] = 38906,
148 [27947] = 38907,
149 [27948] = 38908,
150 [27950] = 38909,
151 [27954] = 38910,
152 [27957] = 38911,
153 [27958] = 38912,
154 [27960] = 38913,
155 [27961] = 38914,
156 [27962] = 38915,
157 [27967] = 38917,
158 [27968] = 38918,
159 [27971] = 38919,
160 [27972] = 38920,
161 [27975] = 38921,
162 [27977] = 38922,
163 [27981] = 38923,
164 [27982] = 38924,
165 [27984] = 38925,
166 [28003] = 38926,
167 [28004] = 38927,
168 [33990] = 38928,
169 [33991] = 38929,
170 [33992] = 38930,
171 [33993] = 38931,
172 [33994] = 38932,
173 [33995] = 38933,
174 [33996] = 38934,
175 [33997] = 38935,
176 [33999] = 38936,
177 [34001] = 38937,
178 [34002] = 38938,
179 [34003] = 38939,
180 [34004] = 38940,
181 [34005] = 38941,
182 [34006] = 38942,
183 [34007] = 38943,
184 [34008] = 38944,
185 [34009] = 38945,
186 [34010] = 38946,
187 [42620] = 38947,
188 [42974] = 38948,
189 [44383] = 38949,
190 [44483] = 38950,
191 [44484] = 38951,
192 [44488] = 38953,
193 [44489] = 38954,
194 [44492] = 38955,
195 [44494] = 38956,
196 [44500] = 38959,
197 [44506] = 38960,
198 [44508] = 38961,
199 [44509] = 38962,
200 [44510] = 38963,
201 [44513] = 38964,
202 [44524] = 38965,
203 [44528] = 38966,
204 [44529] = 38967,
205 [44555] = 38968,
206 [44556] = 38969,
207 [60616] = 38971,
208 [44576] = 38972,
209 [44582] = 38973,
210 [44584] = 38974,
211 [44588] = 38975,
212 [44589] = 38976,
213 [44590] = 38977,
214 [44591] = 38978,
215 [44592] = 38979,
216 [44593] = 38980,
217 [44595] = 38981,
218 [44596] = 38982,
219 [44598] = 38984,
220 [60623] = 38986,
221 [44616] = 38987,
222 [44621] = 38988,
223 [44623] = 38989,
224 [44625] = 38990,
225 [44629] = 38991,
226 [44630] = 38992,
227 [44631] = 38993,
228 [44633] = 38995,
229 [44635] = 38997,
230 [46578] = 38998,
231 [46594] = 38999,
232 [47051] = 39000,
233 [47672] = 39001,
234 [47766] = 39002,
235 [47898] = 39003,
236 [47899] = 39004,
237 [47900] = 39005,
238 [47901] = 39006,
239 [59625] = 43987,
240 [60606] = 44449,
241 [60621] = 44453,
242 [60653] = 44455,
243 [60609] = 44456,
244 [60663] = 44457,
245 [60668] = 44458,
246 [60691] = 44463,
247 [60692] = 44465,
248 [60707] = 44466,
249 [60714] = 44467,
250 [60763] = 44469,
251 [60767] = 44470,
252 [59621] = 44493,
253 [59619] = 44497,
254 [44575] = 44815,
255 [62256] = 44947,
256 [62948] = 45056,
257 [62959] = 45060,
258 [63746] = 45628,
259 [64441] = 46026,
260 [64579] = 46098,
261 [71692] = 50816,
262 };--enchantId=scrollId
263
264 function mod:OnEnable()
265 -- Register our own slash commands
266 addon:RegisterSlash(function()
267 self:QueueAll();
268 end, "q", "que", "queue");
269 end
270
271 function mod:QueueAll()
272 -- Go through all trade skills for the profession
273 for i = 1, GetNumTradeSkills() do
274 -- Go through all groups
275 for groupName, _ in pairs(addon.db.global.groups) do
276 -- Process every single tradeskill
277 self:ProcessTradeSkill(i, groupName);
278 end
279 end
280 end
281
282 function mod:QueueGroup(groupName)
283 if not addon.db.global.groups[groupName] then return false; end
284
285 -- Go through all trade skills for the profession
286 for i = 1, GetNumTradeSkills() do
287 -- Process every single tradeskill
288 self:ProcessTradeSkill(i, groupName);
289 end
290 end
291
292 function mod:ProcessTradeSkill(i, groupName)
293 -- Try to retrieve the itemlink, this will be nil if current item is a group instead
294 local itemLink = GetTradeSkillItemLink(i);
295
296 if itemLink then
297 local itemId = addon:GetItemId(itemLink);
298 if not itemId then
299 -- If this isn't an item, it can only be an enchant instead
300 itemId = tonumber(itemLink:match("|Henchant:([-0-9]+)|h"));
301
302 itemId = scrollIds[itemId]; -- change enchantIds into scrollIds
303 end
304
305 if addon.db.global.groups[groupName].items[itemId] then
306 -- This item is in this group, queue it!
307
308 local amount = ( addon:GetOptionByKey(groupName, "restockTarget") - addon:GetItemCount(itemId) );
309
310 if amount > 0 then
311 self:Queue(i, amount);
312
313 print("Queued " .. amount .. " of " .. itemLink);
314 end
315 end
316 end
317 end
318
319 function mod:Queue(tradeSkillIndex, amount)
320 tradeSkillIndex = tonumber(tradeSkillIndex);
321 amount = tonumber(amount);
322
323 if not tradeSkillIndex or not amount then return; end
324
325 if addon.supportedAddons.crafting[addon.db.global.defaults.craftingAddon] then
326 -- Try to use the default auction pricing addon
327
328 return addon.supportedAddons.crafting[addon.db.global.defaults.craftingAddon].Queue(tradeSkillIndex, amount);
329 else
330 -- Default not available, get the first one then
331
332 for name, value in pairs(addon.supportedAddons.crafting) do
333 if value.IsEnabled() then
334 return value.Queue(tradeSkillIndex, amount);
335 end
336 end
337 end
338
339 return -2;
340 end