Exemple #1
0
        /// <summary>
        /// Creates a new static item and adds it to the Prototype cache
        /// </summary>
        /// <returns>The new prototype item</returns>
        public static ItemWeapon NewPrototype()
        {
            var newItem = new ItemWeapon();

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

            base.CopyTo(item);

            item.DamageType = DamageType;
            item.MinDamage  = MinDamage;
            item.MaxDamage  = MaxDamage;
            item.WeaponType = WeaponType;
        }
Exemple #3
0
        /// <summary>
        /// Creates a new weapon 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 ItemWeapon NewInstance(bool withPrototype)
        {
            ItemWeapon newItem = new ItemWeapon();

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

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

            return(newItem);
        }