Esempio n. 1
0
        /// <summary>
        /// Helper to get specific enchantment based on param.
        /// </summary>
        /// <param name="param">Param of enchantment to retrieve.</param>
        /// <returns>EnchantmentSettings for specificed param or null if not found.</returns>
        public virtual EnchantmentSettings?GetEnchantmentSettings(EnchantmentParam param)
        {
            // Get all enchantment settings for this effect
            EnchantmentSettings[] allSettings = GetEnchantmentSettings();
            if (allSettings == null || allSettings.Length == 0)
            {
                return(null);
            }

            // Locate matching param
            bool usingCustomParam = !string.IsNullOrEmpty(param.CustomParam);

            foreach (EnchantmentSettings settings in allSettings)
            {
                if (usingCustomParam && param.CustomParam == settings.CustomParam)
                {
                    return(settings);
                }
                else if (!usingCustomParam && param.ClassicParam == settings.ClassicParam)
                {
                    return(settings);
                }
            }

            return(null);
        }
 public ForcedEnchantment(string key, short classicParam = -1)
 {
     this.key = key;
     param    = new EnchantmentParam()
     {
         ClassicParam = classicParam, CustomParam = string.Empty
     };
 }