View Single Post
04/08/15, 03:19 PM   #7
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by @AlphaLemming View Post
Garkin, is there a way to get the itemlink from the oldSlot-variable?
Table oldSlotData doesn't contain itemlink and if item doesn't exist, you can't get its itemlink.

However, if you need an itemlink, lets use workaround. I did something like that in my changes to Lost Treasure addon. Register for callback "SlotAdded" and then add itemlink to the slot table (in LT I'm adding itemId).

Lua Code:
  1. local function OnSlotAdded(bagId, slotIndex, slotData)
  2.     slotData.itemLink = GetItemLink(bagId, slotIndex)
  3. end
  4.  
  5. local function OnSlotRemoved(bagId, slotIndex, oldSlotData)
  6.     d(zo_strformat("Item <<t:1>> was removed from the inventory.", oldSlotData.itemLink)
  7. end
  8.  
  9. SHARED_INVENTORY:RegisterCallback("SlotAdded", OnSlotAdded)
  10. SHARED_INVENTORY:RegisterCallback("SlotRemoved", OnSlotRemoved)
  Reply With Quote