Пример #1
0
        /// <summary>
        /// Creates a new potion and adds it to the Prototype cache
        /// </summary>
        /// <returns>The new prototype item</returns>
        public static ItemPotion NewPrototype()
        {
            var newItem = new ItemPotion();

            DataAccess.Add <ItemPotion>(newItem, CacheType.Prototype);
            return(newItem);
        }
Пример #2
0
        /// <summary>
        /// Copies this potion's properties to another potion.
        /// </summary>
        /// <param name="item">The potion to copy to.</param>
        /// <remarks>Doesn't copy IDs or cache type.</remarks>
        public virtual void CopyTo(ItemPotion item)
        {
            if (item == null)
            {
                return;
            }

            base.CopyTo(item);

            if (PoolRestoration != null)
            {
                PoolRestoration.CopyTo(item.PoolRestoration);
            }
            else
            {
                item.PoolRestoration = null;
            }

            if (item.Effect != null)
            {
                item.Effect = Effect;
            }
            else
            {
                item.Effect = null;
            }
        }
Пример #3
0
        /// <summary>
        /// Creates a new potion and adds it to the Instance cache
        /// </summary>
        /// <param name="withPrototype">Whether to also create a backing prototype.</param>
        /// <returns>The new instanced item</returns>
        public static ItemPotion NewInstance(bool withPrototype)
        {
            ItemPotion newItem = new ItemPotion();

            if (withPrototype)
            {
                var newProto = NewPrototype();
                newItem.Prototype = newProto.Prototype;
            }

            DataAccess.Add <ItemPotion>(newItem, CacheType.Instance);

            return(newItem);
        }