示例#1
0
        public IMCommands()
        {
            _commandParser.AddCommand("alerts", "al", this.DoAlertsCommand);
            _commandParser.AddCommand("notifications", "not", this.DoNotificationsCommand);
            _commandParser.AddCommand("help", "h", this.DoHelpCommand);
            _commandParser.AddCommand("status", "?", this.DoStatusCommand);
            _commandParser.AddCommand("record", "r", this.DoRecordCommand);
            _commandParser.AddCommand("cancel", "ca", delegate(IMBotConversation conversation, IList <string> arguments) { return(DoCancelCommand(conversation, arguments, true)); });
            _commandParser.AddCommand("uncancel", "un", delegate(IMBotConversation conversation, IList <string> arguments) { return(DoCancelCommand(conversation, arguments, false)); });
            _commandParser.AddCommand("television", "tv", this.DoTelevisionCommand);
            _commandParser.AddCommand("radio", this.DoRadioCommand);
            CommandParser showParser = _commandParser.AddCommand("show");

            showParser.AddCommand("groups", "gr", this.DoShowChannelGroupsCommand);
            showParser.AddCommand("channels", "ch", this.DoShowChannelsCommand);
            showParser.AddCommand("guide", "g", this.DoShowGuideCommand);
            _commandParser.AddCommand("gr", this.DoShowChannelGroupsCommand);
            _commandParser.AddCommand("ch", this.DoShowChannelsCommand);
            _commandParser.AddCommand("g", this.DoShowGuideCommand);
            AddUpcomingIMCommands(showParser.AddCommand("upcoming", "up"));
            AddUpcomingIMCommands(_commandParser.AddCommand("up"));
            _commandParser.AddCommand("search", "s", this.DoSearchCommand);
            _commandParser.AddCommand("del", this.DoDeleteScheduleCommand);
            CommandParser deleteParser = _commandParser.AddCommand("delete");

            deleteParser.AddCommand("schedule", this.DoDeleteScheduleCommand);
        }
示例#2
0
文件: ReadLog.cs 项目: SinaC/RMUD
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             KeyWord("!LOG"),
             Path("FILENAME"),
             Optional(Number("COUNT"))))
     .Manual("Displays the last COUNT lines of a log file. If no count is provided, 20 lines are displayed.")
     .ProceduralRule((match, actor) =>
     {
         int count = 20;
         if (match.ContainsKey("COUNT"))
         {
             count = (match["COUNT"] as int?).Value;
         }
         var filename = match["FILENAME"].ToString() + ".log";
         if (System.IO.File.Exists(filename))
         {
             foreach (var line in new ReverseLineReader(filename).Take(count).Reverse())
             {
                 MudObject.SendMessage(actor, line);
             }
         }
         else
         {
             MudObject.SendMessage(actor, "I could not find that log file.");
         }
         return(PerformResult.Continue);
     });
 }
示例#3
0
文件: Move.cs 项目: SinaC/RMUD
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("!MOVE"),
                    MustMatch("I don't see that here.",
                              Object("OBJECT", InScope)),
                    OptionalKeyWord("TO"),
                    MustMatch("You have to specify the path of the destination.",
                              Path("DESTINATION"))))
            .Manual("An administrative command to move objects from one place to another. This command entirely ignores all rules that might prevent moving an object.")
            .ProceduralRule((match, actor) =>
            {
                var destination = MudObject.GetObject(match["DESTINATION"].ToString());
                if (destination != null)
                {
                    var target = match["OBJECT"] as MudObject;
                    Core.MarkLocaleForUpdate(target);
                    MudObject.Move(target, destination);
                    Core.MarkLocaleForUpdate(destination);

                    MudObject.SendMessage(actor, "Success.");
                }
                else
                {
                    MudObject.SendMessage(actor, "I could not find the destination.");
                }
                return(PerformResult.Continue);
            });
        }
示例#4
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         new KeyWord("LOOK", false),
         new LookProcessor(),
         "Look around at your suroundings.");
 }
示例#5
0
文件: Jump.cs 项目: Blecki/RMUDReboot
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(KeyWord("JUMP"))
     .ID("Skogard:Jump")
     .Manual("Why not jump?")
     .Perform("jump", "ACTOR");
 }
示例#6
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             RequiredRank(500),
             KeyWord("!RULES"),
             Optional(Object("OBJECT", InScope)),
             Optional(Rest("BOOK-NAME"))))
     .Manual("Lists rules and rulebooks. Both arguments are optional. If no object is supplied, it will list global rules. If no book name is supplied, it will list books rather than listing rules.")
     .ProceduralRule((match, actor) =>
     {
         if (match.ContainsKey("OBJECT"))
         {
             if (match.ContainsKey("BOOK-NAME"))
             {
                 DisplaySingleBook(actor, (match["OBJECT"] as MudObject).Rules, match["BOOK-NAME"].ToString());
             }
             else
             {
                 DisplayBookList(actor, (match["OBJECT"] as MudObject).Rules);
             }
         }
         else if (match.ContainsKey("BOOK-NAME"))
         {
             DisplaySingleBook(actor, Core.GlobalRules.Rules, match["BOOK-NAME"].ToString());
         }
         else
         {
             DisplayBookList(actor, Core.GlobalRules.Rules);
         }
         return(PerformResult.Continue);
     });
 }
示例#7
0
文件: Instance.cs 项目: SinaC/RMUD
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             RequiredRank(500),
             KeyWord("!INSTANCE"),
             MustMatch("It helps if you give me a path.",
                       Path("PATH"))))
     .Manual("Given a path, create a new instance of an object.")
     .ProceduralRule((match, actor) =>
     {
         var path      = match["PATH"].ToString();
         var newObject = MudObject.GetObject(path + "@" + Guid.NewGuid().ToString());
         if (newObject == null)
         {
             MudObject.SendMessage(actor, "Failed to instance " + path + ".");
         }
         else
         {
             MudObject.Move(newObject, actor);
             MudObject.SendMessage(actor, "Instanced " + path + ".");
         }
         return(PerformResult.Continue);
     });
 }
示例#8
0
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Sequence(
                    KeyWord("LOGIN"),
                    MustMatch("You must supply a username.",
                              SingleWord("USERNAME"))))
            .Manual("If you got this far, you know how to login.")
            .ProceduralRule((match, actor) =>
            {
                if (actor.ConnectedClient == null)
                {
                    return(PerformResult.Stop);
                }

                if (actor.ConnectedClient is NetworkClient && (actor.ConnectedClient as NetworkClient).IsLoggedOn)
                {
                    MudObject.SendMessage(actor, "You are already logged in.");
                    return(PerformResult.Stop);
                }

                var userName = match["USERNAME"].ToString();

                actor.CommandHandler = new PasswordCommandHandler(actor, Authenticate, userName);
                return(PerformResult.Continue);
            });
        }
示例#9
0
文件: Version.cs 项目: SinaC/RMUD
        public override void Create(CommandParser Parser)
        {
            Core.StandardMessage("version", "Build: RMUD Hadad <s0>");
            Core.StandardMessage("commit", "Commit: <s0>");
            Core.StandardMessage("no commit", "Commit version not found.");

            Parser.AddCommand(
                Or(
                    KeyWord("VERSION"),
                    KeyWord("VER")))
            .Manual("Displays the server version currently running.")
            .ProceduralRule((match, actor) =>
            {
                var buildVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                MudObject.SendMessage(actor, "@version", buildVersion);

                if (System.IO.File.Exists("version.txt"))
                {
                    MudObject.SendMessage(actor, "@commit", System.IO.File.ReadAllText("version.txt"));
                }
                else
                {
                    MudObject.SendMessage(actor, "@no commit");
                }

                foreach (var module in Core.IntegratedModules)
                {
                    MudObject.SendMessage(actor, module.Info.Description);
                }

                return(PerformResult.Continue);
            });
        }
示例#10
0
        public override void Create(CommandParser Parser)
        {
            Core.StandardMessage("version", "Build: RMUD Hadad <s0>");
            Core.StandardMessage("commit", "Commit: <s0>");
            Core.StandardMessage("no commit", "Commit version not found.");

            Parser.AddCommand(
                Or(
                    KeyWord("VERSION"),
                    KeyWord("VER")))
                .Manual("Displays the server version currently running.")
                .ProceduralRule((match, actor) =>
                {
                    var buildVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                    MudObject.SendMessage(actor, "@version", buildVersion);

                    if (System.IO.File.Exists("version.txt"))
                        MudObject.SendMessage(actor, "@commit", System.IO.File.ReadAllText("version.txt"));
                    else
                        MudObject.SendMessage(actor, "@no commit");

                    foreach (var module in Core.IntegratedModules)
                        MudObject.SendMessage(actor, module.Info.Description);

                    return PerformResult.Continue;
                });
        }
示例#11
0
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new KeyWord("LOOK", false),
				new LookProcessor(),
				"Look around at your suroundings.");
		}
示例#12
0
文件: Go.cs 项目: SinaC/RMUD
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         FirstOf(
             Sequence(
                 KeyWord("GO"),
                 MustMatch("@unmatched cardinal", Cardinal("DIRECTION"))),
             Cardinal("DIRECTION")))
     .Manual("Move between rooms. 'Go' is optional, a raw cardinal works just as well.")
     .ProceduralRule((match, actor) =>
     {
         var direction = match["DIRECTION"] as Direction?;
         var location  = actor.Location as Room;
         var link      = location.EnumerateObjects().FirstOrDefault(thing => thing.GetPropertyOrDefault <bool>("portal?", false) && thing.GetPropertyOrDefault <Direction>("link direction", Direction.NOWHERE) == direction.Value);
         match.Upsert("LINK", link);
         return(PerformResult.Continue);
     }, "lookup link rule")
     .Check("can go?", "ACTOR", "LINK")
     .BeforeActing()
     .Perform("go", "ACTOR", "LINK")
     .AfterActing()
     .ProceduralRule((match, actor) =>
     {
         Core.MarkLocaleForUpdate(actor);
         Core.MarkLocaleForUpdate(match["LINK"] as MudObject);
         return(PerformResult.Continue);
     }, "Mark both sides of link for update rule");
 }
示例#13
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             Or(
                 KeyWord("WHISPER"),
                 KeyWord("TELL")),
             OptionalKeyWord("TO"),
             MustMatch("Whom?",
                       Object("PLAYER", new ConnectedPlayersObjectSource(), ObjectMatcherSettings.None)),
             MustMatch("Tell them what?", Rest("SPEECH"))))
     .Manual("Sends a private message to the player of your choice.")
     .ProceduralRule((match, actor) =>
     {
         if (System.Object.ReferenceEquals(actor, match["PLAYER"]))
         {
             MudObject.SendMessage(actor, "Talking to yourself?");
             return(PerformResult.Stop);
         }
         return(PerformResult.Continue);
     })
     .ProceduralRule((match, actor) =>
     {
         var player = match["PLAYER"] as Actor;
         MudObject.SendMessage(player, "[privately " + DateTime.Now + "] ^<the0> : \"" + match["SPEECH"].ToString() + "\"", actor);
         MudObject.SendMessage(actor, "[privately to <the0>] ^<the1> : \"" + match["SPEECH"].ToString() + "\"", player, actor);
         if (player.ConnectedClient is NetworkClient && (player.ConnectedClient as NetworkClient).IsAfk)
         {
             MudObject.SendMessage(actor, "^<the0> is afk : " + player.ConnectedClient.Player.GetProperty <Account>("account").AFKMessage, player);
         }
         return(PerformResult.Continue);
     });
 }
示例#14
0
文件: Alias.cs 项目: SinaC/RMUD
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Sequence(
                    KeyWord("ALIAS"),
                    SingleWord("NAME"),
                    Rest("RAW-COMMAND")))
            .Manual("Create an alias for another command, or a series of them.")
            .ProceduralRule((match, actor) =>
            {
                if (!actor.HasProperty <Dictionary <String, String> >("aliases"))
                {
                    actor.SetProperty("aliases", new Dictionary <String, String>());
                }
                var aliases = actor.GetProperty <Dictionary <String, String> >("aliases");
                aliases.Add(match["NAME"].ToString().ToUpper(), match["RAW-COMMAND"].ToString());
                MudObject.SendMessage(actor, "Alias added.");
                return(PerformResult.Continue);
            });

            Parser.AddCommand(
                Generic((match, context) =>
            {
                var r = new List <PossibleMatch>();
                if (!context.ExecutingActor.HasProperty <Dictionary <String, String> >("aliases"))
                {
                    return(r);
                }
                var aliases = context.ExecutingActor.GetProperty <Dictionary <String, String> >("aliases");
                if (aliases.ContainsKey(match.Next.Value.ToUpper()))
                {
                    r.Add(match.AdvanceWith("ALIAS", aliases[match.Next.Value.ToUpper()]));
                }
                return(r);
            }, "<ALIAS NAME>"))
            .Manual("Execute an alias.")
            .ProceduralRule((match, actor) =>
            {
                var commands = match["ALIAS"].ToString().Split(';');
                foreach (var command in commands)
                {
                    Core.EnqueuActorCommand(actor, command);
                }
                return(PerformResult.Continue);
            });
        }
示例#15
0
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(KeyWord("SONAR"))
            .ProceduralRule((match, actor) =>
            {
                var builder = new System.Text.StringBuilder();

                var mapGrid = new int[MapWidth, MapHeight];
                for (int y = 0; y < MapHeight; ++y)
                {
                    for (int x = 0; x < MapWidth; ++x)
                    {
                        mapGrid[x, y] = ' ';
                    }
                }

                for (int y = 1; y < MapHeight - 1; ++y)
                {
                    mapGrid[0, y]            = '|';
                    mapGrid[MapWidth - 1, y] = '|';
                }

                for (int x = 1; x < MapWidth - 1; ++x)
                {
                    mapGrid[x, 0]             = '-';
                    mapGrid[x, MapHeight - 1] = '-';
                }

                mapGrid[0, 0]                        = '+';
                mapGrid[0, MapHeight - 1]            = '+';
                mapGrid[MapWidth - 1, 0]             = '+';
                mapGrid[MapWidth - 1, MapHeight - 1] = '+';

                var roomLegend = new Dictionary <int, String>();

                if (actor.Location is RMUD.Room)
                {
                    MapLocation(mapGrid, roomLegend, (MapWidth / 2), (MapHeight / 2), actor.Location as RMUD.Room, '@');
                }

                for (int y = 0; y < MapHeight; ++y)
                {
                    for (int x = 0; x < MapWidth; ++x)
                    {
                        builder.Append((char)mapGrid[x, y]);
                    }
                    builder.Append("\r\n");
                }

                foreach (var entry in roomLegend)
                {
                    builder.Append((char)entry.Key + " - " + entry.Value + "\r\n");
                }

                MudObject.SendMessage(actor, builder.ToString());
                return(RMUD.PerformResult.Continue);
            }, "Implement sonar device rule.");
        }
示例#16
0
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("!RELOAD"),
                    MustMatch("It helps if you give me a path.",
                              Path("TARGET"))))
            .Manual("Given a path, it attempts to recompile that object. The object will be replaced in-place if possible.")
            .ProceduralRule((match, actor) =>
            {
                var target    = match["TARGET"].ToString();
                var newObject = Core.Database.ReloadObject(target);
                if (newObject == null)
                {
                    MudObject.SendMessage(actor, "Failed to reload " + target);
                }
                else
                {
                    MudObject.SendMessage(actor, "Reloaded " + target);
                }
                return(PerformResult.Continue);
            });

            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("!RESET"),
                    MustMatch("It helps if you give me a path.",
                              Path("TARGET"))))
            .Manual("Given a path, it attempts to reset that object without reloading or recompiling. The object will be replaced in-place if possible.")
            .ProceduralRule((match, actor) =>
            {
                var target = match["TARGET"].ToString();
                if (Core.Database.ResetObject(target) == null)
                {
                    MudObject.SendMessage(actor, "Failed to reset " + target);
                }
                else
                {
                    MudObject.SendMessage(actor, "Reset " + target);
                }
                return(PerformResult.Continue);
            });
        }
示例#17
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         new Sequence(
             new KeyWord("GO", true),
             new Cardinal("DIRECTION")),
         new GoProcessor(),
         "Move between rooms.");
 }
示例#18
0
文件: Man.cs 项目: Blecki/RMUDReboot
        public override void Create(CommandParser Parser)
        {
            Core.StandardMessage("help topics", "Available help topics");
            Core.StandardMessage("no help topic", "There is no help available for that topic.");

            Parser.AddCommand(
                Sequence(
                    Or(
                        KeyWord("HELP"),
                        KeyWord("MAN"),
                        KeyWord("?")),
                    Optional(Rest("TOPIC"))))
            .ID("Meta:Man")
            .Manual("This is the command you typed to get this message.")
            .ProceduralRule((match, actor) =>
            {
                if (!match.ContainsKey("TOPIC"))
                {
                    Core.SendMessage(actor, "@help topics");
                    var line = "";
                    foreach (var manPage in ManPages.Pages.Select(p => p.Name).Distinct().OrderBy(s => s))
                    {
                        line += manPage;
                        if (line.Length < 20)
                        {
                            line += new String(' ', 20 - line.Length);
                        }
                        else if (line.Length < 40)
                        {
                            line += new String(' ', 40 - line.Length);
                        }
                        else
                        {
                            Core.SendMessage(actor, line);
                            line = "";
                        }
                    }
                }
                else
                {
                    var manPageName = match["TOPIC"].ToString().ToUpper();
                    var pages       = new List <ManPage>(ManPages.Pages.Where(p => p.Name == manPageName));
                    if (pages.Count > 0)
                    {
                        foreach (var manPage in pages)
                        {
                            manPage.SendManPage(actor);
                        }
                    }
                    else
                    {
                        Core.SendMessage(actor, "@no help topic");
                    }
                }
                return(PerformResult.Continue);
            });
        }
示例#19
0
文件: Examine.cs 项目: SinaC/RMUD
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(Or(KeyWord("EXAMINE"), KeyWord("X")))
            .Manual("Take a detailed look at your surroundings.")
            .Perform("examine", "ACTOR");

            Parser.AddCommand(
                Sequence(
                    Or(
                        Or(KeyWord("EXAMINE"), KeyWord("X")),
                        Sequence(
                            Or(KeyWord("LOOK"), KeyWord("L")),
                            KeyWord("AT"))),
                    MustMatch("@dont see that", Object("OBJECT", InScope))))
            .Manual("Take a close look at an object.")
            .Check("can examine?", "ACTOR", "OBJECT")
            .Perform("describe", "ACTOR", "OBJECT");
        }
示例#20
0
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Or(
					new KeyWord("HELP", false),
					new KeyWord("?", false)),
				new HelpProcessor(),
				"Display a list of all defined commands.");
		}
示例#21
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         new Or(
             new KeyWord("HELP", false),
             new KeyWord("?", false)),
         new HelpProcessor(),
         "Display a list of all defined commands.");
 }
示例#22
0
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new KeyWord("GO", true),
					new Cardinal("DIRECTION")),
				new GoProcessor(),
				"Move between rooms.");
		}
示例#23
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Or(
             KeyWord("LOOK"),
             KeyWord("L")))
     .Manual("Displays a description of your location, and lists what else is present there.")
     .ProceduralRule((match, actor) => Core.GlobalRules.ConsiderPerformRule("describe locale", actor, actor.Location));
 }
示例#24
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         new Sequence(
             new KeyWord("DROP", false),
             new ObjectMatcher("TARGET", new InScopeObjectSource())),
         new DropProcessor(),
         "Drop something");
 }
示例#25
0
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new KeyWord("DROP", false),
					new ObjectMatcher("TARGET", new InScopeObjectSource())),
				new DropProcessor(),
				"Drop something");
		}
示例#26
0
文件: Say.cs 项目: SinaC/RMUD
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Or(
                    Sequence(
                        Or(
                            KeyWord("SAY"),
                            KeyWord("'")),
                        MustMatch("@say what", Rest("SPEECH"))),
                    Generic((pm, context) =>
            {
                var r = new List <PossibleMatch>();
                if (pm.Next == null || pm.Next.Value.Length <= 1 || pm.Next.Value[0] != '\'')
                {
                    return(r);
                }

                pm.Next.Value = pm.Next.Value.Substring(1);         //remove the leading '

                var builder = new StringBuilder();
                var node    = pm.Next;
                for (; node != null; node = node.Next)
                {
                    builder.Append(node.Value);
                    builder.Append(" ");
                }

                builder.Remove(builder.Length - 1, 1);
                r.Add(pm.EndWith("SPEECH", builder.ToString()));
                return(r);
            }, "'[TEXT => SPEECH]")))
            .Manual("Speak within your locale.")
            .Perform("speak", "ACTOR", "SPEECH");


            Parser.AddCommand(
                Sequence(
                    Or(
                        KeyWord("EMOTE"),
                        KeyWord("\"")),
                    MustMatch("@emote what", Rest("SPEECH"))))
            .Manual("Perform an action, visible within your locale.")
            .Perform("emote", "ACTOR", "SPEECH");
        }
示例#27
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         new Or(
             new KeyWord("i", false),
             new KeyWord("inv", false),
             new KeyWord("inventory", false)),
         new InventoryProcessor(),
         "See what you are carrying.");
 }
示例#28
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Or(
             KeyWord("INVENTORY"),
             KeyWord("INV"),
             KeyWord("I")))
     .Manual("Displays what you are wearing and carrying.")
     .Perform("inventory", "ACTOR");
 }
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Or(
					new KeyWord("i", false),
					new KeyWord("inv", false),
					new KeyWord("inventory", false)),
				new InventoryProcessor(),
				"See what you are carrying.");
		}
示例#30
0
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                KeyWord("BANS"))
            .Manual("Lists all active bans.")
            .ProceduralRule((match, actor) =>
            {
                MudObject.SendMessage(actor, "~~~ ALL SET BANS ~~~");
                foreach (var proscription in Clients.ProscriptionList.Proscriptions)
                {
                    MudObject.SendMessage(actor, proscription.Glob + " : " + proscription.Reason);
                }
                return(PerformResult.Continue);
            });

            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("BAN"),
                    MustMatch("You must supply an ip mask.", SingleWord("GLOB")),
                    MustMatch("You must supply a reason.", Rest("REASON"))))
            .Manual("Ban every player who's ip matches the mask.")
            .ProceduralRule((match, actor) =>
            {
                Clients.ProscriptionList.Ban(match["GLOB"].ToString(), match["REASON"].ToString());
                Clients.SendGlobalMessage("^<the0> has banned " + match["GLOB"].ToString(), actor);
                return(PerformResult.Continue);
            });

            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("UNBAN"),
                    MustMatch("You must supply an ip mask.", SingleWord("GLOB"))))
            .Manual("Remove an existing ban.")
            .ProceduralRule((match, actor) =>
            {
                Clients.ProscriptionList.RemoveBan(match["GLOB"].ToString());
                Clients.SendGlobalMessage("^<the0> removes the ban on " + match["GLOB"].ToString(), actor);
                return(PerformResult.Continue);
            });
        }
示例#31
0
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                new Sequence(
                    new Or(
                        new KeyWord("SAY", false),
                        new KeyWord("'", false)),
                    new Rest("SPEECH")),
                new SayProcessor(SayProcessor.EmoteTypes.Speech),
                "Say something.");

            Parser.AddCommand(
                new Sequence(
                    new Or(
                        new KeyWord("EMOTE", false),
                        new KeyWord("\"", false)),
                    new Rest("SPEECH")),
                new SayProcessor(SayProcessor.EmoteTypes.Emote),
                "Emote something.");
        }
示例#32
0
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("SAY", false),
						new KeyWord("'", false)),
					new Rest("SPEECH")),
				new SayProcessor(SayProcessor.EmoteTypes.Speech),
				"Say something.");

			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("EMOTE", false),
						new KeyWord("\"", false)),
					new Rest("SPEECH")),
				new SayProcessor(SayProcessor.EmoteTypes.Emote),
				"Emote something.");
		}
示例#33
0
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new RankGate(500),
					new KeyWord("MOVE", false),
					new ObjectMatcher("TARGET", new InScopeObjectSource()),
					new KeyWord("TO", true),
					new Path("DESTINATION"))
				, new MoveProcessor(),
				"Teleport an object to a new location. Bypasses take rules.");
		}
示例#34
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         new Sequence(
             new RankGate(500),
             new KeyWord("MOVE", false),
             new ObjectMatcher("TARGET", new InScopeObjectSource()),
             new KeyWord("TO", true),
             new Path("DESTINATION"))
         , new MoveProcessor(),
         "Teleport an object to a new location. Bypasses take rules.");
 }
示例#35
0
文件: Inspect.cs 项目: SinaC/RMUD
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("!INSPECT"),
                    MustMatch("I don't see that here.",
                              Or(
                                  Object("OBJECT", InScope),
                                  KeyWord("HERE")))))
            .Manual("Take a peek at the internal workings of any mud object.")
            .ProceduralRule((match, actor) =>
            {
                if (!match.ContainsKey("OBJECT"))
                {
                    match.Upsert("OBJECT", actor.Location);
                }
                return(PerformResult.Continue);
            }, "Convert locale option to standard form rule.")
            .ProceduralRule((match, actor) =>
            {
                var target = match["OBJECT"] as MudObject;
                MudObject.SendMessage(actor, target.GetType().Name);

                foreach (var @interface in target.GetType().GetInterfaces())
                {
                    MudObject.SendMessage(actor, "Implements " + @interface.Name);
                }

                foreach (var field in target.GetType().GetFields())
                {
                    MudObject.SendMessage(actor, "field " + field.FieldType.Name + " " + field.Name + " = " + WriteValue(field.GetValue(target)));
                }

                foreach (var property in target.GetType().GetProperties())
                {
                    var s = (property.CanWrite ? "property " : "readonly ") + property.PropertyType.Name + " " + property.Name;
                    if (property.CanRead)
                    {
                        s += " = ";
                        try
                        {
                            s += WriteValue(property.GetValue(target, null));
                        }
                        catch (Exception) { s += "[Error reading value]"; }
                    }
                    MudObject.SendMessage(actor, s);
                }

                return(PerformResult.Continue);
            }, "List all the damn things rule.");
        }
示例#36
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             Or(
                 KeyWord("LOOK"),
                 KeyWord("L")),
             RelativeLocation("RELLOC"),
             Object("OBJECT", InScope)))
     .Manual("Lists object that are in, on, under, or behind the object specified.")
     .Check("can look relloc?", "ACTOR", "OBJECT", "RELLOC")
     .Perform("look relloc", "ACTOR", "OBJECT", "RELLOC");
 }
示例#37
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             KeyWord("WEAR"),
             BestScore("OBJECT",
                       MustMatch("@clothing wear what",
                                 Object("OBJECT", InScope, PreferHeld)))))
     .Manual("Cover your disgusting flesh.")
     .Check("can wear?", "ACTOR", "OBJECT")
     .BeforeActing()
     .Perform("worn", "ACTOR", "OBJECT")
     .AfterActing();
 }
示例#38
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         Sequence(
             KeyWord("REMOVE"),
             BestScore("OBJECT",
                       MustMatch("@clothing remove what",
                                 Object("OBJECT", InScope, PreferWorn)))))
     .Manual("Expose your amazingly supple flesh.")
     .Check("can remove?", "ACTOR", "OBJECT")
     .BeforeActing()
     .Perform("removed", "ACTOR", "OBJECT")
     .AfterActing();
 }
示例#39
0
 public override void Create(CommandParser Parser)
 {
     Parser.AddCommand(
         KeyWord("!DUMPMESSAGES"))
         .Manual("Dump defined messages to messages.txt")
         .ProceduralRule((match, actor) =>
         {
             var builder = new StringBuilder();
             Core.DumpMessagesForCustomization(builder);
             System.IO.File.WriteAllText("messages.txt", builder.ToString());
             MudObject.SendMessage(actor, "Messages dumped to messages.txt.");
             return PerformResult.Continue;
         });
 }
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new RankGate(500),
					new Or(
						new KeyWord("INSPECT", false),
						new KeyWord("INS", false),
						new KeyWord("P", false)),
					new Or(
						new ObjectMatcher("TARGET", new InScopeObjectSource()),
						new KeyWord("HERE", false)))
				, new InspectProcessor(),
				"Inspect internal properties of an object.");
		}
		public override void Create(CommandParser Parser)
		{
			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("LOOK", false),
						new KeyWord("EXAMINE", false),
						new KeyWord("X", false)),
					new KeyWord("AT", true),
					new ObjectMatcher("TARGET", new InScopeObjectSource())),
				new ExamineProcessor(),
				"Look closely at an object.");

			Parser.AddCommand(
				new Sequence(
					new Or(
						new KeyWord("LOOK", false),
						new KeyWord("EXAMINE", false),
						new KeyWord("X", false)),
					new KeyWord("AT", true),
					new Rest("ERROR"))
				, new ReportError("I don't see that here.\r\n"),
				"Error reporting command");
		}
示例#42
0
文件: Man.cs 项目: Reddit-Mud/RMUD
        public override void Create(CommandParser Parser)
        {
            Core.StandardMessage("help topics", "Available help topics");
            Core.StandardMessage("no help topic", "There is no help available for that topic.");

            Parser.AddCommand(
                Sequence(
                    Or(
                        KeyWord("HELP"),
                        KeyWord("MAN"),
                        KeyWord("?")),
                    Optional(Rest("TOPIC"))))
                .Manual("This is the command you typed to get this message.")
                .ProceduralRule((match, actor) =>
                {
                    if (!match.ContainsKey("TOPIC"))
                    {
                        MudObject.SendMessage(actor, "@help topics");
                        var line = "";
                        foreach (var manPage in ManPages.Pages.Select(p => p.Name).Distinct().OrderBy(s => s))
                        {
                            line += manPage;
                            if (line.Length < 20) line += new String(' ', 20 - line.Length);
                            else if (line.Length < 40) line += new String(' ', 40 - line.Length);
                            else
                            {
                                MudObject.SendMessage(actor, line);
                                line = "";
                            }
                        }
                    }
                    else
                    {
                        var manPageName = match["TOPIC"].ToString().ToUpper();
                        var pages = new List<ManPage>(ManPages.Pages.Where(p => p.Name == manPageName));
                        if (pages.Count > 0)
                            foreach (var manPage in pages)
                                manPage.SendManPage(actor);
                        else
                            MudObject.SendMessage(actor, "@no help topic");

                    }
                    return PerformResult.Continue;
                });
        }
示例#43
0
 private void AddUpcomingIMCommands(CommandParser showUpcomingParser)
 {
     showUpcomingParser.AddCommand("recordings", "r", delegate(IMBotConversation conversation, IList<string> arguments) { return DoShowUpcomingCommand(conversation, ScheduleType.Recording); });
     showUpcomingParser.AddCommand("alerts", "a", delegate(IMBotConversation conversation, IList<string> arguments) { return DoShowUpcomingCommand(conversation, ScheduleType.Alert); });
     showUpcomingParser.AddCommand("suggestions", "s", delegate(IMBotConversation conversation, IList<string> arguments) { return DoShowUpcomingCommand(conversation, ScheduleType.Suggestion); });
 }