Mercurial > wow > inventory
comparison 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 |
comparison
equal
deleted
inserted
replaced
72:7ca83ad9d67a | 73:6216b754350d |
---|---|
23 end, { "s", "sum", "summary" }, "|Hfunction:InventoriumCommandHandler:summary|h|cff00fff7/im summary|r|h (or /im s) - Show the summary window containing an overview of all items within the groups tracked at this current character."); | 23 end, { "s", "sum", "summary" }, "|Hfunction:InventoriumCommandHandler:summary|h|cff00fff7/im summary|r|h (or /im s) - Show the summary window containing an overview of all items within the groups tracked at this current character."); |
24 | 24 |
25 -- /im reset | 25 -- /im reset |
26 addon:RegisterSlash(function() | 26 addon:RegisterSlash(function() |
27 if mod.frame then | 27 if mod.frame then |
28 mod.frame:SetWidth(650); | 28 mod.frame:SetWidth(700); |
29 mod.frame:SetHeight(600); | 29 mod.frame:SetHeight(600); |
30 | 30 |
31 print("Resetting width and height of the summary frame."); | 31 print("Resetting width and height of the summary frame."); |
32 end | 32 end |
33 end, { "r", "reset" }, "|Hfunction:InventoriumCommandHandler:reset|h|cff00fff7/im reset|r|h (or /im r) - Reset the size of the summary frame."); | 33 end, { "r", "reset" }, "|Hfunction:InventoriumCommandHandler:reset|h|cff00fff7/im reset|r|h (or /im r) - Reset the size of the summary frame."); |
326 for itemId, _ in pairs(values.items) do | 326 for itemId, _ in pairs(values.items) do |
327 local itemName, itemLink, itemRarity = GetItemInfo(itemId); | 327 local itemName, itemLink, itemRarity = GetItemInfo(itemId); |
328 | 328 |
329 tinsert(itemsCache[groupName], { | 329 tinsert(itemsCache[groupName], { |
330 id = itemId, | 330 id = itemId, |
331 name = itemName or printf(unknownItemName, itemId), | 331 name = itemName, -- may be nil |
332 link = itemLink, | 332 link = itemLink, -- may be nil |
333 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), | 333 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), |
334 rarity = itemRarity or 1, | 334 rarity = itemRarity, -- may be nil |
335 count = -3,--addon:GetItemCount(itemId, groupName), | 335 count = -3,--addon:GetItemCount(itemId, groupName), |
336 localCount = -3, | 336 localCount = -3, |
337 set = {}, | 337 set = {}, |
338 }); | 338 }); |
339 CACHE_ITEMS_TOTAL = CACHE_ITEMS_TOTAL + 1; | 339 CACHE_ITEMS_TOTAL = CACHE_ITEMS_TOTAL + 1; |
344 | 344 |
345 | 345 |
346 | 346 |
347 -- Sort items | 347 -- Sort items |
348 table.sort(itemsCache[groupName], function(a, b) | 348 table.sort(itemsCache[groupName], function(a, b) |
349 if sortMethod == "item" and a.rarity == b.rarity then | 349 local aRarity = a.rarity or 1; |
350 local bRarity = b.rarity or 1; | |
351 | |
352 if sortMethod == "item" and aRarity == bRarity then | |
350 -- Do a name-compare for items of the same rarity | 353 -- Do a name-compare for items of the same rarity |
351 -- Otherwise epics first, then junk | 354 -- Otherwise epics first, then junk |
355 | |
356 local aName = a.name or printf(unknownItemName, a.id); | |
357 local bName = b.name or printf(unknownItemName, b.id); | |
358 | |
352 if sortDirectory == "ASC" then | 359 if sortDirectory == "ASC" then |
353 return supper(a.name) < supper(b.name); | 360 return supper(aName) < supper(bName); |
354 else | 361 else |
355 return supper(a.name) > supper(b.name); | 362 return supper(aName) > supper(bName); |
356 end | 363 end |
357 elseif sortMethod == "item" then | 364 elseif sortMethod == "item" then |
358 if sortDirectory == "ASC" then | 365 if sortDirectory == "ASC" then |
359 return a.rarity > b.rarity; -- the comparers were reversed because we want epics first | 366 return aRarity > bRarity; -- the comparers were reversed because we want epics first |
360 else | 367 else |
361 return a.rarity < b.rarity; -- the comparers were reversed because we want epics first | 368 return aRarity < bRarity; -- the comparers were reversed because we want epics first |
362 end | 369 end |
363 elseif sortMethod == "current" then | 370 elseif sortMethod == "current" then |
364 if sortDirectory == "ASC" then | 371 if sortDirectory == "ASC" then |
365 return a.count < b.count; | 372 return a.count < b.count; |
366 else | 373 else |
408 | 415 |
409 QueryAuctionItems(itemName, nil, nil, 0, 0, 0, 0, 0, 0); | 416 QueryAuctionItems(itemName, nil, nil, 0, 0, 0, 0, 0, 0); |
410 end | 417 end |
411 end); | 418 end); |
412 btnItemLink:SetRelativeWidth(.7); | 419 btnItemLink:SetRelativeWidth(.7); |
413 btnItemLink:SetItemId(item.id); | 420 btnItemLink:SetItem(item); |
414 | 421 |
415 iGroup:AddChild(btnItemLink); | 422 iGroup:AddChild(btnItemLink); |
416 | 423 |
417 -- Local quantity | 424 -- Local quantity |
418 local lblLocal = AceGUI:Create("Label"); | 425 local lblLocal = AceGUI:Create("Label"); |