Class Item
A wrapper class for InventorySystem.Items.ItemBase.
public class Item : TypeCastObject<Item>, IWrapper<ItemBase>
- Inheritance
-
Item
- Implements
-
IWrapper<ItemBase>
- Derived
- Inherited Members
- Extension Methods
Constructors
Item(ItemBase)
Initializes a new instance of the Item class.
public Item(ItemBase itemBase)
Parameters
itemBase
ItemBaseThe InventorySystem.Items.ItemBase to encapsulate.
Properties
AddReason
Gets or sets a reason for adding this item to the inventory.
public ItemAddReason AddReason { get; set; }
Property Value
- ItemAddReason
Base
Gets the InventorySystem.Items.ItemBase of the item.
public ItemBase Base { get; }
Property Value
- ItemBase
Category
Gets the ItemCategory of the item.
public ItemCategory Category { get; }
Property Value
- ItemCategory
IsAmmo
Gets a value indicating whether this item is ammunition.
public bool IsAmmo { get; }
Property Value
IsArmor
Gets a value indicating whether this item is armor.
public bool IsArmor { get; }
Property Value
IsConsumable
Gets a value indicating whether this item will be destroy when being used.
public bool IsConsumable { get; }
Property Value
IsDisarmer
Gets a value indicating whether this item can be used to disarm players.
public bool IsDisarmer { get; }
Property Value
IsFirearm
Gets a value indicating whether or not this item is a firearm.
public bool IsFirearm { get; }
Property Value
IsInInventory
Gets a value indicating whether if the item are in an inventory.
public bool IsInInventory { get; }
Property Value
IsKeycard
Gets a value indicating whether this item is a keycard.
public bool IsKeycard { get; }
Property Value
IsLightEmitter
Gets a value indicating whether this item emits light.
public bool IsLightEmitter { get; }
Property Value
IsThrowable
Gets a value indicating whether this item is a throwable item.
public bool IsThrowable { get; }
Property Value
IsUsable
Gets a value indicating whether this item can be used by a player.
public bool IsUsable { get; }
Property Value
IsWeapon
Gets a value indicating whether this item is a weapon.
public bool IsWeapon { get; }
Property Value
List
Gets a list of all Item's on the server.
public static IEnumerable<Item> List { get; }
Property Value
Owner
Gets the Player who owns the item.
public Player Owner { get; }
Property Value
Scale
Gets or sets the scale for the item.
public virtual Vector3 Scale { get; set; }
Property Value
- Vector3
Serial
Gets or sets the unique serial number for the item.
public ushort Serial { get; set; }
Property Value
TierFlags
Gets the ItemTierFlags of the item.
public ItemTierFlags TierFlags { get; }
Property Value
- ItemTierFlags
Type
Gets the ItemType of the item.
public ItemType Type { get; }
Property Value
- ItemType
Weight
Gets the Weight of the item.
public float Weight { get; }
Property Value
Methods
ChangeItemOwner(Player, Player)
Changes the owner of the Item.
public void ChangeItemOwner(Player oldOwner, Player newOwner)
Parameters
Clone()
Clones the current item with a different serial.
public virtual Item Clone()
Returns
- 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.
- SCP-1344 can be casted to the Scp1344 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.
public static Item Create(ItemType type, Player owner = null)
Parameters
type
ItemTypeThe ItemType of the item to create.
owner
PlayerThe Player who owns the item by default.
Returns
CreatePickup(Vector3, Quaternion?, bool)
public virtual Pickup CreatePickup(Vector3 position, Quaternion? rotation = null, bool spawn = true)
Parameters
position
Vector3The location to spawn the item.
rotation
Quaternion?The rotation of the item.
spawn
boolWhether the Pickup should be initially spawned.
Returns
Create<T>(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.
- SCP-1344 can be casted to the Scp1344 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.
public static Item Create<T>(ItemType type, Player owner = null) where T : Item
Parameters
type
ItemTypeThe ItemType of the item to create.
owner
PlayerThe Player who owns the item by default.
Returns
Type Parameters
T
The specified Item type.
Destroy()
Destroy this item.
public void Destroy()
Get(ItemBase)
Gets an existing Item or creates a new instance of one.
public static Item Get(ItemBase itemBase)
Parameters
itemBase
ItemBaseThe InventorySystem.Items.ItemBase to convert into an item.
Returns
- Item
The item wrapper for the given InventorySystem.Items.ItemBase.
Get(ushort)
Gets the Item belonging to the specified serial.
public static Item Get(ushort serial)
Parameters
serial
ushortThe Item serial.
Returns
Get<T>(ItemBase)
Gets an existing Item or creates a new instance of one.
public static T Get<T>(ItemBase itemBase) where T : Item
Parameters
itemBase
ItemBaseThe InventorySystem.Items.ItemBase to convert into an item.
Returns
- T
The item wrapper for the given InventorySystem.Items.ItemBase.
Type Parameters
T
The specified Item type.
Get<T>(ushort)
Gets the Item belonging to the specified serial.
public static T Get<T>(ushort serial) where T : Item
Parameters
serial
ushortThe Item serial.
Returns
- T
Returns the Item found or null if not found.
Type Parameters
T
The specified Item type.
Give(Player)
Gives this item to a Player.
public void Give(Player player)
Parameters
ToString()
Returns the Item in a human readable format.
public override string ToString()
Returns
- string
A string containing Item-related data.