Thread: Dungeon IDs
View Single Post
04-17-16, 12:11 PM   #9
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Here's a small bit of code to show the basics of what you need:
Lua Code:
  1. local function UpdateInstanceInfo()
  2.     for index = 1, GetNumRFDungeons() do
  3.         local dungeonID = GetRFDungeonInfo(index)
  4.         local numEncounters, numCompleted = GetLFGDungeonNumEncounters(dungeonID)
  5.         if numCompleted > 0 then
  6.             local dungeonName = GetLFGDungeonInfo(dungeonID)
  7.             local completedEncounterText = "Encounters completed in " .. dungeonName .. ":\n"
  8.             for encounterID = 1, numEncounters do
  9.                 local encounterName, _, isCompleted = GetLFGDungeonEncounterInfo(dungeonID, encounterID)
  10.                 if isCompleted then
  11.                     completedEncounterText = completedEncounterText .. encounterName .. "\n"
  12.                 end
  13.             end
  14.             print(completedEncounterText)
  15.         end
  16.     end
  17. end
  18.  
  19. local frame = CreateFrame('Frame')
  20. frame:SetScript('OnEvent', function(self, event)
  21.     self:UnregisterEvent(event)
  22.     UpdateInstanceInfo()
  23. end)
  24. frame:RegisterEvent('UPDATE_INSTANCE_INFO')
  25. RequestRaidInfo()
Keep in mind you should not call UpdateInstanceInfo without first calling RequestRaidInfo and waiting for the event UPDATE_INSTANCE_INFO or your results won't reflect any bosses killed since the last request.

And here is semlar's macro shrunk some for those that prefer macros in preparation for 4-digit dungeon IDs:
Lua Code:
  1. /run local d={982,1,982,2,982,3,983,4,983,5,983,6,984,7,984,8,984,11,985,9,985,10,985,12,986,13}for i=1,#d,2 do local n,_,x=GetLFGDungeonEncounterInfo(d[i],d[i+1])print(GetLFGDungeonInfo(d[i])..':',n,(x and''or'not ')..'completed')end
  Reply With Quote