Beispiel #1
0
        public override IEnumerable <string> ConfigErrors(LootAffixDef parentDef)
        {
            foreach (string configError in base.ConfigErrors(parentDef))
            {
                yield return(configError);
            }

            // Check for reflection errors
            FieldInfo field = AccessTools.Field(typeof(VerbProperties), affectedField);
            Type      type  = field.FieldType;

            if (!ConvertHelper.CanConvert(1f, type))
            {
                yield return("Unsupported type: " + type);
            }

            // ValueModifierSet sanity checks
            if (valueModifier == null)
            {
                yield return("The valueModifer is not set!");

                yield break;
            }

            foreach (string configError in valueModifier.ConfigErrors(parentDef, this))
            {
                yield return(configError);
            }
        }
        public override IEnumerable <string> ConfigErrors(LootAffixDef parentDef)
        {
            foreach (string configError in base.ConfigErrors(parentDef))
            {
                yield return(configError);
            }

            // affectedStat sanity checks
            if (affectedStat == null)
            {
                yield return("The affectedStat is not set!");

                yield break;
            }
            if (affectedStat.forInformationOnly)
            {
                yield return("The affectedStat is for information purposes only");
            }
            if (affectedStat.alwaysHide)
            {
                yield return("The affectedStat is always hidden");
            }

            // ValueModifierSet sanity checks
            if (valueModifier == null)
            {
                yield return("The valueModifer is not set!");

                yield break;
            }

            foreach (string configError in valueModifier.ConfigErrors(parentDef, this))
            {
                yield return(configError);
            }

            ValueModifierSet vm  = valueModifier;
            StatDef          ast = affectedStat;

            if (vm.preMinValue != -9999999f)
            {
                if (vm.preMinValue > ast.maxValue)
                {
                    yield return(string.Format("The preMinValue is higher than the affectedStat's maxValue: {0} > {1}", vm.preMinValue, ast.maxValue));
                }
                if (vm.preMinValue < ast.minValue)
                {
                    yield return(string.Format("The preMinValue is lower than the affectedStat's minValue: {0} < {1}", vm.preMinValue, ast.minValue));
                }
                if (vm.preMinValue == ast.minValue)
                {
                    yield return(string.Format("The preMinValue is equal than the affectedStat's minValue: {0}", vm.preMinValue));
                }
            }
            if (vm.minValue != -9999999f)
            {
                if (vm.minValue > ast.maxValue)
                {
                    yield return(string.Format("The minValue is higher than the affectedStat's maxValue: {0} > {1}", vm.minValue, ast.maxValue));
                }
                if (vm.minValue < ast.minValue)
                {
                    yield return(string.Format("The minValue is lower than the affectedStat's minValue: {0} < {1}", vm.minValue, ast.minValue));
                }
                if (vm.minValue == ast.minValue)
                {
                    yield return(string.Format("The minValue is equal than the affectedStat's minValue: {0}", vm.minValue));
                }
            }
            if (vm.maxValue != 9999999f)
            {
                if (vm.maxValue > ast.maxValue)
                {
                    yield return(string.Format("The maxValue is higher than the affectedStat's maxValue: {0} > {1}", vm.maxValue, ast.maxValue));
                }
                if (vm.maxValue < ast.minValue)
                {
                    yield return(string.Format("The maxValue is lower than the affectedStat's minValue: {0} < {1}", vm.maxValue, ast.minValue));
                }
                if (vm.maxValue == ast.maxValue)
                {
                    yield return(string.Format("The maxValue is equal than the affectedStat's maxValue: {0}", vm.maxValue));
                }
            }
        }