Search Results for

    Show / Hide Table of Contents

    Class ItemExtensions

    A set of extensions for ItemType.

    Inheritance
    System.Object
    ItemExtensions
    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.API.Extensions
    Assembly: Exiled.API.dll
    Syntax
    public static class ItemExtensions

    Methods

    | Improve this Doc View Source

    GetAmmoType(ItemType)

    Converts a valid ammo ItemType into an AmmoType.

    Declaration
    public static AmmoType GetAmmoType(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The ItemType to convert.

    Returns
    Type Description
    AmmoType

    The ammo type of the given item type.

    | Improve this Doc View Source

    GetAttachmentIdentifiers(FirearmType, UInt32)

    Gets all AttachmentIdentifiers present on a FirearmType.

    Declaration
    public static IEnumerable<AttachmentIdentifier> GetAttachmentIdentifiers(this FirearmType type, uint code)
    Parameters
    Type Name Description
    FirearmType type

    The FirearmType to iterate over.

    System.UInt32 code

    The System.UInt32 value which represents the attachments code to check.

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

    A System.Collections.Generic.IEnumerable<T> of AttachmentIdentifier value which represents all the attachments present on the specified ItemType.

    | Improve this Doc View Source

    GetAttachmentsCode(IEnumerable<AttachmentIdentifier>)

    Gets the value resulting from the sum of all elements within a specific System.Collections.Generic.IEnumerable<T> of AttachmentIdentifier.

    Declaration
    public static uint GetAttachmentsCode(this IEnumerable<AttachmentIdentifier> identifiers)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<AttachmentIdentifier> identifiers

    The System.Collections.Generic.IEnumerable<T> of AttachmentIdentifier to compute.

    Returns
    Type Description
    System.UInt32

    A System.UInt32 value that represents the attachments code.

    | Improve this Doc View Source

    GetBaseCode(FirearmType)

    Gets the base code of the specified FirearmType.

    Declaration
    public static uint GetBaseCode(this FirearmType type)
    Parameters
    Type Name Description
    FirearmType type

    The FirearmType to check.

    Returns
    Type Description
    System.UInt32

    The corresponding base code.

    | Improve this Doc View Source

    GetCategory(ItemType)

    Gets the ItemCategory of the specified ItemType.

    Declaration
    public static ItemCategory GetCategory(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The ItemType to check.

    Returns
    Type Description
    ItemCategory

    ItemCategory of the specified ItemType.

    | Improve this Doc View Source

    GetFirearmType(ItemType)

    Converts a valid firearm ItemType into a FirearmType.

    Declaration
    public static FirearmType GetFirearmType(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The ItemType to convert.

    Returns
    Type Description
    FirearmType

    The firearm type of the given item.

    | Improve this Doc View Source

    GetItemBase(ItemType)

    Given an ItemType, returns the matching InventorySystem.Items.ItemBase.

    Declaration
    public static ItemBase GetItemBase(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The ItemType.

    Returns
    Type Description
    InventorySystem.Items.ItemBase

    The InventorySystem.Items.ItemBase, or null if not found.

    | Improve this Doc View Source

    GetItemBase<T>(ItemType)

    Given an ItemType, returns the matching InventorySystem.Items.ItemBase, casted to T.

    Declaration
    public static T GetItemBase<T>(this ItemType type)
    
        where T : ItemBase
    Parameters
    Type Name Description
    ItemType type

    The ItemType.

    Returns
    Type Description
    T

    The InventorySystem.Items.ItemBase casted to T, or null if not found or couldn't be casted.

    Type Parameters
    Name Description
    T

    The type to cast the InventorySystem.Items.ItemBase to.

    | Improve this Doc View Source

    GetItemType(AmmoType)

    Converts an AmmoType into it's corresponding ItemType.

    Declaration
    public static ItemType GetItemType(this AmmoType type)
    Parameters
    Type Name Description
    AmmoType type

    The AmmoType to convert.

    Returns
    Type Description
    ItemType

    The Item type of the specified ammo.

    | Improve this Doc View Source

    GetItemType(FirearmType)

    Converts a FirearmType into it's corresponding ItemType.

    Declaration
    public static ItemType GetItemType(this FirearmType type)
    Parameters
    Type Name Description
    FirearmType type

    The FirearmType to convert.

    Returns
    Type Description
    ItemType

    The Item type of the specified firearm.

    | Improve this Doc View Source

    GetItemType(ProjectileType)

    Converts a ProjectileType into the corresponding ItemType.

    Declaration
    public static ItemType GetItemType(this ProjectileType type)
    Parameters
    Type Name Description
    ProjectileType type

    The ProjectileType to convert.

    Returns
    Type Description
    ItemType

    The Item type of the specified grenade.

    | Improve this Doc View Source

    GetItemTypes(IEnumerable<Item>)

    Converts a System.Collections.Generic.IEnumerable<T> of Items into the corresponding System.Collections.Generic.IEnumerable<T> of ItemTypes.

    Declaration
    public static IEnumerable<ItemType> GetItemTypes(this IEnumerable<Item> items)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Item> items

    The items to convert.

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

    A new System.Collections.Generic.List<T> of ItemTypes.

    | Improve this Doc View Source

    GetMaxAmmo(FirearmType)

    Gets the maximum ammo of a weapon.

    Declaration
    public static byte GetMaxAmmo(this FirearmType item)
    Parameters
    Type Name Description
    FirearmType item

    The weapon that you want to get maximum of.

    Returns
    Type Description
    System.Byte

    Returns the maximum.

    | Improve this Doc View Source

    GetPickupBase(ItemType)

    Given an ItemType, returns the matching InventorySystem.Items.Pickups.ItemPickupBase.

    Declaration
    public static ItemPickupBase GetPickupBase(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The ItemType.

    Returns
    Type Description
    InventorySystem.Items.Pickups.ItemPickupBase

    The InventorySystem.Items.Pickups.ItemPickupBase, or null if not found.

    | Improve this Doc View Source

    GetProjectileType(ItemType)

    Converts a valid projectile ItemType into a ProjectileType.

    Declaration
    public static ProjectileType GetProjectileType(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The ItemType to convert.

    Returns
    Type Description
    ProjectileType

    The projectile type of the given item type, or None if the provided item type is not a projectile.

    | Improve this Doc View Source

    GetWeaponAmmoType(FirearmType)

    Returns the AmmoType of the weapon is using.

    Declaration
    public static AmmoType GetWeaponAmmoType(this FirearmType type)
    Parameters
    Type Name Description
    FirearmType type

    The FirearmType to convert.

    Returns
    Type Description
    AmmoType

    The given weapon's AmmoType.

    | Improve this Doc View Source

    IsAmmo(ItemType)

    Check if an ItemType is an ammo.

    Declaration
    public static bool IsAmmo(this ItemType item)
    Parameters
    Type Name Description
    ItemType item

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether the ItemType is an ammo or not.

    | Improve this Doc View Source

    IsArmor(ItemType)

    Check if a ItemType is an armor item.

    Declaration
    public static bool IsArmor(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether or not the ItemType is an armor.

    | Improve this Doc View Source

    IsKeycard(ItemType)

    Check if an ItemType is a keycard.

    Declaration
    public static bool IsKeycard(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether or not the ItemType is a keycard.

    | Improve this Doc View Source

    IsMedical(ItemType)

    Check if an ItemType is a medical item.

    Declaration
    public static bool IsMedical(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether or not the ItemType is a medical item.

    | Improve this Doc View Source

    IsScp(ItemType)

    Check if an ItemType is an SCP.

    Declaration
    public static bool IsScp(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether or not the ItemType is an SCP.

    | Improve this Doc View Source

    IsThrowable(ItemType)

    Check if an ItemType is a throwable item.

    Declaration
    public static bool IsThrowable(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether or not the ItemType is a throwable item.

    | Improve this Doc View Source

    IsUtility(ItemType)

    Check if an ItemType is a utility item.

    Declaration
    public static bool IsUtility(this ItemType type)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    Returns
    Type Description
    System.Boolean

    Returns whether or not the ItemType is an utilty item.

    | Improve this Doc View Source

    IsWeapon(ItemType, Boolean)

    Check if an ItemType is a weapon.

    Declaration
    public static bool IsWeapon(this ItemType type, bool checkMicro = true)
    Parameters
    Type Name Description
    ItemType type

    The item to be checked.

    System.Boolean checkMicro

    Indicates whether the MicroHID item should be taken into account or not.

    Returns
    Type Description
    System.Boolean

    Returns whether the ItemType is a weapon or not.

    | Improve this Doc View Source

    TryGetAttachments(FirearmType, UInt32, out IEnumerable<AttachmentIdentifier>)

    Tries to get all AttachmentIdentifiers present on a FirearmType.

    Declaration
    public static bool TryGetAttachments(this FirearmType type, uint code, out IEnumerable<AttachmentIdentifier> identifiers)
    Parameters
    Type Name Description
    FirearmType type

    The FirearmType to iterate over.

    System.UInt32 code

    The System.UInt32 value which represents the attachments code to check.

    System.Collections.Generic.IEnumerable<AttachmentIdentifier> identifiers

    The attachments present on the specified FirearmType.

    Returns
    Type Description
    System.Boolean

    true if the specified FirearmType is a weapon.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX