internal static string GetColor(Command cmd) { LevelPermission perm = GrpCommands.MinPerm(cmd); Group grp = Group.findPerm(perm); return(grp == null ? "&f" : grp.color); }
static void SortCommands(List <Command> cmds, string sort) { if (sort == "name" || sort == "names") { cmds.Sort((a, b) => a.name .CompareTo(b.name)); } if (sort == "rank" || sort == "ranks") { cmds.Sort((a, b) => GrpCommands.MinPerm(a) .CompareTo(GrpCommands.MinPerm(b))); } }
static void AddMap(Player p, string value) { if (p.group.OverseerMaps == 0) { Player.Message(p, "Your rank is not allowed to create any /os maps."); return; } string level = NextLevel(p); if (level == null) { return; } if (value == "") { value = "128 64 128 flat"; } else if (value.IndexOf(' ') == -1) { value = "128 64 128 " + value; } string[] args = value.TrimEnd().Split(' '); if (args.Length == 3) { value += " flat"; } CmdNewLvl newLvl = (CmdNewLvl)Command.all.Find("newlvl"); // TODO: this is a nasty hack, find a better way if (!newLvl.GenerateMap(p, level + " " + value)) { return; } // Set default perbuild permissions CmdLoad.LoadLevel(null, level); Level lvl = LevelInfo.FindExact(level); if (lvl == null) { return; } lvl.RealmOwner = p.name; Command.all.Find("perbuild").Use(null, lvl.name + " +" + p.name); CmdZone.ZoneAll(lvl, p.name); LevelPermission osPerm = Server.osPerbuildDefault; if (osPerm == LevelPermission.Nobody) { osPerm = GrpCommands.MinPerm(Command.all.Find("overseer")); } Group grp = Group.findPerm(osPerm); if (grp == null) { return; } Command.all.Find("perbuild").Use(null, lvl.name + " " + grp.name); Player.Message(p, "Use %T/os zone add [name] %Sto allow " + "players ranked below " + grp.ColoredName + " %Sto build in the map."); }