I'm trying to add a feature to an add-on I'm writing that will automatically leave the group after the final loot roles have completed. My idea is to use START_LOOT_ROLL to check if a Frozen Orb is looted. If it is, then use another event (possibly CHAT_MSG_LOOT) to check and see if all group rolls are finished, and if they are, leave the group. What I can't figure out is how to check to see if all group rolls are finished. I feel that there has be an easy way to check this because I know that if you try to kick somebody during loot roles it will tell you that you can't. I wasn't able to find anything in the API that directly checks this.
Edit: Here is what I have so far. It works so I'm happy with that but if there is a better way I am all ears.
function EQ:START_LOOT_ROLL(event, id, time)
local _, name, _, _, _ = GetLootRollItemInfo(id)
MaxID = id
if name == "Frozen Orb" then
local LootInProgress = false
for i = 1, MaxID do
if GetLootRollItemInfo(i) then
LootInProgress = true
if LootInProgress == false then
Maybe listen for the LFG_COMPLETION_REWARD event to signal the start (so that your addon works for more than just Wrath heroics). Then start a counter at zero, and increment it for each of the loot windows that appear (somewhere between 2 and 5, depending on whether greens are present).
Then, scan the loot lines to look for "so-and-so won:" and decrement the counter. When it reaches zero, you're done.
This is all off the top of my head and is probably problematic.
I wouldn't think LFG_COMPLETION_REWARD fires on non-randoms since there is no completion reward but I could be wrong. My above posted code works good. The only problem is that it leaves when everything is picked up only. So if someone wins a roll and the item just sits there, then it doesn't leave. Also, if you zone out early then CHAT_MSG_LOOT doesn't fire so I wrote in to cancel if you change zones.
Edit: Also plan on making it smarter in Oculus. It left on me today before I got my bag from the chest >_<