Mercurial > wow > inventory
diff Summary.lua @ 73:6216b754350d
Default size for the summary window increase to 700 pixels (from 650).
Cached item name and rarity no longer have a default and will be nil if the value is unknown.
Cached item name, rarity and link can now be updated when the itemlink element is build.
Item element now gets the item table passed rather than just the item id. If the item link is already known, this prevent an additional GetItemInfo call.
author | Zerotorescue |
---|---|
date | Fri, 24 Dec 2010 16:10:20 +0100 |
parents | 7ca83ad9d67a |
children | 8d11fc88ecab |
line wrap: on
line diff
--- a/Summary.lua Thu Dec 23 18:33:05 2010 +0100 +++ b/Summary.lua Fri Dec 24 16:10:20 2010 +0100 @@ -25,7 +25,7 @@ -- /im reset addon:RegisterSlash(function() if mod.frame then - mod.frame:SetWidth(650); + mod.frame:SetWidth(700); mod.frame:SetHeight(600); print("Resetting width and height of the summary frame."); @@ -328,10 +328,10 @@ tinsert(itemsCache[groupName], { id = itemId, - name = itemName or printf(unknownItemName, itemId), - link = itemLink, + name = itemName, -- may be nil + link = itemLink, -- may be nil value = ((priceThreshold == 0 and not alwaysGetAuctionValue) and -4) or -3,-- if (no price threshold is set for this item and you don't want to always get auction value), then don't look it up either --addon:GetAuctionValue(itemLink), - rarity = itemRarity or 1, + rarity = itemRarity, -- may be nil count = -3,--addon:GetItemCount(itemId, groupName), localCount = -3, set = {}, @@ -346,19 +346,26 @@ -- Sort items table.sort(itemsCache[groupName], function(a, b) - if sortMethod == "item" and a.rarity == b.rarity then + local aRarity = a.rarity or 1; + local bRarity = b.rarity or 1; + + if sortMethod == "item" and aRarity == bRarity then -- 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); + if sortDirectory == "ASC" then - return supper(a.name) < supper(b.name); + return supper(aName) < supper(bName); else - return supper(a.name) > supper(b.name); + return supper(aName) > supper(bName); end elseif sortMethod == "item" then if sortDirectory == "ASC" then - return a.rarity > b.rarity; -- the comparers were reversed because we want epics first + return aRarity > bRarity; -- the comparers were reversed because we want epics first else - return a.rarity < b.rarity; -- the comparers were reversed because we want epics first + return aRarity < bRarity; -- the comparers were reversed because we want epics first end elseif sortMethod == "current" then if sortDirectory == "ASC" then @@ -410,7 +417,7 @@ end end); btnItemLink:SetRelativeWidth(.7); - btnItemLink:SetItemId(item.id); + btnItemLink:SetItem(item); iGroup:AddChild(btnItemLink);