Ejemplo n.º 1
0
        static void PrintHelpForGroup(Player p, string sort, string modifier,
                                      string type, string category)
        {
            List <Command> cmds = new List <Command>();

            foreach (Command c in Command.all.commands)
            {
                string disabled = Command.GetDisabledReason(c.Enabled);
                if ((p == null || p.group.CanExecute(c)) && disabled == null)
                {
                    if (!c.type.Contains(type) || c.name == null)
                    {
                        continue;
                    }
                    cmds.Add(c);
                }
            }

            if (cmds.Count == 0)
            {
                Player.Message(p, "You cannot use any of the " + category + " commands."); return;
            }
            SortCommands(cmds, sort);
            Player.Message(p, category + " commands you may use:");

            type = "cmds " + category;
            if (sort != "")
            {
                type += " " + sort;
            }
            MultiPageOutput.Output(p, cmds,
                                   (cmd, i) => CmdHelp.GetColor(cmd) + cmd.name,
                                   type, "commands", modifier, false);
            Player.Message(p, "Type %T/help <command> %Sfor more help on a command.");
        }
Ejemplo n.º 2
0
        static void PrintAllCommands(Player p, string sort, string modifier)
        {
            List <Command> cmds = new List <Command>();

            foreach (Command c in Command.all.commands)
            {
                if (c.name == null)
                {
                    continue;
                }
                cmds.Add(c);
            }

            SortCommands(cmds, sort);
            Player.Message(p, "All commands:");

            string type = "cmds all";

            if (sort != "")
            {
                type += " " + sort;
            }
            MultiPageOutput.Output(p, cmds,
                                   (cmd, i) => CmdHelp.GetColor(cmd) + cmd.name,
                                   type, "commands", modifier, false);
            Player.Message(p, "Type %T/help <command> %Sfor more help on a command.");
        }
Ejemplo n.º 3
0
        static void PrintRankCommands(Player p, string sort, string modifier, Group group, bool own)
        {
            List <Command> cmds = new List <Command>();

            foreach (Command c in Command.all.commands)
            {
                string disabled = Command.GetDisabledReason(c.Enabled);
                if (!group.CanExecute(c) || disabled != null || c.name == null)
                {
                    continue;
                }
                cmds.Add(c);
            }

            if (cmds.Count == 0)
            {
                Player.Message(p, "{0} %Scannot use any commands.", group.ColoredName); return;
            }
            SortCommands(cmds, sort);
            if (own)
            {
                Player.Message(p, "Available commands:");
            }
            else
            {
                Player.Message(p, "Commands available to " + group.ColoredName + " %Srank:");
            }

            string type = "cmds " + group.name;

            if (sort != "")
            {
                type += " " + sort;
            }
            MultiPageOutput.Output(p, cmds,
                                   (cmd, i) => CmdHelp.GetColor(cmd) + cmd.name,
                                   type, "commands", modifier, false);
            Player.Message(p, "Type %T/help <command> %Sfor more help on a command.");
        }
Ejemplo n.º 4
0
        static void SearchCommands(Player p, string keyword, string modifier)
        {
            List <Command> cmds = new List <Command>();

            foreach (Command cmd in Command.all.commands)
            {
                if (cmd.name.CaselessContains(keyword))
                {
                    cmds.Add(cmd); continue;
                }

                if (String.IsNullOrEmpty(cmd.shortcut))
                {
                    continue;
                }
                if (cmd.shortcut.CaselessContains(keyword))
                {
                    cmds.Add(cmd);
                }
            }

            OutputList(p, keyword, "search commands", "commands",
                       modifier, cmds, (cmd, i) => CmdHelp.GetColor(cmd) + cmd.name);
        }