Thread Tools Display Modes
02-11-17, 03:20 AM   #1
Nieve
A Defias Bandit
Join Date: Feb 2017
Posts: 2
Chest loot detection

Hi,

I'm trying to make a loot assistant addon form my guild, to help our raid master to keep a count of player loots. I'm near to finish it, but i have a problem detecting loot when loot source is not from corpse but from a chest (like krossus). Originaly I try this code for loot detection:

Code:
elseif (event == "LOOT_OPENED") then
		local raidID = UnitInRaid("player")
		local masterID = select(3, GetLootMethod())
		if (raidID and masterID and raidID == masterID) then
			if (UnitLevel("target") == -1) then
				RILoot_ManageOpen("inRaid")
			end
		end
It obviously isn't working for chest, since I am only looking for targeted unit level, and I cant figure out how to detect this situation.

May someone help me a bit with that?

Sorry for my bad english and thanks in advance
  Reply With Quote
02-12-17, 06:06 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
On LOOT_READY you can iterate from 1 to GetNumLootItems() and call GetLootSourceInfo(index) to get the GUID of the unit being looted.

If you're looting a chest, the GUID will start with the word "GameObject", and will contain a unique identifier for that particular object as the 5th numeric field; for example the Felbound Chest from Krosus has an object ID of 248513, which you can see in wowhead's url, so its GUID will look something like "GameObject-0-0-0-0-248513-0".

I'm not sure whether you want to match loot to a specific boss or just want to know whether a "boss" is being looted, or if any high level boss-like loot has been found, because there are a few different ways to go from there.

Last edited by semlar : 02-12-17 at 06:09 AM.
  Reply With Quote
02-12-17, 01:42 PM   #3
Nieve
A Defias Bandit
Join Date: Feb 2017
Posts: 2
Hi, semlar

Yes, the idea is to detect when any high level (raid) boss-like loot has been found, being in raid and in master looter mode.

Since i've posted the original post, i've made a little more investigation and found that BAG_OPEN event refers to lootable objects being opened. So, i have replicated the code under LOOT_OPENED event to see if it can help me:

Code:
elseif (event == "BAG_OPEN") then
		local bagId = (...)
		local raidID = UnitInRaid("player")
		local masterID = select(3, GetLootMethod())
		if (raidID and masterID and raidID == masterID) then
			if (bagId == 248513) then -- Cofre de vínculo vil, Krossus
				RILoot_ManageOpen("inRaid")
			end
		end
I knew about GetLootSourceInfo() but I thought that it was deprecated, I dont know why.

Pittyfully, loot funtions are hard to test since its conditions are hardly repeatable, i have to wait to be in raid, be masterlooter and kill a boss whose loot come from an object. I will try both methods next week, when we kill Krosus again.

Thank you very much!!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Chest loot detection


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