Exemplo n.º 1
0
        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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool Use(ConsumableEntry consumable)
        {
            //consumable
            //Consumables.Find(x=>x == consumable)

            return(false);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Adds an item to the inventory
 /// </summary>
 /// <param name="entry"></param>
 public void Add(ConsumableEntry entry)
 {
     Consumables.Add(entry as ConsumableEntry);
 }
Exemplo n.º 6
0
 public void Remove(ConsumableEntry entry)
 {
     Consumables.Remove(entry);
 }