Mercurial > wow > inventory
diff 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 |
line wrap: on
line diff
--- a/Modules/Summary.lua Wed Jan 12 14:15:50 2011 +0100 +++ b/Modules/Summary.lua Wed Jan 12 19:58:39 2011 +0100 @@ -7,7 +7,7 @@ local AceGUI, cacheStart; local _G = _G; -- prevent looking up of the global table -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 +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 function mod:OnEnable() -- Register the summary specific widget @@ -352,8 +352,8 @@ -- Do a name-compare for items of the same rarity -- Otherwise epics first, then junk - local aName = a.name or printf(unknownItemName, a.id); - local bName = b.name or printf(unknownItemName, b.id); + local aName = a.name or sformat(unknownItemName, a.id); + local bName = b.name or sformat(unknownItemName, b.id); if sortDirectory == "ASC" then return supper(aName) < supper(bName); @@ -422,14 +422,14 @@ -- Local quantity local lblLocal = AceGUI:Create("Label"); - lblLocal:SetText(self:DisplayItemCount(item.localCount, minLocalStock)); + lblLocal:SetText(addon:DisplayItemCount(item.localCount, minLocalStock)); lblLocal:SetRelativeWidth(.099); iGroup:AddChild(lblLocal); -- Current quantity local lblQuantity = AceGUI:Create("Label"); - lblQuantity:SetText(self:DisplayItemCount(item.globalCount, minGlobalStock)); + lblQuantity:SetText(addon:DisplayItemCount(item.globalCount, minGlobalStock)); lblQuantity:SetRelativeWidth(.099); iGroup:AddChild(lblQuantity); @@ -487,7 +487,7 @@ -- Only if item count was queued, update it item.globalCount = addon:GetItemCount(item.id, groupName); if item.set.globalCount and item.set.globalCount.SetText then - item.set.globalCount:SetText(self:DisplayItemCount(item.globalCount, minGlobalStock)); + item.set.globalCount:SetText(addon:DisplayItemCount(item.globalCount, minGlobalStock)); end end @@ -495,7 +495,7 @@ -- Only if item count was queued, update it item.localCount = addon:GetLocalItemCount(item.id, groupName); if item.set.localCount and item.set.localCount.SetText then - item.set.localCount:SetText(self:DisplayItemCount(item.localCount, minLocalStock)); + item.set.localCount:SetText(addon:DisplayItemCount(item.localCount, minLocalStock)); end end @@ -517,7 +517,7 @@ CACHE_ITEMS_CURRENT = CACHE_ITEMS_CURRENT + 1; if mod.frame then - mod.frame:SetStatusText(printf("Caching auction values and item-counts... %d%% has already been processed.", floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); + mod.frame:SetStatusText(sformat("Caching auction values and item-counts... %d%% has already been processed.", floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); end if i >= addon.db.profile.defaults.summary.speed then @@ -544,22 +544,6 @@ cacheStart = nil; end -function mod:ColorCode(num, required) - local percentage = ( num / required ); - - if percentage >= addon.db.profile.defaults.colors.green then - return printf("|cff00ff00%d|r", num); - elseif percentage >= addon.db.profile.defaults.colors.yellow then - return printf("|cffffff00%d|r", num); - elseif percentage >= addon.db.profile.defaults.colors.orange then - return printf("|cffff9933%d|r", num); - elseif percentage >= addon.db.profile.defaults.colors.red then - return printf("|cffff0000%d|r", num); - else - return num; - end -end - function mod:DisplayMoney(value, priceThreshold) if value == -1 then return "|cff0000ffNone up|r"; @@ -572,22 +556,12 @@ elseif value == -5 then return "|cffff9933Error|r"; elseif priceThreshold and value < priceThreshold then - return printf("|cffaaaaaa%s|r", sgsub(addon:ReadableMoney(value or 0, true), "|([a-fA-F0-9]+)([gsc]+)|r", "%2")); + return sformat("|cffaaaaaa%s|r", sgsub(addon:ReadableMoney(value or 0, true), "|([a-fA-F0-9]+)([gsc]+)|r", "%2")); else return addon:ReadableMoney(value or 0, true); end end -function mod:DisplayItemCount(value, minimumStock) - if value == -1 then - return "|cffffff00Unknown|r"; - elseif value == -3 then - return "|cffffff00Unknown|r"; - else - return printf("%s / %d", self:ColorCode(value, minimumStock), minimumStock); - end -end - function mod:NumberFormat(num) local formatted = sgsub(num, "(%d)(%d%d%d)$", "%1,%2", 1);