ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   How to identify the being looted coffer (https://www.esoui.com/forums/showthread.php?t=7954)

kafeijao 07/26/18 05:10 AM

How to identify the being looted coffer
 
Hello,

I'm trying to add a functionality to my addon to count the times a battleground coffer drops a certain item (style page). But I am having trouble making sure I don't count the same coffer as opened twice, my initial idea would be useing the item unique ID. The problem is that the:
Code:

local lbName, lbInteractTargetType, actionName, isOwned = GetLootTargetInfo()
Doesn't give me any information about the coffer being looted besides the name, so if I have multiple coffers in my bag it won't work... I still can't identify which coffer I am looting, so this approach won't work...


Does someone know some function/event that would help me with this?

Thanks in advance!


Some random debugging I did with a Rewards of the worthy coffer:
Code:

[23:31] EVENT_INVENTORY_ITEM_USED - Item Used
[23:31] EVENT_LOOT_UPDATED - Is looting :)! GetLootTargetInfo: Name: Rewards for the Worthy, lbInteractTargetType: 2, isOwned: false
[23:31] LootEntry: name:Marksman's Guards, IsColletible: false
[23:31] EVENT_LOOT_UPDATED - Is NOT looting :(!
[23:31] EVENT_INVENTORY_SINGLE_SLOT_UPDATE - ItemName: Marksman's Guards
[23:31] EVENT_LOOT_CLOSED - Loot Closed
[23:31] EVENT_INVENTORY_SINGLE_SLOT_UPDATE - ItemName:


Baertram 07/26/18 05:47 AM

The only idea that comes in my mind:
Upon opening of a coffer check if the name is a reward from the battleground (and please make it multi language from the beginning!) and set a boolean addon variable like "BG reward coffer loot started".
Then check with EVENT_INVENTORY_SINGLE_SLOT_UPDATE if BG reward coffer loot started == true an the itemType. If it's a style item increase the addon counter.
Upon loot end / coffer close reset the variable "BG reward coffer loot started" to false again.

Without really looting (only opening the coffer) this will only work if you got access to the coffer's bag and slotIndex or uniqueId within your inventory (save it via EVENT_INVENTORY_SINGLE_SLOT_UPDATE as you GET the coffer to your inventory) AND if you are able to determine the bag, slotIndex, uniqueId during coffer opening some way.

kafeijao 07/26/18 05:54 AM

Quote:

Originally Posted by Baertram (Post 35436)
AND if you are able to determine the bag, slotIndex, uniqueId during coffer opening some way.

This is what I wanted, but I really can't find a way :(

Thanks for the really fast answer! :)

Dolgubon 07/26/18 09:43 PM

If you use EVENT_SINGLE_SLOT_UPDATE and any time there'/s a new item, just check if it's a BG box, and note down the unique ID you can get them.

However, I'd argue that you don't need to. If you open a BG box anything new which enters your inventory came from it with a very high certainty. Only way I can see it not being the case is if some addon is messing with stuff while you have it open.


That said maybe the slotId of an open container is something Chip can give us.

Baertram 07/27/18 06:42 AM

The problem is not getting the uniqueid of the box with events but comparing it to the opened box as there is no data about the box opened except the name. And this can be several boxes with the same name in your inventory.

So having more info about an opened box, like the bagId and slotIndex (bagid should be always BAG_BACKPACK though as long as coffers/boxes cannot be put to a bank etc.) to compare them properly and uniquely.

kafeijao 07/28/18 09:02 AM

Exactly I have look a lot for it, but I can't find any way of getting the bagId and slotIndex on the current opened coffer :c


All times are GMT -6. The time now is 08:52 PM.

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