Table of Contents

Interface ICooldownController

Namespace
FishMMO.Shared.Core
Assembly
FishMMO.Shared.dll

Interface for a cooldown controller using immutable CooldownInstance based on StartTick + DurationTicks. No per-tick mutation is needed — cooldowns are evaluated via (currentTick - StartTick) < DurationTicks.

public interface ICooldownController : ICharacterBehaviour
Inherited Members

Fields

OnAddCooldown

Event invoked when a cooldown is added.

public static Action<long, CooldownInstance> OnAddCooldown

Field Value

Action<long, CooldownInstance>

OnRemoveCooldown

Event invoked when a cooldown is removed (expired or explicitly cleared).

public static Action<long> OnRemoveCooldown

Field Value

Action<long>

OnUpdateCooldown

Event invoked when a cooldown is updated (e.g., remaining time changes due to reconcile).

public static Action<long, CooldownInstance> OnUpdateCooldown

Field Value

Action<long, CooldownInstance>

Methods

AddCooldown(long, CooldownInstance)

Adds a cooldown for the specified ability.

void AddCooldown(long id, CooldownInstance cooldown)

Parameters

id long

Ability ID.

cooldown CooldownInstance

Cooldown instance.

Clear()

Clears all cooldowns.

void Clear()

CreateReconcileSnapshot()

Creates a reconcile snapshot of all active cooldowns. Returns null when no cooldowns are active.

CooldownReconcileEntry[] CreateReconcileSnapshot()

Returns

CooldownReconcileEntry[]

ExpireElapsed(uint)

Removes all cooldowns that have expired as of currentTick. Called from the Replicate loop. Safe during replay because the same tick value produces the same expiration decisions deterministically.

void ExpireElapsed(uint currentTick)

Parameters

currentTick uint

The current network tick.

IsOnCooldown(long, uint)

Checks if an ability is on cooldown at the given tick.

bool IsOnCooldown(long id, uint currentTick)

Parameters

id long

Ability ID.

currentTick uint

The current network tick.

Returns

bool

True if on cooldown, otherwise false.

Read(Reader, uint)

Reads cooldown data from a network reader.

void Read(Reader reader, uint currentTick)

Parameters

reader Reader

The network reader.

currentTick uint

Current tick for computing UI-facing remaining time.

RemoveCooldown(long)

Removes the cooldown for the specified ability.

void RemoveCooldown(long id)

Parameters

id long

Ability ID.

ResolveAuthoritativeTick(uint)

Maps a raw authoritative tick to the controller's current replicate-tick domain when a replicate tick is available.

uint ResolveAuthoritativeTick(uint serverTick)

Parameters

serverTick uint

Fallback authoritative tick used before any replicate tick exists.

Returns

uint

The effective tick to use for cooldown comparisons.

RestoreFromReconcile(CooldownReconcileEntry[])

Restores cooldown state from a reconcile snapshot.

void RestoreFromReconcile(CooldownReconcileEntry[] entries)

Parameters

entries CooldownReconcileEntry[]

TryGetCooldown(long, uint, out float)

Tries to get the remaining cooldown time in seconds for an ability.

bool TryGetCooldown(long id, uint currentTick, out float cooldown)

Parameters

id long

Ability ID.

currentTick uint

The current network tick.

cooldown float

Remaining cooldown time in seconds.

Returns

bool

True if found and still on cooldown, otherwise false.

TryGetCooldownInstance(long, out CooldownInstance)

Tries to get the full CooldownInstance for an ability or consumable, whether or not it is still running.

bool TryGetCooldownInstance(long id, out CooldownInstance instance)

Parameters

id long

Ability or consumable template ID.

instance CooldownInstance

The cooldown instance.

Returns

bool

True if a cooldown is tracked for the id.

Remarks

TryGetCooldown(long, uint, out float) reports only the REMAINING seconds, which is not enough to draw a sweep — a sweep needs the fraction, and a fraction needs the total the cooldown started from. The UI previously took its total from the instance handed to OnAddCooldown and then never updated, which is what made the hotkey bar's sweep binary rather than animated.

Write(Writer)

Writes cooldown data to a network writer.

void Write(Writer writer)

Parameters

writer Writer

The network writer.

Write(Writer, bool)

Writes cooldown data, or an empty framed block when includeEntries is false (non-owner connections have no use for a peer's cooldowns).

void Write(Writer writer, bool includeEntries)

Parameters

writer Writer
includeEntries bool