Exemplo n.º 1
0
        public override void use(ClientPlayerInfo p, string message)
        {
            LevelPlaylist playlist = new LevelPlaylist();

            playlist.Copy(G.Sys.GameManager_.LevelPlaylist_);

            if (G.Sys.GameManager_.ModeID_ == GameModeID.Trackmogrify)
            {
                Utilities.sendMessage("You can't manage the playlist in trackmogrify");
                return;
            }

            if (playlist.Count_ == 0)
            {
                Utilities.sendMessage("The playlist is empty !");
                return;
            }

            if (Utilities.isOnGamemode())
            {
                shuffleOnGame(playlist);
            }
            else
            {
                shuffleOnLobby(playlist);
            }

            G.Sys.GameManager_.LevelPlaylist_.SetIndex(0);
            G.Sys.GameManager_.NextLevelName_ = G.Sys.GameManager_.LevelPlaylist_.Playlist_[0].levelNameAndPath_.levelName_;
            G.Sys.GameManager_.NextLevelPath_ = G.Sys.GameManager_.LevelPlaylist_.Playlist_[0].levelNameAndPath_.levelPath_;

            Utilities.sendMessage("Playlist shuffled !");
        }
Exemplo n.º 2
0
        public override void use(ClientPlayerInfo p, string message)
        {
            LevelPlaylist playlist = new LevelPlaylist();

            playlist.Copy(G.Sys.GameManager_.LevelPlaylist_);

            if (G.Sys.GameManager_.ModeID_ == GameModeID.Trackmogrify)
            {
                Utilities.sendMessage("You can't manage the playlist in trackmogrify");
                return;
            }

            if (playlist.Count_ == 0)
            {
                Utilities.sendMessage("The playlist is empty !");
                return;
            }

            var item = playlist.Playlist_[G.Sys.GameManager_.LevelPlaylist_.Index_];

            playlist.Playlist_.Clear();

            G.Sys.GameManager_.LevelPlaylist_.Clear();
            G.Sys.GameManager_.LevelPlaylist_.Add(item);

            G.Sys.GameManager_.NextLevelName_ = item.levelNameAndPath_.levelName_;
            G.Sys.GameManager_.NextLevelPath_ = item.levelNameAndPath_.levelPath_;
            G.Sys.GameManager_.LevelPlaylist_.SetIndex(0);

            Utilities.sendMessage("Playlist cleared !");
        }
Exemplo n.º 3
0
        public override void use(ClientPlayerInfo p, string message)
        {
            if (message == "")
            {
                help(p);
                return;
            }

            if (G.Sys.GameManager_.ModeID_ == GameModeID.Trackmogrify)
            {
                Utilities.sendMessage("You can't manage the playlist in trackmogrify");
                return;
            }

            int id = 0;

            int.TryParse(message, out id);

            if (id <= 0)
            {
                Utilities.sendMessage("The id must be a positive number.");
                return;
            }

            int index = G.Sys.GameManager_.LevelPlaylist_.Index_;

            int playListSize = G.Sys.GameManager_.LevelPlaylist_.Playlist_.Count - index;

            if (id > playListSize)
            {
                Utilities.sendMessage("The playlist have only " + playListSize + " maps.");
                return;
            }

            LevelPlaylist playlist = new LevelPlaylist();

            playlist.Copy(G.Sys.GameManager_.LevelPlaylist_);
            var currentPlaylist = playlist.Playlist_;

            currentPlaylist.RemoveAt(index + id);

            G.Sys.GameManager_.LevelPlaylist_.Clear();

            foreach (var lvl in currentPlaylist)
            {
                G.Sys.GameManager_.LevelPlaylist_.Add(lvl);
            }
            G.Sys.GameManager_.LevelPlaylist_.SetIndex(index);

            Utilities.sendMessage("Map removed !");
        }
Exemplo n.º 4
0
        public override void use(ClientPlayerInfo p, string message)
        {
            LevelPlaylist playlist = new LevelPlaylist();

            playlist.Copy(G.Sys.GameManager_.LevelPlaylist_);

            if (G.Sys.GameManager_.ModeID_ == GameModeID.Trackmogrify)
            {
                Utilities.sendMessage("You can't manage the playlist in trackmogrify");
                return;
            }

            if (playlist.Count_ == 0)
            {
                Utilities.sendMessage("The playlist is empty !");
                return;
            }

            int index = G.Sys.GameManager_.LevelPlaylist_.Index_;
            var item  = playlist.Playlist_[index];

            playlist.Playlist_.RemoveAt(index);

            var shuffledList = playlist.Playlist_;

            Utilities.Shuffle(playlist.Playlist_, new Random());
            G.Sys.GameManager_.LevelPlaylist_.Clear();
            G.Sys.GameManager_.LevelPlaylist_.Add(item);
            foreach (var lvl in shuffledList)
            {
                G.Sys.GameManager_.LevelPlaylist_.Add(lvl);
            }

            G.Sys.GameManager_.NextLevelName_ = item.levelNameAndPath_.levelName_;
            G.Sys.GameManager_.NextLevelPath_ = item.levelNameAndPath_.levelPath_;
            G.Sys.GameManager_.LevelPlaylist_.SetIndex(0);

            Utilities.sendMessage("Playlist shuffled !");
        }
Exemplo n.º 5
0
        public override void use(ClientPlayerInfo p, string message)
        {
            if (message == "")
            {
                help(p);
                return;
            }

            if (Utilities.isOnLobby())
            {
                Utilities.sendMessage("You can't set the next level here");
                return;
            }

            if (G.Sys.GameManager_.ModeID_ == GameModeID.Trackmogrify)
            {
                Utilities.sendMessage("You can't manage the playlist in trackmogrify");
                return;
            }

            Modifiers m    = LevelList.extractModifiers(message);
            var       list = LevelList.levels(m);

            if (list.Count == 0)
            {
                Utilities.sendMessage("Can't find a level with the filter '" + message + "'.");
                return;
            }

            if (!m.all && list.Count() > 1 && m.index.Count == 0)
            {
                LevelList.printLevels(list, m.page, 10, true);
                //LevelList.printLevels(list, 10, true);
                return;
            }

            if (playersCanAddMap && !p.IsLocal_)
            {
                var value = list[0];
                list.Clear();
                list.Add(value);
            }

            LevelPlaylist playlist = new LevelPlaylist();

            playlist.Copy(G.Sys.GameManager_.LevelPlaylist_);

            var currentPlaylist = playlist.Playlist_;
            int index           = G.Sys.GameManager_.LevelPlaylist_.Index_;

            Utilities.Shuffle(list, new Random());
            foreach (var lvl in list)
            {
                currentPlaylist.Insert(index + 1, lvl);
            }
            G.Sys.GameManager_.LevelPlaylist_.Clear();

            foreach (var lvl in currentPlaylist)
            {
                G.Sys.GameManager_.LevelPlaylist_.Add(lvl);
            }
            G.Sys.GameManager_.LevelPlaylist_.SetIndex(index);

            string lvlsStr = "";

            foreach (var lvl in list)
            {
                lvlsStr += lvl.levelNameAndPath_.levelName_ + ", ";
            }

            Utilities.sendMessage("Level(s) " + lvlsStr.Substring(0, lvlsStr.Count() - 2) + " added to the playlist !");
        }