View Single Post
01/08/15, 07:53 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
  • Lua Code:
    1. local backpackSlots = GetBagSize and GetBagSize(bag) or select(2, GetBagInfo(bag))
    Is no longer needed. It was compatibility function to make addon work with both API 100007 and 100008 (because of PTS). Just use:
    Lua Code:
    1. local backpackSlots = GetBagSize(bag)
  • Lua Code:
    1. for i=1, backpackSlots do
    Inventory slots are the only index value in ESO which starts with zero. So the correct code is:
    Lua Code:
    1. for i = 0, backpackSlots - 1 do
  • Lua Code:
    1. backpackItem = GetItemLink(BAG_BACKPACK, i, LINK_ITEM_TYPE)
    I have no idea how you have defined LINK_ITEM_TYPE, but you should use LINK_STYLE_DEFAULT or LINK_STYLE_BRACKETS.
    Lua Code:
    1. backpackItem = GetItemLink(BAG_BACKPACK, i, LINK_STYLE_BRACKETS)
  • Lua Code:
    1. if string.match(backpackItem, COLLECTIBLE_ITEM_TYPE_TROPHY) then
    Global constant COLLECTIBLE_ITEM_TYPE_TROPHY is not what you are looking for. Value of COLLECTIBLE_ITEM_TYPE_TROPHY is number 2, so your function returns all itemlinks which contains number 2.
    You should use item type instead, something like:
    Lua Code:
    1. if GetItemLinkItemType(backpackItem) == ITEMTYPE_TROPHY then --if you want collectibles, use ITEMTYPE_COLLECTIBLE

Anyway, try this code:
Lua Code:
  1. local bagCache = SHARED_INVENTORY:GenerateFullSlotData(nil, BAG_BACKPACK)
  2. for slotIndex, slotData in pairs(bagCache) do
  3.     if slotData.itemType == ITEMTYPE_TROPHY then
  4.        d(zo_strformat("<<1>> (<<2>>)", slotData.name, slotIndex))
  5.     end
  6. end

Last edited by Garkin : 01/08/15 at 08:30 AM.
  Reply With Quote