Cooldown tracker

This one prints when CD of used spells end.

Snippet

local total,desired = 0
local spell,cooldown
local f = CreateFrame("Frame")

local function onUpdate(self,elapsed)
   total = total + elapsed
   if total >= desired then
      print(spell.." Cooldown done!")
      f:SetScript("OnUpdate",nil)
   end
end

f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(self,event,...)
      local player = UnitGUID("player")
      local _,minievent,guidsource = ...
      if guidsource == player then
         spell = select(10,...)
         cooldown = select(2,GetSpellCooldown(spell))
         if cooldown ~= nil and cooldown > 0 then
            total = 0
            desired = cooldown
            f:SetScript("OnUpdate", onUpdate)   
         end
      end
end)
Posted by Mikma at Sun, 03 May 2009 15:50:03 +0000