public CommandEntry AddCommand(CommandTokenMatcher Matcher) { var Entry = new CommandEntry { Matcher = Matcher }; Entry.ManualName = Matcher.FindFirstKeyWord(); Commands.Add(Entry); return Entry; }
public static void ProcessPlayerCommand(CommandEntry Command, PossibleMatch Match, Actor Actor) { ExecutingCommand = Match; try { ExecuteCommand(Command, Match, Actor); } finally { ExecutingCommand = null; } }
public MatchedCommand(CommandEntry Command, PossibleMatch Match) { this.Command = Command; this.Match = Match; }
public void AddCommand(ICommandTokenMatcher Matcher, ICommandProcessor Processor, String HelpText) { var Entry = new CommandEntry { Matcher = Matcher, Processor = Processor, HelpText = HelpText }; Commands.Add(Entry); }
/// <summary> /// Actually carryout the command, following all of it's rules, including the before and after command rules. /// </summary> /// <param name="Command"></param> /// <param name="Match"></param> /// <param name="Actor"></param> /// <returns>The result of the command's procedural rules.</returns> private static PerformResult ExecuteCommand(CommandEntry Command, PossibleMatch Match, Actor Actor) { var result = PerformResult.Stop; Match.Upsert("COMMAND", Command); if (GlobalRules.ConsiderMatchBasedPerformRule("before command", Match, Actor) == PerformResult.Continue) { result = Command.ProceduralRules.Consider(Match, Actor); GlobalRules.ConsiderMatchBasedPerformRule("after command", Match, Actor); } GlobalRules.ConsiderPerformRule("after every command", Actor); return result; }
public MatchedCommand(CommandEntry Command, IEnumerable<PossibleMatch> Matches) { this.Command = Command; if (Matches != null) this.Matches = new List<PossibleMatch>(Matches); else this.Matches = new List<PossibleMatch>(); }