ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Event changes to craftbag (https://www.esoui.com/forums/showthread.php?t=9808)

rp12439_3 06/21/21 01:41 PM

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!

Baertram 06/21/21 03:48 PM

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)

rp12439_3 06/21/21 04:23 PM

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.

rp12439_3 06/21/21 04:54 PM

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)


All times are GMT -6. The time now is 07:16 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI