Mercurial > wow > inventory
comparison Modules/Summary.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 | 252292b703ce |
children | 6724bc8eface |
comparison
equal
deleted
inserted
replaced
105:4efbaf069ddb | 106:d3fbb5676a5e |
---|---|
5 | 5 |
6 local CACHE_ITEMS_TOTAL, CACHE_ITEMS_CURRENT, itemsCache = 0, 0, {}; | 6 local CACHE_ITEMS_TOTAL, CACHE_ITEMS_CURRENT, itemsCache = 0, 0, {}; |
7 local AceGUI, cacheStart; | 7 local AceGUI, cacheStart; |
8 | 8 |
9 local _G = _G; -- prevent looking up of the global table | 9 local _G = _G; -- prevent looking up of the global table |
10 local printf, sgsub, supper, tinsert, pairs, ceil, GetItemInfo = _G.string.format, _G.string.gsub, _G.string.upper, _G.table.insert, _G.pairs, _G.ceil, _G.GetItemInfo; -- prevent looking up of the most used globals all the time | 10 local sformat, sgsub, supper, tinsert, pairs, ceil, GetItemInfo = _G.string.format, _G.string.gsub, _G.string.upper, _G.table.insert, _G.pairs, _G.ceil, _G.GetItemInfo; -- prevent looking up of the most used globals all the time |
11 | 11 |
12 function mod:OnEnable() | 12 function mod:OnEnable() |
13 -- Register the summary specific widget | 13 -- Register the summary specific widget |
14 addon:GetModule("Widgets"):InlineGroupWithButton(); | 14 addon:GetModule("Widgets"):InlineGroupWithButton(); |
15 | 15 |
350 | 350 |
351 if sortMethod == "item" and aRarity == bRarity then | 351 if sortMethod == "item" and aRarity == bRarity then |
352 -- Do a name-compare for items of the same rarity | 352 -- Do a name-compare for items of the same rarity |
353 -- Otherwise epics first, then junk | 353 -- Otherwise epics first, then junk |
354 | 354 |
355 local aName = a.name or printf(unknownItemName, a.id); | 355 local aName = a.name or sformat(unknownItemName, a.id); |
356 local bName = b.name or printf(unknownItemName, b.id); | 356 local bName = b.name or sformat(unknownItemName, b.id); |
357 | 357 |
358 if sortDirectory == "ASC" then | 358 if sortDirectory == "ASC" then |
359 return supper(aName) < supper(bName); | 359 return supper(aName) < supper(bName); |
360 else | 360 else |
361 return supper(aName) > supper(bName); | 361 return supper(aName) > supper(bName); |
420 | 420 |
421 iGroup:AddChild(btnItemLink); | 421 iGroup:AddChild(btnItemLink); |
422 | 422 |
423 -- Local quantity | 423 -- Local quantity |
424 local lblLocal = AceGUI:Create("Label"); | 424 local lblLocal = AceGUI:Create("Label"); |
425 lblLocal:SetText(self:DisplayItemCount(item.localCount, minLocalStock)); | 425 lblLocal:SetText(addon:DisplayItemCount(item.localCount, minLocalStock)); |
426 lblLocal:SetRelativeWidth(.099); | 426 lblLocal:SetRelativeWidth(.099); |
427 | 427 |
428 iGroup:AddChild(lblLocal); | 428 iGroup:AddChild(lblLocal); |
429 | 429 |
430 -- Current quantity | 430 -- Current quantity |
431 local lblQuantity = AceGUI:Create("Label"); | 431 local lblQuantity = AceGUI:Create("Label"); |
432 lblQuantity:SetText(self:DisplayItemCount(item.globalCount, minGlobalStock)); | 432 lblQuantity:SetText(addon:DisplayItemCount(item.globalCount, minGlobalStock)); |
433 lblQuantity:SetRelativeWidth(.099); | 433 lblQuantity:SetRelativeWidth(.099); |
434 | 434 |
435 iGroup:AddChild(lblQuantity); | 435 iGroup:AddChild(lblQuantity); |
436 | 436 |
437 -- Value | 437 -- Value |
485 if item.globalCount == -3 or item.localCount == -3 or item.value == -3 then | 485 if item.globalCount == -3 or item.localCount == -3 or item.value == -3 then |
486 if item.globalCount == -3 then | 486 if item.globalCount == -3 then |
487 -- Only if item count was queued, update it | 487 -- Only if item count was queued, update it |
488 item.globalCount = addon:GetItemCount(item.id, groupName); | 488 item.globalCount = addon:GetItemCount(item.id, groupName); |
489 if item.set.globalCount and item.set.globalCount.SetText then | 489 if item.set.globalCount and item.set.globalCount.SetText then |
490 item.set.globalCount:SetText(self:DisplayItemCount(item.globalCount, minGlobalStock)); | 490 item.set.globalCount:SetText(addon:DisplayItemCount(item.globalCount, minGlobalStock)); |
491 end | 491 end |
492 end | 492 end |
493 | 493 |
494 if item.localCount == -3 then | 494 if item.localCount == -3 then |
495 -- Only if item count was queued, update it | 495 -- Only if item count was queued, update it |
496 item.localCount = addon:GetLocalItemCount(item.id, groupName); | 496 item.localCount = addon:GetLocalItemCount(item.id, groupName); |
497 if item.set.localCount and item.set.localCount.SetText then | 497 if item.set.localCount and item.set.localCount.SetText then |
498 item.set.localCount:SetText(self:DisplayItemCount(item.localCount, minLocalStock)); | 498 item.set.localCount:SetText(addon:DisplayItemCount(item.localCount, minLocalStock)); |
499 end | 499 end |
500 end | 500 end |
501 | 501 |
502 if item.value == -3 then | 502 if item.value == -3 then |
503 -- Only if item value was queued, update it | 503 -- Only if item value was queued, update it |
515 | 515 |
516 i = i + 1; | 516 i = i + 1; |
517 CACHE_ITEMS_CURRENT = CACHE_ITEMS_CURRENT + 1; | 517 CACHE_ITEMS_CURRENT = CACHE_ITEMS_CURRENT + 1; |
518 | 518 |
519 if mod.frame then | 519 if mod.frame then |
520 mod.frame:SetStatusText(printf("Caching auction values and item-counts... %d%% has already been processed.", floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); | 520 mod.frame:SetStatusText(sformat("Caching auction values and item-counts... %d%% has already been processed.", floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); |
521 end | 521 end |
522 | 522 |
523 if i >= addon.db.profile.defaults.summary.speed then | 523 if i >= addon.db.profile.defaults.summary.speed then |
524 return; | 524 return; |
525 end | 525 end |
540 -- Announce | 540 -- Announce |
541 mod.frame:SetStatusText("All required prices and itemcounts have been cached. This process took " .. ceil(GetTime() - cacheStart) .. " seconds."); | 541 mod.frame:SetStatusText("All required prices and itemcounts have been cached. This process took " .. ceil(GetTime() - cacheStart) .. " seconds."); |
542 | 542 |
543 -- Forget time | 543 -- Forget time |
544 cacheStart = nil; | 544 cacheStart = nil; |
545 end | |
546 | |
547 function mod:ColorCode(num, required) | |
548 local percentage = ( num / required ); | |
549 | |
550 if percentage >= addon.db.profile.defaults.colors.green then | |
551 return printf("|cff00ff00%d|r", num); | |
552 elseif percentage >= addon.db.profile.defaults.colors.yellow then | |
553 return printf("|cffffff00%d|r", num); | |
554 elseif percentage >= addon.db.profile.defaults.colors.orange then | |
555 return printf("|cffff9933%d|r", num); | |
556 elseif percentage >= addon.db.profile.defaults.colors.red then | |
557 return printf("|cffff0000%d|r", num); | |
558 else | |
559 return num; | |
560 end | |
561 end | 545 end |
562 | 546 |
563 function mod:DisplayMoney(value, priceThreshold) | 547 function mod:DisplayMoney(value, priceThreshold) |
564 if value == -1 then | 548 if value == -1 then |
565 return "|cff0000ffNone up|r"; | 549 return "|cff0000ffNone up|r"; |
570 elseif value == -4 then | 554 elseif value == -4 then |
571 return "|cff00ff00-|r"; | 555 return "|cff00ff00-|r"; |
572 elseif value == -5 then | 556 elseif value == -5 then |
573 return "|cffff9933Error|r"; | 557 return "|cffff9933Error|r"; |
574 elseif priceThreshold and value < priceThreshold then | 558 elseif priceThreshold and value < priceThreshold then |
575 return printf("|cffaaaaaa%s|r", sgsub(addon:ReadableMoney(value or 0, true), "|([a-fA-F0-9]+)([gsc]+)|r", "%2")); | 559 return sformat("|cffaaaaaa%s|r", sgsub(addon:ReadableMoney(value or 0, true), "|([a-fA-F0-9]+)([gsc]+)|r", "%2")); |
576 else | 560 else |
577 return addon:ReadableMoney(value or 0, true); | 561 return addon:ReadableMoney(value or 0, true); |
578 end | |
579 end | |
580 | |
581 function mod:DisplayItemCount(value, minimumStock) | |
582 if value == -1 then | |
583 return "|cffffff00Unknown|r"; | |
584 elseif value == -3 then | |
585 return "|cffffff00Unknown|r"; | |
586 else | |
587 return printf("%s / %d", self:ColorCode(value, minimumStock), minimumStock); | |
588 end | 562 end |
589 end | 563 end |
590 | 564 |
591 function mod:NumberFormat(num) | 565 function mod:NumberFormat(num) |
592 local formatted = sgsub(num, "(%d)(%d%d%d)$", "%1,%2", 1); | 566 local formatted = sgsub(num, "(%d)(%d%d%d)$", "%1,%2", 1); |