Beispiel #1
0
        internal static RangeDuration Parse(IniParser parser)
        {
            var token = parser.GetNextToken(IniParser.SeparatorsColon);

            if (parser.IsFloat(token))
            {
                var value = parser.ScanFloat(token);
                return(new RangeDuration
                {
                    Min = value,
                    Max = value
                });
            }

            if (token.Text.ToUpper() != "MIN")
            {
                throw new IniParseException($"Unexpected range duration: {token.Text}", token.Position);
            }

            var minValue = parser.ScanInteger(parser.GetNextToken());

            return(new RangeDuration
            {
                Min = minValue,
                Max = parser.ParseAttributeInteger("Max")
            });
        }
Beispiel #2
0
        private static T ParseModule <T>(IniParser parser, Dictionary <string, Func <IniParser, T> > moduleParseTable)
        {
            var moduleType = parser.GetNextToken();

            if (!moduleParseTable.TryGetValue(moduleType.Text, out var moduleParser))
            {
                throw new IniParseException($"Unknown module type: {moduleType.Text}", moduleType.Position);
            }

            return(moduleParser(parser));
        }
Beispiel #3
0
        private void ParseVeterancyGroupProperty(IniParser parser, Action <DamageFXGroup> callback)
        {
            var token = parser.GetNextToken();

            if (token.Text != "HEROIC")
            {
                throw new IniParseException($"Unexpected identifier: {token.Text}", token.Position);
            }

            ParseGroupProperty(parser, callback);
        }
Beispiel #4
0
        //represents values of type 1 : 1024 etc.
        internal static Probability Parse(IniParser parser)
        {
            var first  = parser.ParseInteger();
            var colon  = parser.GetNextToken();
            var second = parser.ParseInteger();

            return(new Probability
            {
                First = first,
                Second = second
            });
        }