View Single Post
04-25-17, 06:54 AM   #8
loff93
A Fallenroot Satyr
Join Date: Apr 2017
Posts: 25
Originally Posted by jeruku View Post
Quick and dirty example.

Lua Code:
  1. local frame = CreateFrame('Frame')
  2. local tab = {}
  3. local wait = {}
  4.  
  5. frame:SetScript('OnEvent', function(self, event, ...)
  6.    if event == 'BAG_UPDATE_DELAYED' then
  7.       -- do checks and stuff and get the desired itemID
  8.       local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemID)
  9.       if not name then
  10.         wait[itemID] = {}
  11.      else
  12.         -- this may just create a library so you may have to put them in individually with something like tinsert(tab[itemID], name)...
  13.         tab[itemID] = {name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice}
  14.      end
  15.    elseif event == 'GET_ITEM_INFO_RECIEVED' then
  16.       -- the info is now downloaded and cached
  17.       local itemID = ...
  18.       if wait[itemID] then
  19.          tab[itemID] = {GetItemInfo(itemID)}
  20.          wait[itemID] = nil
  21.       end
  22.    end
  23. end
  24.  
  25. frame:RegisterEvent('BAG_UPDATE_DELAYED')
  26. frame:RegisterEvent('GET_ITEM_INFO_RECIEVED')
Cool, thanks for taking your time to help out.
Will test it when I get the chance
  Reply With Quote