private void OnSerialized(ConsumableEntry entry) { ISerializable value = entry.value; BinaryMemoryWriter writer = entry.writer; Item item = value as Item; if (item != null) { Save(item, writer); } else { Mobile mob = value as Mobile; if (mob != null) { Save(mob, writer); } else { BaseGuild guild = value as BaseGuild; if (guild != null) { Save(guild, writer); } } } }
public bool Use(ConsumableEntry consumable) { //consumable //Consumables.Find(x=>x == consumable) return(false); }
/// <summary> /// Adds a consumable to the inventory, constructing a new /// inventory item object, which holds the count. /// </summary> /// <param name="item"></param> public void Add(Consumable item, int count = 1) { var entry = new ConsumableEntry(item, count); // Now add it this.Add(entry); }
private void OnSerialized(ConsumableEntry entry) { ISerializable value = entry.value; BinaryMemoryWriter writer = entry.writer; if (value is Item item) { Save(item, writer); } else if (value is Mobile mob) { Save(mob, writer); } else if (value is BaseGuild guild) { Save(guild, writer); } }
/// <summary> /// Adds an item to the inventory /// </summary> /// <param name="entry"></param> public void Add(ConsumableEntry entry) { Consumables.Add(entry as ConsumableEntry); }
public void Remove(ConsumableEntry entry) { Consumables.Remove(entry); }