Table of Contents

Class ActiveAbility

Namespace
Exiled.CustomRoles.API.Features
Assembly
Exiled.CustomRoles.dll

The base class for active (on-use) abilities.

public abstract class ActiveAbility : CustomAbility
Inheritance
ActiveAbility
Inherited Members
Extension Methods

Properties

ActivePlayers

Gets all players actively using this ability.

[YamlIgnore]
public HashSet<Player> ActivePlayers { get; }

Property Value

HashSet<Player>

AllActiveAbilities

Gets a Dictionary<TKey, TValue> containing all players with active abilities, and the abilities they have access to.

public static Dictionary<Player, HashSet<ActiveAbility>> AllActiveAbilities { get; }

Property Value

Dictionary<Player, HashSet<ActiveAbility>>

CanUseOverride

Gets or sets an action to override the behavior of CanUseAbility(Player, out string, bool).

[YamlIgnore]
public virtual Func<bool>? CanUseOverride { get; set; }

Property Value

Func<bool>

Cooldown

Gets or sets how long must go between ability uses.

public abstract float Cooldown { get; set; }

Property Value

float

Duration

Gets or sets how long the ability lasts.

public abstract float Duration { get; set; }

Property Value

float

LastUsed

Gets the last time this ability was used.

[YamlIgnore]
public Dictionary<Player, DateTime> LastUsed { get; }

Property Value

Dictionary<Player, DateTime>

SelectedPlayers

Gets all players who have this ability selected.

[YamlIgnore]
public HashSet<Player> SelectedPlayers { get; }

Property Value

HashSet<Player>

Methods

AbilityAdded(Player)

Called when the ability is first added to the player.

protected override void AbilityAdded(Player player)

Parameters

player Player

The Player using the ability.

AbilityEnded(Player)

Called when the abilities duration has ended.

protected virtual void AbilityEnded(Player player)

Parameters

player Player

The Player the ability has ended for.

AbilityRemoved(Player)

Called when the ability is being removed.

protected override void AbilityRemoved(Player player)

Parameters

player Player

The Player using the ability.

AbilityUsed(Player)

Called when the ability is used.

protected virtual void AbilityUsed(Player player)

Parameters

player Player

The Player using the ability.

CanUseAbility(Player, out string, bool)

Checks to see if the ability is usable by the player.

public virtual bool CanUseAbility(Player player, out string response, bool selectedOnly = false)

Parameters

player Player

The player to check.

response string

The response to send to the player.

selectedOnly bool

Whether to disallow usage if the ability is not selected.

Returns

bool

True if the ability is usable.

Check(Player)

Checks if the specified player is using the ability.

public override bool Check(Player player)

Parameters

player Player

The Player to check.

Returns

bool

True if the player is actively using the ability.

Check(Player, CheckType)

Checks if the specified Player meets certain check criteria.

public virtual bool Check(Player player, CheckType type)

Parameters

player Player

The Player to check.

type CheckType

The CheckType type of check to preform.

Returns

bool

The results of the check. Active: Checks if the ability is currently active for the player. Selected: Checks if the player has the ability selected. Available: Checks if the player has the ability.

Exceptions

ArgumentOutOfRangeException

This should never happen unless Joker fucks up.

EndAbility(Player)

Ends the ability.

public void EndAbility(Player player)

Parameters

player Player

The Player the ability is ended for.

SelectAbility(Player)

Selects the ability.

public void SelectAbility(Player player)

Parameters

player Player

The Player to select the ability.

Selected(Player)

Called when the ability is selected.

protected virtual void Selected(Player player)

Parameters

player Player

The Player selecting the ability.

UnSelectAbility(Player)

Un-Selects the ability.

public void UnSelectAbility(Player player)

Parameters

player Player

The Player to un-select the ability.

Unselected(Player)

Called when the ability is un-selected.

protected virtual void Unselected(Player player)

Parameters

player Player

The Player un-selecting the ability.

UseAbility(Player)

Uses the ability.

public void UseAbility(Player player)

Parameters

player Player

The Player using the ability.