Exemplo n.º 1
0
        private void doHelp(string[] args, Player player)
        {
            Commands commands = new Commands();
            StringBuilder buffer = new StringBuilder();

            buffer.AppendLine("Available Commands:\r\n");
            foreach (Command c in commands.all)
            {
                buffer.AppendFormat("    [ {0,12} ] {1}\r\n", c.name, c.description);
            }
            player.client.send(buffer.ToString());
        }
Exemplo n.º 2
0
        public void parse(string message)
        {
            Commands commands = new Commands();
            string []args = message.Split(' ');
            args[0] = args[0].TrimEnd('\r', '\n');

            Command command = commands.lookupCommand(args[0]);

            if (args.ElementAtOrDefault(1) != null)
            {
                if (args[1].TrimEnd('\r', '\n') == "--help")
                {
                    player.client.send("\r\n" + command.name + ": " + command.description);
                    return;
                }
            }

            if (command != null)
                command.dispatch(args, player);
            else
                player.client.send("I don't know how to do " + args[0] + "\r\n");
        }