diff Queue.lua @ 17:8f5c02113c5c

Reduced the softmax of most ranges from 1.000 to 100. This should make them actually useful. You can still manually enter an amount below the sliders of up to 100.000. The help text for the ?Replenishing stock? category now includes bonus queue information. Added an option to the ?add items? tab called ?Import premade data? which allows a user to import item data from a premade group shipped with the addon. If this premade data ever changes, the user will be notified and queried for an update. Added a ?mass remove? option to the ?current items? tab. Item data should be imported again when importing a complete group. Added ?DataStore (current account only)?, ?DataStore (with guilds)? and ?DataStore (without guilds)? item count options. One might prefer these over Altoholic for a few reasons. Scroll IDs are now stored in a seperate file in a new ?data? folder. Premade groups data can be found there too. Bonus queue and min crafting queue options should now be fully functional. Enchanting scrolls should now work properly. Text in the summary of the value of items below the price threshold window will now be colored completely grey.
author Zerotorescue
date Wed, 20 Oct 2010 01:30:51 +0200
parents 0fc8a54516d7
children 7d7aaa3fbe94
line wrap: on
line diff
--- a/Queue.lua	Mon Oct 18 19:37:43 2010 +0200
+++ b/Queue.lua	Wed Oct 20 01:30:51 2010 +0200
@@ -1,266 +1,6 @@
-local addon = LibStub("AceAddon-3.0"):GetAddon("Inventorium");
+local addon = select(2, ...);
 local mod = addon:NewModule("Queue", "AceEvent-3.0", "AceTimer-3.0");
 
-local scrollIds = {
-	[27951] = 37603,
-	[7418] = 38679,
-	[7420] = 38766,
-	[7426] = 38767,
-	[7428] = 38768,
-	[7443] = 38769,
-	[7454] = 38770,
-	[7457] = 38771,
-	[7745] = 38772,
-	[7748] = 38773,
-	[7766] = 38774,
-	[7771] = 38775,
-	[7776] = 38776,
-	[7779] = 38777,
-	[7782] = 38778,
-	[7786] = 38779,
-	[7788] = 38780,
-	[7793] = 38781,
-	[7857] = 38782,
-	[7859] = 38783,
-	[7861] = 38784,
-	[7863] = 38785,
-	[7867] = 38786,
-	[13378] = 38787,
-	[13380] = 38788,
-	[13419] = 38789,
-	[13421] = 38790,
-	[13464] = 38791,
-	[13485] = 38792,
-	[13501] = 38793,
-	[13503] = 38794,
-	[13522] = 38795,
-	[13529] = 38796,
-	[13536] = 38797,
-	[13538] = 38798,
-	[13607] = 38799,
-	[13612] = 38800,
-	[13617] = 38801,
-	[13620] = 38802,
-	[13622] = 38803,
-	[13626] = 38804,
-	[13631] = 38805,
-	[13635] = 38806,
-	[13637] = 38807,
-	[13640] = 38808,
-	[13642] = 38809,
-	[13644] = 38810,
-	[13646] = 38811,
-	[13648] = 38812,
-	[13653] = 38813,
-	[13655] = 38814,
-	[13657] = 38815,
-	[13659] = 38816,
-	[13661] = 38817,
-	[13663] = 38818,
-	[13687] = 38819,
-	[13689] = 38820,
-	[13693] = 38821,
-	[13695] = 38822,
-	[13698] = 38823,
-	[13700] = 38824,
-	[13746] = 38825,
-	[13794] = 38826,
-	[13815] = 38827,
-	[13817] = 38828,
-	[13822] = 38829,
-	[13836] = 38830,
-	[13841] = 38831,
-	[13846] = 38832,
-	[13858] = 38833,
-	[13868] = 38834,
-	[13882] = 38835,
-	[13887] = 38836,
-	[13890] = 38837,
-	[13898] = 38838,
-	[13905] = 38839,
-	[13915] = 38840,
-	[13917] = 38841,
-	[13931] = 38842,
-	[13933] = 38843,
-	[13935] = 38844,
-	[13937] = 38845,
-	[13939] = 38846,
-	[13941] = 38847,
-	[13943] = 38848,
-	[13945] = 38849,
-	[13947] = 38850,
-	[13948] = 38851,
-	[20008] = 38852,
-	[20009] = 38853,
-	[20010] = 38854,
-	[20011] = 38855,
-	[20012] = 38856,
-	[20013] = 38857,
-	[20014] = 38858,
-	[20015] = 38859,
-	[20016] = 38860,
-	[20017] = 38861,
-	[20020] = 38862,
-	[20023] = 38863,
-	[20024] = 38864,
-	[20025] = 38865,
-	[20026] = 38866,
-	[20028] = 38867,
-	[20029] = 38868,
-	[20030] = 38869,
-	[20031] = 38870,
-	[20032] = 38871,
-	[20033] = 38872,
-	[20034] = 38873,
-	[20035] = 38874,
-	[20036] = 38875,
-	[21931] = 38876,
-	[22749] = 38877,
-	[22750] = 38878,
-	[23799] = 38879,
-	[23800] = 38880,
-	[23801] = 38881,
-	[23802] = 38882,
-	[23803] = 38883,
-	[23804] = 38884,
-	[25072] = 38885,
-	[25073] = 38886,
-	[25074] = 38887,
-	[25078] = 38888,
-	[25079] = 38889,
-	[25080] = 38890,
-	[25081] = 38891,
-	[25082] = 38892,
-	[25083] = 38893,
-	[25084] = 38894,
-	[25086] = 38895,
-	[27837] = 38896,
-	[27899] = 38897,
-	[27905] = 38898,
-	[27906] = 38899,
-	[27911] = 38900,
-	[27913] = 38901,
-	[27914] = 38902,
-	[27917] = 38903,
-	[27944] = 38904,
-	[27945] = 38905,
-	[27946] = 38906,
-	[27947] = 38907,
-	[27948] = 38908,
-	[27950] = 38909,
-	[27954] = 38910,
-	[27957] = 38911,
-	[27958] = 38912,
-	[27960] = 38913,
-	[27961] = 38914,
-	[27962] = 38915,
-	[27967] = 38917,
-	[27968] = 38918,
-	[27971] = 38919,
-	[27972] = 38920,
-	[27975] = 38921,
-	[27977] = 38922,
-	[27981] = 38923,
-	[27982] = 38924,
-	[27984] = 38925,
-	[28003] = 38926,
-	[28004] = 38927,
-	[33990] = 38928,
-	[33991] = 38929,
-	[33992] = 38930,
-	[33993] = 38931,
-	[33994] = 38932,
-	[33995] = 38933,
-	[33996] = 38934,
-	[33997] = 38935,
-	[33999] = 38936,
-	[34001] = 38937,
-	[34002] = 38938,
-	[34003] = 38939,
-	[34004] = 38940,
-	[34005] = 38941,
-	[34006] = 38942,
-	[34007] = 38943,
-	[34008] = 38944,
-	[34009] = 38945,
-	[34010] = 38946,
-	[42620] = 38947,
-	[42974] = 38948,
-	[44383] = 38949,
-	[44483] = 38950,
-	[44484] = 38951,
-	[44488] = 38953,
-	[44489] = 38954,
-	[44492] = 38955,
-	[44494] = 38956,
-	[44500] = 38959,
-	[44506] = 38960,
-	[44508] = 38961,
-	[44509] = 38962,
-	[44510] = 38963,
-	[44513] = 38964,
-	[44524] = 38965,
-	[44528] = 38966,
-	[44529] = 38967,
-	[44555] = 38968,
-	[44556] = 38969,
-	[60616] = 38971,
-	[44576] = 38972,
-	[44582] = 38973,
-	[44584] = 38974,
-	[44588] = 38975,
-	[44589] = 38976,
-	[44590] = 38977,
-	[44591] = 38978,
-	[44592] = 38979,
-	[44593] = 38980,
-	[44595] = 38981,
-	[44596] = 38982,
-	[44598] = 38984,
-	[60623] = 38986,
-	[44616] = 38987,
-	[44621] = 38988,
-	[44623] = 38989,
-	[44625] = 38990,
-	[44629] = 38991,
-	[44630] = 38992,
-	[44631] = 38993,
-	[44633] = 38995,
-	[44635] = 38997,
-	[46578] = 38998,
-	[46594] = 38999,
-	[47051] = 39000,
-	[47672] = 39001,
-	[47766] = 39002,
-	[47898] = 39003,
-	[47899] = 39004,
-	[47900] = 39005,
-	[47901] = 39006,
-	[59625] = 43987,
-	[60606] = 44449,
-	[60621] = 44453,
-	[60653] = 44455,
-	[60609] = 44456,
-	[60663] = 44457,
-	[60668] = 44458,
-	[60691] = 44463,
-	[60692] = 44465,
-	[60707] = 44466,
-	[60714] = 44467,
-	[60763] = 44469,
-	[60767] = 44470,
-	[59621] = 44493,
-	[59619] = 44497,
-	[44575] = 44815,
-	[62256] = 44947,
-	[62948] = 45056,
-	[62959] = 45060,
-	[63746] = 45628,
-	[64441] = 46026,
-	[64579] = 46098,
-	[71692] = 50816,
-};--enchantId=scrollId
-
 function mod:OnEnable()
 	-- Register our own slash commands
 	addon:RegisterSlash(function()
@@ -309,7 +49,7 @@
 	for itemId, _ in pairs(addon.db.global.groups[groupName].items) do
 		if not temp[itemId] then
 			local itemLink = select(2, GetItemInfo(itemId));
-			print("Couldn't queue " .. itemLink);
+			print("Couldn't queue " .. itemLink .. " (not part of this profession)");
 		end
 	end
 end
@@ -324,7 +64,7 @@
 			-- If this isn't an item, it can only be an enchant instead
 			itemId = tonumber(itemLink:match("|Henchant:([-0-9]+)|h"));
 			
-			itemId = scrollIds[itemId]; -- change enchantIds into scrollIds
+			itemId = addon.scrollIds[itemId]; -- change enchantIds into scrollIds
 		end
 		
 		if addon.db.global.groups[groupName].items[itemId] then
@@ -338,9 +78,17 @@
 			local currentStock = addon:GetItemCount(itemId);
 			if currentStock >= 0 then
 				-- Current stock will be -1 when no itemcount addon was found
-				local amount = ( addon:GetOptionByKey(groupName, "restockTarget") - currentStock );
+				local restockTarget = addon:GetOptionByKey(groupName, "restockTarget");
+				local bonusQueue = addon:GetOptionByKey(groupName, "bonusQueue");
+				local minCraftingQueue = floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * restockTarget );
 				
-				if amount > 0 then
+				local amount = ( restockTarget - currentStock );
+				
+				if currentStock == 0 and bonusQueue > 0 then
+					amount = floor( ( amount * ( bonusQueue + 1 ) ) + .5 ); -- round
+				end
+				
+				if amount > 0 and amount >= minCraftingQueue then
 					self:Queue(i, amount);
 					
 					print("Queued " .. amount .. " of " .. itemLink);