You'd probably have to accord for somehow not getting data (inspect throttle), but the basic function looks like this:
Code:
local isScanning = false -- don't scan multiple times before the first one has finished. it breaks stuff, as we have to wait for the server to give us data every time.
local nextMember
local eventFrame = CreateFrame("Frame")
local function scanNext()
if not nextMember then return end
nextMember = nextMember+1
if nextMember > GetNumPartyMembers() then print("Scan finished!") nextMember = nil isScanning = false end
eventFrame:RegisterEvent("INSPECT_READY")
NotifyInspect("party"..nextMember)
end
local nums = {}
eventFrame:SetScript("OnEvent",function(s)
local treeName,primaryIcon
table.wipe(nums)
local primaryNum = GetPrimaryTalentTree(true)
for tabNum=1, GetNumTalentTabs(true) do
local _, name, _, icon, numPoints = GetTalentTabInfo(tabNum,true)
if tabNum == primaryNum then
treeName = name
primaryIcon = icon
end
nums[tabNum] = numPoints
end
print((UnitName("party"..nextMember))..": |T"..(primaryIcon or "interface\\icons\\spell_shadow_sacrificialshield")..":20|t "..(treeName or "None").." ("..table.concat(nums,"/")..")")
s:UnregisterEvent("INSPECT_READY")
scanNext()
end)
SlashCmdList["SCANTALENTS"]=function()
if isScanning then print("Already scanning! Wait for it to finish first!") return end
nextMember = 0
isScanning = true
scanNext()
end
SLASH_SCANTALENTS1 = "/scantalents"
Untested.