2017-05-15 21:30:12 +02:00
|
|
|
|
using Cyber.Entities.SyncBases;
|
|
|
|
|
|
2017-05-13 21:54:14 +02:00
|
|
|
|
namespace Cyber.Items {
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// An item, containing itemmy information.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Item {
|
2017-05-15 21:30:12 +02:00
|
|
|
|
public delegate void ItemAction(Character host);
|
2017-05-13 21:54:14 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ID of the item, used in <see cref="ItemDB"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public readonly int ID;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Model ID of this item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int ModelID;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Name of the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Description of the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Description;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The weight of the item (in kg).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Weight;
|
|
|
|
|
|
2017-05-14 22:28:55 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The slot in which the item can be equipped to.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public EquipSlot Slot;
|
|
|
|
|
|
2017-05-15 21:30:12 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The function that is ran when the item is used.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ItemAction Action;
|
|
|
|
|
|
2017-05-13 21:54:14 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates an item. This should technically be only called by ItemDB, but it's public because of "reasons".
|
|
|
|
|
/// </summary>
|
2017-05-14 22:28:55 +02:00
|
|
|
|
/// <param name="id">ID of the item.</param>
|
2017-05-13 21:54:14 +02:00
|
|
|
|
/// <param name="modelId">ModelID of the item, see ModelDB.</param>
|
2017-05-14 22:28:55 +02:00
|
|
|
|
/// <param name="name">The name if the item.</param>
|
|
|
|
|
/// <param name="weight">The Weight of the item.</param>
|
|
|
|
|
/// <param name="slot">The equip slot of the item.</param>
|
2017-05-13 21:54:14 +02:00
|
|
|
|
/// <param name="description">The description of the item.</param>
|
2017-05-15 21:30:12 +02:00
|
|
|
|
public Item(int id, int modelId, string name, float weight, EquipSlot slot, string description, ItemAction action = null) {
|
2017-05-13 21:54:14 +02:00
|
|
|
|
ID = id;
|
|
|
|
|
ModelID = modelId;
|
|
|
|
|
Name = name;
|
|
|
|
|
Weight = weight;
|
2017-05-14 22:28:55 +02:00
|
|
|
|
Slot = slot;
|
2017-05-13 21:54:14 +02:00
|
|
|
|
Description = description;
|
2017-05-15 21:30:12 +02:00
|
|
|
|
Action = action;
|
2017-05-13 21:54:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Clones the item, used mostly for <see cref="ItemDB.Get(int)"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public Item Clone() {
|
2017-05-15 21:30:12 +02:00
|
|
|
|
return new Item(ID, ModelID, Name, Weight, Slot, Description, Action);
|
2017-05-13 21:54:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|