I think this should work (updated when the random LFD is updated):
lua Code:
local f = CreateFrame("Frame")
f:RegisterEvent("LFG_UPDATE_RANDOM_INFO")
f:SetScript("OnEvent", function(f, event)
local dungeonID = LFDQueueFrame.type
if type(dungeonID) == "number" then
for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do
local eligible, forTank, forHealer, forDamage, itemCount, money, xp = GetLFGRoleShortageRewards(dungeonID, i)
if eligible and (itemCount ~= 0 or money ~= 0 or xp ~= 0) then -- show only if eligible and has a reward
if forTank then print("Call to Arms: Tank") end
if forHealer then print("Call to Arms: Healer") end
if forDamage then print("Call to Arms: DPS") end
end
end
end
end)
Like you suggest a OnUpdate with a sleep timer would be better, because I didn't find a event for this. Blizzard simply updates the CtA information when the frame is shown and player toggles between the various dungeon types. The API is what gets the new data from the server, not that bad tough. Keeping it on a 5 sec loop should be plenty.