Пример #1
0
        public override void PlayerJoinedLevel(Player p, Level lvl, Level oldLvl)
        {
            p.SendCpeMessage(CpeMessageType.BottomRight3, "");
            p.SendCpeMessage(CpeMessageType.BottomRight2, "");
            p.SendCpeMessage(CpeMessageType.BottomRight1, "");
            if (RoundInProgress && lvl.name.CaselessEq(CurLevelName))
            {
                if (Running && p != null)
                {
                    p.SendMessage("You joined in the middle of a round. &cYou are now infected!");
                    p.Game.BlocksLeft = 25;
                    InfectPlayer(p, null);
                }
            }

            if (lvl.name.CaselessEq(CurLevelName))
            {
                double startLeft = (RoundStart - DateTime.UtcNow).TotalSeconds;
                if (startLeft >= 0)
                {
                    p.SendMessage("%a" + (int)startLeft + " %Sseconds left until the round starts. %aRun!");
                }
                p.SendMessage("This map has &a" + CurLevel.Likes +
                              " likes %Sand &c" + CurLevel.Dislikes + " dislikes");
                p.SendMessage("This map's win chance is &a" + CurLevel.WinChance + "%S%");

                if (CurLevel.Authors != "")
                {
                    string[] authors = CurLevel.Authors.Replace(" ", "").Split(',');
                    Player.Message(p, "It was created by {0}",
                                   authors.Join(n => PlayerInfo.GetColoredName(p, n)));
                }

                HUD.UpdatePrimary(this, p);
                HUD.UpdateSecondary(this, p);
                HUD.UpdateTertiary(p);

                if (Server.votingforlevel)
                {
                    LevelPicker.SendVoteMessage(p, this);
                }
                return;
            }

            p.SetPrefix();
            HUD.Reset(p);
            Alive.Remove(p);
            Infected.Remove(p);
            if (oldLvl != null && oldLvl.name.CaselessEq(CurLevelName))
            {
                HUD.UpdateAllPrimary(this);
            }
        }
Пример #2
0
        protected virtual string GetStartMap(Player p, string forcedMap)
        {
            if (forcedMap.Length > 0)
            {
                return(forcedMap);
            }
            List <string> maps = Picker.GetCandidateMaps(this);

            if (maps == null || maps.Count == 0)
            {
                return(null);
            }
            return(LevelPicker.GetRandomMap(new Random(), maps));
        }
Пример #3
0
        void MainLoopCore()
        {
            if (Status == ZombieGameStatus.NotStarted)
            {
                return;
            }
            while (true)
            {
                RoundInProgress = false;
                RoundsDone++;

                if (!Running)
                {
                    return;
                }
                else if (Status == ZombieGameStatus.InfiniteRounds)
                {
                    DoRound();
                    if (ZombieGameProps.ChangeLevels)
                    {
                        LevelPicker.ChooseNextLevel(this);
                    }
                }
                else if (Status == ZombieGameStatus.SingleRound)
                {
                    DoRound();
                    ResetState(); return;
                }
                else if (Status == ZombieGameStatus.VariableRounds)
                {
                    if (RoundsDone == MaxRounds)
                    {
                        ResetState(); return;
                    }
                    else
                    {
                        DoRound();
                        if (ZombieGameProps.ChangeLevels)
                        {
                            LevelPicker.ChooseNextLevel(this);
                        }
                    }
                }
                else if (Status == ZombieGameStatus.LastRound)
                {
                    ResetState(); return;
                }
            }
        }
Пример #4
0
        bool SetStartLevel(Level level)
        {
            if (level == null)
            {
                List <string> levels = Picker.GetCandidateLevels();
                if (levels == null)
                {
                    return(false);
                }

                MapName = LevelPicker.GetRandomLevel(new Random(), levels);
                Map     = LevelInfo.FindExact(MapName)
                          ?? CmdLoad.LoadLevel(null, MapName);
                if (Map == null)
                {
                    return(false);
                }
            }
            else
            {
                MapName = level.name;
                Map     = level;
            }

            Map.SaveChanges = false;
            Chat.MessageGlobal("A game of zombie survival is starting on: {0}", MapName);
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                if (p.level != Map)
                {
                    continue;
                }
                PlayerJoinedLevel(p, p.level, p.level);
            }

            if (ZSConfig.SetMainLevel)
            {
                Server.mainLevel = Map;
            }
            return(true);
        }
Пример #5
0
        bool SetStartLevel(Level level)
        {
            if (level == null)
            {
                List <string> levels = LevelPicker.GetCandidateLevels();
                if (levels == null)
                {
                    return(false);
                }

                CurLevelName = LevelPicker.GetRandomLevel(new Random(), levels);
                CurLevel     = LevelInfo.FindExact(CurLevelName)
                               ?? CmdLoad.LoadLevel(null, CurLevelName);
                if (CurLevel == null)
                {
                    return(false);
                }
            }
            else
            {
                CurLevelName = level.name;
                CurLevel     = level;
            }

            Chat.MessageAll("A game of zombie survival is starting on: {0}", CurLevelName);
            Player[] players = PlayerInfo.Online.Items;
            foreach (Player p in players)
            {
                if (p.level != CurLevel)
                {
                    continue;
                }
                PlayerJoinedLevel(p, p.level, p.level);
            }

            if (ZombieGameProps.SetMainLevel)
            {
                Server.mainLevel = CurLevel;
            }
            return(true);
        }
Пример #6
0
 public TWGame()
 {
     Picker = new LevelPicker();
 }
Пример #7
0
 public ZSGame()
 {
     Picker = new LevelPicker();
 }
Пример #8
0
 public CountdownGame()
 {
     Picker = new LevelPicker();
 }
Пример #9
0
 public CTFGame()
 {
     Picker = new LevelPicker();
 }
Пример #10
0
 public NOGGame()
 {
     Picker = new LevelPicker();
 }