Thread Tools Display Modes
06/21/21, 01:41 PM   #1
rp12439_3
AddOn Author - Click to view addons
Join Date: Jun 2021
Posts: 45
Event changes to craftbag

Hi there,

Is there an event which is triggerd when changes to the craftbag happen. I couldnt find one.

I dont want to use

EVENT_MANAGER:RegisterForEvent(Crafty.name, EVENT_INVENTORY_SINGLE_SLOT_UPDATE, Crafty.InvChange)

this will trigger my function all the time... money changes and so on.

So far I use:

EVENT_MANAGER:RegisterForEvent(Crafty.name, EVENT_BUY_RECEIPT, Crafty.InvChange)
EVENT_MANAGER:RegisterForEvent(Crafty.name, EVENT_LOOT_RECEIVED, Crafty.InvChange)
EVENT_MANAGER:RegisterForEvent(Crafty.name, EVENT_MAIL_TAKE_ATTACHED_ITEM_SUCCESS , Crafty.InvChange)
EVENT_MANAGER:RegisterForEvent(Crafty.name, EVENT_CRAFT_COMPLETED, Crafty.InvChange)

But this does not cover stows or transfers from inv to craftbag and vice versa

THX!
  Reply With Quote
06/21/21, 03:48 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,963
No there isn't. Use EVENT_INVENTORY_SINGLE_SLOT_UPDATE and register a filter to the bagId = BAG_VIRTUAL if you only want to check craftbag items.
https://wiki.esoui.com/AddFilterForEvent
Also add other filtes like fr new items only if you just want to tarck "looted" items (taken from mail attachments/player trade = new as well!)

Or use the SHARED_INVENTORY global and it's functions + callbacks (slot changed -> SHARED_INVENTORY:RegisterCallback("SlotUpdated", yourCallbackFunction)).
CraftBag data = SHARED_INVENTORY:GetOrCreateBagCache(BAG_VIRTUAL)

Last edited by Baertram : 06/21/21 at 03:54 PM.
  Reply With Quote
06/21/21, 04:23 PM   #3
rp12439_3
AddOn Author - Click to view addons
Join Date: Jun 2021
Posts: 45
Thanks a lot!

I go with the event filter for the craftbag since i only track craftbag items. I can delete the other events too.
  Reply With Quote
06/21/21, 04:54 PM   #4
rp12439_3
AddOn Author - Click to view addons
Join Date: Jun 2021
Posts: 45
for the search. Thats how Ive done it:

EVENT_MANAGER:RegisterForEvent(Crafty.name, EVENT_INVENTORY_SINGLE_SLOT_UPDATE, Crafty.InvChange)
EVENT_MANAGER:AddFilterForEvent(Crafty.name, EVENT_INVENTORY_SINGLE_SLOT_UPDATE, REGISTER_FILTER_BAG_ID, BAG_VIRTUAL)
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Event changes to craftbag

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off