예제 #1
0
        public void ResetState()
        {
            Status          = ZombieGameStatus.NotStarted;
            MaxRounds       = 0;
            RoundInProgress = false;
            RoundStart      = DateTime.MinValue;
            RoundEnd        = DateTime.MinValue;
            Player[] online = PlayerInfo.Online.Items;

            Alive.Clear();
            Infected.Clear();

            Lottery.Clear();
            Bounties.Clear();
            RecentMaps.Clear();

            foreach (Player pl in online)
            {
                pl.Game.Referee  = false;
                pl.Game.RatedMap = false;
                pl.Game.ResetZombieState();
                ResetInvisibility(pl);
                pl.SetPrefix();

                if (pl.level == null || !pl.level.name.CaselessEq(CurLevelName))
                {
                    continue;
                }
                HUD.Reset(pl);
            }

            LastLevelName = "";
            CurLevelName  = "";
            CurLevel      = null;
        }
예제 #2
0
        public void HandOutRewards()
        {
            if (!RoundInProgress)
            {
                return;
            }
            RoundInProgress = false;
            RoundStart      = DateTime.MinValue;
            RoundEnd        = DateTime.MinValue;
            Bounties.Clear();
            if (!Running)
            {
                return;
            }

            Player[] alive = Alive.Items;
            CurLevel.ChatLevel(Colors.lime + "The game has ended!");
            if (alive.Length == 0)
            {
                CurLevel.ChatLevel(Colors.maroon + "Zombies have won this round.");
            }
            else if (alive.Length == 1)
            {
                CurLevel.ChatLevel(Colors.green + "Congratulations to the sole survivor:");
            }
            else
            {
                CurLevel.ChatLevel(Colors.green + "Congratulations to the survivors:");
            }

            timer.Enabled = false;
            string playersString = "";

            Player[] online = null;

            if (alive.Length == 0)
            {
                online = PlayerInfo.Online.Items;
                foreach (Player pl in online)
                {
                    ResetPlayer(pl, ref playersString);
                }
            }
            else
            {
                foreach (Player pl in alive)
                {
                    if (pl.Game.PledgeSurvive)
                    {
                        pl.SendMessage("You received &a5 %3" + Server.moneys +
                                       "%s for successfully pledging that you would survive.");
                        pl.money += 5;
                        pl.OnMoneyChanged();
                    }
                    pl.Game.CurrentRoundsSurvived++;
                    pl.Game.TotalRoundsSurvived++;
                    pl.Game.MaxRoundsSurvived = Math.Max(pl.Game.CurrentRoundsSurvived, pl.Game.MaxRoundsSurvived);
                    ResetPlayer(pl, ref playersString);
                }
            }

            CurLevel.ChatLevel(playersString);
            online = PlayerInfo.Online.Items;
            Random rand = new Random();

            foreach (Player pl in online)
            {
                if (!pl.level.name.CaselessEq(CurLevelName))
                {
                    continue;
                }
                int money = GetMoney(pl, alive, rand);

                Player.GlobalDespawn(pl, true);
                Player.GlobalSpawn(pl, true);
                if (money == -1)
                {
                    pl.SendMessage("You may not hide inside a block! No " + Server.moneys + " for you."); money = 0;
                }
                else if (money > 0)
                {
                    pl.SendMessage(Colors.gold + "You gained " + money + " " + Server.moneys);
                }

                pl.Game.BlocksLeft      = 50;
                pl.Game.CurrentInfected = 0;
                pl.money        += money;
                pl.Game.Infected = false;
                if (pl.Game.Referee)
                {
                    pl.SendMessage("You gained one " + Server.moneys + " because you're a ref. Would you like a medal as well?");
                    pl.money++;
                }
                pl.OnMoneyChanged();
            }
            UpdateAllPlayerStatus();
            Alive.Clear();
            Infected.Clear();
        }