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
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
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
Cooldown
Gets or sets how long must go between ability uses.
public abstract float Cooldown { get; set; }
Property Value
Duration
Gets or sets how long the ability lasts.
public abstract float Duration { get; set; }
Property Value
LastUsed
Gets the last time this ability was used.
[YamlIgnore]
public Dictionary<Player, DateTime> LastUsed { get; }
Property Value
SelectedPlayers
Gets all players who have this ability selected.
[YamlIgnore]
public HashSet<Player> SelectedPlayers { get; }
Property Value
Methods
AbilityAdded(Player)
Called when the ability is first added to the player.
protected override void AbilityAdded(Player player)
Parameters
AbilityEnded(Player)
Called when the abilities duration has ended.
protected virtual void AbilityEnded(Player player)
Parameters
AbilityRemoved(Player)
Called when the ability is being removed.
protected override void AbilityRemoved(Player player)
Parameters
AbilityUsed(Player)
Called when the ability is used.
protected virtual void AbilityUsed(Player player)
Parameters
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
PlayerThe player to check.
response
stringThe response to send to the player.
selectedOnly
boolWhether 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
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
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
SelectAbility(Player)
Selects the ability.
public void SelectAbility(Player player)
Parameters
Selected(Player)
Called when the ability is selected.
protected virtual void Selected(Player player)
Parameters
UnSelectAbility(Player)
Un-Selects the ability.
public void UnSelectAbility(Player player)
Parameters
Unselected(Player)
Called when the ability is un-selected.
protected virtual void Unselected(Player player)
Parameters
UseAbility(Player)
Uses the ability.
public void UseAbility(Player player)