Exemple #1
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            Main.NewText("The sky has been Fortified!");

            if (Main.dungeonX < Main.maxTilesX * .5f)
            {
                Center = (int)((double)Main.maxTilesX * 0.8);
            }
            else
            {
                Center = (int)((double)Main.maxTilesX * 0.2);
            }
            if (Main.maxTilesX > 8000)
            {
                lowerLimit            = 320;
                maxDistanceFromCenter = 750;
            }
            else if (Main.maxTilesX > 6000)
            {
                lowerLimit            = 230;
                maxDistanceFromCenter = 550;
            }
            else
            {
                lowerLimit            = 130;
                maxDistanceFromCenter = 320;
            }
            QwertyMethods.BreakTiles(Center - maxDistanceFromCenter, 0, maxDistanceFromCenter * 2, (int)(lowerLimit));
            //Main.NewText(maxDistanceFromCenter);

            //Main.NewText(Main.maxTilesX);
            if (Main.dungeonX < Main.maxTilesX * .5f)
            {
                startingX = (int)((double)Main.maxTilesX * 0.8);
            }
            else
            {
                startingX = (int)((double)Main.maxTilesX * 0.2);
            }
            //Main.NewText(startingX);
            int roomsPerLayer = 7;

            if (Main.maxTilesX > 8000)
            {
                roomsPerLayer += 4;
            }
            if (Main.maxTilesX > 6000)
            {
                roomsPerLayer += 4;
            }
            else
            {
            }
            int roomHeight     = 25;
            int roomWidth      = 25;
            int bridgeHeight   = 25;
            int bridgeWidth    = 75;
            int verticalHeight = 21;
            int verticalWith   = 25;
            int HeightOffset   = (roomHeight - 1) / 2;
            int WidthOffset    = (roomWidth - 1) / 2;
            int startingY      = 110;

            if (Main.maxTilesX > 8000)
            {
                startingY = 195;
            }
            else if (Main.maxTilesX > 6000)
            {
                startingY = 145;
            }
            else
            {
                startingY = 110;
            }
            if (Main.maxTilesX > 8000)
            {
                startingY -= 25;
            }
            startingX -= WidthOffset + (((roomsPerLayer - 1) / 2) * (roomWidth + bridgeWidth));
            startingY -= HeightOffset;



            int treasure = Main.rand.Next(roomsPerLayer - 1);

            if (treasure >= (roomsPerLayer - 1) / 2)
            {
                treasure++;
            }
            for (int n = 0; n < roomsPerLayer; n++)
            {
                if (n == (roomsPerLayer - 1) / 2)
                {
                    //Main.NewText(n + ", " + startingX + (n * (roomWidth + bridgeWidth)) + ", " + startingY);
                    generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY, -1);
                }
                else
                {
                    if (n == treasure)
                    {
                        //Main.NewText(n + ", " + startingX + (n * (roomWidth + bridgeWidth)) + ", " + startingY);
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY, -2);
                    }
                    else
                    {
                        //Main.NewText(n + ", " + startingX + (n * (roomWidth + bridgeWidth)) + ", " + startingY);
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY, 1);
                    }
                }

                if (n != roomsPerLayer - 1)
                {
                    generateBridge(startingX + roomWidth + (n * (roomWidth + bridgeWidth)), startingY, 0);
                }
            }
            treasure = Main.rand.Next(roomsPerLayer);
            for (int n = 0; n < roomsPerLayer; n++)
            {
                if (n == treasure)
                {
                    generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY - 1 * (roomHeight + verticalHeight), -2);
                }
                else
                {
                    generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY - 1 * (roomHeight + verticalHeight), 1);
                }
                Vertical(startingX + (n * (roomWidth + bridgeWidth)), startingY - 1 * (roomHeight + verticalHeight) + roomHeight, 1);
                if (n != roomsPerLayer - 1)
                {
                    generateBridge(startingX + roomWidth + (n * (roomWidth + bridgeWidth)), startingY - 1 * (roomHeight + verticalHeight), 0);
                }
            }
            if (Main.maxTilesX > 6000)
            {
                treasure = Main.rand.Next(roomsPerLayer);
                for (int n = 0; n < roomsPerLayer; n++)
                {
                    if (n == treasure)
                    {
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY + 1 * (roomHeight + verticalHeight), -2);
                    }
                    else
                    {
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY + 1 * (roomHeight + verticalHeight), 1);
                    }
                    Vertical(startingX + (n * (roomWidth + bridgeWidth)), startingY + 1 * (roomHeight + verticalHeight) - verticalHeight, 1);
                    if (n != roomsPerLayer - 1)
                    {
                        generateBridge(startingX + roomWidth + (n * (roomWidth + bridgeWidth)), startingY + 1 * (roomHeight + verticalHeight), 0);
                    }
                }
                treasure = Main.rand.Next(roomsPerLayer);
                for (int n = 0; n < roomsPerLayer; n++)
                {
                    if (n == treasure)
                    {
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY - 2 * (roomHeight + verticalHeight), -2);
                    }
                    else
                    {
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY - 2 * (roomHeight + verticalHeight), 1);
                    }
                    Vertical(startingX + (n * (roomWidth + bridgeWidth)), startingY - 2 * (roomHeight + verticalHeight) + roomHeight, 1);
                    if (n != roomsPerLayer - 1)
                    {
                        generateBridge(startingX + roomWidth + (n * (roomWidth + bridgeWidth)), startingY - 2 * (roomHeight + verticalHeight), 0);
                    }
                }
            }
            if (Main.maxTilesX > 8000)
            {
                treasure = Main.rand.Next(roomsPerLayer);
                for (int n = 0; n < roomsPerLayer; n++)
                {
                    if (n == treasure)
                    {
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY + 2 * (roomHeight + verticalHeight), -2);
                    }
                    else
                    {
                        generateRoom(startingX + (n * (roomWidth + bridgeWidth)), startingY + 2 * (roomHeight + verticalHeight), 1);
                    }
                    Vertical(startingX + (n * (roomWidth + bridgeWidth)), startingY + 2 * (roomHeight + verticalHeight) - verticalHeight, 1);
                    if (n != roomsPerLayer - 1)
                    {
                        generateBridge(startingX + roomWidth + (n * (roomWidth + bridgeWidth)), startingY + 2 * (roomHeight + verticalHeight), 0);
                    }
                }
            }
        }
        public static void BuildFortress()
        {
            int lowerLimit;
            int upperLimit = 60;
            int CenterX;
            int maxDistanceFromCenter;
            int mediumRoomCount  = Main.rand.Next(8, 11);
            int smallRoomsPerMed = 2;
            int tinyRoomsPerMed  = 3;

            if (Main.dungeonX < Main.maxTilesX * .5f)
            {
                CenterX = (int)((double)Main.maxTilesX * 0.8);
            }
            else
            {
                CenterX = (int)((double)Main.maxTilesX * 0.2);
            }
            if (Main.maxTilesX > 8000)
            {
                lowerLimit            = 320;
                maxDistanceFromCenter = 750;
                mediumRoomCount      *= 6;
            }
            else if (Main.maxTilesX > 6000)
            {
                lowerLimit            = 230;
                maxDistanceFromCenter = 550;
                mediumRoomCount      *= 3;
            }
            else
            {
                lowerLimit            = 130;
                maxDistanceFromCenter = 320;
            }
            int     height  = lowerLimit - upperLimit;
            Vector2 topLeft = new Vector2(CenterX - maxDistanceFromCenter, upperLimit);

            QwertyMethods.BreakTiles(CenterX - maxDistanceFromCenter, 0, maxDistanceFromCenter * 2, (int)(lowerLimit));
            bool[,] region = new bool[maxDistanceFromCenter * 2, height];

            /*
             * for(int i = 0; i < region.GetLength(0); i++)
             * {
             *  for(int j = 0; i < region.GetLength(1); j++)
             *  {
             *      region[i, j] = false;
             *  }
             * }*/
            Vector2 offset = new Vector2(maxDistanceFromCenter - Fortress2Blueprints.AltarRooms.GetLength(3) / 2, height / 2 - Fortress2Blueprints.AltarRooms.GetLength(2) / 2);

            Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.AltarRoomTileTypes, Fortress2Blueprints.AltarRooms);
            OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.AltarRooms.GetLength(3), Fortress2Blueprints.AltarRooms.GetLength(2), ref region);
            int l = 4;

            if (Main.maxTilesX < 6000)
            {
                //for (int l/2 = 1; l/2 < l; l/2++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && l / 2 % 2 == 0) || (b % 2 == 0 && l / 2 % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.LargeRooms.GetLength(3) / 2, l / 2 * height / l - Fortress2Blueprints.LargeRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.LargeRoomTileTypes, Fortress2Blueprints.LargeRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }

                l = 8;
                // for (int l/2 = 1; l/2 < l; l/2++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && l / 2 % 2 == 0) || (b % 2 == 0 && l / 2 % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.MediumRooms.GetLength(3) / 2, l / 2 * height / l - Fortress2Blueprints.MediumRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.MediumRoomTileTypes, Fortress2Blueprints.MediumRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }
                l = 16;

                //for (int l/2 = 1; l/2 < l; l/2++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && l / 2 % 2 == 0) || (b % 2 == 0 && l / 2 % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.SmallRooms.GetLength(3) / 2, l / 2 * height / l - Fortress2Blueprints.SmallRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.SmallRoomTileTypes, Fortress2Blueprints.SmallRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }

                l = 32;
                //for (int l/2 = 1; l/2 < l; l/2++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && l / 2 % 2 == 0) || (b % 2 == 0 && l / 2 % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.TinyRooms.GetLength(3) / 2, l / 2 * height / l - Fortress2Blueprints.TinyRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.TinyRoomTileTypes, Fortress2Blueprints.TinyRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }
            }
            else if (Main.maxTilesX < 8000)
            {
                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.LargeRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.LargeRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.LargeRoomTileTypes, Fortress2Blueprints.LargeRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }

                l = 6;
                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.MediumRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.MediumRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.MediumRoomTileTypes, Fortress2Blueprints.MediumRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }
                l = 12;

                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.SmallRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.SmallRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.SmallRoomTileTypes, Fortress2Blueprints.SmallRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }

                l = 18;
                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.TinyRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.TinyRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.TinyRoomTileTypes, Fortress2Blueprints.TinyRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }
            }
            else
            {
                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.LargeRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.LargeRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.LargeRoomTileTypes, Fortress2Blueprints.LargeRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }

                l = 8;
                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.MediumRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.MediumRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.MediumRoomTileTypes, Fortress2Blueprints.MediumRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }
                l = 16;

                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.SmallRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.SmallRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.SmallRoomTileTypes, Fortress2Blueprints.SmallRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }

                l = 32;
                for (int q = 1; q < l; q++)
                {
                    for (int b = 1; b < l; b++)
                    {
                        if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
                        {
                            offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.TinyRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.TinyRooms.GetLength(2) / 2);
                            if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), region))
                            {
                                Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.TinyRoomTileTypes, Fortress2Blueprints.TinyRooms);
                                OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), ref region);
                            }
                        }
                    }
                }
            }

            /*
             * int l = 4;
             * for(int q =1; q< l; q++)
             * {
             *  for(int b =1; b < l; b++)
             *  {
             *      if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
             *      {
             *          offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.LargeRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.LargeRooms.GetLength(2) / 2);
             *          if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), region))
             *          {
             *              Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.LargeRoomTileTypes, Fortress2Blueprints.LargeRooms);
             *              OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.LargeRooms.GetLength(3), Fortress2Blueprints.LargeRooms.GetLength(2), ref region);
             *          }
             *      }
             *  }
             * }
             *
             * l = 8;
             * for (int q = 1; q < l; q++)
             * {
             *  for (int b = 1; b < l; b++)
             *  {
             *      if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
             *      {
             *          offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.MediumRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.MediumRooms.GetLength(2) / 2);
             *          if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), region))
             *          {
             *              Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.MediumRoomTileTypes, Fortress2Blueprints.MediumRooms);
             *              OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.MediumRooms.GetLength(3), Fortress2Blueprints.MediumRooms.GetLength(2), ref region);
             *          }
             *      }
             *  }
             * }
             * l = 16;
             *
             * for (int q = 1; q < l; q++)
             * {
             *  for (int b = 1; b < l; b++)
             *  {
             *      if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
             *      {
             *          offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.SmallRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.SmallRooms.GetLength(2) / 2);
             *          if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), region))
             *          {
             *              Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.SmallRoomTileTypes, Fortress2Blueprints.SmallRooms);
             *              OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.SmallRooms.GetLength(3), Fortress2Blueprints.SmallRooms.GetLength(2), ref region);
             *          }
             *      }
             *  }
             * }
             * l = 32;
             * for (int q = 1; q < l; q++)
             * {
             *  for (int b = 1; b < l; b++)
             *  {
             *      if ((b % 2 != 0 && q % 2 == 0) || (b % 2 == 0 && q % 2 != 0))
             *      {
             *          offset = new Vector2(b * 2 * maxDistanceFromCenter / l - Fortress2Blueprints.TinyRooms.GetLength(3) / 2, q * height / l - Fortress2Blueprints.TinyRooms.GetLength(2) / 2);
             *          if (CheckRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), region))
             *          {
             *              Fortress2Blueprints.BuildRoom((int)(topLeft.X + offset.X), (int)(topLeft.Y + offset.Y), Fortress2Blueprints.TinyRoomTileTypes, Fortress2Blueprints.TinyRooms);
             *              OccupyRegion((int)offset.X, (int)offset.Y, Fortress2Blueprints.TinyRooms.GetLength(3), Fortress2Blueprints.TinyRooms.GetLength(2), ref region);
             *          }
             *      }
             *  }
             * }
             */
            /*
             * for (int i = 0; i < mediumRoomCount; i++)
             * {
             *   AttemptRoomPlace(topLeft, Fortress2Blueprints.MediumRoomTileTypes, Fortress2Blueprints.MediumRooms, ref region);
             *   for (int k = 0; k < smallRoomsPerMed; k++)
             *   {
             *       AttemptRoomPlace(topLeft, Fortress2Blueprints.SmallRoomTileTypes, Fortress2Blueprints.SmallRooms, ref region);
             *   }
             *   for (int k = 0; k < tinyRoomsPerMed; k++)
             *   {
             *       AttemptRoomPlace(topLeft, Fortress2Blueprints.TinyRoomTileTypes, Fortress2Blueprints.TinyRooms, ref region);
             *   }
             * }*/
        }
        public override void PreUpdate()
        {
            ArmorFrameCounter++;
            if (Main.myPlayer == player.whoAmI)
            {
                //QwertyMethods.ServerClientCheck(Main.myPlayer);
                QwertysRandomContent.LocalCursor[Main.myPlayer] = Main.MouseWorld;

                if (Main.netMode == 1)
                {
                    ModPacket packet = mod.GetPacket();
                    packet.Write((byte)ModMessageType.UpdateLocalCursor); // Message type, you would need to create an enum for this
                    packet.Write((byte)Main.myPlayer);
                    packet.WriteVector2(QwertysRandomContent.LocalCursor[Main.myPlayer]);
                    packet.Send();
                }
            }
            mythrilPrismRotation += (float)Math.PI / 90f;
            if (grappleBoost)
            {
                //Main.NewText("double??");
            }
            //WorldGen.PlaceTile((int)player.Center.X/16, (int)player.Center.Y/16 - 4, TileID.Dirt);
            if (hyperRune)
            {
                if (hyperRuneTimer == 120)
                {
                    signalRune          = Main.projectile[Projectile.NewProjectile(player.Center.X, player.Center.Y, 0, 0, mod.ProjectileType("SignalRune"), 0, 0, player.whoAmI)];
                    signalRune.timeLeft = 2;
                    //CombatText.NewText(player.getRect(), new Color(39, 219, 219), "Recharged!", true, false);
                }
                if (hyperRuneTimer > 120)
                {
                    signalRune.timeLeft = 2;
                }
            }


            if (gemRegen)
            {
                regenTimer++;
                if (regenTimer == 300)
                {
                    for (int i = 0; i < 200; i++)
                    {
                        float theta = Main.rand.NextFloat(-(float)Math.PI, (float)Math.PI);

                        Dust dust = Dust.NewDustPerfect(player.Center + QwertyMethods.PolarVector(200, theta), mod.DustType("AncientGlow"), QwertyMethods.PolarVector(-200 / 10, theta));
                        dust.noGravity = true;
                    }
                    //CombatText.NewText(player.getRect(), Color.Green, "Reconstructed", true, false);
                    player.statLife += 999;
                }
            }

            if (usingVulcan)
            {
                player.accRunSpeed   = 0f;
                player.moveSpeed     = 0f;
                player.rangedDamage += 10;
            }

            if (Main.mouseRight)
            {
                while (RhuthiniumCharge > 0)
                {
                    float angle = (Main.MouseWorld - player.Center).ToRotation() + MathHelper.ToRadians(Main.rand.Next(-100, 101) * .05f);


                    Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)Math.Cos(angle) * 12f, (float)Math.Sin(angle) * 12f, mod.ProjectileType("RhuthiniumCharge"), 20, 2f, player.whoAmI);
                    RhuthiniumCharge--;
                }
            }


            if (iceScroll)
            {
                if (iceScrollCounter >= (int)(2 * Math.PI * 10))
                {
                    float startDistance = 100;
                    Projectile.NewProjectile(player.Center.X + (float)Math.Cos(0) * startDistance, player.Center.Y + (float)Math.Sin(0) * startDistance, 0, 0, mod.ProjectileType("IceRuneFreindly"), (int)(300 * player.meleeDamage), 3f, Main.myPlayer);
                    Projectile.NewProjectile(player.Center.X + (float)Math.Cos(Math.PI) * startDistance, player.Center.Y + (float)Math.Sin(Math.PI) * startDistance, 0, 0, mod.ProjectileType("IceRuneFreindly"), (int)(300 * player.meleeDamage), 3f, Main.myPlayer);
                    iceScrollCounter = 0;
                }
                iceScrollCounter++;
            }

            if (heldItemOld != player.inventory[player.selectedItem])
            {
                if (Metronome && killCount != 0)
                {
                    CombatText.NewText(player.getRect(), Color.DarkRed, "Reset!", true, false);
                }
                killCount = 0;
            }
            heldItemOld = player.inventory[player.selectedItem];
        }