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)
   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.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    56368
  • Created
    Apr 24, 2013
  • Last Released File
    Jan 6, 2022
  • Total Downloads
    7,090
  • License

Categories

Members

Recent Files