Exemplo n.º 1
0
 public static void End(Player winner)
 {
     CountdownGame.squaresleft.Clear();
     if (winner != null)
     {
         winner.SendMessage("Congratulations!! You won!!!");
     }
     gamestatus = CountdownGameStatus.Finished;
     if (winner != null)
     {
         Command.all.Find("spawn").Use(winner, "");
     }
     CountdownGame.playersleftlist.Clear();
     if (winner != null)
     {
         winner.incountdown = false;
     }
     if (winner == null)
     {
         foreach (Player pl in CountdownGame.players)
         {
             Player.SendMessage(pl, "The countdown game was canceled!");
             Command.all.Find("spawn").Use(pl, "");
         }
         Player.GlobalMessage("The countdown game was canceled!!");
         CountdownGame.gamestatus  = CountdownGameStatus.Enabled;
         CountdownGame.playersleft = 0;
         CountdownGame.playersleftlist.Clear();
         CountdownGame.players.Clear();
         CountdownGame.squaresleft.Clear();
         CountdownGame.Reset(null, true);
         CountdownGame.cancel = false;
         return;
     }
 }
Exemplo n.º 2
0
        void End(Player winner)
        {
            squaresLeft.Clear();
            gamestatus = CountdownGameStatus.Finished;
            playersleftlist.Clear();

            if (winner != null)
            {
                winner.SendMessage("Congratulations!! You won!!!");
                Command.all.Find("spawn").Use(winner, "");
                winner.incountdown = false;
            }
            else
            {
                foreach (Player pl in players)
                {
                    Player.SendMessage(pl, "The countdown game was canceled!");
                    Command.all.Find("spawn").Use(pl, "");
                }
                Player.GlobalMessage("The countdown game was canceled!!");
                gamestatus = CountdownGameStatus.Enabled;
                playersleftlist.Clear();
                players.Clear();
                squaresLeft.Clear();
                Reset(null, true);
                cancel = false;
            }
        }
Exemplo n.º 3
0
        public static void AfterStart()
        {
            Block air   = Block.BlockList.AIR;
            Block glass = Block.BlockList.GLASS;

            mapon.BlockChange(15, 14, 18, air);
            mapon.BlockChange(16, 14, 18, air);
            mapon.BlockChange(15, 14, 17, air);
            mapon.BlockChange(16, 17, 14, air);

            mapon.BlockChange(14, 15, 17, air);
            mapon.BlockChange(14, 16, 18, air);
            mapon.BlockChange(14, 16, 17, air);
            mapon.BlockChange(14, 15, 18, air);

            mapon.BlockChange(15, 17, 17, air);
            mapon.BlockChange(16, 17, 18, air);
            mapon.BlockChange(15, 17, 18, air);
            mapon.BlockChange(16, 17, 17, air);

            mapon.BlockChange(17, 16, 17, air);
            mapon.BlockChange(17, 15, 18, air);
            mapon.BlockChange(17, 16, 18, air);
            mapon.BlockChange(17, 15, 17, air);

            mapon.BlockChange(16, 15, 16, glass);
            mapon.BlockChange(15, 16, 16, glass);
            mapon.BlockChange(15, 16, 16, glass);
            mapon.BlockChange(16, 16, 16, glass);

            ushort x1 = 27, x2 = 4, z1 = 27, z2 = 4;

            while (x1 >= 4)
            {
                mapon.BlockChange(x1, 4, 4, air); x1--;
            }
            while (x2 <= 27)
            {
                mapon.BlockChange(x2, 27, 4, air); x2++;
            }
            while (z1 >= 4)
            {
                mapon.BlockChange(4, z1, 4, air); z1--;
            }
            while (z2 <= 27)
            {
                mapon.BlockChange(27, z2, 4, air); z2++;
            }
            if (!freezemode)
            {
                mapon.InCountdown = true; gamestatus = CountdownGameStatus.InProgress;
            }
        }
Exemplo n.º 4
0
        public void Disable()
        {
            if (Status == CountdownGameStatus.RoundInProgress)
            {
                EndRound(null);
            }

            Status = CountdownGameStatus.Disabled;
            plugin.Unload(false);

            Map.ChatLevel("Countdown was disabled.");
            Players.Clear();
            Remaining.Clear();
            squaresLeft.Clear();
        }
Exemplo n.º 5
0
        void AfterStart()
        {
            SetGlassTube(Block.air, Block.glass);

            int maxX = mapon.Width - 1, maxZ = mapon.Length - 1;

            Cuboid(4, 4, 4, maxX - 4, 4, 4, Block.air, mapon);
            Cuboid(4, 4, maxZ - 4, maxX - 4, 4, maxZ - 4, Block.air, mapon);
            Cuboid(4, 4, 4, 4, 4, maxZ - 4, Block.air, mapon);
            Cuboid(maxX - 4, 4, 4, maxX - 4, 4, maxZ - 4, Block.air, mapon);

            if (!freezemode)
            {
                gamestatus = CountdownGameStatus.InProgress;
            }
        }
Exemplo n.º 6
0
        void DoRound()
        {
            if (FreezeMode)
            {
                MessageFreezeCountdown();
                Map.ChatLevel("&bPlayers Frozen");

                Player[] players = Players.Items;
                foreach (Player pl in players)
                {
                    Position pos = pl.Pos;
                    pl.CountdownFreezeX = pos.X;
                    pl.CountdownFreezeZ = pos.Z;
                }
                RemoveAllSquareBorders();
            }

            CloseOffBoard();
            Status = CountdownGameStatus.RoundInProgress;
            RemoveSquares();
        }
Exemplo n.º 7
0
        public void Play()
        {
            if (!freezemode)
            {
                RemoveRandomSquares();
            }
            else
            {
                SendFreezeMessages();
                MessageAll("&bPlayers Frozen");
                gamestatus = CountdownGameStatus.InProgress;
                foreach (Player pl in players)
                {
                    pl.countdownsettemps = true;
                }
                Thread.Sleep(500);

                RemoveGlassBlocks();
                RemoveRandomSquares();
            }
        }
Exemplo n.º 8
0
        public void EndRound(Player winner)
        {
            squaresLeft.Clear();
            Status = CountdownGameStatus.Enabled;
            Remaining.Clear();
            squaresLeft.Clear();

            if (winner != null)
            {
                winner.SendMessage("Congratulations, you won this round of countdown!");
                Command.all.FindByName("Spawn").Use(winner, "");
            }
            else
            {
                Player[] players = Players.Items;
                foreach (Player pl in players)
                {
                    Command.all.FindByName("Spawn").Use(pl, "");
                }
                Map.ChatLevel("Current round was force ended!");
            }
        }
Exemplo n.º 9
0
 public static void End(Player winner)
 {
     gamestatus = CountdownGameStatus.Finished;
     squaresleft.Clear();
     if (winner != null)
     {
         winner.SendMessage("Congratulations! You won!"); Command.Find("spawn").Use(winner, null); winner.ExtraData["IsInCountdown"] = false;
     }
     playersleftlist.Clear();
     if (winner == null)
     {
         foreach (Player pl in players)
         {
             pl.SendMessage("The game was canceled!"); Command.Find("spawn").Use(pl, null);
         }
         gamestatus  = CountdownGameStatus.Enabled;
         playersleft = 0;
         playersleftlist.Clear();
         players.Clear();
         //TODO: reset here
         cancel = false;
         return;
     }
 }
Exemplo n.º 10
0
        public void Enable(Player p)
        {
            plugin.Game = this;
            plugin.Load(false);

            MapName = "countdown";
            CmdLoad.LoadLevel(null, "countdown");
            Map = LevelInfo.FindExact("countdown");

            if (Map == null)
            {
                Player.Message(p, "Countdown level not found, generating..");
                GenerateMap(p, 32, 32, 32);
                Map = LevelInfo.FindExact("countdown");
            }

            Map.Config.Deletable = false;
            Map.Config.Buildable = false;
            Map.BuildAccess.Min  = LevelPermission.Nobody;
            Map.Config.MOTD      = "Welcome to the Countdown map! -hax";

            Status = CountdownGameStatus.Enabled;
            Chat.MessageGlobal("Countdown has been enabled!");
        }
Exemplo n.º 11
0
 public static void Play()
 {
     if (freezemode == false)
     {
         while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
         {
             Random number     = new Random();
             int    randnum    = number.Next(squaresleft.Count);
             string nextsquare = squaresleft.ElementAt(randnum);
             squaresleft.Remove(nextsquare);
             RemoveSquare(nextsquare);
             if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
             {
                 mapon.ChatLevel(squaresleft.Count + " Squares Left and " + playersleft.ToString() + " Players left!!");
             }
             if (cancel == true)
             {
                 End(null);
             }
         }
         return;
     }
     else
     {
         {//Find yo places stuff (15 seconds)
             Thread.Sleep(500);
             MessagePlayers("Welcome to Freeze Mode of countdown");
             MessagePlayers("You have 15 seconds to stand on a square");
             Thread.Sleep(500);
             MessagePlayers("-----&b15" + Server.DefaultColor + "-----");
             Thread.Sleep(500);
             MessagePlayers("Once the countdown is up, you are stuck on your square");
             Thread.Sleep(500);
             MessagePlayers("-----&b14" + Server.DefaultColor + "-----");
             Thread.Sleep(500);
             MessagePlayers("The squares then start to dissapear");
             Thread.Sleep(500);
             MessagePlayers("-----&b13" + Server.DefaultColor + "-----");
             Thread.Sleep(500);
             MessagePlayers("Whoever is last out wins!!");
             Thread.Sleep(500);
             MessagePlayers("-----&b12" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b11" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b10" + Server.DefaultColor + "-----");
             MessagePlayers("Only 10 Seconds left to pick your places!!");
             Thread.Sleep(1000);
             MessagePlayers("-----&b9" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b8" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b7" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b6" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b5" + Server.DefaultColor + "-----");
             MessagePlayers("5 Seconds left to pick your places!!");
             Thread.Sleep(1000);
             MessagePlayers("-----&b4" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b3" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b2" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b1" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("&bPlayers Frozen");
             {
                 mapon.countdowninprogress = true;
                 gamestatus = CountdownGameStatus.InProgress;
                 foreach (Player pl in players)
                 {
                     pl.countdownsettemps = true;
                     Thread.Sleep(100);
                 }
             }
             {//Get rid of glass
                 ushort x3 = 5;
                 while (x3 <= 26)
                 {
                     ushort z4 = 26;
                     while (z4 >= 4)
                     {
                         mapon.Blockchange(x3, 4, z4, Block.air);
                         z4 = (ushort)(z4 - 1);
                     }
                     x3 = (ushort)(x3 + 3);
                 }
                 ushort z3 = 5;
                 while (z3 <= 26)
                 {
                     ushort x4 = 4;
                     while (x4 <= 26)
                     {
                         mapon.Blockchange(x4, 4, z3, Block.air);
                         x4++;
                     }
                     z3 = (ushort)(z3 + 3);
                 }
             }
             while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
             {
                 Random number     = new Random();
                 int    randnum    = number.Next(squaresleft.Count);
                 string nextsquare = squaresleft.ElementAt(randnum);
                 squaresleft.Remove(nextsquare);
                 RemoveSquare(nextsquare);
                 if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
                 {
                     mapon.ChatLevel(squaresleft.Count + " Squares Left and " + playersleft.ToString() + " Players left!!");
                 }
                 if (cancel == true)
                 {
                     End(null);
                 }
             }
             return;
         }
     }
 }
Exemplo n.º 12
0
        public static void GameStart(Player p)
        {
            switch (gamestatus)
            {
                case CountdownGameStatus.Disabled:
                    p.SendMessage("Please enable Countdown first!"); return;
                case CountdownGameStatus.AboutToStart:
                    p.SendMessage("The game is about to start!"); return;
                case CountdownGameStatus.InProgress:
                    p.SendMessage("The game is already in progress!"); return;
                case CountdownGameStatus.Finished:
                    p.SendMessage("The game has finished!"); return;
                case CountdownGameStatus.Enabled:
                    gamestatus = CountdownGameStatus.AboutToStart;
                    Thread.Sleep(2000);
                    break;
            }
            #region Blockchanges
            Block glass = Block.BlockList.GLASS;
            Block air = Block.BlockList.AIR;
            mapon.BlockChange(15, 16, 27, glass);
            mapon.BlockChange(16, 15, 27, glass);
            mapon.BlockChange(16, 16, 27, glass);
            mapon.BlockChange(15, 15, 27, glass);

            mapon.BlockChange(15, 14, 18, glass);
            mapon.BlockChange(16, 14, 18, glass);
            mapon.BlockChange(15, 14, 17, glass);
            mapon.BlockChange(16, 14, 17, glass);

            mapon.BlockChange(14, 15, 17, glass);
            mapon.BlockChange(14, 16, 18, glass);
            mapon.BlockChange(14, 16, 17, glass);
            mapon.BlockChange(14, 15, 18, glass);

            mapon.BlockChange(15, 17, 17, glass);
            mapon.BlockChange(16, 17, 18, glass);
            mapon.BlockChange(15, 17, 18, glass);
            mapon.BlockChange(16, 17, 17, glass);

            mapon.BlockChange(17, 16, 17, glass);
            mapon.BlockChange(17, 15, 18, glass);
            mapon.BlockChange(17, 16, 18, glass);
            mapon.BlockChange(17, 15, 17, glass);

            mapon.BlockChange(16, 15, 16, glass);
            mapon.BlockChange(15, 16, 16, glass);
            mapon.BlockChange(15, 15, 16, glass);
            mapon.BlockChange(16, 16, 16, glass);
            #endregion
            Player.LevelChat(mapon, "Countdown is about to start!");
            //TODO: perbuild to nobody
            ushort x1 = (ushort)((15.5) * 32);
            ushort y1 = (ushort)((30) * 32);
            ushort z1 = (ushort)((15.5) * 32);
            foreach (Player pl in Server.Players)  { 
                if (pl.Level != mapon) { 
                    Command.Find("goto").Use(pl, new string[1] { mapon.Name });
                    while (p.IsLoading) { Thread.Sleep(500); } pl.SendToPos(new Vector3(x1, z1, y1), new byte[] { 0, 0 });
                }          
            }
            squaresleft.Clear();
            PopulateSquaresLeft();
            Player.LevelChat(mapon, freezemode ? "Countdown starting with difficulty " + speedtype + " and mode freeze in:" : "Countdown starting with difficulty " + speedtype + " and mode normal in:");
            Thread.Sleep(2000);
            for (int i = 5; i >= 1; i--) {
                Player.LevelChat(mapon, "--&b" + i.ToString() + Server.DefaultColor + "--");
                if (i == 5) { mapon.BlockChange(16, 15, 16, air); mapon.BlockChange(15, 16, 16, air); mapon.BlockChange(15, 15, 16, air); mapon.BlockChange(16, 16, 16, air); }
                if (i == 3) { mapon.BlockChange(15, 16, 27, air); mapon.BlockChange(16, 15, 27, air); mapon.BlockChange(16, 16, 27, air); mapon.BlockChange(15, 15, 27, air); }
                Thread.Sleep(1000);
            }
            Player.LevelChat(mapon, "&bGO!!!");
            playersleft = players.Count();
            playersleftlist = players;
            foreach (Player play in players) { play.ExtraData.CreateIfNotExist("IsInCountdown", true); play.ExtraData["IsInCountdown"] = true; }
            AfterStart();
            Play();
        }
Exemplo n.º 13
0
        public static void AfterStart()
        {
            Block air = Block.BlockList.AIR;
            Block glass = Block.BlockList.GLASS;

            mapon.BlockChange(15, 14, 18, air);
            mapon.BlockChange(16, 14, 18, air);
            mapon.BlockChange(15, 14, 17, air);
            mapon.BlockChange(16, 17, 14, air);

            mapon.BlockChange(14, 15, 17, air);
            mapon.BlockChange(14, 16, 18, air);
            mapon.BlockChange(14, 16, 17, air);
            mapon.BlockChange(14, 15, 18, air);

            mapon.BlockChange(15, 17, 17, air);
            mapon.BlockChange(16, 17, 18, air);
            mapon.BlockChange(15, 17, 18, air);
            mapon.BlockChange(16, 17, 17, air);

            mapon.BlockChange(17, 16, 17, air);
            mapon.BlockChange(17, 15, 18, air);
            mapon.BlockChange(17, 16, 18, air);
            mapon.BlockChange(17, 15, 17, air);

            mapon.BlockChange(16, 15, 16, glass);
            mapon.BlockChange(15, 16, 16, glass);
            mapon.BlockChange(15, 16, 16, glass);
            mapon.BlockChange(16, 16, 16, glass);

            ushort x1 = 27, x2 = 4, z1 = 27, z2 = 4;
            while (x1 >= 4) { mapon.BlockChange(x1, 4, 4, air); x1--; }
            while (x2 <= 27) { mapon.BlockChange(x2, 27, 4, air); x2++; }
            while (z1 >= 4) { mapon.BlockChange(4, z1, 4, air); z1--; }
            while (z2 <= 27) { mapon.BlockChange(27, z2, 4, air); z2++; }
            if (!freezemode) { mapon.InCountdown = true; gamestatus = CountdownGameStatus.InProgress; }
        }
Exemplo n.º 14
0
        public static void Play()
        {
            Block air = Block.BlockList.AIR;

            if (!freezemode)
            {
                while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
                {
                    Random number     = new Random();
                    int    randnum    = number.Next(squaresleft.Count);
                    string nextsquare = squaresleft.ElementAt(randnum);
                    squaresleft.Remove(nextsquare);
                    RemoveSquare(nextsquare);
                    if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
                    {
                        Player.LevelChat(mapon, "There's " + squaresleft.Count + " squares left, and " + playersleft.ToString() + " players left!");
                    }
                    if (cancel == true)
                    {
                        End(null);
                    }
                }
                return;
            }
            else
            {
                Player.LevelChat(mapon, "Welcome to Freeze Mode of coundown");
                Player.LevelChat(mapon, "You have 15 seconds to choose your square, after that you're stuck on that square!");
                Player.LevelChat(mapon, "Then the squares start dissapearing!");
                Thread.Sleep(500);
                for (int i = 15; i >= 1; i--)
                {
                    Player.LevelChat(mapon, "---&b" + i.ToString() + Server.DefaultColor + "---"); Thread.Sleep(1000);
                }
                mapon.InCountdown = true;
                gamestatus        = CountdownGameStatus.InProgress;
                //TODO: actually freeze players here, when somebody bothers adding /freeze
                ushort x3 = 5, z4 = 26, z3 = 5, x4 = 4;
                while (x3 <= 26)
                {
                    while (z4 >= 4)
                    {
                        mapon.BlockChange(x3, z4, 4, air); z4--;
                    }
                    x3 += 3;
                }
                while (z3 <= 26)
                {
                    while (x4 <= 26)
                    {
                        mapon.BlockChange(x4, z3, 4, air); x4++;
                    }
                    z3 += 3;
                }
                while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
                {
                    Random number     = new Random();
                    int    randnum    = number.Next(squaresleft.Count);
                    string nextsquare = squaresleft.ElementAt(randnum);
                    squaresleft.Remove(nextsquare);
                    RemoveSquare(nextsquare);
                    if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
                    {
                        Player.LevelChat(mapon, "There's " + squaresleft.Count + " squares left, and " + playersleft.ToString() + " players left!");
                    }
                    if (cancel == true)
                    {
                        End(null);
                    }
                }
            }
        }
Exemplo n.º 15
0
        public void Reset(Player p, bool all)
        {
            if (!(gamestatus == CountdownGameStatus.Enabled || gamestatus == CountdownGameStatus.Finished || gamestatus == CountdownGameStatus.Disabled))
            {
                switch (gamestatus)
                {
                case CountdownGameStatus.Disabled:
                    Player.SendMessage(p, "Please enable the game first"); return;

                default:
                    Player.SendMessage(p, "Please wait till the end of the game"); return;
                }
            }
            SetGlassTube(Block.air, Block.air);

            int maxX = mapon.Width - 1, maxZ = mapon.Length - 1;

            Cuboid(4, 4, 4, maxX - 4, 4, maxZ - 4, Block.glass, mapon);
            for (int zz = 6; zz < maxZ - 6; zz += 3)
            {
                for (int xx = 6; xx < maxX - 6; xx += 3)
                {
                    Cuboid(xx, 4, zz, xx + 1, 4, zz + 1, Block.green, mapon);
                }
            }

            if (!all)
            {
                Player.SendMessage(p, "The Countdown map has been reset");
                if (gamestatus == CountdownGameStatus.Finished)
                {
                    Player.SendMessage(p, "You do not need to re-enable it");
                }
                gamestatus = CountdownGameStatus.Enabled;

                Player[] online = PlayerInfo.Online.Items;
                foreach (Player pl in online)
                {
                    if (!pl.playerofcountdown)
                    {
                        continue;
                    }
                    if (pl.level == mapon)
                    {
                        Command.all.Find("countdown").Use(pl, "join");
                        Player.SendMessage(pl, "You've rejoined countdown!!");
                    }
                    else
                    {
                        Player.SendMessage(pl, "You've been removed from countdown because you aren't on the map");
                        pl.playerofcountdown = false;
                        players.Remove(pl);
                    }
                }
            }
            else
            {
                Player.SendMessage(p, "Countdown has been reset");
                if (gamestatus == CountdownGameStatus.Finished)
                {
                    Player.SendMessage(p, "You do not need to re-enable it");
                }
                gamestatus = CountdownGameStatus.Enabled;
                playersleftlist.Clear();
                players.Clear();
                squaresLeft.Clear();

                speed = 750;
                Player[] online = PlayerInfo.Online.Items;
                foreach (Player pl in online)
                {
                    pl.playerofcountdown = false;
                    pl.incountdown       = false;
                }
            }
        }
Exemplo n.º 16
0
        public static void Reset(Player p, bool all)
        {
            Block air = Block.BlockList.AIR, glass = Block.BlockList.GLASS, green = Block.BlockList.GREEN_CLOTH;

            if (gamestatus == CountdownGameStatus.Enabled || gamestatus == CountdownGameStatus.Finished || gamestatus == CountdownGameStatus.Disabled)
            {
                if (all)
                {
                    gamestatus  = CountdownGameStatus.Disabled;
                    playersleft = 0; playersleftlist.Clear();
                    squaresleft.Clear(); speed = 750;
                }
                #region BlockChanges
                mapon.BlockChange(15, 14, 18, air);
                mapon.BlockChange(16, 14, 18, air);
                mapon.BlockChange(15, 14, 17, air);
                mapon.BlockChange(16, 14, 17, air);

                mapon.BlockChange(14, 15, 17, air);
                mapon.BlockChange(14, 16, 18, air);
                mapon.BlockChange(14, 16, 17, air);
                mapon.BlockChange(14, 15, 18, air);

                mapon.BlockChange(15, 17, 17, air);
                mapon.BlockChange(16, 17, 18, air);
                mapon.BlockChange(15, 17, 18, air);
                mapon.BlockChange(16, 17, 17, air);

                mapon.BlockChange(17, 16, 17, air);
                mapon.BlockChange(17, 15, 18, air);
                mapon.BlockChange(17, 16, 18, air);
                mapon.BlockChange(17, 15, 17, air);

                mapon.BlockChange(16, 15, 16, air);
                mapon.BlockChange(15, 16, 16, air);
                mapon.BlockChange(15, 15, 16, air);
                mapon.BlockChange(16, 16, 16, air);

                {
                    ushort x1 = 27, x2 = 4, z1 = 27, z2 = 4, x3 = 5, z4 = 26, z3 = 5, x4 = 4;
                    while (x1 >= 4)
                    {
                        mapon.BlockChange(x1, 4, 4, glass); x1--;
                    }
                    while (x2 <= 27)
                    {
                        mapon.BlockChange(x2, 27, 4, glass); x2++;
                    }
                    while (z1 >= 4)
                    {
                        mapon.BlockChange(4, z1, 4, glass); z1--;
                    }
                    while (z2 <= 27)
                    {
                        mapon.BlockChange(27, z2, 4, glass); z2++;
                    }
                    while (x3 <= 26)
                    {
                        while (z4 >= 4)
                        {
                            mapon.BlockChange(x3, z4, 4, glass); z4--;
                        }
                        x3 += 3;
                    }
                    while (z3 <= 26)
                    {
                        while (x4 <= 26)
                        {
                            mapon.BlockChange(x4, z3, 4, glass); x4++;
                        }
                        z3 += 3;
                    }
                }
                PopulateSquaresLeft();
                while (squaresleft.Count > 0)
                {
                    Random number     = new Random();
                    int    randnum    = number.Next(squaresleft.Count);
                    string nextsquare = squaresleft.ElementAt(randnum);
                    squaresleft.Remove(nextsquare);
                    int    column = int.Parse(nextsquare.Split(':')[0]);
                    int    row = int.Parse(nextsquare.Split(':')[1]);
                    ushort x1 = (ushort)(27 - (row * 3)), x2 = (ushort)(28 - (row * 3)), y = 4, z1 = (ushort)(27 - (column * 3)), z2 = (ushort)(28 - (column * 3));
                    mapon.BlockChange(x1, z1, y, green); mapon.BlockChange(x2, z1, y, green); mapon.BlockChange(x2, z2, y, green); mapon.BlockChange(x1, z2, y, green);
                }
                #endregion
                if (!all)
                {
                    p.SendMessage("The Countdown map has been reset!"); if (gamestatus == CountdownGameStatus.Finished)
                    {
                        p.SendMessage("You don't need to re-enable it!");
                    }
                    gamestatus = CountdownGameStatus.Enabled;
                    foreach (Player pl in Server.Players)
                    {
                        if ((bool)pl.ExtraData["IsInCountdown"])
                        {
                            if (pl.Level == mapon)
                            {
                                Command.Find("coundown").Use(pl, new string[1] {
                                    "join"
                                });
                                pl.SendMessage("You've rejoined the countdown!");
                            }
                            else
                            {
                                pl.SendMessage("You've been removed from the countdown because you aren't on the map!");
                                players.Remove(pl); pl.ExtraData["IsInCountdown"] = false;
                            }
                        }
                    }
                }
                else if (all && p != null)
                {
                    p.SendMessage("Countdown has been reset!"); if (gamestatus == CountdownGameStatus.Finished)
                    {
                        p.SendMessage("You do not need to re-enable it");
                    }
                    gamestatus  = CountdownGameStatus.Enabled;
                    playersleft = 0; playersleftlist.Clear(); players.Clear();
                    foreach (Player pl in Server.Players)
                    {
                        pl.ExtraData["IsInCountdown"] = false;
                    }
                }
                return;
            }
            else
            {
                if (p == null)
                {
                    return;
                }
                if (gamestatus == CountdownGameStatus.Disabled)
                {
                    p.SendMessage("Please enable the game first!");
                }
                else
                {
                    p.SendMessage("Please wait till the end of the game!");
                }
            }
        }
Exemplo n.º 17
0
 public static void End(Player winner)
 {
     CountdownGame.squaresleft.Clear();
     if (winner != null)
     {
         winner.SendMessage("Congratulations!! You won!!!");
     }
     gamestatus = CountdownGameStatus.Finished;
     if (winner != null)
     {
         Command.all.Find("spawn").Use(winner, "");
     }
     CountdownGame.playersleftlist.Clear();
     if (winner != null)
     {
         winner.incountdown = false;
     }
     if (winner == null)
     {
         foreach (Player pl in CountdownGame.players)
         {
             Player.SendMessage(pl, "The countdown game was canceled!");
             Command.all.Find("spawn").Use(pl, "");
         }
         Player.GlobalMessage("The countdown game was canceled!!");
         CountdownGame.gamestatus = CountdownGameStatus.Enabled;
         CountdownGame.playersleft = 0;
         CountdownGame.playersleftlist.Clear();
         CountdownGame.players.Clear();
         CountdownGame.squaresleft.Clear();
         CountdownGame.Reset(null, true);
         CountdownGame.cancel = false;
         return;
     }
 }
Exemplo n.º 18
0
        public static void AfterStart()
        {
            {
                {
                    {
                        mapon.Blockchange(15, 18, 14, Block.air);
                        mapon.Blockchange(16, 18, 14, Block.air);
                        mapon.Blockchange(15, 17, 14, Block.air);
                        mapon.Blockchange(16, 17, 14, Block.air);
                    }
                    {
                        mapon.Blockchange(14, 17, 15, Block.air);
                        mapon.Blockchange(14, 18, 16, Block.air);
                        mapon.Blockchange(14, 17, 16, Block.air);
                        mapon.Blockchange(14, 18, 15, Block.air);
                    }
                    {
                        mapon.Blockchange(15, 17, 17, Block.air);
                        mapon.Blockchange(16, 18, 17, Block.air);
                        mapon.Blockchange(15, 18, 17, Block.air);
                        mapon.Blockchange(16, 17, 17, Block.air);
                    }
                    {
                        mapon.Blockchange(17, 17, 16, Block.air);
                        mapon.Blockchange(17, 18, 15, Block.air);
                        mapon.Blockchange(17, 18, 16, Block.air);
                        mapon.Blockchange(17, 17, 15, Block.air);
                    }
                }
                {
                    mapon.Blockchange(16, 16, 15, Block.glass);
                    mapon.Blockchange(15, 16, 16, Block.glass);
                    mapon.Blockchange(15, 16, 15, Block.glass);
                    mapon.Blockchange(16, 16, 16, Block.glass);
                }
                {
                    ushort x1 = 27;
                    while (x1 >= 4)
                    {
                        mapon.Blockchange(x1, 4, 4, Block.air);
                        x1 = (ushort)(x1 - 1);
                    }
                    ushort x2 = 4;
                    while (x2 <= 27)
                    {
                        mapon.Blockchange(x2, 4, 27, Block.air);
                        x2++;
                    }
                    ushort z1 = 27;
                    while (z1 >= 4)
                    {
                        mapon.Blockchange(4, 4, z1, Block.air);
                        z1 = (ushort)(z1 - 1);
                    }
                    ushort z2 = 4;
                    while (z2 <= 27)
                    {
                        mapon.Blockchange(27, 4, z2, Block.air);
                        z2++;
                    }
                }
            }

            if (freezemode == false)
            {
                mapon.countdowninprogress = true;
                gamestatus = CountdownGameStatus.InProgress;
            }
        }
Exemplo n.º 19
0
 public static void Play()
 {
     if (freezemode == false)
     {
         while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
         {
             Random number = new Random();
             int randnum = number.Next(squaresleft.Count);
             string nextsquare = squaresleft.ElementAt(randnum);
             squaresleft.Remove(nextsquare);
             RemoveSquare(nextsquare);
             if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
             {
                 mapon.ChatLevel(squaresleft.Count + " Squares Left and " + playersleft.ToString() + " Players left!!");
             }
             if (cancel == true)
             {
                 End(null);
             }
         }
         return;
     }
     else
     {
         {//Find yo places stuff (15 seconds)
             Thread.Sleep(500);
             MessagePlayers("Welcome to Freeze Mode of countdown");
             MessagePlayers("You have 15 seconds to stand on a square");
             Thread.Sleep(500);
             MessagePlayers("-----&b15" + Server.DefaultColor + "-----");
             Thread.Sleep(500);
             MessagePlayers("Once the countdown is up, you are stuck on your square");
             Thread.Sleep(500);
             MessagePlayers("-----&b14" + Server.DefaultColor + "-----");
             Thread.Sleep(500);
             MessagePlayers("The squares then start to dissapear");
             Thread.Sleep(500);
             MessagePlayers("-----&b13" + Server.DefaultColor + "-----");
             Thread.Sleep(500);
             MessagePlayers("Whoever is last out wins!!");
             Thread.Sleep(500);
             MessagePlayers("-----&b12" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b11" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b10" + Server.DefaultColor + "-----");
             MessagePlayers("Only 10 Seconds left to pick your places!!");
             Thread.Sleep(1000);
             MessagePlayers("-----&b9" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b8" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b7" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b6" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b5" + Server.DefaultColor + "-----");
             MessagePlayers("5 Seconds left to pick your places!!");
             Thread.Sleep(1000);
             MessagePlayers("-----&b4" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b3" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b2" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("-----&b1" + Server.DefaultColor + "-----");
             Thread.Sleep(1000);
             MessagePlayers("&bPlayers Frozen");
             {
                 mapon.countdowninprogress = true;
                 gamestatus = CountdownGameStatus.InProgress;
                 foreach (Player pl in players)
                 {
                     pl.countdownsettemps = true;
                     Thread.Sleep(100);
                 }
             }
             {//Get rid of glass
                 ushort x3 = 5;
                 while (x3 <= 26)
                 {
                     ushort z4 = 26;
                     while (z4 >= 4)
                     {
                         mapon.Blockchange(x3, 4, z4, Block.air);
                         z4 = (ushort)(z4 - 1);
                     }
                     x3 = (ushort)(x3 + 3);
                 }
                 ushort z3 = 5;
                 while (z3 <= 26)
                 {
                     ushort x4 = 4;
                     while (x4 <= 26)
                     {
                         mapon.Blockchange(x4, 4, z3, Block.air);
                         x4++;
                     }
                     z3 = (ushort)(z3 + 3);
                 }
             }
             while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
             {
                 Random number = new Random();
                 int randnum = number.Next(squaresleft.Count);
                 string nextsquare = squaresleft.ElementAt(randnum);
                 squaresleft.Remove(nextsquare);
                 RemoveSquare(nextsquare);
                 if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished)
                 {
                     mapon.ChatLevel(squaresleft.Count + " Squares Left and " + playersleft.ToString() + " Players left!!");
                 }
                 if (cancel == true)
                 {
                     End(null);
                 }
             }
             return;
         }
     }
 }
Exemplo n.º 20
0
        //private static ushort[] x; // this is useless?

        public static void GameStart(Player p)
        {
            switch (gamestatus)
            {
            case CountdownGameStatus.Disabled:
                Player.SendMessage(p, "Please enable Countdown first!!");
                return;

            case CountdownGameStatus.AboutToStart:
                Player.SendMessage(p, "Game is about to start");
                return;

            case CountdownGameStatus.InProgress:
                Player.SendMessage(p, "Game is already in progress");
                return;

            case CountdownGameStatus.Finished:
                Player.SendMessage(p, "Game has finished");
                return;

            case CountdownGameStatus.Enabled:
                gamestatus = CountdownGameStatus.AboutToStart;
                Thread.Sleep(2000);
                break;
            }
            {
                {
                    mapon.Blockchange(15, 27, 16, Block.glass);
                    mapon.Blockchange(16, 27, 15, Block.glass);
                    mapon.Blockchange(16, 27, 16, Block.glass);
                    mapon.Blockchange(15, 27, 15, Block.glass);
                }
                {
                    {
                        mapon.Blockchange(15, 18, 14, Block.glass);
                        mapon.Blockchange(16, 18, 14, Block.glass);
                        mapon.Blockchange(15, 17, 14, Block.glass);
                        mapon.Blockchange(16, 17, 14, Block.glass);
                    }
                    {
                        mapon.Blockchange(14, 17, 15, Block.glass);
                        mapon.Blockchange(14, 18, 16, Block.glass);
                        mapon.Blockchange(14, 17, 16, Block.glass);
                        mapon.Blockchange(14, 18, 15, Block.glass);
                    }
                    {
                        mapon.Blockchange(15, 17, 17, Block.glass);
                        mapon.Blockchange(16, 18, 17, Block.glass);
                        mapon.Blockchange(15, 18, 17, Block.glass);
                        mapon.Blockchange(16, 17, 17, Block.glass);
                    }
                    {
                        mapon.Blockchange(17, 17, 16, Block.glass);
                        mapon.Blockchange(17, 18, 15, Block.glass);
                        mapon.Blockchange(17, 18, 16, Block.glass);
                        mapon.Blockchange(17, 17, 15, Block.glass);
                    }
                }
                {
                    mapon.Blockchange(16, 16, 15, Block.glass);
                    mapon.Blockchange(15, 16, 16, Block.glass);
                    mapon.Blockchange(15, 16, 15, Block.glass);
                    mapon.Blockchange(16, 16, 16, Block.glass);
                }
            }
            mapon.ChatLevel("Countdown is about to start!!");
            mapon.permissionbuild = LevelPermission.Nobody;
            ushort x1 = (ushort)((15.5) * 32);
            ushort y1 = (ushort)((30) * 32);
            ushort z1 = (ushort)((15.5) * 32);

            foreach (Player player in players)
            {
                if (player.level != mapon)
                {
                    player.SendMessage("Sending you to the correct map.");
                    Command.all.Find("goto").Use(player, mapon.name);
                    Thread.Sleep(1000);
                    // Sleep for a bit while they load
                    while (player.Loading)
                    {
                        Thread.Sleep(250);
                    }
                }
                unchecked
                {
                    player.SendSpawn((byte)-1, player.name, x1, y1, z1, (byte)0, (byte)0, player.DisplayName, player.SkinName);
                }
            }
            {
                CountdownGame.squaresleft.Clear();
                PopulateSquaresLeft();
                if (freezemode == true)
                {
                    mapon.ChatLevel("Countdown starting with difficulty " + speedtype + " and mode freeze in:");
                }
                else
                {
                    mapon.ChatLevel("Countdown starting with difficulty " + speedtype + " and mode normal in:");
                }
                Thread.Sleep(2000);
                mapon.ChatLevel("-----&b5" + Server.DefaultColor + "-----");
                {
                    mapon.Blockchange(16, 16, 15, Block.air);
                    mapon.Blockchange(15, 16, 16, Block.air);
                    mapon.Blockchange(15, 16, 15, Block.air);
                    mapon.Blockchange(16, 16, 16, Block.air);
                }
                Thread.Sleep(1000);
                mapon.ChatLevel("-----&b4" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                mapon.ChatLevel("-----&b3" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                {
                    mapon.Blockchange(15, 27, 16, Block.air);
                    mapon.Blockchange(16, 27, 15, Block.air);
                    mapon.Blockchange(16, 27, 16, Block.air);
                    mapon.Blockchange(15, 27, 15, Block.air);
                }
                mapon.ChatLevel("-----&b2" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                mapon.ChatLevel("-----&b1" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                mapon.ChatLevel("GO!!!!!!!");
            }
            {
                playersleft     = players.Count();
                playersleftlist = players;
                foreach (Player plya in players)
                {
                    plya.incountdown = true;
                }
            }
            AfterStart();
            Play();
        }
Exemplo n.º 21
0
        public static void AfterStart()
        {
            {
                {
                    {
                        mapon.Blockchange(15, 18, 14, Block.air);
                        mapon.Blockchange(16, 18, 14, Block.air);
                        mapon.Blockchange(15, 17, 14, Block.air);
                        mapon.Blockchange(16, 17, 14, Block.air);
                    }
                    {
                        mapon.Blockchange(14, 17, 15, Block.air);
                        mapon.Blockchange(14, 18, 16, Block.air);
                        mapon.Blockchange(14, 17, 16, Block.air);
                        mapon.Blockchange(14, 18, 15, Block.air);
                    }
                    {
                        mapon.Blockchange(15, 17, 17, Block.air);
                        mapon.Blockchange(16, 18, 17, Block.air);
                        mapon.Blockchange(15, 18, 17, Block.air);
                        mapon.Blockchange(16, 17, 17, Block.air);
                    }
                    {
                        mapon.Blockchange(17, 17, 16, Block.air);
                        mapon.Blockchange(17, 18, 15, Block.air);
                        mapon.Blockchange(17, 18, 16, Block.air);
                        mapon.Blockchange(17, 17, 15, Block.air);
                    }
                }
                {
                    mapon.Blockchange(16, 16, 15, Block.glass);
                    mapon.Blockchange(15, 16, 16, Block.glass);
                    mapon.Blockchange(15, 16, 15, Block.glass);
                    mapon.Blockchange(16, 16, 16, Block.glass);
                }
                {
                    ushort x1 = 27;
                    while (x1 >= 4)
                    {
                        mapon.Blockchange(x1, 4, 4, Block.air);
                        x1 = (ushort)(x1 - 1);
                    }
                    ushort x2 = 4;
                    while (x2 <= 27)
                    {
                        mapon.Blockchange(x2, 4, 27, Block.air);
                        x2++;
                    }
                    ushort z1 = 27;
                    while (z1 >= 4)
                    {
                        mapon.Blockchange(4, 4, z1, Block.air);
                        z1 = (ushort)(z1 - 1);
                    }
                    ushort z2 = 4;
                    while (z2 <= 27)
                    {
                        mapon.Blockchange(27, 4, z2, Block.air);
                        z2++;
                    }
                }
            }

            if (freezemode == false)
            {
                mapon.countdowninprogress = true;
                gamestatus = CountdownGameStatus.InProgress;
            }
        }
Exemplo n.º 22
0
        public static void Reset(Player p, bool all)
        {
            if (gamestatus == CountdownGameStatus.Enabled || gamestatus == CountdownGameStatus.Finished || gamestatus == CountdownGameStatus.Disabled)
            {
                {
                    if (all == true)
                    {
                        { //clean variables
                            CountdownGame.gamestatus  = CountdownGameStatus.Disabled;
                            CountdownGame.playersleft = 0;
                            CountdownGame.playersleftlist.Clear();
                            CountdownGame.squaresleft.Clear();
                            CountdownGame.speed = 750;
                        }
                    }
                    { //top part of map tube thingy
                        {
                            mapon.Blockchange(15, 18, 14, Block.air);
                            mapon.Blockchange(16, 18, 14, Block.air);
                            mapon.Blockchange(15, 17, 14, Block.air);
                            mapon.Blockchange(16, 17, 14, Block.air);
                        }
                        {
                            mapon.Blockchange(14, 17, 15, Block.air);
                            mapon.Blockchange(14, 18, 16, Block.air);
                            mapon.Blockchange(14, 17, 16, Block.air);
                            mapon.Blockchange(14, 18, 15, Block.air);
                        }
                        {
                            mapon.Blockchange(15, 17, 17, Block.air);
                            mapon.Blockchange(16, 18, 17, Block.air);
                            mapon.Blockchange(15, 18, 17, Block.air);
                            mapon.Blockchange(16, 17, 17, Block.air);
                        }
                        {
                            mapon.Blockchange(17, 17, 16, Block.air);
                            mapon.Blockchange(17, 18, 15, Block.air);
                            mapon.Blockchange(17, 18, 16, Block.air);
                            mapon.Blockchange(17, 17, 15, Block.air);
                        }
                        {
                            mapon.Blockchange(16, 16, 15, Block.glass);
                            mapon.Blockchange(15, 16, 16, Block.glass);
                            mapon.Blockchange(15, 16, 15, Block.glass);
                            mapon.Blockchange(16, 16, 16, Block.glass);
                        }
                    }
                    {
                        { //sides of map
                            ushort x1 = 27;
                            while (x1 >= 4)
                            {
                                mapon.Blockchange(x1, 4, 4, Block.glass);
                                x1 = (ushort)(x1 - 1);
                            }
                            ushort x2 = 4;
                            while (x2 <= 27)
                            {
                                mapon.Blockchange(x2, 4, 27, Block.glass);
                                x2++;
                            }
                            ushort z1 = 27;
                            while (z1 >= 4)
                            {
                                mapon.Blockchange(4, 4, z1, Block.glass);
                                z1 = (ushort)(z1 - 1);
                            }
                            ushort z2 = 4;
                            while (z2 <= 27)
                            {
                                mapon.Blockchange(27, 4, z2, Block.glass);
                                z2++;
                            }
                        }
                        { //rest of glass on map
                            ushort x3 = 5;
                            while (x3 <= 26)
                            {
                                ushort z4 = 26;
                                while (z4 >= 4)
                                {
                                    mapon.Blockchange(x3, 4, z4, Block.glass);
                                    z4 = (ushort)(z4 - 1);
                                }
                                x3 = (ushort)(x3 + 3);
                            }
                            ushort z3 = 5;
                            while (z3 <= 26)
                            {
                                ushort x4 = 4;
                                while (x4 <= 26)
                                {
                                    mapon.Blockchange(x4, 4, z3, Block.glass);
                                    x4++;
                                }
                                z3 = (ushort)(z3 + 3);
                            }
                        }
                        { //green on map
                            PopulateSquaresLeft();
                            while (squaresleft.Count > 0)
                            {
                                Random number     = new Random();
                                int    randnum    = number.Next(squaresleft.Count);
                                string nextsquare = squaresleft.ElementAt(randnum);
                                squaresleft.Remove(nextsquare);
                                {
                                    int    column = int.Parse(nextsquare.Split(':')[0]);
                                    int    row    = int.Parse(nextsquare.Split(':')[1]);
                                    ushort x1     = (ushort)(27 - (row * 3));
                                    ushort x2     = (ushort)(28 - (row * 3));
                                    ushort y      = 4;
                                    ushort z1     = (ushort)(27 - (column * 3));
                                    ushort z2     = (ushort)(28 - (column * 3));
                                    {
                                        {
                                            mapon.Blockchange(x1, y, z1, Block.green);
                                            mapon.Blockchange(x2, y, z1, Block.green);
                                            mapon.Blockchange(x2, y, z2, Block.green);
                                            mapon.Blockchange(x1, y, z2, Block.green);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (all == false)
                {
                    if (p != null)
                    {
                        p.SendMessage("The Countdown map has been reset");
                        if (gamestatus == CountdownGameStatus.Finished)
                        {
                            p.SendMessage("You do not need to re-enable it");
                        }
                    }
                    gamestatus = CountdownGameStatus.Enabled;
                    foreach (Player pl in Player.players)
                    {
                        if (pl.playerofcountdown == true)
                        {
                            if (pl.level == mapon)
                            {
                                Command.all.Find("countdown").Use(pl, "join");
                                Player.SendMessage(pl, "You've rejoined countdown!!");
                            }
                            else
                            {
                                Player.SendMessage(pl, "You've been removed from countdown because you aren't on the map");
                                pl.playerofcountdown = false;
                                players.Remove(pl);
                            }
                        }
                    }
                }
                else if (all == true)
                {
                    if (p != null)
                    {
                        p.SendMessage("Countdown has been reset");
                        if (gamestatus == CountdownGameStatus.Finished)
                        {
                            p.SendMessage("You do not need to re-enable it");
                        }
                    }
                    gamestatus = CountdownGameStatus.Enabled;
                    CountdownGame.playersleft = 0;
                    CountdownGame.playersleftlist.Clear();
                    CountdownGame.players.Clear();
                    foreach (Player pl in Player.players)
                    {
                        pl.playerofcountdown = false;
                        pl.incountdown       = false;
                    }
                }
                return;
            }
            else
            {
                switch (gamestatus)
                {
                case CountdownGameStatus.Disabled:
                    if (p != null)
                    {
                        p.SendMessage("Please enable the game first");
                    }
                    return;

                default:
                    if (p != null)
                    {
                        p.SendMessage("Please wait till the end of the game");
                    }
                    return;
                }
            }
        }
Exemplo n.º 23
0
        public static void GameStart(Player p)
        {
            switch (gamestatus)
            {
            case CountdownGameStatus.Disabled:
                p.SendMessage("Please enable Countdown first!"); return;

            case CountdownGameStatus.AboutToStart:
                p.SendMessage("The game is about to start!"); return;

            case CountdownGameStatus.InProgress:
                p.SendMessage("The game is already in progress!"); return;

            case CountdownGameStatus.Finished:
                p.SendMessage("The game has finished!"); return;

            case CountdownGameStatus.Enabled:
                gamestatus = CountdownGameStatus.AboutToStart;
                Thread.Sleep(2000);
                break;
            }
            #region Blockchanges
            Block glass = Block.BlockList.GLASS;
            Block air   = Block.BlockList.AIR;
            mapon.BlockChange(15, 16, 27, glass);
            mapon.BlockChange(16, 15, 27, glass);
            mapon.BlockChange(16, 16, 27, glass);
            mapon.BlockChange(15, 15, 27, glass);

            mapon.BlockChange(15, 14, 18, glass);
            mapon.BlockChange(16, 14, 18, glass);
            mapon.BlockChange(15, 14, 17, glass);
            mapon.BlockChange(16, 14, 17, glass);

            mapon.BlockChange(14, 15, 17, glass);
            mapon.BlockChange(14, 16, 18, glass);
            mapon.BlockChange(14, 16, 17, glass);
            mapon.BlockChange(14, 15, 18, glass);

            mapon.BlockChange(15, 17, 17, glass);
            mapon.BlockChange(16, 17, 18, glass);
            mapon.BlockChange(15, 17, 18, glass);
            mapon.BlockChange(16, 17, 17, glass);

            mapon.BlockChange(17, 16, 17, glass);
            mapon.BlockChange(17, 15, 18, glass);
            mapon.BlockChange(17, 16, 18, glass);
            mapon.BlockChange(17, 15, 17, glass);

            mapon.BlockChange(16, 15, 16, glass);
            mapon.BlockChange(15, 16, 16, glass);
            mapon.BlockChange(15, 15, 16, glass);
            mapon.BlockChange(16, 16, 16, glass);
            #endregion
            Player.LevelChat(mapon, "Countdown is about to start!");
            //TODO: perbuild to nobody
            ushort x1 = (ushort)((15.5) * 32);
            ushort y1 = (ushort)((30) * 32);
            ushort z1 = (ushort)((15.5) * 32);
            foreach (Player pl in Server.Players)
            {
                if (pl.Level != mapon)
                {
                    Command.Find("goto").Use(pl, new string[1] {
                        mapon.Name
                    });
                    while (p.IsLoading)
                    {
                        Thread.Sleep(500);
                    }
                    pl.SendToPos(new Vector3(x1, z1, y1), new byte[] { 0, 0 });
                }
            }
            squaresleft.Clear();
            PopulateSquaresLeft();
            Player.LevelChat(mapon, freezemode ? "Countdown starting with difficulty " + speedtype + " and mode freeze in:" : "Countdown starting with difficulty " + speedtype + " and mode normal in:");
            Thread.Sleep(2000);
            for (int i = 5; i >= 1; i--)
            {
                Player.LevelChat(mapon, "--&b" + i.ToString() + Server.DefaultColor + "--");
                if (i == 5)
                {
                    mapon.BlockChange(16, 15, 16, air); mapon.BlockChange(15, 16, 16, air); mapon.BlockChange(15, 15, 16, air); mapon.BlockChange(16, 16, 16, air);
                }
                if (i == 3)
                {
                    mapon.BlockChange(15, 16, 27, air); mapon.BlockChange(16, 15, 27, air); mapon.BlockChange(16, 16, 27, air); mapon.BlockChange(15, 15, 27, air);
                }
                Thread.Sleep(1000);
            }
            Player.LevelChat(mapon, "&bGO!!!");
            playersleft     = players.Count();
            playersleftlist = players;
            foreach (Player play in players)
            {
                play.ExtraData.CreateIfNotExist("IsInCountdown", true); play.ExtraData["IsInCountdown"] = true;
            }
            AfterStart();
            Play();
        }
Exemplo n.º 24
0
        //private static ushort[] x; // this is useless?
        public static void GameStart(Player p)
        {
            switch (gamestatus)
            {
                case CountdownGameStatus.Disabled:
                    Player.SendMessage(p, "Please enable Countdown first!!");
                    return;

                case CountdownGameStatus.AboutToStart:
                    Player.SendMessage(p, "Game is about to start");
                    return;

                case CountdownGameStatus.InProgress:
                    Player.SendMessage(p, "Game is already in progress");
                    return;

                case CountdownGameStatus.Finished:
                    Player.SendMessage(p, "Game has finished");
                    return;

                case CountdownGameStatus.Enabled:
                    gamestatus = CountdownGameStatus.AboutToStart;
                    Thread.Sleep(2000);
                    break;
            }
            {
                {
                    mapon.Blockchange(15, 27, 16, Block.glass);
                    mapon.Blockchange(16, 27, 15, Block.glass);
                    mapon.Blockchange(16, 27, 16, Block.glass);
                    mapon.Blockchange(15, 27, 15, Block.glass);
                }
                {
                    {
                        mapon.Blockchange(15, 18, 14, Block.glass);
                        mapon.Blockchange(16, 18, 14, Block.glass);
                        mapon.Blockchange(15, 17, 14, Block.glass);
                        mapon.Blockchange(16, 17, 14, Block.glass);
                    }
                    {
                        mapon.Blockchange(14, 17, 15, Block.glass);
                        mapon.Blockchange(14, 18, 16, Block.glass);
                        mapon.Blockchange(14, 17, 16, Block.glass);
                        mapon.Blockchange(14, 18, 15, Block.glass);
                    }
                    {
                        mapon.Blockchange(15, 17, 17, Block.glass);
                        mapon.Blockchange(16, 18, 17, Block.glass);
                        mapon.Blockchange(15, 18, 17, Block.glass);
                        mapon.Blockchange(16, 17, 17, Block.glass);
                    }
                    {
                        mapon.Blockchange(17, 17, 16, Block.glass);
                        mapon.Blockchange(17, 18, 15, Block.glass);
                        mapon.Blockchange(17, 18, 16, Block.glass);
                        mapon.Blockchange(17, 17, 15, Block.glass);
                    }
                }
                {
                    mapon.Blockchange(16, 16, 15, Block.glass);
                    mapon.Blockchange(15, 16, 16, Block.glass);
                    mapon.Blockchange(15, 16, 15, Block.glass);
                    mapon.Blockchange(16, 16, 16, Block.glass);
                }
            }
            mapon.ChatLevel("Countdown is about to start!!");
            mapon.permissionbuild = LevelPermission.Nobody;
            ushort x1 = (ushort)((15.5) * 32);
            ushort y1 = (ushort)((30) * 32);
            ushort z1 = (ushort)((15.5) * 32);
            foreach (Player player in players)
            {
                if (player.level != mapon)
                {
                    player.SendMessage("Sending you to the correct map.");
                    Command.all.Find("goto").Use(player, mapon.name);
                    Thread.Sleep(1000);
                    // Sleep for a bit while they load
                    while (player.Loading) { Thread.Sleep(250); }
                }
                unchecked
                {
                    player.SendSpawn((byte)-1, player.name, x1, y1, z1, (byte)0, (byte)0);
                }
            }
            {
                CountdownGame.squaresleft.Clear();
                PopulateSquaresLeft();
                if (freezemode == true)
                {
                    mapon.ChatLevel("Countdown starting with difficulty " + speedtype + " and mode freeze in:");
                }
                else
                {
                    mapon.ChatLevel("Countdown starting with difficulty " + speedtype + " and mode normal in:");
                }
                Thread.Sleep(2000);
                mapon.ChatLevel("-----&b5" + Server.DefaultColor + "-----");
                {
                    mapon.Blockchange(16, 16, 15, Block.air);
                    mapon.Blockchange(15, 16, 16, Block.air);
                    mapon.Blockchange(15, 16, 15, Block.air);
                    mapon.Blockchange(16, 16, 16, Block.air);
                }
                Thread.Sleep(1000);
                mapon.ChatLevel("-----&b4" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                mapon.ChatLevel("-----&b3" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                {
                    mapon.Blockchange(15, 27, 16, Block.air);
                    mapon.Blockchange(16, 27, 15, Block.air);
                    mapon.Blockchange(16, 27, 16, Block.air);
                    mapon.Blockchange(15, 27, 15, Block.air);
                }
                mapon.ChatLevel("-----&b2" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                mapon.ChatLevel("-----&b1" + Server.DefaultColor + "-----");
                Thread.Sleep(1000);
                mapon.ChatLevel("GO!!!!!!!");
            }
            {
                playersleft = players.Count();
                playersleftlist = players;
                foreach (Player plya in players)
                {
                    plya.incountdown = true;
                }
            }
            AfterStart();
            Play();
        }
Exemplo n.º 25
0
        public void BeginRound(Player p)
        {
            Status = CountdownGameStatus.RoundCountdown;
            ResetMap();
            SetGlassTube(Block.Glass, Block.Glass);
            Map.ChatLevel("Countdown is about to start!");
            if (Status != CountdownGameStatus.RoundCountdown)
            {
                return;
            }

            int midX = Map.Width / 2, midY = Map.Height / 2, midZ = Map.Length / 2;
            int xSpawn = (midX * 32 + 16);
            int ySpawn = ((Map.Height - 2) * 32);
            int zSpawn = (midZ * 32 + 16);

            squaresLeft.Clear();
            for (int zz = 6; zz < Map.Length - 6; zz += 3)
            {
                for (int xx = 6; xx < Map.Width - 6; xx += 3)
                {
                    squaresLeft.Add(new SquarePos(xx, zz));
                }
            }

            if (FreezeMode)
            {
                Map.ChatLevel("Countdown starting with difficulty " + SpeedType + " and mode freeze in:");
            }
            else
            {
                Map.ChatLevel("Countdown starting with difficulty " + SpeedType + " and mode normal in:");
            }

            Thread.Sleep(2000);
            SpawnPlayers(xSpawn, ySpawn, zSpawn);
            Map.ChatLevel("-----&b5%S-----");
            if (Status != CountdownGameStatus.RoundCountdown)
            {
                return;
            }

            Cuboid(midX - 1, midY, midZ - 1, midX, midY, midZ, Block.Air, Map);
            Thread.Sleep(1000);
            if (Status != CountdownGameStatus.RoundCountdown)
            {
                return;
            }

            Map.ChatLevel("-----&b4%S-----"); Thread.Sleep(1000);
            Map.ChatLevel("-----&b3%S-----"); Thread.Sleep(1000);
            Cuboid(midX, Map.Height - 5, midZ, midX + 1, Map.Height - 5, midZ + 1, Block.Air, Map);
            if (Status != CountdownGameStatus.RoundCountdown)
            {
                return;
            }

            Map.ChatLevel("-----&b2%S-----"); Thread.Sleep(1000);
            Map.ChatLevel("-----&b1%S-----"); Thread.Sleep(1000);
            Map.ChatLevel("GO!!!!!!!");
            if (Status != CountdownGameStatus.RoundCountdown)
            {
                return;
            }

            Player[] players = Players.Items;
            Remaining.Clear();
            foreach (Player pl in players)
            {
                Remaining.Add(pl);
            }

            DoRound();
        }
Exemplo n.º 26
0
        public static void Reset(Player p, bool all)
        {
            if (gamestatus == CountdownGameStatus.Enabled || gamestatus == CountdownGameStatus.Finished || gamestatus == CountdownGameStatus.Disabled)
            {
                {
                    if (all == true)
                    {
                        { //clean variables
                            CountdownGame.gamestatus = CountdownGameStatus.Disabled;
                            CountdownGame.playersleft = 0;
                            CountdownGame.playersleftlist.Clear();
                            CountdownGame.squaresleft.Clear();
                            CountdownGame.speed = 750;
                        }
                    }
                    { //top part of map tube thingy
                        {
                            mapon.Blockchange(15, 18, 14, Block.air);
                            mapon.Blockchange(16, 18, 14, Block.air);
                            mapon.Blockchange(15, 17, 14, Block.air);
                            mapon.Blockchange(16, 17, 14, Block.air);
                        }
                        {
                            mapon.Blockchange(14, 17, 15, Block.air);
                            mapon.Blockchange(14, 18, 16, Block.air);
                            mapon.Blockchange(14, 17, 16, Block.air);
                            mapon.Blockchange(14, 18, 15, Block.air);
                        }
                        {
                            mapon.Blockchange(15, 17, 17, Block.air);
                            mapon.Blockchange(16, 18, 17, Block.air);
                            mapon.Blockchange(15, 18, 17, Block.air);
                            mapon.Blockchange(16, 17, 17, Block.air);
                        }
                        {
                            mapon.Blockchange(17, 17, 16, Block.air);
                            mapon.Blockchange(17, 18, 15, Block.air);
                            mapon.Blockchange(17, 18, 16, Block.air);
                            mapon.Blockchange(17, 17, 15, Block.air);
                        }
                        {
                            mapon.Blockchange(16, 16, 15, Block.glass);
                            mapon.Blockchange(15, 16, 16, Block.glass);
                            mapon.Blockchange(15, 16, 15, Block.glass);
                            mapon.Blockchange(16, 16, 16, Block.glass);
                        }
                    }
                    {
                        { //sides of map
                            ushort x1 = 27;
                            while (x1 >= 4)
                            {
                                mapon.Blockchange(x1, 4, 4, Block.glass);
                                x1 = (ushort)(x1 - 1);
                            }
                            ushort x2 = 4;
                            while (x2 <= 27)
                            {
                                mapon.Blockchange(x2, 4, 27, Block.glass);
                                x2++;
                            }
                            ushort z1 = 27;
                            while (z1 >= 4)
                            {
                                mapon.Blockchange(4, 4, z1, Block.glass);
                                z1 = (ushort)(z1 - 1);
                            }
                            ushort z2 = 4;
                            while (z2 <= 27)
                            {
                                mapon.Blockchange(27, 4, z2, Block.glass);
                                z2++;
                            }
                        }
                        { //rest of glass on map
                            ushort x3 = 5;
                            while (x3 <= 26)
                            {
                                ushort z4 = 26;
                                while (z4 >= 4)
                                {
                                    mapon.Blockchange(x3, 4, z4, Block.glass);
                                    z4 = (ushort)(z4 - 1);
                                }
                                x3 = (ushort)(x3 + 3);
                            }
                            ushort z3 = 5;
                            while (z3 <= 26)
                            {
                                ushort x4 = 4;
                                while (x4 <= 26)
                                {
                                    mapon.Blockchange(x4, 4, z3, Block.glass);
                                    x4++;
                                }
                                z3 = (ushort)(z3 + 3);
                            }
                        }
                        { //green on map
                            PopulateSquaresLeft();
                            while (squaresleft.Count > 0)
                            {
                                Random number = new Random();
                                int randnum = number.Next(squaresleft.Count);
                                string nextsquare = squaresleft.ElementAt(randnum);
                                squaresleft.Remove(nextsquare);
                                {
                                    int column = int.Parse(nextsquare.Split(':')[0]);
                                    int row = int.Parse(nextsquare.Split(':')[1]);
                                    ushort x1 = (ushort)(27 - (row * 3));
                                    ushort x2 = (ushort)(28 - (row * 3));
                                    ushort y = 4;
                                    ushort z1 = (ushort)(27 - (column * 3));
                                    ushort z2 = (ushort)(28 - (column * 3));
                                    {
                                        {
                                            mapon.Blockchange(x1, y, z1, Block.green);
                                            mapon.Blockchange(x2, y, z1, Block.green);
                                            mapon.Blockchange(x2, y, z2, Block.green);
                                            mapon.Blockchange(x1, y, z2, Block.green);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (all == false)
                {
                    if (p != null)
                    {
                        p.SendMessage("The Countdown map has been reset");
                        if (gamestatus == CountdownGameStatus.Finished)
                        {
                            p.SendMessage("You do not need to re-enable it");
                        }
                    }
                    gamestatus = CountdownGameStatus.Enabled;
                    foreach (Player pl in Player.players)
                    {
                        if (pl.playerofcountdown == true)
                        {
                            if (pl.level == mapon)
                            {
                                Command.all.Find("countdown").Use(pl, "join");
                                Player.SendMessage(pl, "You've rejoined countdown!!");
                            }
                            else
                            {
                                Player.SendMessage(pl, "You've been removed from countdown because you aren't on the map");
                                pl.playerofcountdown = false;
                                players.Remove(pl);
                            }
                        }
                    }
                }
                else if (all == true)
                {
                    if (p != null)
                    {
                        p.SendMessage("Countdown has been reset");
                        if (gamestatus == CountdownGameStatus.Finished)
                        {
                            p.SendMessage("You do not need to re-enable it");
                        }
                    }
                    gamestatus = CountdownGameStatus.Enabled;
                    CountdownGame.playersleft = 0;
                    CountdownGame.playersleftlist.Clear();
                    CountdownGame.players.Clear();
                    foreach (Player pl in Player.players)
                    {
                        pl.playerofcountdown = false;
                        pl.incountdown = false;
                    }
                }
                return;
            }
            else
            {
                switch (gamestatus)
                {
                    case CountdownGameStatus.Disabled:
                        if (p != null)
                        {
                            p.SendMessage("Please enable the game first");
                        }
                        return;

                    default:
                        if (p != null)
                        {
                            p.SendMessage("Please wait till the end of the game");
                        }
                        return;
                }
            }
        }
Exemplo n.º 27
0
 public static void Play()
 {
     Block air = Block.BlockList.AIR;
     if (!freezemode)
     {
         while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
         {
             Random number = new Random();
             int randnum = number.Next(squaresleft.Count);
             string nextsquare = squaresleft.ElementAt(randnum);
             squaresleft.Remove(nextsquare);
             RemoveSquare(nextsquare);
             if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished) { Player.LevelChat(mapon, "There's " + squaresleft.Count + " squares left, and " + playersleft.ToString() + " players left!"); }
             if (cancel == true) { End(null); }
         }
         return;
     }
     else
     {
         Player.LevelChat(mapon, "Welcome to Freeze Mode of coundown");
         Player.LevelChat(mapon, "You have 15 seconds to choose your square, after that you're stuck on that square!");
         Player.LevelChat(mapon, "Then the squares start dissapearing!");
         Thread.Sleep(500);
         for (int i = 15; i >= 1; i--) { Player.LevelChat(mapon, "---&b" + i.ToString() + Server.DefaultColor + "---"); Thread.Sleep(1000); }
         mapon.InCountdown = true;
         gamestatus = CountdownGameStatus.InProgress;
         //TODO: actually freeze players here, when somebody bothers adding /freeze
         ushort x3 = 5, z4 = 26, z3 = 5, x4 = 4;
         while (x3 <= 26) { while (z4 >= 4) { mapon.BlockChange(x3, z4, 4, air); z4--; } x3 += 3; }
         while (z3 <= 26) { while (x4 <= 26) { mapon.BlockChange(x4, z3, 4, air); x4++; } z3 += 3; }
         while (squaresleft.Any() && playersleft != 0 && (gamestatus == CountdownGameStatus.InProgress || gamestatus == CountdownGameStatus.Finished))
         {
             Random number = new Random();
             int randnum = number.Next(squaresleft.Count);
             string nextsquare = squaresleft.ElementAt(randnum);
             squaresleft.Remove(nextsquare);
             RemoveSquare(nextsquare);
             if (squaresleft.Count % 10 == 0 && gamestatus != CountdownGameStatus.Finished) { Player.LevelChat(mapon, "There's " + squaresleft.Count + " squares left, and " + playersleft.ToString() + " players left!"); }
             if (cancel == true) { End(null); }
         }
     }
 }
Exemplo n.º 28
0
 public static void End(Player winner)
 {
     gamestatus = CountdownGameStatus.Finished;
     squaresleft.Clear();
     if (winner != null) { winner.SendMessage("Congratulations! You won!"); Command.Find("spawn").Use(winner, null); winner.ExtraData["IsInCountdown"] = false; }
     playersleftlist.Clear();
     if (winner == null) { 
         foreach (Player pl in players) { pl.SendMessage("The game was canceled!"); Command.Find("spawn").Use(pl, null); }
         gamestatus = CountdownGameStatus.Enabled;
         playersleft = 0; 
         playersleftlist.Clear(); 
         players.Clear(); 
         //TODO: reset here
         cancel = false;
         return;
     }      
 }
Exemplo n.º 29
0
        public static void Reset(Player p, bool all)
        {
            Block air = Block.BlockList.AIR, glass = Block.BlockList.GLASS, green = Block.BlockList.GREEN_CLOTH;
            if (gamestatus == CountdownGameStatus.Enabled || gamestatus == CountdownGameStatus.Finished || gamestatus == CountdownGameStatus.Disabled) {
                if (all) {
                    gamestatus = CountdownGameStatus.Disabled;
                    playersleft = 0; playersleftlist.Clear();
                    squaresleft.Clear(); speed = 750;
                }
                #region BlockChanges
                mapon.BlockChange(15, 14, 18, air);
                mapon.BlockChange(16, 14, 18, air);
                mapon.BlockChange(15, 14, 17, air);
                mapon.BlockChange(16, 14, 17, air);

                mapon.BlockChange(14, 15, 17, air);
                mapon.BlockChange(14, 16, 18, air);
                mapon.BlockChange(14, 16, 17, air);
                mapon.BlockChange(14, 15, 18, air);

                mapon.BlockChange(15, 17, 17, air);
                mapon.BlockChange(16, 17, 18, air);
                mapon.BlockChange(15, 17, 18, air);
                mapon.BlockChange(16, 17, 17, air);

                mapon.BlockChange(17, 16, 17, air);
                mapon.BlockChange(17, 15, 18, air);
                mapon.BlockChange(17, 16, 18, air);
                mapon.BlockChange(17, 15, 17, air);

                mapon.BlockChange(16, 15, 16, air);
                mapon.BlockChange(15, 16, 16, air);
                mapon.BlockChange(15, 15, 16, air);
                mapon.BlockChange(16, 16, 16, air);

                {
                    ushort x1 = 27, x2 = 4, z1 = 27, z2 = 4, x3 = 5, z4 = 26, z3 = 5, x4 = 4;
                    while (x1 >= 4) { mapon.BlockChange(x1, 4, 4, glass); x1--; }
                    while (x2 <= 27) { mapon.BlockChange(x2, 27, 4, glass); x2++; }
                    while (z1 >= 4) { mapon.BlockChange(4, z1, 4, glass); z1--; }
                    while (z2 <= 27) { mapon.BlockChange(27, z2, 4, glass); z2++; }
                    while (x3 <= 26) { while (z4 >= 4) { mapon.BlockChange(x3, z4, 4, glass); z4--; } x3 += 3; }
                    while (z3 <= 26) { while (x4 <= 26) { mapon.BlockChange(x4, z3, 4, glass); x4++; } z3 += 3; }
                }
                PopulateSquaresLeft();
                while (squaresleft.Count > 0) {
                    Random number = new Random();
                    int randnum = number.Next(squaresleft.Count);
                    string nextsquare = squaresleft.ElementAt(randnum);
                    squaresleft.Remove(nextsquare);
                    int column = int.Parse(nextsquare.Split(':')[0]);
                    int row = int.Parse(nextsquare.Split(':')[1]);
                    ushort x1 = (ushort)(27 - (row * 3)), x2 = (ushort)(28 - (row * 3)), y = 4, z1 = (ushort)(27 - (column * 3)), z2 = (ushort)(28 - (column * 3));
                    mapon.BlockChange(x1, z1, y, green); mapon.BlockChange(x2, z1, y, green); mapon.BlockChange(x2, z2, y, green); mapon.BlockChange(x1, z2, y, green);
                }
                #endregion
                if (!all) {
                    p.SendMessage("The Countdown map has been reset!"); if (gamestatus == CountdownGameStatus.Finished) { p.SendMessage("You don't need to re-enable it!"); }
                    gamestatus = CountdownGameStatus.Enabled;
                    foreach (Player pl in Server.Players) {
                        if ((bool)pl.ExtraData["IsInCountdown"]) {
                            if (pl.Level == mapon) {
                                Command.Find("coundown").Use(pl, new string[1] { "join" });
                                pl.SendMessage("You've rejoined the countdown!");
                            }
                            else {
                                pl.SendMessage("You've been removed from the countdown because you aren't on the map!");
                                players.Remove(pl); pl.ExtraData["IsInCountdown"] = false;
                            }
                        }
                    }
                }
                else if (all && p != null) {
                        p.SendMessage("Countdown has been reset!"); if (gamestatus == CountdownGameStatus.Finished) { p.SendMessage("You do not need to re-enable it"); }
                        gamestatus = CountdownGameStatus.Enabled;
                        playersleft = 0; playersleftlist.Clear(); players.Clear();
                        foreach (Player pl in Server.Players) { pl.ExtraData["IsInCountdown"] = false; }
                }
                return;
            }
            else {
                if (p == null) { return; }
                if (gamestatus == CountdownGameStatus.Disabled) { p.SendMessage("Please enable the game first!"); }
                else { p.SendMessage("Please wait till the end of the game!"); }
            }
        }
Exemplo n.º 30
0
        public void GameStart(Player p)
        {
            switch (gamestatus)
            {
            case CountdownGameStatus.Disabled:
                Player.SendMessage(p, "Please enable Countdown first!!"); return;

            case CountdownGameStatus.AboutToStart:
                Player.SendMessage(p, "Game is about to start"); return;

            case CountdownGameStatus.InProgress:
                Player.SendMessage(p, "Game is already in progress"); return;

            case CountdownGameStatus.Finished:
                Player.SendMessage(p, "Game has finished"); return;

            case CountdownGameStatus.Enabled:
                gamestatus = CountdownGameStatus.AboutToStart;
                Thread.Sleep(2000); break;
            }

            SetGlassTube(Block.glass, Block.glass);
            mapon.ChatLevel("Countdown is about to start!!");
            mapon.permissionbuild = LevelPermission.Nobody;
            int    midX = mapon.Width / 2, midY = mapon.Height / 2, midZ = mapon.Length / 2;
            ushort x1 = (ushort)(midX * 32 + 16);
            ushort y1 = (ushort)((mapon.Height - 2) * 32);
            ushort z1 = (ushort)(midZ * 32 + 16);

            foreach (Player player in players)
            {
                if (player.level != mapon)
                {
                    player.SendMessage("Sending you to the correct map.");
                    Command.all.Find("goto").Use(player, mapon.name);
                }
                p.SpawnEntity(p, 0xFF, x1, y1, z1, 0, 0);
            }

            squaresLeft.Clear();
            int maxX = mapon.Width - 1, maxZ = mapon.Length - 1;

            for (int zz = 6; zz < maxZ - 6; zz += 3)
            {
                for (int xx = 6; xx < maxX - 6; xx += 3)
                {
                    squaresLeft.Add(new SquarePos(xx, zz));
                }
            }

            if (freezemode)
            {
                mapon.ChatLevel("Countdown starting with difficulty " + speedtype + " and mode freeze in:");
            }
            else
            {
                mapon.ChatLevel("Countdown starting with difficulty " + speedtype + " and mode normal in:");
            }

            Thread.Sleep(2000);
            mapon.ChatLevel("-----&b5%S-----");

            Cuboid(midX - 1, midY, midZ - 1, midX, midY, midZ, Block.air, mapon);
            Thread.Sleep(1000);
            mapon.ChatLevel("-----&b4%S-----"); Thread.Sleep(1000);
            mapon.ChatLevel("-----&b3%S-----"); Thread.Sleep(1000);
            Cuboid(midX, mapon.Height - 5, midZ, midX + 1, mapon.Height - 5, midZ + 1, Block.air, mapon);
            mapon.ChatLevel("-----&b2%S-----"); Thread.Sleep(1000);
            mapon.ChatLevel("-----&b1%S-----"); Thread.Sleep(1000);
            mapon.ChatLevel("GO!!!!!!!");

            playersleftlist = players;
            foreach (Player pl in players)
            {
                pl.incountdown = true;
            }
            AfterStart();
            Play();
        }
Exemplo n.º 31
0
 public static void End(Player winner)
 {
     CountdownGame.squaresleft.Clear();
     winner.SendMessage("Congratulations!! You won!!!");
     gamestatus = CountdownGameStatus.Finished;
     Command.all.Find("spawn").Use(winner, "");
     CountdownGame.playersleftlist.Clear();
     winner.incountdown = false;
 }