Table of Contents

Class RoleExtensions

Namespace
Exiled.API.Extensions
Assembly
Exiled.API.dll

A set of extensions for PlayerRoles.RoleTypeId.

public static class RoleExtensions
Inheritance
RoleExtensions
Inherited Members

Methods

CompareLife(Footprint, Footprint)

Compares LifeIdentifier.

public static bool CompareLife(this Footprint footprint, Footprint other)

Parameters

footprint Footprint

The footprint to compare.

other Footprint

The other footprint.

Returns

bool

If LifeIdentifier is the same (same role).

CompareLife(Footprint, ReferenceHub)

Compares LifeIdentifier.

public static bool CompareLife(this Footprint footprint, ReferenceHub other)

Parameters

footprint Footprint

The footprint to compare.

other ReferenceHub

The hub to compare to.

Returns

bool

If LifeIdentifier is the same (same role).

GetColor(RoleTypeId)

Gets a role's UnityEngine.Color.

public static Color GetColor(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId to get the color of.

Returns

Color

The UnityEngine.Color of the role.

GetFaction(SpawnableFaction)

Gets the PlayerRoles.Faction associated with the provided SpawnableFaction.

public static Faction GetFaction(this SpawnableFaction spawnableFaction)

Parameters

spawnableFaction SpawnableFaction

A member of the SpawnableFaction enum.

Returns

Faction

PlayerRoles.Faction associated with the provided spawnableFaction.

GetFullName(RoleTypeId)

Gets the full name of the given PlayerRoles.RoleTypeId.

public static string GetFullName(this RoleTypeId typeId)

Parameters

typeId RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

string

The full name.

GetInventory(RoleTypeId)

Gets the starting InventorySystem.InventoryRoleInfo of a PlayerRoles.RoleTypeId.

public static InventoryRoleInfo GetInventory(this RoleTypeId role)

Parameters

role RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

InventoryRoleInfo

The InventorySystem.InventoryRoleInfo that the role receives on spawn.

GetLeadingTeam(Team)

Gets the LeadingTeam.

public static LeadingTeam GetLeadingTeam(this Team team)

Parameters

team Team

Team.

Returns

LeadingTeam

LeadingTeam.

GetRandomSpawnLocation(RoleTypeId)

Gets a random spawn point of a PlayerRoles.RoleTypeId.

public static SpawnLocation GetRandomSpawnLocation(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId to get the spawn point from.

Returns

SpawnLocation

Returns a SpawnLocation representing the spawn, or null if no spawns were found.

GetRoleBase(RoleTypeId)

Gets the base PlayerRoles.PlayerRoleBase of the given PlayerRoles.RoleTypeId.

public static PlayerRoleBase GetRoleBase(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

PlayerRoleBase

The PlayerRoles.PlayerRoleBase.

GetSide(RoleTypeId)

Gets a role's Side.

public static Side GetSide(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId to check the side of.

Returns

Side

Side.

GetSide(Team)

Gets a team's Side.

public static Side GetSide(this Team team)

Parameters

team Team

The PlayerRoles.Team to get the Side of.

Returns

Side

Side.

GetSpawnableFaction(SpawnableWaveBase)

Gets the SpawnableFaction of a Respawning.Waves.SpawnableWaveBase.

public static SpawnableFaction GetSpawnableFaction(this SpawnableWaveBase waveBase)

Parameters

waveBase SpawnableWaveBase

A Respawning.Waves.SpawnableWaveBase instance.

Returns

SpawnableFaction

SpawnableFaction associated with the wave.

GetStartingAmmo(RoleTypeId)

Gets the starting ammo of a PlayerRoles.RoleTypeId.

public static Dictionary<AmmoType, ushort> GetStartingAmmo(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

Dictionary<AmmoType, ushort>

An Array of ItemType that the role receives on spawn. Will be empty for classes that do not spawn with ammo.

GetStartingInventory(RoleTypeId)

Gets the starting items of a PlayerRoles.RoleTypeId.

public static ItemType[] GetStartingInventory(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

ItemType[]

An Array of ItemType that the role receives on spawn. Will be empty for classes that do not spawn with items.

GetTeam(RoleTypeId)

Gets the PlayerRoles.Team of the given PlayerRoles.RoleTypeId.

public static Team GetTeam(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

Team

PlayerRoles.Team.

IsChaos(RoleTypeId)

Checks if the role is a Chaos role.

public static bool IsChaos(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

A boolean which is true when the role is a Chaos role.

IsCivilian(RoleTypeId)

Checks if the role is a civilian role (Scientists and Class-D).

public static bool IsCivilian(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

A boolean which is true when the role is a civilian role.

IsDead(RoleTypeId)

Checks if the role is a dead role.

public static bool IsDead(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

A boolean which is true when the role is a dead role.

IsFpcRole(RoleTypeId)

Checks whether a PlayerRoles.RoleTypeId is an PlayerRoles.FirstPersonControl.IFpcRole or not.

public static bool IsFpcRole(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

Returns whether roleType is an PlayerRoles.FirstPersonControl.IFpcRole or not.

IsMilitary(RoleTypeId)

Checks if the role is a military role (Chaos Insurgency or NTF).

public static bool IsMilitary(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

A boolean which is true when the role is a military role.

IsNtf(RoleTypeId)

Checks if the role is an NTF role.

public static bool IsNtf(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

A boolean which is true when the role is an NTF role. Does not include Facility Guards.

IsScp(RoleTypeId)

Checks if the role is an SCP role.

public static bool IsScp(this RoleTypeId roleType)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

Returns

bool

A boolean which is true when the role is an SCP role.

TryGetRoleBase(RoleTypeId, out PlayerRoleBase)

Tries to get the base PlayerRoles.PlayerRoleBase of the given PlayerRoles.RoleTypeId.

public static bool TryGetRoleBase(this RoleTypeId roleType, out PlayerRoleBase roleBase)

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

roleBase PlayerRoleBase

The PlayerRoles.PlayerRoleBase to return.

Returns

bool

The PlayerRoles.PlayerRoleBase.

TryGetRoleBase<T>(RoleTypeId, out T)

Tries to get the base PlayerRoles.PlayerRoleBase of the given PlayerRoles.RoleTypeId.

public static bool TryGetRoleBase<T>(this RoleTypeId roleType, out T roleBase) where T : PlayerRoleBase

Parameters

roleType RoleTypeId

The PlayerRoles.RoleTypeId.

roleBase T

The PlayerRoles.PlayerRoleBase to return.

Returns

bool

The PlayerRoles.PlayerRoleBase.

Type Parameters

T

The type to cast the PlayerRoles.PlayerRoleBase to.

TryGetSpawnableFaction(Faction, out SpawnableFaction, bool)

Tries to get the SpawnableFaction associated with the provided PlayerRoles.Faction and bool.

public static bool TryGetSpawnableFaction(this Faction faction, out SpawnableFaction spawnableFaction, bool mini = false)

Parameters

faction Faction

A member of the PlayerRoles.Factionenum.

spawnableFaction SpawnableFaction

The SpawnableFaction to return.

mini bool

A bool determining whether to get a normal spawn wave or a mini one.

Returns

bool

PlayerRoles.Faction associated with the provided faction influenced by mini.