View Single Post
08/08/19, 06:43 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
The loot event got no bagId or slotIndex afaik. It will be determined and shown in the small popup if you got autoloot all off. Else it will be looted.
And at the end the inventory will find the slot to update a given stack or to create a new slot and calls event_inventory_single_slot_update.

If you want to do checks as the event single slot update fires you could check the event_loot which provides an itemLink afaik. Store this itemLink in your addon's "toCheckInEventInvSIngleSlotUpdateTable[ItemlInk] = true. This might get you several items into the table which got looted before event_inv_single_slot_update gets raised.

Then in the events callback function check if the parameters like isNew ==true, inventory_update_reason is correct etc..
Create an itemLink from the bagId and slotIndex of the event. Check your table with the itemlinks if your created itemLink is in there and you got your needed bagid and slotIndex this way now.

Maybe there is an easier way as well if there is always a 1:1 connection between event_loot and event_single_slot_update. You could also simply use zo_callLater to wait for the inventoryData to be created properly (same as Votan said with RegisterForUpdate).
  Reply With Quote