Beispiel #1
0
 public override List <string> GetCandidateMaps(RoundsGame game)
 {
     return(new List <string>()
     {
         "countdown"
     });
 }
Beispiel #2
0
        public override void Unload(bool shutdown)
        {
            Command.Unregister(cmd);
            RoundsGame game = NOGGame.Instance;

            if (game.Running)
            {
                game.End();
            }
        }
Beispiel #3
0
        public virtual List <string> GetCandidateMaps(RoundsGame game)
        {
            List <string> maps = new List <string>(game.GetConfig().Maps);

            if (maps.Count < minMaps)
            {
                Logger.Log(LogType.Warning, "You must have 3 or more maps configured to change levels in " + game.GameName);
                return(null);
            }
            return(maps);
        }
Beispiel #4
0
        public override void Load(bool startup)
        {
            cmd = new CmdNameOfGamemode();
            Command.Register(cmd);

            RoundsGame game = NOGGame.Instance;

            game.GetConfig().Load();
            if (!game.Running)
            {
                game.AutoStart();
            }
        }
Beispiel #5
0
        public virtual List <string> GetCandidateMaps(RoundsGame game)
        {
            List <string> maps = new List <string>(game.GetConfig().Maps);

            // TODO: Should this instead be
            // if (maps.Count < 3) {
            //     Logger.Log(LogType.Warning, "You must have more than 3 maps to change levels in " + game.GameName);

            if (maps.Count == 0)
            {
                Logger.Log(LogType.Warning, "You must have at least 1 level configured to play " + game.GameName);
                return(null);
            }
            return(maps);
        }
Beispiel #6
0
        protected override void HandleStart(Player p, RoundsGame game, string[] args)
        {
            if (game.Running)
            {
                p.Message("{0} is already running", game.GameName); return;
            }

            int interval = 150;

            if (args.Length > 1 && !CommandParser.GetInt(p, args[1], "Delay", ref interval, 1, 1000))
            {
                return;
            }

            ((NOGGame)game).Interval = interval;
            game.Start(p, "", int.MaxValue);
        }
Beispiel #7
0
        protected override void HandleSet(Player p, RoundsGame game, string[] args)
        {
            if (args.Length < 2)
            {
                Help(p, "set"); return;
            }
            string prop = args[1];

            if (prop.CaselessEq("spawn"))
            {
                NOGMapConfig cfg = RetrieveConfig(p);
                cfg.Spawn = (Vec3U16)p.Pos.FeetBlockCoords;
                p.Message("Set spawn pos to: &b{0}", cfg.Spawn);
                UpdateConfig(p, cfg);
                return;
            }

            if (args.Length < 3)
            {
                Help(p, "set");
            }
        }
Beispiel #8
0
        public string ChooseNextLevel(RoundsGame game)
        {
            if (QueuedMap != null)
            {
                return(QueuedMap);
            }

            try {
                List <string> maps = GetCandidateMaps(game);
                if (maps == null)
                {
                    return(null);
                }

                RemoveRecentLevels(maps);
                Votes1 = 0; Votes2 = 0; Votes3 = 0;

                Random r = new Random();
                Candidate1 = GetRandomMap(r, maps);
                Candidate2 = GetRandomMap(r, maps);
                Candidate3 = GetRandomMap(r, maps);

                if (!game.Running)
                {
                    return(null);
                }
                DoLevelVote(game);
                if (!game.Running)
                {
                    return(null);
                }

                return(NextLevel(r, maps));
            } catch (Exception ex) {
                Logger.LogError(ex);
                return(null);
            }
        }
        public static void RemoveMap(Player p, string map, LevelConfig lvlCfg, RoundsGame game)
        {
            RoundsGameConfig cfg         = game.GetConfig();
            string           coloredName = lvlCfg.Color + map;

            if (!cfg.Maps.CaselessRemove(map))
            {
                p.Message("{0} &Swas not in the list of {1} maps", coloredName, game.GameName);
            }
            else
            {
                p.Message("Removed {0} &Sfrom the list of {1} maps", coloredName, game.GameName);
                lvlCfg.AutoUnload = true;
                if (!cfg.AllowAutoload)
                {
                    lvlCfg.LoadOnGoto = true;
                }

                cfg.Save();
                lvlCfg.SaveFor(map);
                OnMapsChangedEvent.Call(game);
            }
        }
Beispiel #10
0
        public static void AddMap(Player p, string map, LevelConfig lvlCfg, RoundsGame game)
        {
            RoundsGameConfig cfg         = game.GetConfig();
            string           coloredName = lvlCfg.Color + map;

            if (cfg.Maps.CaselessContains(map))
            {
                p.Message("{0} &Sis already in the list of {1} maps", coloredName, game.GameName);
            }
            else
            {
                p.Message("Added {0} &Sto the list of {1} maps", coloredName, game.GameName);
                cfg.Maps.Add(map);
                if (!cfg.AllowAutoload)
                {
                    lvlCfg.LoadOnGoto = false;
                }

                cfg.Save();
                lvlCfg.SaveFor(map);
                OnMapsChangedEvent.Call(game);
            }
        }