void CommandInitExtraPerms()
        {
            extraPermsList = CommandExtraPerms.FindAll(cmd.name);
            for (int i = 0; i < commandExtraBoxes.Length; i++)
            {
                commandExtraBoxes[i].Visible  = false;
                commandExtraLabels[i].Visible = false;
            }
            if (cmd.ExtraPerms == null)
            {
                extraPermsList.Clear();
            }

            int height = 12;

            for (int i = 0; i < extraPermsList.Count; i++)
            {
                CommandExtraPerms perms = LookupExtraPerms(extraPermsList[i].CmdName, extraPermsList[i].Num);
                if (perms == null)
                {
                    perms = extraPermsList[i];
                }

                GuiPerms.SetDefaultIndex(commandExtraBoxes[i], perms.MinRank);
                commandExtraBoxes[i].Visible  = true;
                commandExtraLabels[i].Text    = "+ " + perms.Desc;
                commandExtraLabels[i].Visible = true;
                height = commandExtraBoxes[i].Bottom + 12;
            }
            cmd_grpExtra.Visible = extraPermsList.Count > 0;
            cmd_grpExtra.Height  = height;
        }
Exemple #2
0
        public static void PrintCommandInfo(Player p, Command cmd)
        {
            ItemPerms perms = CommandPerms.Find(cmd.name);

            if (perms == null)
            {
                perms = new ItemPerms(cmd.defaultRank, null, null);
            }

            p.Message("Usable by: " + perms.Describe());
            PrintAliases(p, cmd);

            List <CommandExtraPerms> extraPerms = CommandExtraPerms.FindAll(cmd.name);

            if (cmd.ExtraPerms == null)
            {
                extraPerms.Clear();
            }
            if (extraPerms.Count == 0)
            {
                return;
            }

            p.Message("%TExtra permissions:");
            foreach (CommandExtraPerms extra in extraPerms)
            {
                p.Message("{0}) {1} {2}", extra.Num, extra.Describe(), extra.Desc);
            }
        }
Exemple #3
0
        public static void PrintCommandInfo(Player p, Command cmd)
        {
            CommandPerms  perms   = CommandPerms.Find(cmd.name);
            StringBuilder builder = new StringBuilder();

            builder.Append("Usable by: ");
            if (perms == null)
            {
                builder.Append(Group.GetColoredName(cmd.defaultRank) + "%S+");
            }
            else
            {
                PrintRanks(perms.MinRank, perms.Allowed, perms.Disallowed, builder);
            }
            Player.Message(p, builder.ToString());

            PrintAliases(p, cmd);
            List <CommandExtraPerms> extraPerms = CommandExtraPerms.FindAll(cmd.name);

            if (extraPerms.Count == 0)
            {
                return;
            }

            Player.Message(p, "%TExtra permissions:");
            foreach (CommandExtraPerms extra in extraPerms)
            {
                Player.Message(p, "{0}) {1}%S{2}", extra.Number,
                               Group.GetColoredName(extra.MinRank), extra.Description);
            }
        }