Thread Tools Display Modes
07/26/18, 05:10 AM   #1
kafeijao
AddOn Author - Click to view addons
Join Date: Apr 2018
Posts: 11
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:
  Reply With Quote
07/26/18, 05:47 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.
  Reply With Quote
07/26/18, 05:54 AM   #3
kafeijao
AddOn Author - Click to view addons
Join Date: Apr 2018
Posts: 11
Originally Posted by Baertram View Post
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!
  Reply With Quote
07/26/18, 09:43 PM   #4
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
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.
  Reply With Quote
07/27/18, 06:42 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.
  Reply With Quote
07/28/18, 09:02 AM   #6
kafeijao
AddOn Author - Click to view addons
Join Date: Apr 2018
Posts: 11
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
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How to identify the being looted coffer

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