public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            if (Context.ExecutingActor.Rank >= RequiredRank)
            {
                R.Add(State);
            }
            return(R);
        }
Пример #2
0
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var Matches = new List <PossibleMatch>();

            foreach (var Matcher in Matchers)
            {
                Matches.AddRange(Matcher.Match(State, Context));
            }
            return(Matches);
        }
Пример #3
0
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            if (Filter(State, Context))
            {
                R.Add(State);
            }
            return(R);
        }
Пример #4
0
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            if (State.Next != null)
            {
                var match = new PossibleMatch(State.Arguments, State.Next.Next);
                match.Arguments.Upsert(ArgumentName, State.Next.Value);
                R.Add(match);
            }
            return(R);
        }
Пример #5
0
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            if (State.Next != null && State.Next.Value.ToUpper() == Word)
            {
                R.Add(new PossibleMatch(State.Arguments, State.Next.Next));
            }
            if (Optional)
            {
                R.Add(new PossibleMatch(State.Arguments, State.Next));
            }
            return(R);
        }
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var r = new List <PossibleMatch>();

            if (State.Next == null)
            {
                return(r);
            }

            if (Link.IsCardinal(State.Next.Value.ToUpper()))
            {
                var match = new PossibleMatch(State.Arguments, State.Next.Next);
                match.Arguments.Upsert(ArgumentName, Link.ToCardinal(State.Next.Value.ToUpper()));
                r.Add(match);
            }
            return(r);
        }
Пример #7
0
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var Matches = new List <PossibleMatch>();

            Matches.Add(State);
            foreach (var Matcher in Matchers)
            {
                var NextMatches = new List <PossibleMatch>();
                foreach (var Match in Matches)
                {
                    NextMatches.AddRange(Matcher.Match(Match, Context));
                }
                Matches = NextMatches;
                if (Matches.Count == 0)
                {
                    return(Matches);                                    //Shortcircuit for when no matches are found.
                }
            }
            return(Matches);
        }
Пример #8
0
        public List <PossibleMatch> Match(PossibleMatch State, CommandParser.MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            if (State.Next == null)
            {
                return(R);
            }

            if ((Settings & ObjectMatcherSettings.UnderstandMe) == ObjectMatcherSettings.UnderstandMe)
            {
                if (State.Next.Value.ToUpper() == "ME")
                {
                    var possibleMatch = new PossibleMatch(State.Arguments, State.Next.Next);
                    possibleMatch.Arguments.Upsert(CaptureName, Context.ExecutingActor);
                    R.Add(possibleMatch);
                }
            }

            foreach (var thing in ObjectSource.GetObjects(State, Context))
            {
                var  possibleMatch = new PossibleMatch(State.Arguments, State.Next);
                bool matched       = false;
                while (possibleMatch.Next != null && thing.Nouns.Contains(possibleMatch.Next.Value.ToUpper()))
                {
                    matched            = true;
                    possibleMatch.Next = possibleMatch.Next.Next;
                }

                if (matched)
                {
                    possibleMatch.Arguments.Upsert(CaptureName, thing);
                    R.Add(possibleMatch);
                }
            }
            return(R);
        }
Пример #9
0
 public List <IMatchable> GetObjects(PossibleMatch State, CommandParser.MatchContext Context)
 {
     return(new List <IMatchable>(Context.ObjectsInScope.Select(t => t as IMatchable)));
 }