Class Item
A wrapper class for InventorySystem.Items.ItemBase.
Inheritance
Implements
Inherited Members
Namespace: Exiled.API.Features.Items
Assembly: Exiled.API.dll
Syntax
public class Item : TypeCastObject<Item>, IWrapper<ItemBase>
Constructors
| Improve this Doc View SourceItem(ItemBase)
Initializes a new instance of the Item class.
Declaration
public Item(ItemBase itemBase)
Parameters
Type | Name | Description |
---|---|---|
InventorySystem.Items.ItemBase | itemBase | The InventorySystem.Items.ItemBase to encapsulate. |
Properties
| Improve this Doc View SourceBase
Gets the InventorySystem.Items.ItemBase of the item.
Declaration
public ItemBase Base { get; }
Property Value
Type | Description |
---|---|
InventorySystem.Items.ItemBase |
Category
Gets the ItemCategory of the item.
Declaration
public ItemCategory Category { get; }
Property Value
Type | Description |
---|---|
ItemCategory |
IsAmmo
Gets a value indicating whether or not this item is ammunition.
Declaration
public bool IsAmmo { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsArmor
Gets a value indicating whether or not this item is armor.
Declaration
public bool IsArmor { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsConsumable
Gets a value indicating whether or not this item will be destroy when being used.
Declaration
public bool IsConsumable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDisarmer
Gets a value indicating whether or not this item can be used to disarm players.
Declaration
public bool IsDisarmer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInInventory
Gets a value indicating whether if the item are in an inventory.
Declaration
public bool IsInInventory { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsKeycard
Gets a value indicating whether or not this item is a keycard.
Declaration
public bool IsKeycard { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLightEmitter
Gets a value indicating whether or not this item emits light.
Declaration
public bool IsLightEmitter { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsThrowable
Gets a value indicating whether or not this item is a throwable item.
Declaration
public bool IsThrowable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsUsable
Gets a value indicating whether or not this item can be used by a player.
Declaration
public bool IsUsable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsWeapon
Gets a value indicating whether or not this item is a weapon.
Declaration
public bool IsWeapon { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
List
Gets a list of all Item's on the server.
Declaration
public static IEnumerable<Item> List { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Item> |
Owner
Gets the Player who owns the item.
Declaration
public Player Owner { get; }
Property Value
Type | Description |
---|---|
Player |
Scale
Gets or sets the scale for the item.
Declaration
public Vector3 Scale { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector3 |
Serial
Gets or sets the unique serial number for the item.
Declaration
public ushort Serial { get; set; }
Property Value
Type | Description |
---|---|
System.UInt16 |
TierFlags
Gets the ItemTierFlags of the item.
Declaration
public ItemTierFlags TierFlags { get; }
Property Value
Type | Description |
---|---|
ItemTierFlags |
Type
Gets the ItemType of the item.
Declaration
public ItemType Type { get; }
Property Value
Type | Description |
---|---|
ItemType |
Weight
Gets the Weight of the item.
Declaration
public float Weight { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
| Improve this Doc View SourceChangeItemOwner(Player, Player)
Changes the owner of the Item.
Declaration
public void ChangeItemOwner(Player oldOwner, Player newOwner)
Parameters
Type | Name | Description |
---|---|---|
Player | oldOwner | Old Item owner. |
Player | newOwner | New Item owner. |
Clone()
Clones the current item with a different serial.
Declaration
public virtual Item Clone()
Returns
Type | Description |
---|---|
Item | Cloned item object. |
Create(ItemType, Player)
Creates a new Item with the proper inherited subclass.
Based on the type
, the returned Item can be casted into a subclass to gain more control over the object.
- Usable items (Adrenaline, Medkit, Painkillers, SCP-207, SCP-268, and SCP-500) should be casted to the Usable class.
- All valid ammo should be casted to the Ammo class.
- All valid firearms (not including the Micro HID) should be casted to the Firearm class.
- All valid keycards should be casted to the Keycard class.
- All valid armor should be casted to the Armor class.
- Explosive grenades and SCP-018 should be casted to the ExplosiveGrenade class.
- Flash grenades should be casted to the FlashGrenade class.
The following have their own respective classes:
- Flashlights can be casted to Flashlight.
- Radios can be casted to Radio.
- The Micro HID can be casted to MicroHid.
- SCP-244 A and B variants can be casted to Scp244.
- SCP-330 can be casted to Scp330.
- SCP-2176 can be casted to the Scp2176 class.
- SCP-1576 can be casted to the Scp1576 class.
- Jailbird can be casted to the Jailbird class.
Items that are not listed above do not have a subclass, and can only use the base Item class.
Declaration
public static Item Create(ItemType type, Player owner = null)
Parameters
Type | Name | Description |
---|---|---|
ItemType | type | The ItemType of the item to create. |
Player | owner | The Player who owns the item by default. |
Returns
Type | Description |
---|---|
Item | The Item created. This can be cast as a subclass. |
CreatePickup(Vector3, Quaternion, Boolean)
Declaration
public virtual Pickup CreatePickup(Vector3 position, Quaternion rotation = default(Quaternion), bool spawn = true)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | The location to spawn the item. |
UnityEngine.Quaternion | rotation | The rotation of the item. |
System.Boolean | spawn | Whether the Pickup should be initially spawned. |
Returns
Type | Description |
---|---|
Pickup | The created Pickup. |
Destroy()
Destroy this item.
Declaration
public void Destroy()
Get(ItemBase)
Gets an existing Item or creates a new instance of one.
Declaration
public static Item Get(ItemBase itemBase)
Parameters
Type | Name | Description |
---|---|---|
InventorySystem.Items.ItemBase | itemBase | The InventorySystem.Items.ItemBase to convert into an item. |
Returns
Type | Description |
---|---|
Item | The item wrapper for the given InventorySystem.Items.ItemBase. |
Get(UInt16)
Gets the Item belonging to the specified serial.
Declaration
public static Item Get(ushort serial)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | serial | The Item serial. |
Returns
Type | Description |
---|---|
Item | Returns the Item found or null if not found. |
Give(Player)
Gives this item to a Player.
Declaration
public void Give(Player player)
Parameters
Type | Name | Description |
---|---|---|
Player | player | The Player to give the item to. |
ToString()
Returns the Item in a human readable format.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string containing Item-related data. |