LibCooldownTracker-1.0

Main

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:

localCT=LibStub("LibCooldownTracker-1.0")functionaddon:OnEnable()CT.RegisterCallback(self,"LCT_CooldownUsed")CT.RegisterCallback(self,"LCT_CooldownsReset")CT:RegisterUnit("player")endfunctionaddon:OnDisable()CT:UnregisterUnit("player")CT.UnregisterAllCallbacks(self)endfunctionaddon:LCT_CooldownsReset(event,unit)print("Cooldowns reset for unit "..unit)endfunctionaddon:LCT_CooldownUsed(event,unitid,spellid)print(unitid.." used "..GetSpellInfo(spellid))localtracked=CT:GetUnitCooldownInfo(unitid,spellid)iftrackedthenprint("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)endend

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