Posted by animor on Tue, 24 Jan 2012 20:23:06
I'm writing an addon and I'm looking for a way to get the progress of the current instance (raid/dungeon/LFD/LFR) the player is in. What I'm looking for is the number of dead/defeated bosses in the current instance. Please note: 1. This is not the saved instance data, since random dungeons can be done through LFG even if the player is saved to them. 2. This is not the LFR looted bosses, since LFR can be repeated several times, even if the player cannot loot the bosses after the first run.
I've tried several APIs, but non gave the correct result: 1. GetInstanceLockTimeRemaining and GetInstanceLockTimeRemainingEncounter do not work as I expected them to. I think they return valid data only when the player is about to be saved to the instance. If I just run them, I get "0" for the killed bosses.
- As far as I could see, GetLFGDungeonNumEncounters gives the data for the LFR looted bosses, but this is not always the current defeated bosses in the current LFR.
I've also consulted here (second question): http://www.wowinterface.com/forums/showthread.php?t=42391
I will appreciate any help that will redeem me from my frustration! Thanks :)
Posted by istaran on Tue, 21 Feb 2012 19:49:03
Don't know if your question is still relevant for you but as I ran through the same kind of problems, I thought I can post an answer anyway.
For normal and heroic, you should use GetSavedInstanceInfo(i) where i is the ith saved instance. You will get the total number of instance where the player is currently saved with GetNumSavedInstances(). GetSavedInstanceInfo(i) returns the name of the instance as the first value which will allow you to select the instance which is relevant to you and the number of boss defeated as the 12th value. To use it correctly, you need to call first RequestRaidInfo() and register for the event "UPDATEINSTANCEINFO" to listen. Then call GetSavedInstanceInfo(i).
For LFR, the only way I found so far is GetLFGDungeonNumEncounters() or GetLFGDungeonEncounterInfo(). However as you noticed, it does work only once per week, i.e. only if this the first time the player is actually running LFR. I'm starting wondering if there is a way at all to get the number of defeated boss in the current intance of the LFR the player is through the API.