Exemplo n.º 1
0
        private void OffCommand(IInvokeSource source, ParsedRequest request)
        {
            RequireModerator(source);

            if (!roundsManager.Enabled)
            {
                source.Reply("Bot is already disabled.");
            }
            else
            {
                source.Reply("Disabling bot...");
                roundsManager.Enabled = false;
            }
        }
Exemplo n.º 2
0
        private void StopCommand(IInvokeSource source, ParsedRequest request)
        {
            RequireModerator(source);

            if (!roundsManager.Enabled)
            {
                source.Reply("Bot is not enabled!");
            }
            else
            {
                source.Reply("Stopping round...");
                roundsManager.ForceStop();
            }
        }
Exemplo n.º 3
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireEdit();

            bool enabled;

            if (message.Count >= 1)
            {
                try
                {
                    enabled = Boolean.Parse(message.Args[0]);
                }
                catch (Exception ex)
                {
                    throw new CommandException("Unable to parse parameter: enabled", ex);
                }
            }
            else
            {
                enabled = !this.PlayerService.OwnPlayer.IsGod;
            }

            this.ActionService.GodMode(enabled);

            source.Reply("God mode was set to {0}.", enabled);
        }
Exemplo n.º 4
0
 private void Run(IInvokeSource source, ParsedCommand message)
 {
     this.RequireOwner();
     string key = message.GetTrail(0);
     this.RoomService.ChangeKey(key);
     source.Reply("Set key to {0}.", key);
 }
Exemplo n.º 5
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            Player player = this.PlayerService.MatchPlayer(message.Args[0]);

            this.Chatter.Unmute(player.Username);

            source.Reply("Unmuted {0}.", player.ChatName);
        }
Exemplo n.º 6
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            Player player = this.PlayerService.MatchPlayer(message.Args[0]);

            this.Chatter.ReportAbuse(player.Username, message.GetTrail(1));

            source.Reply("Reported {0}.", player.ChatName);
        }
Exemplo n.º 7
0
        protected override void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();

            var name = message.GetTrail(0);
            this.RoomService.SetName(name);
            source.Reply("Name changed to: {0}", name);
        }
Exemplo n.º 8
0
        public void Invoke(IInvokeSource source, ParsedCommand message)
        {
            var e = new InvokeEvent(source, message);
            this.Events.Raise(e);

            if (!e.Handled && source.Group >= this.ResponseMinGroup)
                source.Reply(UnknownCommandStr);
        }
Exemplo n.º 9
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();
            if (message.Count == 0 || message.Args[0] != "SAVE")
                throw new CommandException("To use save, type !save SAVE");

            this.RoomService.Save();
            source.Reply("Saved.");
        }
Exemplo n.º 10
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();

            if (message.Count == 0 || message.Args[0] != "CLEAR")
                throw new CommandException("To use clear, type !clear CLEAR");

            this.RoomService.Clear();
            source.Reply("Cleared level.");
        }
Exemplo n.º 11
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();
            Player player = this.GetPlayerOrSelf(source, message);
            this.RequireSameRank(source, player);

            this.Chatter.GiveEdit(player.Username);

            source.Reply("Gave edit to {0}.", player.ChatName);
        }
Exemplo n.º 12
0
        protected override void Run(IInvokeSource source, ParsedCommand message)
        {
            string key = String.Empty;

            if (message.Count >= 1)
                key = message.GetTrail(0);

            this.RoomService.Access(key);

            source.Reply("Access sent.");
        }
Exemplo n.º 13
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     if (message.Count >= 1)
     {
         string user = message.Args[0];
         this.PlayerService.MatchPlayer(user,
             player =>
                 source.Reply("{0}'s rank is {1}", player.ChatName, player.GetGroup()),
             username =>
                 source.Reply("{0} is now {1}.", PlayerUtils.GetChatName(username),
                     this.Host.GetPermission(PlayerUtils.GetStorageName(username))));
     }
     var playerSource = source as PlayerInvokeSource;
     if (playerSource != null)
     {
         source.Reply("{0}'s rank is {1}", playerSource.Player.ChatName, playerSource.Player.GetGroup());
     }
     else
     {
         throw new UnknownPlayerCommandException("No player was specified!");
     }
 }
Exemplo n.º 14
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            Smiley smiley;
            try
            {
                smiley = (Smiley)Enum.Parse(typeof(Smiley), message.Args[0], true);
            }
            catch (Exception ex)
            {
                throw new CommandException("Unable to parse parameter: smiley", ex);
            }

            this.ActionService.ChangeFace(smiley);

            source.Reply("Smiley set to {0}.", smiley);
        }
Exemplo n.º 15
0
        protected override void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();

            bool isAllowed;
            try
            {
                isAllowed = Boolean.Parse(message.Args[0]);
            }
            catch (Exception ex)
            {
                throw new CommandException("Unable to parse parameter: isAllowed", ex);
            }
            this.RoomService.SetAllowPotions(isAllowed);
            source.Reply("Potions enabled: {0}.", isAllowed);
        }
Exemplo n.º 16
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();

            bool isVisible;
            try
            {
                isVisible = Boolean.Parse(message.Args[0]);
            }
            catch (Exception ex)
            {
                throw new CommandException("Unable to parse parameter: isVisible", ex);
            }
            this.Chatter.ChangeVisibility(isVisible);
            source.Reply("Changed visibility to {0}.", isVisible);
        }
Exemplo n.º 17
0
        protected override void Run(IInvokeSource source, ParsedCommand message)
        {
            this.RequireOwner();
            Player player = this.PlayerService.MatchPlayer(message.Args[0]);
            this.RequireSameRank(source, player);

            if (message.Count >= 3)
            {
                int x = message.GetInt(1);
                int y = message.GetInt(2);

                this.Chatter.Teleport(player.Username, x, y);
            }
            else if (message.Count == 2)
            {
                try
                {
                    Player target = this.PlayerService.MatchPlayer(message.Args[1]);
                    this.Chatter.Teleport(player.Username, target.BlockX, target.BlockY);
                }
                catch (CommandException ex)
                {
                    throw new CommandException(ex.Message + " Parameter: target", ex);
                }
            }
            else
            {
                var playerSource = source as PlayerInvokeSource;
                if (playerSource != null)
                {
                    int x = playerSource.Player.BlockX;
                    int y = playerSource.Player.BlockX;

                    this.Chatter.Teleport(player.Username, x, y);
                }
                else
                {
                    this.Chatter.Teleport(player.Username);
                }
            }

            source.Reply("Teleported {0}.", player.ChatName);
        }
Exemplo n.º 18
0
        protected override void Run(IInvokeSource source, ParsedCommand message)
        {
            Potion pot;
            try
            {
                pot = (Potion)Enum.Parse(typeof(Potion), message.Args[0], true);
            }
            catch (Exception ex)
            {
                throw new CommandException("Unable to parse parameter: potion", ex);
            }

            try
            {
                this.PotionService.UsePotion(pot);
            }
            catch (InvalidOperationException ex)
            {
                throw new CommandException("Unable to use potion: " + ex.Message, ex);
            }

            source.Reply("Potion {0} used.", pot);
        }
Exemplo n.º 19
0
        protected override void Run(IInvokeSource source, ParsedCommand message)
        {
            bool enabled;

            if (message.Count >= 1)
            {
                try
                {
                    enabled = Boolean.Parse(message.Args[0]);
                }
                catch (Exception ex)
                {
                    throw new CommandException("Unable to parse parameter: enabled", ex);
                }
            }
            else
            {
                enabled = !this.PlayerService.OwnPlayer.IsGuardian;
            }

            this.ActionService.GuardianMode(enabled);

            source.Reply("Guardian mode was set to {0}.", enabled);
        }
Exemplo n.º 20
0
 void HiCommand(IInvokeSource source, ParsedRequest request)
 {
     source.Reply("Hello");
 }
Exemplo n.º 21
0
 void HiCommand(IInvokeSource source, ParsedRequest request)
 {
     source.Reply("Hello");
 }
Exemplo n.º 22
0
 private void Run(IInvokeSource source, ParsedCommand message)
 {
     this.RequireOwner();
     this.Chatter.RespawnAll();
     source.Reply("Respawned all.");
 }
Exemplo n.º 23
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            source.Reply("Restarting...");

            this.HostService.Restart();
        }
Exemplo n.º 24
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     source.Reply("Hello!");
 }
Exemplo n.º 25
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     this.RequireOwner();
     this.Chatter.KillAll();
     source.Reply("Killed everyone.");
 }
Exemplo n.º 26
0
        private static void HiCommand(IInvokeSource source, ParsedRequest request)
        {
            var player = source.ToPlayerInvokeSource().Player;

            source.Reply("Hello world {0}!", player.Username);
        }
Exemplo n.º 27
0
 private void Run(IInvokeSource source, ParsedCommand message)
 {
     source.Reply("Pong.");
 }
Exemplo n.º 28
0
        private void Run(IInvokeSource source, ParsedCommand message)
        {
            source.Reply("Shutting down...");

            this.HostService.Shutdown();
        }
 public static void Reply(this IInvokeSource invokeSource, string message, params object[] args)
 {
     // ReSharper disable once RedundantStringFormatCall
     invokeSource.Reply(string.Format(message, args));
 }
Exemplo n.º 30
0
 private void Run(IInvokeSource source, ParsedCommand message)
 {
     this.KeyService.PressKey(Key.Blue);
     source.Reply("Pressed blue key.");
 }
Exemplo n.º 31
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     this.KeyService.PressKey(Key.Green);
     source.Reply("Pressed green key.");
 }
Exemplo n.º 32
0
 private void Run(IInvokeSource source, ParsedCommand message)
 {
     this.ActionService.GetCrown();
     source.Reply("Got crown.");
 }
Exemplo n.º 33
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     this.RequireOwner();
     this.Chatter.LoadLevel();
     source.Reply("Loaded level.");
 }
Exemplo n.º 34
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     this.RequireOwner();
     this.Chatter.Reset();
     source.Reply("Level reset.");
 }
Exemplo n.º 35
0
 protected override void Run(IInvokeSource source, ParsedCommand message)
 {
     this.RequireOwner();
     this.Chatter.PotionsOn(message.Args);
     source.Reply("Enabled potions: {0}", message.GetTrail(0));
 }