Making your passive talents work with Passive Cooldown Tracker
==============================================================

So, your addon adds passive talents that have a trigger cooldown, and you'd
like them to be shown with a cooldown tracker in the buffs section.  Well,
first off, thanks for helping to make this addon more useful. ;)

The good news is that you may not have to do anything at all.  If your
passive talent uses the standard cooldown mechanism, namely
ActorTalents:startTalentCooldown(), this addon will detect your talent
automatically and show a tracker for it, using the information from
ActorTalents:isTalentCoolingDown() and ActorTalents:getTalentCooldown()
to get your talent's current and maximum cooldown values for display
purposes.

If your talent manages its own internal cooldown counter, all you need to
do to let this addon know about your talent is include a .passive_cooldown()
method in the talent definition, as defined below:

.passive_cooldown(who, t)
-------------------------
  Called from Minimalist:drawPassiveCooldownTrackers() while drawing
  passive cooldown trackers in the buffs display.  Arguments are:
    who:	The Actor for whom the tracker is being drawn.
    t:		Talent definition table for the relevant talent.

  The method should return two values:
    - Current cooldown value, or nil/false if the talent is not cooling
      down.
    - Maximum cooldown value, or nil/false if the talent is not cooling
      down.

Note that sustained and activated talents can also use the .passive_cooldown()
method if they have a suitable passive trigger cooldown; see, for instance,
this addon's handling of Phantasmal Shield and Call of the Mausoleum.

Multiple cooldowns
------------------
Some passive talents, like Endless Woes and Elemental Surge, have multiple
trigger cooldowns.  Handling that is trickier, but doable.  For this case,
.passive_cooldown{} is a table; the keys are talent-specific
representations of the talent's various cooldowns, and the values are the
maximum cooldown for each.  For Elemental Surge and Endless Woes, for
instance, the keys are turn proc identifiers [cf. Actor:hasProc() and
Actor:setProc()], while for Elemental Discord, the keys are damage types.

The .passive_cooldown{} table has one additional special field, '__'.
.passive_cooldown.__{} is a table, containing two functions:

  .passive_cooldown.__.cd(who, t, key)
  ------------------------------------
    Returns the current cooldown value for the specified cooldown key, or
    nil if the corresponding cooldown is not active.

  .passive_cooldown.__.fmt(cd, key)
  ---------------------------------
    Returns a formatted string representation of the provided cooldown for
    display.  For the game's built-in prodigies, for instance, we colorize
    the cooldown based on the corresponding damage type.  Optional; if not
    present, we just convert the cooldown value to text.


$Id: hooks.txt 4990 2024-08-23 22:13:59Z dsb $
