Exemple #1
0
        static void HandleGoto(Player p, string map, string ignored)
        {
            byte mapNum = 0;

            if (map == "" || map == "1")
            {
                map = FirstMapName(p);
            }
            else
            {
                if (!byte.TryParse(map, out mapNum))
                {
                    Player.MessageLines(p, gotoHelp);
                    return;
                }
                map = p.name.ToLower() + map;
            }

            Level[] loaded = LevelInfo.Loaded.Items;
            if (LevelInfo.FindExact(map) == null)
            {
                CmdLoad.LoadLevel(p, map, "0", Server.AutoLoad);
            }
            if (LevelInfo.FindExact(map) != null)
            {
                PlayerActions.ChangeMap(p, map);
            }
        }
Exemple #2
0
        void HandleEnable(Player p)
        {
            if (Server.Countdown.gamestatus == CountdownGameStatus.Disabled)
            {
                CmdLoad.LoadLevel(null, "countdown");
                Server.Countdown.mapon = LevelInfo.FindExact("countdown");

                if (Server.Countdown.mapon == null)
                {
                    Player.Message(p, "countdown level not found, generating..");
                    HandleGenerate(p, "", "", "");
                    Server.Countdown.mapon = LevelInfo.FindExact("countdown");
                }

                Server.Countdown.mapon.Deletable       = false;
                Server.Countdown.mapon.Buildable       = false;
                Server.Countdown.mapon.permissionbuild = LevelPermission.Nobody;
                Server.Countdown.mapon.motd            = "Welcome to the Countdown map! -hax";

                Server.Countdown.gamestatus = CountdownGameStatus.Enabled;
                Chat.MessageAll("Countdown has been enabled!!");
            }
            else
            {
                Player.Message(p, "A Game is either already enabled or is already progress");
            }
        }
Exemple #3
0
        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.");
        }