View Single Post
01/08/15, 03:42 AM   #1
dopiate
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 142
Collectible_item_type_trophy ??

I thought I had posted this before but I didn't see it show up?

I am writing an addon that will need to scan the users backpack and get back the name and index of the trophy (and then eventually) it will do the same with costumes.

This is the code - it works - but it just gives me (what looks like) the first 20 items in the backpack.

What am I missing here - I know it's got to be something simple.

Lua Code:
  1. function RandomTrophy.trophies()
  2.  
  3.     local backpackItem
  4.     local backpackSlots = GetBagSize and GetBagSize(bag) or select(2, GetBagInfo(bag))
  5.    
  6.     for i=1, backpackSlots do
  7.         backpackItem = GetItemLink(BAG_BACKPACK, i, LINK_ITEM_TYPE)
  8.         if string.match(backpackItem, COLLECTIBLE_ITEM_TYPE_TROPHY) then
  9.             d(i)
  10.             d(backpackItem)
  11.         end
  12.     end
  13.    
  14. end

Any help greatly appreciated !

Thanks,

-d
  Reply With Quote