LibCooldownTracker-1.0

Library for tracking cooldowns of both enemies and allies. This library was made for the cooldown tracker in GladiusEx and therefore it is mainly intended to be used in arenas.

Example usage:

local CT = LibStub("LibCooldownTracker-1.0")

function addon:OnEnable()
   CT.RegisterCallback(self, "LCT_CooldownUsed")
   CT.RegisterCallback(self, "LCT_CooldownsReset")
   CT:RegisterUnit("player")
end

function addon:OnDisable()
   CT:UnregisterUnit("player")
   CT.UnregisterAllCallbacks(self)
end

function addon:LCT_CooldownsReset(event, unit)
   print("Cooldowns reset for unit " .. unit)
end

function addon:LCT_CooldownUsed(event, unitid, spellid)
   print(unitid .. " used " .. GetSpellInfo(spellid))
   local tracked = CT:GetUnitCooldownInfo(unitid, spellid)
   if tracked then
      print("cooldown starts:", tracked.cooldown_start) -- times are based on GetTime()
      print("cooldown ends:", tracked.cooldown_end)
      print("effect starts:", tracked.used_start)
      print("effect ends:", tracked.used_end)
      print(tracked.detected) -- use this to check if the unit has used this spell before (useful for detecting talents/glyphs)
   end   
end

Check the cooldowns module of GladiusEx if you want to see a real world usage example.

See the API page for more details.

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Apr 24, 2013
Last updated
May 01, 2013

Author