comparison Core.lua @ 106:d3fbb5676a5e

Added tooltips to the item refill window headers. Now color coding the availibility of items at the item refill window. Added a hide help text option (which is off by default). Renamed all premade groups to a new naming pattern; ?Profession - Category - Detail?, e.g. ?Inscription - Glyphs by class - Death Knight?. To continue getting notified about updates to a selected premade group, you must re-add them. Repositioned elements of the item refill frame to fit better. No longer using colorsargs to remember the index of a queued move, but instead providing a reference to the move itself in the new ?rowData? property of each row. Added tooltips to the headers of the sort table. Merged missing and available columns together (showing available / missing) and sorting on available now sorts on percentage of how many of the missing items are available. Moving and available columns are now aligned to the right. Added an ?extra? config group which contains the additional (but completely optional) settings. Moved color codes adjustments, forget character, auto refill skip confirm and hide help info options to this group.
author Zerotorescue
date Wed, 12 Jan 2011 19:58:39 +0100
parents 6ae44d372360
children 67bd5057ecb7
comparison
equal deleted inserted replaced
105:4efbaf069ddb 106:d3fbb5676a5e
8 --[===[@non-debug@ 8 --[===[@non-debug@
9 local addonRevision = @project-revision@; 9 local addonRevision = @project-revision@;
10 --@end-non-debug@]===] 10 --@end-non-debug@]===]
11 11
12 local _G = _G; 12 local _G = _G;
13 local print, pairs, tonumber = _G.print, _G.pairs, _G.tonumber; 13 local sformat, print, pairs, tonumber = _G.string.format, _G.print, _G.pairs, _G.tonumber;
14 14
15 -- All modules must be able to retrieve our supported addons database, thus keep it a part of the addon object rather than local 15 -- All modules must be able to retrieve our supported addons database, thus keep it a part of the addon object rather than local
16 addon.supportedAddons = {}; 16 addon.supportedAddons = {};
17 addon.supportedAddons.auctionPricing = {}; 17 addon.supportedAddons.auctionPricing = {};
18 addon.supportedAddons.itemCount = {}; 18 addon.supportedAddons.itemCount = {};
40 restockTarget = 60, 40 restockTarget = 60,
41 minCraftingQueue = 0.05, 41 minCraftingQueue = 0.05,
42 bonusQueue = 0.1, 42 bonusQueue = 0.1,
43 priceThreshold = 0, 43 priceThreshold = 0,
44 summaryHidePriceThreshold = false, 44 summaryHidePriceThreshold = false,
45 hideHelp = false,
45 trackAtCharacters = { 46 trackAtCharacters = {
46 }, 47 },
47 localItemData = { 48 localItemData = {
48 ["Bag"] = true, 49 ["Bag"] = true,
49 ["Auction House"] = true, 50 ["Auction House"] = true,
323 324
324 325
325 326
326 327
327 328
329 function addon:ColorCode(num, required)
330 local percentage = ( num / required );
331
332 if percentage >= addon.db.profile.defaults.colors.green then
333 return sformat("|cff00ff00%d|r", num);
334 elseif percentage >= addon.db.profile.defaults.colors.yellow then
335 return sformat("|cffffff00%d|r", num);
336 elseif percentage >= addon.db.profile.defaults.colors.orange then
337 return sformat("|cffff9933%d|r", num);
338 elseif percentage >= addon.db.profile.defaults.colors.red then
339 return sformat("|cffff0000%d|r", num);
340 else
341 return num;
342 end
343 end
344
345 function addon:DisplayItemCount(value, minimumStock)
346 if value == -1 then
347 return "|cffffff00Unknown|r";
348 elseif value == -3 then
349 return "|cffffff00Unknown|r";
350 else
351 return sformat("%s / %d", self:ColorCode(value, minimumStock), minimumStock);
352 end
353 end
354
328 -- Readable money 355 -- Readable money
329 356
330 local goldText = "%s%d|cffffd700g|r "; 357 local goldText = "%s%d|cffffd700g|r ";
331 local silverText = "%s%d|cffc7c7cfs|r "; 358 local silverText = "%s%d|cffc7c7cfs|r ";
332 local copperText = "%s%d|cffeda55fc|r"; 359 local copperText = "%s%d|cffeda55fc|r";
334 function addon:ReadableMoney(copper, clean) 361 function addon:ReadableMoney(copper, clean)
335 local text = ""; 362 local text = "";
336 363
337 local gold = floor( copper / COPPER_PER_GOLD ); 364 local gold = floor( copper / COPPER_PER_GOLD );
338 if gold > 0 then 365 if gold > 0 then
339 text = goldText:format(text, gold); 366 text = sformat(goldText, text, gold);
340 end 367 end
341 368
342 if not clean or (not gold or gold < 10) then 369 if not clean or (not gold or gold < 10) then
343 local silver = floor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER ); 370 local silver = floor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER );
344 if silver > 0 then 371 if silver > 0 then
345 text = silverText:format(text, silver); 372 text = sformat(silverText, text, silver);
346 end 373 end
347 374
348 if not clean or (not gold or gold < 1) then 375 if not clean or (not gold or gold < 1) then
349 local copper = floor( copper % COPPER_PER_SILVER ); 376 local copper = floor( copper % COPPER_PER_SILVER );
350 if copper > 0 or text == "" then 377 if copper > 0 or text == "" then
351 text = copperText:format(text, copper); 378 text = sformat(copperText, text, copper);
352 end 379 end
353 end 380 end
354 end 381 end
355 382
356 383
465 end 492 end
466 end 493 end
467 end 494 end
468 495
469 if self.debugChannel then 496 if self.debugChannel then
470 self.debugChannel:AddMessage(t:format(...)); 497 self.debugChannel:AddMessage(sformat(t, ...));
471 end 498 end
472 end 499 end