Search Results for

    Show / Hide Table of Contents

    Class CustomRole

    The custom role base class.

    Inheritance
    System.Object
    CustomRole
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Exiled.CustomRoles.API.Features
    Assembly: Exiled.CustomRoles.dll
    Syntax
    public abstract class CustomRole

    Properties

    | Improve this Doc View Source

    AbilityUsage

    Gets or sets a System.String for the ability usage help sent to players in the player console.

    Declaration
    public virtual string AbilityUsage { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Ammo

    Gets or sets the starting ammo for the role.

    Declaration
    public virtual Dictionary<AmmoType, ushort> Ammo { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<AmmoType, System.UInt16>
    | Improve this Doc View Source

    Broadcast

    Gets or sets a value indicating broadcast that will be shown to the player.

    Declaration
    public virtual Broadcast Broadcast { get; set; }
    Property Value
    Type Description
    Broadcast
    | Improve this Doc View Source

    ConsoleMessage

    Gets or sets a System.String for the console message given to players when they receive a role.

    Declaration
    public virtual string ConsoleMessage { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    CustomAbilities

    Gets or sets a list of the roles custom abilities.

    Declaration
    public virtual List<CustomAbility> CustomAbilities { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<CustomAbility>
    | Improve this Doc View Source

    CustomInfo

    Gets or sets the CustomInfo of this role.

    Declaration
    public abstract string CustomInfo { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    CustomRoleFFMultiplier

    Gets or sets a System.Collections.Generic.Dictionary<TKey, TValue> containing cached System.String and their System.Collections.Generic.Dictionary<TKey, TValue> which is cached Role with FF multiplier.

    Declaration
    public virtual Dictionary<RoleTypeId, float> CustomRoleFFMultiplier { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<PlayerRoles.RoleTypeId, System.Single>
    | Improve this Doc View Source

    Description

    Gets or sets the description of this role.

    Declaration
    public abstract string Description { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    DisplayCustomItemMessages

    Gets or sets a value indicating whether players will receive a message for getting a custom item, when gaining it through the inventory config for this role.

    Declaration
    public virtual bool DisplayCustomItemMessages { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Id

    Gets or sets the custom RoleID of the role.

    Declaration
    public abstract uint Id { get; set; }
    Property Value
    Type Description
    System.UInt32
    | Improve this Doc View Source

    IgnoreSpawnSystem

    Gets or sets a value indicating whether the spawn system is ignored for this role or not.

    Declaration
    public virtual bool IgnoreSpawnSystem { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Inventory

    Gets or sets the starting inventory for the role.

    Declaration
    public virtual List<string> Inventory { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>
    | Improve this Doc View Source

    KeepInventoryOnSpawn

    Gets or sets a value indicating whether players keep their current inventory when gaining this role.

    Declaration
    public virtual bool KeepInventoryOnSpawn { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    KeepPositionOnSpawn

    Gets or sets a value indicating whether players keep their current position when gaining this role.

    Declaration
    public virtual bool KeepPositionOnSpawn { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    KeepRoleOnChangingRole

    Gets or sets a value indicating whether players keep this Custom Role when they switch roles: Class-D -> Scientist for example.

    Declaration
    public virtual bool KeepRoleOnChangingRole { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    KeepRoleOnDeath

    Gets or sets a value indicating whether players keep this role when they die.

    Declaration
    public virtual bool KeepRoleOnDeath { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    MaxHealth

    Gets or sets the max Health for the role.

    Declaration
    public abstract int MaxHealth { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Name

    Gets or sets the name of this role.

    Declaration
    public abstract string Name { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Registered

    Gets a list of all registered custom roles.

    Declaration
    public static HashSet<CustomRole> Registered { get; }
    Property Value
    Type Description
    System.Collections.Generic.HashSet<CustomRole>
    | Improve this Doc View Source

    RemovalKillsPlayer

    Gets or sets a value indicating whether players die when this role is removed.

    Declaration
    public virtual bool RemovalKillsPlayer { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Role

    Gets or sets the PlayerRoles.RoleTypeId to spawn this role as.

    Declaration
    public virtual RoleTypeId Role { get; set; }
    Property Value
    Type Description
    PlayerRoles.RoleTypeId
    | Improve this Doc View Source

    Scale

    Gets or sets a value indicating the Player's size.

    Declaration
    public virtual Vector3 Scale { get; set; }
    Property Value
    Type Description
    UnityEngine.Vector3
    | Improve this Doc View Source

    SpawnChance

    Gets or sets a value indicating the Spawn Chance of the Role.

    Declaration
    public virtual float SpawnChance { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    SpawnProperties

    Gets or sets the possible spawn locations for this role.

    Declaration
    public virtual SpawnProperties SpawnProperties { get; set; }
    Property Value
    Type Description
    SpawnProperties
    | Improve this Doc View Source

    TrackedPlayers

    Gets all of the players currently set to this role.

    Declaration
    [YamlIgnore]
    public HashSet<Player> TrackedPlayers { get; }
    Property Value
    Type Description
    System.Collections.Generic.HashSet<Player>

    Methods

    | Improve this Doc View Source

    AddRole(Player)

    Handles setup of the role, including spawn location, inventory and registering event handlers and add FF rules.

    Declaration
    public virtual void AddRole(Player player)
    Parameters
    Type Name Description
    Player player

    The Player to add the role to.

    | Improve this Doc View Source

    Check(Player)

    Checks if the given player has this role.

    Declaration
    public virtual bool Check(Player player)
    Parameters
    Type Name Description
    Player player

    The Player to check.

    Returns
    Type Description
    System.Boolean

    True if the player has this role.

    | Improve this Doc View Source

    Destroy()

    Destroys this role manager.

    Declaration
    public virtual void Destroy()
    | Improve this Doc View Source

    ForceSyncSetPlayerFriendlyFire(CustomRole, Player)

    Force sync CustomRole Friendly Fire with Player (Set to).

    Declaration
    public static void ForceSyncSetPlayerFriendlyFire(CustomRole roleToSync, Player player)
    Parameters
    Type Name Description
    CustomRole roleToSync

    CustomRole to sync with player.

    Player player

    Player Player to add custom role to.

    | Improve this Doc View Source

    Get(String)

    Gets a CustomRole by name.

    Declaration
    public static CustomRole Get(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the role to get.

    Returns
    Type Description
    CustomRole

    The role, or null if it doesn't exist.

    | Improve this Doc View Source

    Get(Type)

    Gets a CustomRole by type.

    Declaration
    public static CustomRole Get(Type t)
    Parameters
    Type Name Description
    System.Type t

    The System.Type to get.

    Returns
    Type Description
    CustomRole

    The role, or null if it doesn't exist.

    | Improve this Doc View Source

    Get(UInt32)

    Gets a CustomRole by ID.

    Declaration
    public static CustomRole Get(uint id)
    Parameters
    Type Name Description
    System.UInt32 id

    The ID of the role to get.

    Returns
    Type Description
    CustomRole

    The role, or null if it doesn't exist.

    | Improve this Doc View Source

    GetSpawnPosition()

    Gets a random UnityEngine.Vector3 from SpawnProperties.

    Declaration
    protected Vector3 GetSpawnPosition()
    Returns
    Type Description
    UnityEngine.Vector3

    The chosen spawn location.

    | Improve this Doc View Source

    Init()

    Initializes this role manager.

    Declaration
    public virtual void Init()
    | Improve this Doc View Source

    RegisterRoles(Boolean, Object)

    Registers all the CustomRole's present in the current assembly.

    Declaration
    public static IEnumerable<CustomRole> RegisterRoles(bool skipReflection = false, object overrideClass = null)
    Parameters
    Type Name Description
    System.Boolean skipReflection

    Whether or not reflection is skipped (more efficient if you are not using your custom item classes as config objects).

    System.Object overrideClass

    The class to search properties for, if different from the plugin's config class.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CustomRole>

    A System.Collections.Generic.IEnumerable<T> of CustomRole which contains all registered CustomRole's.

    | Improve this Doc View Source

    RegisterRoles(Boolean, Object, Boolean, Assembly)

    Registers all the CustomRole's present in the current assembly.

    Declaration
    public static IEnumerable<CustomRole> RegisterRoles(bool skipReflection = false, object overrideClass = null, bool inheritAttributes = true, Assembly assembly = null)
    Parameters
    Type Name Description
    System.Boolean skipReflection

    Whether or not reflection is skipped (more efficient if you are not using your custom item classes as config objects).

    System.Object overrideClass

    The class to search properties for, if different from the plugin's config class.

    System.Boolean inheritAttributes

    Whether or not inherited attributes should be taken into account for registration.

    System.Reflection.Assembly assembly

    Assembly which is calling this method.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CustomRole>

    A System.Collections.Generic.IEnumerable<T> of CustomRole which contains all registered CustomRole's.

    | Improve this Doc View Source

    RegisterRoles(IEnumerable<Type>, Boolean, Boolean, Object)

    Registers all the CustomRole's present in the current assembly.

    Declaration
    public static IEnumerable<CustomRole> RegisterRoles(IEnumerable<Type> targetTypes, bool isIgnored = false, bool skipReflection = false, object overrideClass = null)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Type> targetTypes

    The System.Collections.Generic.IEnumerable<T> of System.Type containing the target types.

    System.Boolean isIgnored

    A value indicating whether the target types should be ignored.

    System.Boolean skipReflection

    Whether or not reflection is skipped (more efficient if you are not using your custom item classes as config objects).

    System.Object overrideClass

    The class to search properties for, if different from the plugin's config class.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CustomRole>

    A System.Collections.Generic.IEnumerable<T> of CustomRole which contains all registered CustomRole's.

    | Improve this Doc View Source

    RemoveRole(Player)

    Removes the role from a specific player and FF rules.

    Declaration
    public virtual void RemoveRole(Player player)
    Parameters
    Type Name Description
    Player player

    The Player to remove the role from.

    | Improve this Doc View Source

    RoleAdded(Player)

    Called after the role has been added to the player.

    Declaration
    protected virtual void RoleAdded(Player player)
    Parameters
    Type Name Description
    Player player

    The Player the role was added to.

    | Improve this Doc View Source

    RoleRemoved(Player)

    Called 1 frame before the role is removed from the player.

    Declaration
    protected virtual void RoleRemoved(Player player)
    Parameters
    Type Name Description
    Player player

    The Player the role was removed from.

    | Improve this Doc View Source

    SetFriendlyFire(RoleTypeId, Single)

    Tries to add PlayerRoles.RoleTypeId to CustomRole FriendlyFire rules.

    Declaration
    public void SetFriendlyFire(RoleTypeId roleToAdd, float ffMult)
    Parameters
    Type Name Description
    PlayerRoles.RoleTypeId roleToAdd

    Role to add.

    System.Single ffMult

    Friendly fire multiplier.

    | Improve this Doc View Source

    SetFriendlyFire(KeyValuePair<RoleTypeId, Single>)

    Wrapper to call SetFriendlyFire(RoleTypeId, Single).

    Declaration
    public void SetFriendlyFire(KeyValuePair<RoleTypeId, float> roleFF)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<PlayerRoles.RoleTypeId, System.Single> roleFF

    Role with FF to add even if it exists.

    | Improve this Doc View Source

    ShowBroadcast(Player)

    Shows the spawn broadcast to the player.

    Declaration
    protected virtual void ShowBroadcast(Player player)
    Parameters
    Type Name Description
    Player player

    The Player to show the message to.

    | Improve this Doc View Source

    ShowMessage(Player)

    Shows the spawn message to the player.

    Declaration
    protected virtual void ShowMessage(Player player)
    Parameters
    Type Name Description
    Player player

    The Player to show the message to.

    | Improve this Doc View Source

    SubscribeEvents()

    Called when the role is initialized to setup internal events.

    Declaration
    protected virtual void SubscribeEvents()
    | Improve this Doc View Source

    SyncPlayerFriendlyFire(CustomRole, Player, Boolean)

    ResyncCustomRole Friendly Fire with Player (Append, or Overwrite).

    Declaration
    public static void SyncPlayerFriendlyFire(CustomRole roleToSync, Player player, bool overwrite = false)
    Parameters
    Type Name Description
    CustomRole roleToSync

    CustomRole to sync with player.

    Player player

    Player Player to add custom role to.

    System.Boolean overwrite

    System.Boolean whether to force sync (Overwriting previous information).

    | Improve this Doc View Source

    TryAddFriendlyFire(RoleTypeId, Single)

    Tries to add PlayerRoles.RoleTypeId to CustomRole FriendlyFire rules.

    Declaration
    public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult)
    Parameters
    Type Name Description
    PlayerRoles.RoleTypeId roleToAdd

    Role to add.

    System.Single ffMult

    Friendly fire multiplier.

    Returns
    Type Description
    System.Boolean

    Whether the item was able to be added.

    | Improve this Doc View Source

    TryAddFriendlyFire(Dictionary<RoleTypeId, Single>, Boolean)

    Tries to add PlayerRoles.RoleTypeId to CustomRole FriendlyFire rules.

    Declaration
    public bool TryAddFriendlyFire(Dictionary<RoleTypeId, float> ffRules, bool overwrite = false)
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<PlayerRoles.RoleTypeId, System.Single> ffRules

    Roles to add with friendly fire values.

    System.Boolean overwrite

    Whether to overwrite current values if they exist.

    Returns
    Type Description
    System.Boolean

    Whether the item was able to be added.

    | Improve this Doc View Source

    TryAddFriendlyFire(KeyValuePair<RoleTypeId, Single>)

    Tries to add PlayerRoles.RoleTypeId to CustomRole FriendlyFire rules.

    Declaration
    public bool TryAddFriendlyFire(KeyValuePair<RoleTypeId, float> pairedRoleFF)
    Parameters
    Type Name Description
    System.Collections.Generic.KeyValuePair<PlayerRoles.RoleTypeId, System.Single> pairedRoleFF

    Role FF multiplier to add.

    Returns
    Type Description
    System.Boolean

    Whether the item was able to be added.

    | Improve this Doc View Source

    TryAddItem(Player, String)

    Tries to add an item to the player's inventory by name.

    Declaration
    protected bool TryAddItem(Player player, string itemName)
    Parameters
    Type Name Description
    Player player

    The Player to try giving the item to.

    System.String itemName

    The name of the item to try adding.

    Returns
    Type Description
    System.Boolean

    Whether or not the item was able to be added.

    | Improve this Doc View Source

    TryGet(Player, out IReadOnlyCollection<CustomRole>)

    Tries to get a System.Collections.Generic.IReadOnlyCollection<T> of the specified Player's CustomRoles.

    Declaration
    public static bool TryGet(Player player, out IReadOnlyCollection<CustomRole> customRoles)
    Parameters
    Type Name Description
    Player player

    The player to check.

    System.Collections.Generic.IReadOnlyCollection<CustomRole> customRoles

    The custom roles the player has.

    Returns
    Type Description
    System.Boolean

    True if the player has custom roles.

    Exceptions
    Type Condition
    System.ArgumentNullException

    If the player is null.

    | Improve this Doc View Source

    TryGet(String, out CustomRole)

    Tries to get a CustomRole by name.

    Declaration
    public static bool TryGet(string name, out CustomRole customRole)
    Parameters
    Type Name Description
    System.String name

    The name of the role to get.

    CustomRole customRole

    The custom role.

    Returns
    Type Description
    System.Boolean

    True if the role exists.

    Exceptions
    Type Condition
    System.ArgumentNullException

    If the name is null or an empty string.

    | Improve this Doc View Source

    TryGet(Type, out CustomRole)

    Tries to get a CustomRole by name.

    Declaration
    public static bool TryGet(Type t, out CustomRole customRole)
    Parameters
    Type Name Description
    System.Type t

    The System.Type of the role to get.

    CustomRole customRole

    The custom role.

    Returns
    Type Description
    System.Boolean

    True if the role exists.

    Exceptions
    Type Condition
    System.ArgumentNullException

    If the name is null or an empty string.

    | Improve this Doc View Source

    TryGet(UInt32, out CustomRole)

    Tries to get a CustomRole by .

    Declaration
    public static bool TryGet(uint id, out CustomRole customRole)
    Parameters
    Type Name Description
    System.UInt32 id

    The ID of the role to get.

    CustomRole customRole

    The custom role.

    Returns
    Type Description
    System.Boolean

    True if the role exists.

    | Improve this Doc View Source

    UnregisterRoles()

    Unregisters all the CustomRole's present in the current assembly.

    Declaration
    public static IEnumerable<CustomRole> UnregisterRoles()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CustomRole>

    A System.Collections.Generic.IEnumerable<T> of CustomRole which contains all unregistered CustomRole's.

    | Improve this Doc View Source

    UnregisterRoles(IEnumerable<CustomRole>, Boolean)

    Unregisters all the CustomRole's present in the current assembly.

    Declaration
    public static IEnumerable<CustomRole> UnregisterRoles(IEnumerable<CustomRole> targetRoles, bool isIgnored = false)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<CustomRole> targetRoles

    The System.Collections.Generic.IEnumerable<T> of CustomRole containing the target roles.

    System.Boolean isIgnored

    A value indicating whether the target roles should be ignored.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CustomRole>

    A System.Collections.Generic.IEnumerable<T> of CustomRole which contains all unregistered CustomRole's.

    | Improve this Doc View Source

    UnregisterRoles(IEnumerable<Type>, Boolean)

    Unregisters all the CustomRole's present in the current assembly.

    Declaration
    public static IEnumerable<CustomRole> UnregisterRoles(IEnumerable<Type> targetTypes, bool isIgnored = false)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Type> targetTypes

    The System.Collections.Generic.IEnumerable<T> of System.Type containing the target types.

    System.Boolean isIgnored

    A value indicating whether the target types should be ignored.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<CustomRole>

    A System.Collections.Generic.IEnumerable<T> of CustomRole which contains all unregistered CustomRole's.

    | Improve this Doc View Source

    UnsubscribeEvents()

    Called when the role is destroyed to unsubscribe internal event handlers.

    Declaration
    protected virtual void UnsubscribeEvents()

    Extension Methods

    Extensions.Register(CustomRole)
    Extensions.Unregister(CustomRole)
    ReflectionExtensions.CopyProperties(Object, Object)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX