예제 #1
0
        private static void MakeSewerEntrance(BlockManager bm, int x, int z, int intPlotSize)
        {
            // path
            BlockShapes.MakeHollowLayers(x, x + 8, 63, 63, z, z + intPlotSize, (int)BlockType.DOUBLE_SLAB);
            // building
            BlockShapes.MakeHollowBox(x + 2, x + 6, 63, 67, z + 2, z + 6, (int)BlockType.STONE);
            // doorway
            BlockShapes.MakeSolidBox(x + 4, x + 4, 64, 65, z + 2, z + 2, (int)BlockType.AIR);
            // tunnel down
            BlockShapes.MakeSolidBox(x + 4, x + 4, 55, 63, z + 4, z + 4, (int)BlockType.AIR);
            // ladder back
            BlockShapes.MakeSolidBox(x + 4, x + 4, 52, 55, z + 5, z + 5, (int)BlockType.STONE);
            // ladder rungs
            BlockHelper.MakeLadder(x + 4, 52, 63, z + 4);
            // hatch
            bm.SetID(x + 4, 64, z + 4, (int)BlockType.TRAPDOOR);
            bm.SetData(x + 4, 64, z + 4, 2);
            // chest with torches
            bm.SetID(x + 5, 64, z + 5, (int)BlockType.CHEST);
            TileEntityChest tec = new TileEntityChest();

            tec.Items[0] = BlockHelper.MakeItem((int)BlockType.REDSTONE_TORCH_ON, 64);
            tec.Items[1] = BlockHelper.MakeItem((int)BlockType.TORCH, 32);
            bm.SetTileEntity(x + 5, 64, z + 5, tec);
            // sign
            BlockHelper.MakeSign(x + 4, 66, z + 1, "Sewers||Currently|empty!", (int)BlockType.STONE);
        }
예제 #2
0
        public static void MakeMineshaft(BetaWorld world, BlockManager bm, Buildings.structPoint spMineshaftEntrance, frmMace frmLogForm)
        {
            _intBlockStartBuildings = City.EdgeLength + 13;
            int intMineshaftSize = (1 + City.MapLength) - (_intBlockStartBuildings * 2);

            if (intMineshaftSize % 5 > 0)
            {
                intMineshaftSize += 5 - (intMineshaftSize % 5);
            }
            _intBlockStartBuildings -= 2;
            for (int intLevel = 1; intLevel <= 7; intLevel++)
            {
                if (Utils.ValueFromXMLElement(Path.Combine("Resources", "Mineshaft.xml"), "active", "level" + intLevel.ToString()).IsAffirmative())
                {
                    MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance, frmLogForm);
                }
            }
            int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1);

            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x,
                                     3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Wood.ID, 0);
            BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockInfo.Wood.ID);
            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1,
                                     spMineshaftEntrance.z + 1, BlockInfo.Stone.ID, 0);
            bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace);
        }
예제 #3
0
 private static void MakePark(BlockManager bm, int x, int z)
 {
     BlockShapes.MakeSolidBox(x + 4, x + 6, 63, 63, z + 4, z + 6, (int)BlockType.STATIONARY_WATER);
     for (int a = x + 1; a <= x + 7; a += 6)
     {
         for (int b = z + 1; b <= z + 7; b += 6)
         {
             bm.SetID(a + 1, 64, b + 1, (int)BlockType.SAPLING);
             bm.SetData(a + 1, 64, b + 1, 15);
         }
     }
     for (int x1 = x + 1; x1 <= x + 9; x1++)
     {
         for (int z1 = z + 1; z1 <= z + 9; z1++)
         {
             if (bm.GetID(x1, 64, z1) != (int)BlockType.SAPLING &&
                 bm.GetID(x1, 63, z1) != (int)BlockType.STATIONARY_WATER)
             {
                 int intRand = rand.Next(100);
                 if (intRand > 55)
                 {
                     bm.SetID(x1, 64, z1, (int)BlockType.YELLOW_FLOWER);
                 }
                 else if (intRand > 20)
                 {
                     bm.SetID(x1, 64, z1, (int)BlockType.RED_ROSE);
                 }
             }
         }
     }
 }
예제 #4
0
 public static void MakeGuardTowers(BlockManager bm, int intFarmSize, int intMapSize, bool booIncludeWalls)
 {
     // remove wall
     BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79,
                              intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
     // add tower
     BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80,
                               intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // divide into two rooms
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 59, 71,
                              intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // add openings to the walls
     for (int y = 72; y <= 74; y++)
     {
         for (int x = intFarmSize + 7; x <= intFarmSize + 9; x++)
         {
             BlockShapes.MakeBlock(x, y, intFarmSize + 12, (int)BlockType.AIR, 2);
         }
     }
     // add blocks on top of the towers
     BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81,
                                  intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // alternating top blocks
     for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
     {
         for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
         {
             if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
             {
                 BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
             }
         }
     }
     // add central columns
     BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 72, 81,
                              intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
     BlockHelper.MakeLadder(intFarmSize + 7, 72, 81, intFarmSize + 8, 2);
     BlockHelper.MakeLadder(intFarmSize + 9, 72, 81, intFarmSize + 8, 2);
     // add cobwebs
     // todo: could probably use double-mirroring here
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
     // add chests
     MakeGuardChest(bm, intFarmSize + 11, 72, intFarmSize + 11);
     MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 72, intFarmSize + 11);
     MakeGuardChest(bm, intFarmSize + 11, 72, intMapSize - (intFarmSize + 11));
     MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 72, intMapSize - (intFarmSize + 11));
     // add archery slots
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 73, 76,
                              intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 75, 75,
                              intFarmSize + 7, intFarmSize + 9, (int)BlockType.AIR, 2);
     if (!booIncludeWalls)
     {
         BlockHelper.MakeLadder(intFarmSize + 13, 64, 71, intFarmSize + 8, 2);
     }
 }
예제 #5
0
 public static void MakeDrawbridges(BlockManager bm, int intFarmSize, int intMapSize,
                                    bool booIncludeMoat, bool booIncludeWalls)
 {
     if (booIncludeWalls)
     {
         // drawbridge
         int intBridgeEnd = booIncludeMoat ? -2 : 5;
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 63, 63,
                                  intFarmSize + intBridgeEnd, intFarmSize + 13, (int)BlockType.STONE, 2);
         // carve out the entrance/exit
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 64, 67,
                                  intFarmSize + 6, intFarmSize + 10, (int)BlockType.AIR, 2);
         // add the bottom of a portcullis
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 67, 67,
                                  intFarmSize + 6, intFarmSize + 6, (int)BlockType.FENCE, 2);
         // add room for murder holes
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, (intMapSize / 2) + 2, 69, 71,
                                  intFarmSize + 8, intFarmSize + 9, (int)BlockType.AIR, 2);
         BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 69, 72,
                                  intFarmSize + 8, intFarmSize + 9, (int)BlockType.AIR, 2);
         BlockHelper.MakeLadder(intMapSize / 2, 69, 72, intFarmSize + 9, 2, (int)BlockType.STONE);
         BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 72, 72,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 2);
         // murder holes
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, (intMapSize / 2) - 2, 68, 68,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
         BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 68, 68,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
         BlockShapes.MakeSolidBox((intMapSize / 2) + 2, (intMapSize / 2) + 2, 68, 68,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
         // chests
         BlockShapes.MakeBlock((intMapSize / 2) - 4, 69, intFarmSize + 9, (int)BlockType.GRAVEL, 2, 100, -1);
         BlockShapes.MakeBlock((intMapSize / 2) + 4, 69, intFarmSize + 9, (int)BlockType.GRAVEL, 2, 100, -1);
         BlockShapes.MakeBlock((intMapSize / 2) - 3, 70, intFarmSize + 9, (int)BlockType.AIR, 2, 100, -1);
         BlockShapes.MakeBlock((intMapSize / 2) + 3, 70, intFarmSize + 9, (int)BlockType.AIR, 2, 100, -1);
         TileEntityChest tec = new TileEntityChest();
         tec.Items[0] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         tec.Items[1] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         tec.Items[2] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         BlockHelper.MakeChest((intMapSize / 2) - 3, 69, intFarmSize + 9, (int)BlockType.GRAVEL, tec, 2);
         // add torches
         BlockHelper.MakeTorch((intMapSize / 2) - 1, 70, intFarmSize + 9, (int)BlockType.STONE, 2);
         BlockHelper.MakeTorch((intMapSize / 2) + 1, 70, intFarmSize + 9, (int)BlockType.STONE, 2);
         // link to main roads
         //BlockShapes.MakeSolidBox((intMapSize / 2) - 1, (intMapSize / 2) + 1, 63, 63,
         //                         intFarmSize + 11, intFarmSize + 13, (int)BlockType.DOUBLE_SLAB, 0);
     }
     else if (booIncludeMoat)
     {
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 63, 63,
                                  intFarmSize - 2, intFarmSize + 6, (int)BlockType.STONE, 2);
     }
 }
예제 #6
0
 private static void MakeStreetLights(BlockManager bm, int intMapSize, int intFarmSize)
 {
     for (int a = intMapSize / 2; a >= intFarmSize + 16; a -= 8)
     {
         BlockShapes.MakeSolidBox(a, a, 64, 66, intMapSize / 2, intMapSize / 2, (int)BlockType.FENCE, 2);
         BlockShapes.MakeBlock(a, 67, intMapSize / 2, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a - 1, 67, intMapSize / 2, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a + 1, 67, intMapSize / 2, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a, 67, (intMapSize / 2) - 1, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a, 67, (intMapSize / 2) + 1, (int)BlockType.WOOD_PLANK, 2);
     }
 }
예제 #7
0
        public static void MakeMineshaft(BetaWorld world, BlockManager bm, int intFarmSize, int intMapSize)
        {
            intBlockStart = intFarmSize + 13;
            int intMineshaftSize = (1 + intMapSize) - (intBlockStart * 2);

            intBlockStart -= 2;
            for (int intLevel = 1; intLevel <= 7; intLevel++)
            {
                MakeLevel(world, bm, intLevel, intMineshaftSize);
            }
            BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 3, 64, (intMapSize / 2) + 1, (intMapSize / 2) + 1, (int)BlockType.WOOD, 0);
            BlockHelper.MakeLadder(intMapSize / 2, 4, 63, intMapSize / 2, 0, (int)BlockType.WOOD);
            //BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 4, 63, intMapSize / 2, intMapSize / 2, (int)BlockType.AIR, 0);
            bm.SetID(intMapSize / 2, 64, intMapSize / 2, (int)BlockType.TRAPDOOR);
        }
예제 #8
0
 public static void MakeGuardTowers()
 {
     Console.WriteLine("Making guard towers");
     // remove wall
     BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79, intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
     // add tower
     BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // divide into two rooms
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 71, 71, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // add openings to the walls
     for (int y = 72; y <= 74; y++)
     {
         for (int x = intFarmSize + 7; x <= intFarmSize + 9; x++)
         {
             BlockShapes.MakeBlock(x, y, intFarmSize + 12, (int)BlockType.AIR, 2);
         }
     }
     // add blocks on top of the towers
     BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // alternating top blocks
     for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
     {
         for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
         {
             if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
             {
                 BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
             }
         }
     }
     // add central columns
     BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 72, 81, intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
     BlockShapes.MakeLadder(intFarmSize + 7, 72, 81, intFarmSize + 8, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 9, 72, 81, intFarmSize + 8, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 8, 72, 81, intFarmSize + 7, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 8, 72, 81, intFarmSize + 9, 0, 1);
     // add cobwebs
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, 30, 1, 30);
     // add chests
     MakeGuardChest(intFarmSize + 5, 72, intFarmSize + 5);
     MakeGuardChest(intMapSize - (intFarmSize + 5), 72, intFarmSize + 5);
     MakeGuardChest(intFarmSize + 5, 72, intMapSize - (intFarmSize + 5));
     MakeGuardChest(intMapSize - (intFarmSize + 5), 72, intMapSize - (intFarmSize + 5));
 }
예제 #9
0
 private static void MakeHouse(BlockManager bm, int x, int z)
 {
     BlockShapes.MakeHollowBox(x + 2, x + 10, 63, 67, z + 2, z + 10, (int)BlockType.WOOD_PLANK);
     for (int a = 0; a <= 4; a++)
     {
         BlockShapes.MakeSolidBox(x + 2, x + 10, 67 + a, 67 + a, z + 2 + a, z + 10 - a, (int)BlockType.WOOD);
     }
     BlockShapes.MakeSolidBox(x + 10, x + 10, 65, 65, z + 6, z + 8, (int)BlockType.GLASS);
     BlockShapes.MakeSolidBox(x + 2, x + 2, 65, 65, z + 4, z + 8, (int)BlockType.GLASS);
     BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 2, z + 2, (int)BlockType.GLASS);
     BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 10, z + 10, (int)BlockType.GLASS);
     bm.SetID(x + 10, 64, z + 4, (int)BlockType.WOOD_DOOR);
     bm.SetData(x + 10, 64, z + 4, 5);
     bm.SetID(x + 10, 65, z + 4, (int)BlockType.WOOD_DOOR);
     bm.SetData(x + 10, 65, z + 4, 13);
     BlockShapes.RotateBlocks(x + 2, x + 10, 63, 71, z + 2, z + 10);
 }
예제 #10
0
 static void MakeSewerSection(bool[,] booMaze, int intMazeX, int intMazeZ, int intMapX, int intMapZ,
                              int intStartY, int intPlotSize)
 {
     BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY, intStartY,
                              intMapZ - 1, intMapZ + 1, (int)BlockType.STATIONARY_WATER);
     BlockShapes.MakeSolidBox(intMapX - 2, intMapX + 2, intStartY + 1, intStartY + 3,
                              intMapZ - 2, intMapZ + 2, (int)BlockType.AIR);
     BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY + 4, intStartY + 4,
                              intMapZ - 1, intMapZ + 1, (int)BlockType.AIR);
     if (booMaze[intMazeX - 1, intMazeZ])
     {
         BlockShapes.MakeSolidBox(intMapX - (intPlotSize / 2), intMapX - 1, intStartY, intStartY,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - (intPlotSize / 2), intMapX - 2, intStartY + 1, intStartY + 3,
                                  intMapZ - 2, intMapZ + 2, (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - (intPlotSize / 2), intMapX - 1, intStartY + 4, intStartY + 4,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.AIR);
     }
     if (booMaze[intMazeX + 1, intMazeZ])
     {
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + (intPlotSize / 2), intStartY, intStartY,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - 2, intMapX + (intPlotSize / 2), intStartY + 1, intStartY + 3,
                                  intMapZ - 2, intMapZ + 2, (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + (intPlotSize / 2), intStartY + 4, intStartY + 4,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.AIR);
     }
     if (booMaze[intMazeX, intMazeZ - 1])
     {
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX - 1, intStartY, intStartY,
                                  intMapZ - (intPlotSize / 2), intMapZ + 1, (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - 2, intMapX - 2, intStartY + 1, intStartY + 3,
                                  intMapZ - (intPlotSize / 2), intMapZ + 2, (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX - 1, intStartY + 4, intStartY + 4,
                                  intMapZ - (intPlotSize / 2), intMapZ + 1, (int)BlockType.AIR);
     }
     if (booMaze[intMazeX, intMazeZ + 1])
     {
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY, intStartY,
                                  intMapZ - 1, intMapZ + (intPlotSize / 2), (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - 2, intMapX + 2, intStartY + 1, intStartY + 3,
                                  intMapZ - 2, intMapZ + (intPlotSize / 2), (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY + 4, intStartY + 4,
                                  intMapZ - 1, intMapZ + (intPlotSize / 2), (int)BlockType.AIR);
     }
 }
예제 #11
0
 public static void MakeDrawbridges()
 {
     Console.WriteLine("Making drawbridges");
     // drawbridge
     BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 63, 63, intFarmSize - 2, intFarmSize + 11, (int)BlockType.STONE, 2);
     // carve out the entrance/exit
     BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 64, 67, intFarmSize + 6, intFarmSize + 10, (int)BlockType.AIR, 2);
     // add the bottom of a portcullis
     BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 67, 67, intFarmSize + 6, intFarmSize + 6, (int)BlockType.FENCE, 2);
     // ladder
     BlockShapes.MakeLadder((intMapSize / 2) - 4, 64, 72, intFarmSize + 11);
     BlockShapes.MakeLadder((intMapSize / 2) + 4, 64, 72, intFarmSize + 11);
     BlockShapes.MakeLadder((intMapSize / 2) - 4, 64, 72, intMapSize - (intFarmSize + 11));
     BlockShapes.MakeLadder((intMapSize / 2) + 4, 64, 72, intMapSize - (intFarmSize + 11));
     BlockShapes.MakeLadder(intFarmSize + 11, 64, 72, (intMapSize / 2) - 4);
     BlockShapes.MakeLadder(intFarmSize + 11, 64, 72, (intMapSize / 2) + 4);
     BlockShapes.MakeLadder(intMapSize - (intFarmSize + 11), 64, 72, (intMapSize / 2) - 4);
     BlockShapes.MakeLadder(intMapSize - (intFarmSize + 11), 64, 72, (intMapSize / 2) + 4);
 }
예제 #12
0
        public static void MakeMineshaft(BetaWorld world, BlockManager bm, int intFarmLength, int intMapLength, Buildings.structPoint spMineshaftEntrance)
        {
            _intBlockStartBuildings = intFarmLength + 13;
            int intMineshaftSize = (1 + intMapLength) - (_intBlockStartBuildings * 2);

            if (intMineshaftSize % 5 > 0)
            {
                intMineshaftSize += 5 - (intMineshaftSize % 5);
            }
            _intBlockStartBuildings -= 2;
            for (int intLevel = 1; intLevel <= 7; intLevel++)
            {
                MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance);
            }
            int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1);

            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x,
                                     3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockType.WOOD, 0);
            BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockType.WOOD);
            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1,
                                     spMineshaftEntrance.z + 1, BlockType.STONE, 0);
            bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace);
        }
예제 #13
0
        public static void MakeMineshaft(BetaWorld world, BlockManager bm, Buildings.structPoint spMineshaftEntrance, frmMace frmLogForm)
        {
            _intBlockStartBuildings = City.FarmLength + 13;
            int intMineshaftSize = (1 + City.MapLength) - (_intBlockStartBuildings * 2);

            if (intMineshaftSize % 5 > 0)
            {
                intMineshaftSize += 5 - (intMineshaftSize % 5);
            }
            _intBlockStartBuildings -= 2;
            for (int intLevel = 1; intLevel <= 7; intLevel++)
            {
                MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance, frmLogForm);
            }
            int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1);

            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x,
                                     3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Wood.ID, 0);
            BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockInfo.Wood.ID);
            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1,
                                     spMineshaftEntrance.z + 1, BlockInfo.Stone.ID, 0);
            bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace);
        }
예제 #14
0
        public static void MakeGuardTowers(BlockManager bm, int intFarmSize, int intMapSize,
                                           bool booIncludeWalls, string strOutsideLights, string strFireBeacons)
        {
            // remove wall
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79,
                                     intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
            // add tower
            BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80,
                                      intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
            // divide into two rooms
            BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 2, 72,
                                     intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 67,
                                     intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
            switch (strOutsideLights)
            {
            case "Fire":
                for (int y = 72; y <= 79; y += 7)
                {
                    BlockShapes.MakeBlock(intFarmSize + 6, y, intFarmSize + 3, (int)BlockType.NETHERRACK, 2);
                    BlockShapes.MakeBlock(intFarmSize + 6, y + 1, intFarmSize + 3, (int)BlockType.FIRE, 2);
                    BlockShapes.MakeBlock(intFarmSize + 10, y, intFarmSize + 3, (int)BlockType.NETHERRACK, 2);
                    BlockShapes.MakeBlock(intFarmSize + 10, y + 1, intFarmSize + 3, (int)BlockType.FIRE, 2);
                }
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(intFarmSize + 6, y, intFarmSize + 3, (int)BlockType.STONE, 2);
                    BlockHelper.MakeTorch(intFarmSize + 10, y, intFarmSize + 3, (int)BlockType.STONE, 2);
                }
                break;
            }
            // add torches
            BlockHelper.MakeTorch(intFarmSize + 6, 79, intFarmSize + 13, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 10, 79, intFarmSize + 13, (int)BlockType.STONE, 2);
            // add torches inside
            BlockHelper.MakeTorch(intFarmSize + 6, 77, intFarmSize + 11, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 10, 77, intFarmSize + 11, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 5, 77, intFarmSize + 6, (int)BlockType.STONE, 2);
            BlockHelper.MakeTorch(intFarmSize + 5, 77, intFarmSize + 10, (int)BlockType.STONE, 2);
            // add openings to the walls
            BlockShapes.MakeBlock(intFarmSize + 7, 73, intFarmSize + 12, (int)BlockType.AIR, 2);
            BlockShapes.MakeBlock(intFarmSize + 9, 73, intFarmSize + 12, (int)BlockType.AIR, 2);
            BlockShapes.MakeBlock(intFarmSize + 7, 74, intFarmSize + 12, (int)BlockType.AIR, 2);
            BlockShapes.MakeBlock(intFarmSize + 9, 74, intFarmSize + 12, (int)BlockType.AIR, 2);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81,
                                         intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
            // alternating top blocks
            for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
            {
                for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
                {
                    if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 73, 82,
                                     intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
            BlockHelper.MakeLadder(intFarmSize + 7, 73, 82, intFarmSize + 8, 2);
            BlockHelper.MakeLadder(intFarmSize + 9, 73, 82, intFarmSize + 8, 2);
            // add torches on the roof
            BlockShapes.MakeBlock(intFarmSize + 6, 81, intFarmSize + 6, (int)BlockType.TORCH, 1);
            BlockShapes.MakeBlock(intFarmSize + 6, 81, intFarmSize + 10, (int)BlockType.TORCH, 2);
            BlockShapes.MakeBlock(intFarmSize + 10, 81, intFarmSize + 10, (int)BlockType.TORCH, 1);
            // add cobwebs
            BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
            BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
            BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
            BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
            // add chests
            MakeGuardChest(bm, intFarmSize + 11, 73, intFarmSize + 11);
            MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 73, intFarmSize + 11);
            MakeGuardChest(bm, intFarmSize + 11, 73, intMapSize - (intFarmSize + 11));
            MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 73, intMapSize - (intFarmSize + 11));
            // add archery slots
            BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 74, 77,
                                     intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 76, 76,
                                     intFarmSize + 7, intFarmSize + 9, (int)BlockType.AIR, 2);
            if (!booIncludeWalls)
            {
                BlockHelper.MakeLadder(intFarmSize + 13, 64, 72, intFarmSize + 8, 2);
            }
            // include beds
            BlockHelper.MakeBed(intFarmSize + 5, intFarmSize + 6, 64, intFarmSize + 8, intFarmSize + 8, 2);
            BlockHelper.MakeBed(intFarmSize + 5, intFarmSize + 6, 64, intFarmSize + 10, intFarmSize + 10, 2);
            BlockHelper.MakeBed(intFarmSize + 11, intFarmSize + 10, 64, intFarmSize + 8, intFarmSize + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 73, intFarmSize + 5, intFarmSize + 5, (int)BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 5, intFarmSize + 5, (int)BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.WOOD, 2);
            // add ladders
            BlockHelper.MakeLadder(intFarmSize + 5, 64, 73, intFarmSize + 6, 2, (int)BlockType.WOOD);
            // make torches
            BlockHelper.MakeTorch(intFarmSize + 10, 66, intFarmSize + 5, (int)BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmSize + 6, 66, intFarmSize + 11, (int)BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmSize + 10, 66, intFarmSize + 11, (int)BlockType.WOOD, 2);
            // make columns for real
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 73, intFarmSize + 5, intFarmSize + 5, (int)BlockType.STONE, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 5, intFarmSize + 5, (int)BlockType.STONE, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 5, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.STONE, 2);
            BlockShapes.MakeSolidBox(intFarmSize + 11, intFarmSize + 11, 64, 71, intFarmSize + 11, intFarmSize + 11, (int)BlockType.STONE, 2);
            // make cobwebs
            BlockShapes.MakeBlock(intFarmSize + 11, 67, intFarmSize + 8, (int)BlockType.COBWEB, 2, 75);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(intFarmSize + 11, 65, intFarmSize + 11, (int)BlockType.GOLD_BLOCK, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 11, (int)BlockType.GOLD_BLOCK, 1);
            BlockHelper.MakeDoor(intFarmSize + 11, 64, intFarmSize + 12, (int)BlockType.GOLD_BLOCK, true, 2);
            BlockShapes.MakeBlock(intFarmSize + 11, 65, intFarmSize + 11, (int)BlockType.AIR, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 11, (int)BlockType.AIR, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 11, (int)BlockType.STONE_PLATE, 1);
            BlockShapes.MakeBlock(intFarmSize + 11, 64, intFarmSize + 13, (int)BlockType.STONE_PLATE, 2);
            // make beacon
            if (strFireBeacons == "Yes")
            {
                BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 83, 84,
                                         intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
                BlockShapes.MakeSolidBox(intFarmSize + 6, intFarmSize + 10, 85, 85, intFarmSize + 6, intFarmSize + 10, (int)BlockType.STONE, 1);
                BlockShapes.MakeSolidBox(intFarmSize + 6, intFarmSize + 10, 86, 86, intFarmSize + 6, intFarmSize + 10, (int)BlockType.NETHERRACK, 1);
                BlockShapes.MakeSolidBox(intFarmSize + 6, intFarmSize + 10, 87, 87, intFarmSize + 6, intFarmSize + 10, (int)BlockType.FIRE, 1);
            }
        }
예제 #15
0
 public static void MakeMoat(frmMace frmLogForm, BlockManager bm)
 {
     frmLogForm.UpdateLog("Moat type: " + City.MoatType, true, true);
     switch (City.MoatType)
     {
         case "Drop to Bedrock":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 2, 63, a,
                                              City.MapLength - a, BlockInfo.Air.ID, 0, -1);
             }
             BlockShapes.MakeHollowLayers(City.EdgeLength - 2, City.MapLength - (City.EdgeLength - 2),
                                          64, 64,
                                          City.EdgeLength - 2, City.MapLength - (City.EdgeLength - 2), BlockInfo.Fence.ID, 0, -1);
             break;
         case "Cactus":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 63, 63, a,
                                              City.MapLength - a, BlockInfo.Sand.ID, 0, -1);
             }
             for (int a = City.EdgeLength + 1; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             for (int a = City.EdgeLength; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             if (City.HasGuardTowers)
             {
                 for (int a = City.EdgeLength + 3; a <= City.EdgeLength + 13; a += 2)
                 {
                     BlockShapes.MakeBlock(a, 64, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 65, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                 }
             }
             break;
         case "Cactus Low":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 59, 63,
                                              a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 58, 58,
                                              a, City.MapLength - a, BlockInfo.Sand.ID, 0, -1);
             }
             for (int a = City.EdgeLength + 1; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 1, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 3, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             for (int a = City.EdgeLength; a <= City.MapLength / 2; a += 2)
             {
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 2, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
                 if (RNG.NextDouble() > 0.5)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 4, BlockInfo.Cactus.ID, 2, 50, -1);
                 }
             }
             if (City.HasGuardTowers)
             {
                 for (int a = City.EdgeLength + 3; a <= City.EdgeLength + 13; a += 2)
                 {
                     BlockShapes.MakeBlock(a, 59, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                     BlockShapes.MakeBlock(a, 60, City.EdgeLength + 3, BlockInfo.Air.ID, 2, 100, -1);
                 }
             }
             break;
         case "Lava":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 55, 56,
                                              a, City.MapLength - a, BlockInfo.Lava.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 57, 63,
                                              a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
             }
             break;
         case "Fire":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 56, 56,
                                              a, City.MapLength - a, BlockInfo.Netherrack.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 57, 57,
                                              a, City.MapLength - a, BlockInfo.Fire.ID, 0, -1);
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 58, 63,
                                              a, City.MapLength - a, BlockInfo.Air.ID, 0, -1);
             }
             break;
         case "Water":
             for (int a = City.EdgeLength - 1; a <= City.EdgeLength + 5; a++)
             {
                 BlockShapes.MakeHollowLayers(a, City.MapLength - a, 59, 63,
                                              a, City.MapLength - a, BlockInfo.Water.ID, 0, -1);
             }
             break;
         default:
             Debug.Fail("Invalid switch result");
             break;
     }
     // drawbridge
     int intBridgeEnd = City.HasMoat ? -2 : 5;
     if (City.MoatType == "Lava" || City.MoatType == "Fire")
     {
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                  City.EdgeLength + intBridgeEnd, City.EdgeLength + 13, BlockInfo.StoneBrick.ID, 2);
     }
     else
     {
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                  City.EdgeLength + intBridgeEnd, City.EdgeLength + 13, BlockInfo.WoodPlank.ID, 2);
     }
     BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 64, 65,
                  City.EdgeLength + intBridgeEnd, City.EdgeLength + 13, BlockInfo.Air.ID, 2);
 }
예제 #16
0
 public static void MakeDrawbridges(BlockManager bm)
 {
     if (City.HasWalls)
     {
         // drawbridge
         int intBridgeEnd = City.HasMoat ? -2 : 5;
         if (City.MoatType == "Lava" || City.MoatType == "Fire")
         {
             BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                      City.FarmLength + intBridgeEnd, City.FarmLength + 13, BlockInfo.Stone.ID, 2);
         }
         else
         {
             BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                      City.FarmLength + intBridgeEnd, City.FarmLength + 13, BlockInfo.WoodPlank.ID, 2);
         }
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 64, 64,
                                  City.FarmLength + intBridgeEnd, City.FarmLength + 13, BlockInfo.Air.ID, 2);
         // carve out the entrance/exit
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 64, 67,
                                  City.FarmLength + intBridgeEnd, City.FarmLength + 10, BlockInfo.Air.ID, 2);
         if (Utils.IsValidSign(City.Name))
         {
             BlockHelper.MakeSign((City.MapLength / 2) - 3, 65, City.FarmLength + 5,
                                  Utils.ConvertStringToSignText(City.Name.Replace("City of ", "City of~")),
                                  City.WallMaterialID, 2);
         }
         // add the bottom of a portcullis
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 67, 67,
                                  City.FarmLength + 6, City.FarmLength + 6, BlockInfo.Fence.ID, 2);
         // add room for murder holes
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, (City.MapLength / 2) + 2, 69, 71,
                                  City.FarmLength + 8, City.FarmLength + 9, BlockInfo.Air.ID, 2);
         BlockShapes.MakeSolidBox(City.MapLength / 2, City.MapLength / 2, 69, 72,
                                  City.FarmLength + 8, City.FarmLength + 9, BlockInfo.Air.ID, 2);
         BlockHelper.MakeLadder(City.MapLength / 2, 69, 72, City.FarmLength + 9, 2, City.WallMaterialID);
         BlockShapes.MakeSolidBoxWithData(City.MapLength / 2, City.MapLength / 2, 72, 72,
                                          City.FarmLength + 8, City.FarmLength + 8,
                                          City.WallMaterialID, 2, City.WallMaterialData);
         // murder holes
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, (City.MapLength / 2) - 2, 68, 68,
                                  City.FarmLength + 8, City.FarmLength + 8, BlockInfo.Air.ID, 2);
         BlockShapes.MakeSolidBox(City.MapLength / 2, City.MapLength / 2, 68, 68,
                                  City.FarmLength + 8, City.FarmLength + 8, BlockInfo.Air.ID, 2);
         BlockShapes.MakeSolidBox((City.MapLength / 2) + 2, (City.MapLength / 2) + 2, 68, 68,
                                  City.FarmLength + 8, City.FarmLength + 8, BlockInfo.Air.ID, 2);
         // chests
         BlockShapes.MakeBlock((City.MapLength / 2) - 4, 69, City.FarmLength + 9, BlockInfo.Gravel.ID, 2, 100, -1);
         BlockShapes.MakeBlock((City.MapLength / 2) + 4, 69, City.FarmLength + 9, BlockInfo.Gravel.ID, 2, 100, -1);
         BlockShapes.MakeBlock((City.MapLength / 2) - 3, 70, City.FarmLength + 9, BlockInfo.Air.ID, 2, 100, -1);
         BlockShapes.MakeBlock((City.MapLength / 2) + 3, 70, City.FarmLength + 9, BlockInfo.Air.ID, 2, 100, -1);
         TileEntityChest tec = new TileEntityChest();
         if (City.HasItemsInChests)
         {
             tec.Items[0] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
             tec.Items[1] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
             tec.Items[2] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         }
         BlockHelper.MakeChest((City.MapLength / 2) - 3, 69, City.FarmLength + 9, BlockInfo.Gravel.ID, tec, 2);
         // add torches
         BlockHelper.MakeTorch((City.MapLength / 2) - 1, 70, City.FarmLength + 9, City.WallMaterialID, 2);
         BlockHelper.MakeTorch((City.MapLength / 2) + 1, 70, City.FarmLength + 9, City.WallMaterialID, 2);
         // link to main roads
         //BlockShapes.MakeSolidBox((City.intMapLength / 2) - 1, (City.intMapLength / 2) + 1, 63, 63,
         //                         City.intFarmSize + 11, City.intFarmSize + 13, BlockType.DOUBLE_SLAB, 0);
     }
     else if (City.HasMoat)
     {
         BlockShapes.MakeSolidBox((City.MapLength / 2) - 2, City.MapLength / 2, 63, 63,
                                  City.FarmLength - 2, City.FarmLength + 6, BlockInfo.Stone.ID, 2);
     }
 }
예제 #17
0
        public static void MakeWalls(AnvilWorld world, frmMace frmLogForm)
        {
            // walls
            for (int a = City.edgeLength + 6; a <= City.edgeLength + 10; a++)
            {
                BlockShapes.MakeHollowLayers(a, City.mapLength - a, 1, 72, a, City.mapLength - a,
                                             City.wallMaterialID, 0, City.wallMaterialData);
                world.Save();
            }
            // outside and inside edges at the top
            BlockShapes.MakeHollowLayers(City.edgeLength + 5, City.mapLength - (City.edgeLength + 5), 72, 73,
                                         City.edgeLength + 5, City.mapLength - (City.edgeLength + 5),
                                         City.wallMaterialID, 0, City.wallMaterialData);
            BlockShapes.MakeHollowLayers(City.edgeLength + 11, City.mapLength - (City.edgeLength + 11), 72, 73,
                                         City.edgeLength + 11, City.mapLength - (City.edgeLength + 11),
                                         City.wallMaterialID, 0, City.wallMaterialData);
            // alternating blocks on top of the edges
            for (int a = City.edgeLength + 6; a <= City.mapLength - (City.edgeLength + 6); a += 2)
            {
                BlockShapes.MakeBlock(a, 74, City.edgeLength + 5, City.wallMaterialID, 2, 100, City.wallMaterialData);
            }
            for (int a = City.edgeLength + 12; a <= City.mapLength - (City.edgeLength + 12); a += 2)
            {
                BlockShapes.MakeBlock(a, 74, City.edgeLength + 11, City.wallMaterialID, 2, 100, City.wallMaterialData);
            }
            // ladder
            BlockHelper.MakeLadder((City.mapLength / 2) - 5, 64, 72, City.edgeLength + 11, 2, City.wallMaterialID);

            BlockShapes.MakeSolidBox((City.mapLength / 2) - 5, (City.mapLength / 2) + 5,
                                     65, 74,
                                     City.edgeLength + 11, City.edgeLength + 11,
                                     BlockInfo.Air.ID, 2);

            // decorations at the gates
            frmLogForm.UpdateLog("Creating wall lights: " + City.outsideLightType, true, true);
            switch (City.outsideLightType)
            {
            case "Fire":
                // fire above the entrances
                BlockShapes.MakeBlock((City.mapLength / 2) - 1, 69, City.edgeLength + 5, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock((City.mapLength / 2), 69, City.edgeLength + 5, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock((City.mapLength / 2) - 1, 70, City.edgeLength + 5, BlockInfo.Fire.ID, 2, 100, -1);
                BlockShapes.MakeBlock((City.mapLength / 2), 70, City.edgeLength + 5, BlockInfo.Fire.ID, 2, 100, -1);
                // fire on the outside walls
                for (int a = City.edgeLength + 8; a < (City.mapLength / 2) - 9; a += 4)
                {
                    BlockShapes.MakeBlock(a, 69, City.edgeLength + 5, BlockInfo.Netherrack.ID, 2, 100, -1);
                    BlockShapes.MakeBlock(a, 70, City.edgeLength + 5, BlockInfo.Fire.ID, 2, 100, -1);
                }
                break;

            case "Torches":
                // torches above the entrances
                BlockHelper.MakeTorch((City.mapLength / 2), 70, City.edgeLength + 5, City.wallMaterialID, 2);
                BlockHelper.MakeTorch((City.mapLength / 2) - 1, 70, City.edgeLength + 5, City.wallMaterialID, 2);
                // torches on the outside walls
                for (int a = City.edgeLength + 8; a < (City.mapLength / 2) - 9; a += 4)
                {
                    BlockHelper.MakeTorch(a, 70, City.edgeLength + 5, City.wallMaterialID, 2);
                }
                break;

            case "None":
            case "":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            if (City.hasTorchesOnWalkways)
            {
                // torches on the inside walls
                for (int a = City.edgeLength + 16; a < (City.mapLength / 2); a += 4)
                {
                    BlockHelper.MakeTorch(a, 69, City.edgeLength + 11, City.wallMaterialID, 2);
                }
                // torches on the wall roofs
                for (int a = City.edgeLength + 16; a < (City.mapLength / 2); a += 4)
                {
                    BlockShapes.MakeBlock(a, 73, City.edgeLength + 8, BlockInfo.Torch.ID, 2, 100, -1);
                }
            }


            for (int a = City.edgeLength + 16; a < (City.mapLength / 2); a += 24)
            {
                switch (City.npcs)
                {
                case "Ghostdancer's NPCs":
                    EntityVillager eVillager;
                    eVillager        = new EntityVillager(new TypedEntity("GKnight"));
                    eVillager.Health = 20;
                    BlockShapes.MakeEntity(a, 73, City.edgeLength + 8, eVillager, 2);
                    break;

                case "Minecraft Villagers":
                    EntityMob eMob;
                    eMob        = new EntityMob(new TypedEntity("VillagerGolem"));
                    eMob.Health = 100;
                    BlockShapes.MakeEntity(a, 73, City.edgeLength + 8, eMob, 2);
                    break;
                }
            }

            frmLogForm.UpdateLog("Creating wall emblems: " + City.cityEmblemType, true, true);
            MakeEmblem();
        }
예제 #18
0
        public static void MakeGuardTowers(BlockManager bm, int intFarmLength, int intMapLength, bool booIncludeWalls,
                                           string strOutsideLights, string strTowerAddition,
                                           bool booIncludeItemsInChests, int intWallMaterial)
        {
            // remove wall
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 11, 64, 79,
                                     intFarmLength + 5, intFarmLength + 11, BlockType.AIR, 1);
            // add tower
            BlockShapes.MakeHollowBox(intFarmLength + 4, intFarmLength + 12, 63, 80,
                                      intFarmLength + 4, intFarmLength + 12, intWallMaterial, 1, -1);
            // divide into two rooms
            BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 12, 2, 72,
                                     intFarmLength + 4, intFarmLength + 12, intWallMaterial, 1);
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 11, 64, 67,
                                     intFarmLength + 5, intFarmLength + 11, BlockType.AIR, 1);
            switch (strOutsideLights)
            {
            case "Fire":
                BlockShapes.MakeBlock(intFarmLength + 5, 76, intFarmLength + 3, BlockType.NETHERRACK, 2, 100, -1);
                BlockShapes.MakeBlock(intFarmLength + 5, 77, intFarmLength + 3, BlockType.FIRE, 2, 100, -1);
                BlockShapes.MakeBlock(intFarmLength + 11, 76, intFarmLength + 3, BlockType.NETHERRACK, 2, 100, -1);
                BlockShapes.MakeBlock(intFarmLength + 11, 77, intFarmLength + 3, BlockType.FIRE, 2, 100, -1);
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(intFarmLength + 6, y, intFarmLength + 3, intWallMaterial, 2);
                    BlockHelper.MakeTorch(intFarmLength + 10, y, intFarmLength + 3, intWallMaterial, 2);
                }
                break;

            case "None":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            // add torches
            BlockHelper.MakeTorch(intFarmLength + 6, 79, intFarmLength + 13, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 10, 79, intFarmLength + 13, intWallMaterial, 2);
            // add torches inside
            BlockHelper.MakeTorch(intFarmLength + 6, 77, intFarmLength + 11, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 10, 77, intFarmLength + 11, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 5, 77, intFarmLength + 6, intWallMaterial, 2);
            BlockHelper.MakeTorch(intFarmLength + 5, 77, intFarmLength + 10, intWallMaterial, 2);
            // add openings to the walls
            BlockShapes.MakeBlock(intFarmLength + 7, 73, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 9, 73, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 7, 74, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 9, 74, intFarmLength + 12, BlockType.AIR, 2, 100, -1);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(intFarmLength + 4, intFarmLength + 12, 81, 81,
                                         intFarmLength + 4, intFarmLength + 12, intWallMaterial, 1, -1);
            // alternating top blocks
            for (int x = intFarmLength + 4; x <= intFarmLength + 12; x += 2)
            {
                for (int z = intFarmLength + 4; z <= intFarmLength + 12; z += 2)
                {
                    if (x == intFarmLength + 4 || x == intFarmLength + 12 || z == intFarmLength + 4 || z == intFarmLength + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, intWallMaterial, 1, 100, -1);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBox(intFarmLength + 8, intFarmLength + 8, 73, 82,
                                     intFarmLength + 8, intFarmLength + 8, intWallMaterial, 1);
            BlockHelper.MakeLadder(intFarmLength + 7, 73, 82, intFarmLength + 8, 2, intWallMaterial);
            BlockHelper.MakeLadder(intFarmLength + 9, 73, 82, intFarmLength + 8, 2, intWallMaterial);
            // add torches on the roof
            BlockShapes.MakeBlock(intFarmLength + 6, 81, intFarmLength + 6, BlockType.TORCH, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 6, 81, intFarmLength + 10, BlockType.TORCH, 2, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 10, 81, intFarmLength + 10, BlockType.TORCH, 1, 100, -1);
            // add cobwebs
            BlockShapes.MakeBlock(intFarmLength + 5, 79, intFarmLength + 5, BlockType.COBWEB, 1, 30, -1);
            BlockShapes.MakeBlock(intFarmLength + 5, 79, intFarmLength + 11, BlockType.COBWEB, 1, 30, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 79, intFarmLength + 5, BlockType.COBWEB, 1, 30, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 79, intFarmLength + 11, BlockType.COBWEB, 1, 30, -1);
            // add chests
            MakeGuardChest(bm, intFarmLength + 11, 73, intFarmLength + 11, booIncludeItemsInChests);
            MakeGuardChest(bm, intMapLength - (intFarmLength + 11), 73, intFarmLength + 11, booIncludeItemsInChests);
            MakeGuardChest(bm, intFarmLength + 11, 73, intMapLength - (intFarmLength + 11), booIncludeItemsInChests);
            MakeGuardChest(bm, intMapLength - (intFarmLength + 11), 73, intMapLength - (intFarmLength + 11),
                           booIncludeItemsInChests);
            // add archery slots
            BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 4, 74, 77,
                                     intFarmLength + 8, intFarmLength + 8, BlockType.AIR, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 4, 76, 76,
                                     intFarmLength + 7, intFarmLength + 9, BlockType.AIR, 2);
            if (!booIncludeWalls)
            {
                BlockHelper.MakeLadder(intFarmLength + 13, 64, 72, intFarmLength + 8, 2, intWallMaterial);
            }
            // include beds
            BlockHelper.MakeBed(intFarmLength + 5, intFarmLength + 6, 64, intFarmLength + 8, intFarmLength + 8, 2);
            BlockHelper.MakeBed(intFarmLength + 5, intFarmLength + 6, 64, intFarmLength + 10, intFarmLength + 10, 2);
            BlockHelper.MakeBed(intFarmLength + 11, intFarmLength + 10, 64, intFarmLength + 8, intFarmLength + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 73, intFarmLength + 5, intFarmLength + 5,
                                     BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 5, intFarmLength + 5,
                                     BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     BlockType.WOOD, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     BlockType.WOOD, 2);
            // add ladders
            BlockHelper.MakeLadder(intFarmLength + 5, 64, 73, intFarmLength + 6, 2, BlockType.WOOD);
            // make torches
            BlockHelper.MakeTorch(intFarmLength + 10, 66, intFarmLength + 5, BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmLength + 6, 66, intFarmLength + 11, BlockType.WOOD, 2);
            BlockHelper.MakeTorch(intFarmLength + 10, 66, intFarmLength + 11, BlockType.WOOD, 2);
            // make columns for real
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 73, intFarmLength + 5, intFarmLength + 5,
                                     intWallMaterial, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 5, intFarmLength + 5,
                                     intWallMaterial, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 5, intFarmLength + 5, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     intWallMaterial, 2);
            BlockShapes.MakeSolidBox(intFarmLength + 11, intFarmLength + 11, 64, 71, intFarmLength + 11, intFarmLength + 11,
                                     intWallMaterial, 2);
            // make cobwebs
            BlockShapes.MakeBlock(intFarmLength + 11, 67, intFarmLength + 8, BlockType.COBWEB, 2, 75, -1);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(intFarmLength + 11, 65, intFarmLength + 11, BlockType.GOLD_BLOCK, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 11, BlockType.GOLD_BLOCK, 1, 100, -1);
            BlockHelper.MakeDoor(intFarmLength + 11, 64, intFarmLength + 12, BlockType.GOLD_BLOCK, true, 2);
            BlockShapes.MakeBlock(intFarmLength + 11, 65, intFarmLength + 11, BlockType.AIR, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 11, BlockType.AIR, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 11, BlockType.STONE_PLATE, 1, 100, -1);
            BlockShapes.MakeBlock(intFarmLength + 11, 64, intFarmLength + 13, BlockType.STONE_PLATE, 2, 100, -1);
            //BlockShapes.MakeBlock(intFarmLength + 13, 64, intFarmLength + 11, BlockType.STONE_PLATE, 1, 100, -1);
            // add guard tower sign
            BlockHelper.MakeSign(intFarmLength + 12, 65, intFarmLength + 13, "~Guard Tower~~", intWallMaterial, 1);
            BlockHelper.MakeSign(intFarmLength + 8, 74, intFarmLength + 13, "~Guard Tower~~", intWallMaterial, 2);
            // make beacon
            switch (strTowerAddition)
            {
            case "Fire beacon":
                BlockShapes.MakeSolidBox(intFarmLength + 8, intFarmLength + 8, 83, 84,
                                         intFarmLength + 8, intFarmLength + 8, intWallMaterial, 1);
                BlockShapes.MakeSolidBox(intFarmLength + 6, intFarmLength + 10, 85, 85,
                                         intFarmLength + 6, intFarmLength + 10, intWallMaterial, 1);
                BlockShapes.MakeSolidBox(intFarmLength + 6, intFarmLength + 10, 86, 86,
                                         intFarmLength + 6, intFarmLength + 10, BlockType.NETHERRACK, 1);
                BlockShapes.MakeSolidBox(intFarmLength + 6, intFarmLength + 10, 87, 87,
                                         intFarmLength + 6, intFarmLength + 10, BlockType.FIRE, 1);
                break;

            case "Flag":
                BlockShapes.MakeSolidBox(intFarmLength + 4, intFarmLength + 4, 83, 91,
                                         intFarmLength + 12, intFarmLength + 12, BlockType.FENCE, 2);
                BlockShapes.MakeBlock(intFarmLength + 4, 84, intFarmLength + 13, BlockType.FENCE, 2, 100, 0);
                BlockShapes.MakeBlock(intFarmLength + 4, 91, intFarmLength + 13, BlockType.FENCE, 2, 100, 0);
                int[] intColours = Utils.ShuffleArray(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
                switch (RandomHelper.Next(7))
                {
                case 0:         //2vert
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 17, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 18, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    break;

                case 1:         //3vert
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 15, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 16, intFarmLength + 18, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 19, intFarmLength + 21, BlockType.WOOL, 2, intColours[2]);
                    break;

                case 2:         //4vert
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 14, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 15, intFarmLength + 16, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 17, intFarmLength + 18, BlockType.WOOL, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 19, intFarmLength + 20, BlockType.WOOL, 2, intColours[3]);
                    break;

                case 3:         //2horiz
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 87,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 88, 90,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    break;

                case 4:         //3horiz
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 86,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 87, 88,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 89, 90,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[2]);
                    break;

                case 5:         //quarters
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 87,
                                                     intFarmLength + 13, intFarmLength + 17, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 87,
                                                     intFarmLength + 18, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 88, 90,
                                                     intFarmLength + 13, intFarmLength + 17, BlockType.WOOL, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 88, 90,
                                                     intFarmLength + 18, intFarmLength + 22, BlockType.WOOL, 2, intColours[3]);
                    break;

                case 6:         //cross
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 87, 88,
                                                     intFarmLength + 13, intFarmLength + 22, BlockType.WOOL, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(intFarmLength + 4, intFarmLength + 4, 85, 90,
                                                     intFarmLength + 17, intFarmLength + 18, BlockType.WOOL, 2, intColours[1]);
                    break;

                default:
                    Debug.Fail("Invalid switch result");
                    break;
                }
                break;
            }
        }
예제 #19
0
        public static void MakeFarms(BetaWorld world, BlockManager bm, frmMace frmLogForm)
        {
            if (City.HasFarms)
            {
                frmLogForm.UpdateLog("Creating farm buildings", true, true);
                AddBuildings(bm);
                frmLogForm.UpdateLog("Creating farms and outside features", true, true);
                int intFail  = 0;
                int intFarms = 0;
                while (intFail <= 500)
                {
                    int xlen = RandomHelper.Next(8, 26);
                    int x1   = RandomHelper.Next(5, City.MapLength - (5 + xlen));
                    int zlen = RandomHelper.Next(8, 26);
                    int z1   = RandomHelper.Next(5, City.MapLength - (5 + zlen));
                    if (!(x1 >= City.FarmLength && z1 >= City.FarmLength &&
                          x1 <= City.MapLength - City.FarmLength && z1 <= City.MapLength - City.FarmLength))
                    {
                        bool booValid = true;
                        for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                        {
                            for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                            {
                                // make sure it doesn't overlap with the spawn point or another farm
                                if ((x == City.MapLength / 2 && z == SpawnZ) ||
                                    bm.GetID(x, 63, z) != City.GroundBlockID ||
                                    bm.GetID(x, 64, z) != BlockInfo.Air.ID)
                                {
                                    booValid = false;
                                    intFail++;
                                }
                            }
                        }
                        if (booValid)
                        {
                            // first there is a 25% chance of a hill or pond
                            // if not, for large farms, there is a 50% chance it'll be an orchard
                            // if not, 33% are cactus, 33% are wheat and 33% are sugarcane

                            FarmTypes curFarm;
                            int       intFarmType = RandomHelper.Next(100);
                            if (xlen >= 10 && zlen >= 10 && intFarmType > 75)
                            {
                                if (RandomHelper.NextDouble() > 0.5)
                                {
                                    curFarm = FarmTypes.Pond;
                                    MakePond(bm, x1, xlen, z1, zlen, false);
                                }
                                else
                                {
                                    curFarm = FarmTypes.Hill;
                                    MakeHill(bm, x1, xlen, z1, zlen, false);
                                }
                            }
                            else
                            {
                                intFarmType = RandomHelper.Next(100);
                                if (((xlen >= 11 && zlen >= 16) || (xlen >= 16 && zlen >= 11)) && intFarmType > 50)
                                {
                                    curFarm = FarmTypes.Orchard;
                                    xlen    = ((int)((xlen - 1) / 5) * 5) + 1;
                                    zlen    = ((int)((zlen - 1) / 5) * 5) + 1;
                                }
                                else
                                {
                                    intFarmType = RandomHelper.Next(3);
                                    if (intFarmType == 2)
                                    {
                                        curFarm = FarmTypes.Cactus;
                                    }
                                    else if (intFarmType == 1)
                                    {
                                        curFarm = FarmTypes.Wheat;
                                        xlen   += (xlen % 2) - 1;
                                        zlen   += (zlen % 2) - 1;
                                    }
                                    else
                                    {
                                        curFarm = FarmTypes.SugarCane;
                                        xlen   += (xlen % 2) - 1;
                                        zlen   += (zlen % 2) - 1;
                                    }
                                }
                            }

                            int intWallMaterial = RandomHelper.NextDouble() > 0.5 ? BlockInfo.Fence.ID : BlockInfo.Leaves.ID;

                            switch (curFarm)
                            {
                            case FarmTypes.Hill:
                            case FarmTypes.Pond:
                                intWallMaterial = 0;
                                break;

                            case FarmTypes.SugarCane:
                            case FarmTypes.Mushroom:
                                if (RandomHelper.NextDouble() > 0.5)
                                {
                                    intWallMaterial = 0;
                                }
                                break;

                            case FarmTypes.Wheat:
                                intWallMaterial = BlockInfo.Leaves.ID;
                                break;
                                // no need for default - the other types don't need anything here
                            }
#pragma warning disable
                            switch (intWallMaterial)
                            {
                            case BlockType.FENCE:
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen,
                                                             BlockInfo.Fence.ID, 0, -1);
                                break;

                            case BlockType.LEAVES:
                                // the saplings will all disappear if one of them is broken.
                                // so we put wood beneath them to stop that happening
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 63, 63, z1, z1 + zlen,
                                                             BlockInfo.Wood.ID, 0, -1);
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 65, z1, z1 + zlen, BlockInfo.Leaves.ID, 0,
                                                             RandomHelper.RandomNumber((int)LeafType.OAK, (int)LeafType.SPRUCE,
                                                                                       (int)LeafType.BIRCH));
                                break;

                            case 0:
                                // no wall
                                break;

                            default:
                                Debug.Fail("Invalid switch result");
                                break;
                            }
#pragma warning restore

                            switch (curFarm)
                            {
                            case FarmTypes.Orchard:
                                int intSaplingType = RandomHelper.RandomNumber(SaplingBirchDataID,
                                                                               SaplingOakDataID,
                                                                               SaplingSpruceDataID);
                                for (int x = x1 + 3; x <= x1 + xlen - 3; x += 5)
                                {
                                    for (int z = z1 + 3; z <= z1 + zlen - 3; z += 5)
                                    {
                                        BlockShapes.MakeBlock(x, 63, z, City.GroundBlockID, City.GroundBlockData);
                                        BlockShapes.MakeBlock(x, 64, z, BlockInfo.Sapling.ID, intSaplingType);
                                    }
                                }
                                break;

                            case FarmTypes.Cactus:
                                int intAttempts = 0;
                                do
                                {
                                    int  xCactus      = RandomHelper.Next(x1 + 1, x1 + xlen);
                                    int  zCactus      = RandomHelper.Next(z1 + 1, z1 + zlen);
                                    bool booValidFarm = true;
                                    for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                    {
                                        for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                        {
                                            if (bm.GetID(xCheck, 64, zCheck) != BlockInfo.Air.ID)
                                            {
                                                booValidFarm = false;
                                            }
                                        }
                                    }
                                    if (booValidFarm)
                                    {
                                        bm.SetID(xCactus, 64, zCactus, BlockInfo.Cactus.ID);
                                        if (RandomHelper.NextDouble() > 0.5)
                                        {
                                            bm.SetID(xCactus, 65, zCactus, BlockInfo.Cactus.ID);
                                        }
                                    }
                                }while (++intAttempts < 100);
                                break;

                            case FarmTypes.Wheat:
                                BlockShapes.MakeHollowLayers(x1, x1 + xlen, 66, 66, z1, z1 + zlen,
                                                             BlockInfo.Glass.ID, 0, -1);
                                BlockShapes.MakeSolidBox(x1 + 1, x1 + xlen - 1, 67, 67, z1 + 1, z1 + zlen - 1,
                                                         BlockInfo.Glass.ID, 0);
                                break;
                                // no need for a default, because there's nothing to do for the other farms
                            }

                            for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                            {
                                for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                                {
                                    switch (curFarm)
                                    {
                                    case FarmTypes.Cactus:
                                        bm.SetID(x, 63, z, BlockInfo.Sand.ID);
                                        break;

                                    case FarmTypes.Wheat:
                                        if (z == z1 + 1)
                                        {
                                            bm.SetID(x, 63, z, BlockInfo.DoubleSlab.ID);
                                        }
                                        else if (x % 2 == 0)
                                        {
                                            BlockShapes.MakeBlock(x, 63, z, BlockInfo.Farmland.ID, 1);
                                            bm.SetID(x, 64, z, BlockInfo.Crops.ID);
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, BlockInfo.StationaryWater.ID);
                                        }
                                        break;

                                    case FarmTypes.SugarCane:
                                        if (z != z1 + 1)
                                        {
                                            if (x % 2 == 0)
                                            {
                                                bm.SetID(x, 64, z, BlockInfo.SugarCane.ID);
                                                if (RandomHelper.Next(100) > 50)
                                                {
                                                    bm.SetID(x, 65, z, BlockInfo.SugarCane.ID);
                                                }
                                            }
                                            else
                                            {
                                                bm.SetID(x, 63, z, BlockInfo.StationaryWater.ID);
                                            }
                                        }
                                        break;
                                        // no need for a default, because there's nothing to do for the other farms
                                    }
                                }
                            }
                            int intDoorPosition = x1 + RandomHelper.Next(1, xlen - 1);
                            if (curFarm == FarmTypes.Wheat)
                            {
                                bm.SetID(intDoorPosition, 63, z1, BlockInfo.DoubleSlab.ID);
                            }
                            if (intWallMaterial != 0)
                            {
                                if (curFarm == FarmTypes.Wheat || intWallMaterial == BlockInfo.Leaves.ID)
                                {
                                    BlockShapes.MakeBlock(intDoorPosition, 64, z1, BlockInfo.WoodDoor.ID, 4);
                                    BlockShapes.MakeBlock(intDoorPosition, 65, z1, BlockInfo.WoodDoor.ID, 4 + (int)DoorState.TOPHALF);
                                }
                                else
                                {
                                    bm.SetID(intDoorPosition, 64, z1, BlockInfo.FenceGate.ID);
                                    bm.SetData(intDoorPosition, 64, z1, 0);
                                }
                            }
                            intFail = 0;
                            if (++intFarms > 10)
                            {
                                world.Save();
                                intFarms = 0;
                            }
                        }
                    }
                }
                MakeMiniPondsAndHills(world, bm);
            }
            if (City.HasFlowers)
            {
                MakeFlowers(world, bm);
            }
        }
예제 #20
0
 public static void MakeDrawbridges(BlockManager bm, int intFarmLength, int intMapLength,
                                    bool booIncludeMoat, bool booIncludeWalls, bool booIncludeItemsInChests,
                                    int intWallMaterial, string strMoatType, string strCityName)
 {
     if (booIncludeWalls)
     {
         // drawbridge
         int intBridgeEnd = booIncludeMoat ? -2 : 5;
         if (strMoatType == "Lava" || strMoatType == "Fire")
         {
             BlockShapes.MakeSolidBox((intMapLength / 2) - 2, intMapLength / 2, 63, 63,
                                      intFarmLength + intBridgeEnd, intFarmLength + 13, BlockType.STONE, 2);
         }
         else
         {
             BlockShapes.MakeSolidBox((intMapLength / 2) - 2, intMapLength / 2, 63, 63,
                                      intFarmLength + intBridgeEnd, intFarmLength + 13, BlockType.WOOD_PLANK, 2);
         }
         BlockShapes.MakeSolidBox((intMapLength / 2) - 2, intMapLength / 2, 64, 64,
                                  intFarmLength + intBridgeEnd, intFarmLength + 13, BlockType.AIR, 2);
         // carve out the entrance/exit
         BlockShapes.MakeSolidBox((intMapLength / 2) - 2, intMapLength / 2, 64, 67,
                                  intFarmLength + 6, intFarmLength + 10, BlockType.AIR, 2);
         if (Utils.IsValidSign(strCityName))
         {
             BlockHelper.MakeSign((intMapLength / 2) - 3, 65, intFarmLength + 5, Utils.ConvertStringToSignText(strCityName.Replace("City of ", "City of~")), intWallMaterial, 2);
         }
         // add the bottom of a portcullis
         BlockShapes.MakeSolidBox((intMapLength / 2) - 2, intMapLength / 2, 67, 67,
                                  intFarmLength + 6, intFarmLength + 6, BlockType.FENCE, 2);
         // add room for murder holes
         BlockShapes.MakeSolidBox((intMapLength / 2) - 2, (intMapLength / 2) + 2, 69, 71,
                                  intFarmLength + 8, intFarmLength + 9, BlockType.AIR, 2);
         BlockShapes.MakeSolidBox(intMapLength / 2, intMapLength / 2, 69, 72,
                                  intFarmLength + 8, intFarmLength + 9, BlockType.AIR, 2);
         BlockHelper.MakeLadder(intMapLength / 2, 69, 72, intFarmLength + 9, 2, intWallMaterial);
         BlockShapes.MakeSolidBox(intMapLength / 2, intMapLength / 2, 72, 72,
                                  intFarmLength + 8, intFarmLength + 8, intWallMaterial, 2);
         // murder holes
         BlockShapes.MakeSolidBox((intMapLength / 2) - 2, (intMapLength / 2) - 2, 68, 68,
                                  intFarmLength + 8, intFarmLength + 8, BlockType.AIR, 2);
         BlockShapes.MakeSolidBox(intMapLength / 2, intMapLength / 2, 68, 68,
                                  intFarmLength + 8, intFarmLength + 8, BlockType.AIR, 2);
         BlockShapes.MakeSolidBox((intMapLength / 2) + 2, (intMapLength / 2) + 2, 68, 68,
                                  intFarmLength + 8, intFarmLength + 8, BlockType.AIR, 2);
         // chests
         BlockShapes.MakeBlock((intMapLength / 2) - 4, 69, intFarmLength + 9, BlockType.GRAVEL, 2, 100, -1);
         BlockShapes.MakeBlock((intMapLength / 2) + 4, 69, intFarmLength + 9, BlockType.GRAVEL, 2, 100, -1);
         BlockShapes.MakeBlock((intMapLength / 2) - 3, 70, intFarmLength + 9, BlockType.AIR, 2, 100, -1);
         BlockShapes.MakeBlock((intMapLength / 2) + 3, 70, intFarmLength + 9, BlockType.AIR, 2, 100, -1);
         TileEntityChest tec = new TileEntityChest();
         if (booIncludeItemsInChests)
         {
             tec.Items[0] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
             tec.Items[1] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
             tec.Items[2] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         }
         BlockHelper.MakeChest((intMapLength / 2) - 3, 69, intFarmLength + 9, BlockType.GRAVEL, tec, 2);
         // add torches
         BlockHelper.MakeTorch((intMapLength / 2) - 1, 70, intFarmLength + 9, intWallMaterial, 2);
         BlockHelper.MakeTorch((intMapLength / 2) + 1, 70, intFarmLength + 9, intWallMaterial, 2);
         // link to main roads
         //BlockShapes.MakeSolidBox((intMapLength / 2) - 1, (intMapLength / 2) + 1, 63, 63,
         //                         intFarmLength + 11, intFarmLength + 13, BlockType.DOUBLE_SLAB, 0);
     }
     else if (booIncludeMoat)
     {
         BlockShapes.MakeSolidBox((intMapLength / 2) - 2, intMapLength / 2, 63, 63,
                                  intFarmLength - 2, intFarmLength + 6, BlockType.STONE, 2);
     }
 }
예제 #21
0
        public static void MakePlots(bool[,] booSewerEntrances)
        {
            Console.WriteLine("Making plots");
            int intPlots = 1 + (((intMapSize - (intFarmSize + 20)) - (intFarmSize + 18)) / intPlotSize);

            for (int x = intFarmSize + 18; x < intMapSize - (intFarmSize + 20); x += intPlotSize)
            {
                for (int z = intFarmSize + 18; z < intMapSize - (intFarmSize + 20); z += intPlotSize)
                {
                    if (booSewerEntrances[(x - (intFarmSize + 18)) / intPlotSize, (z - (intFarmSize + 18)) / intPlotSize])
                    {
                        BlockShapes.MakeHollowBox(x + (intPlotSize / 2) - 2, x + (intPlotSize / 2) + 2, 63, 67,
                                                  z + (intPlotSize / 2) - 2, z + (intPlotSize / 2) + 2,
                                                  (int)BlockType.STONE);
                        BlockShapes.MakeSolidBox(x + (intPlotSize / 2), x + (intPlotSize / 2), 64, 65,
                                                 z + (intPlotSize / 2) - 2, z + (intPlotSize / 2) - 2,
                                                 (int)BlockType.AIR);
                        BlockShapes.MakeSolidBox(x + (intPlotSize / 2), x + (intPlotSize / 2), 55, 63,
                                                 z + (intPlotSize / 2), z + (intPlotSize / 2),
                                                 (int)BlockType.AIR);
                        BlockShapes.MakeSolidBox(x + (intPlotSize / 2), x + (intPlotSize / 2), 52, 55,
                                                 z + (intPlotSize / 2) + 1, z + (intPlotSize / 2) + 1, (int)BlockType.STONE);
                        BlockShapes.MakeLadder(x + (intPlotSize / 2), 52, 63, z + (intPlotSize / 2), 2);
                        bm.SetID(x + (intPlotSize / 2), 64, z + (intPlotSize / 2), 96); // hatch
                        bm.SetData(x + (intPlotSize / 2), 64, z + (intPlotSize / 2), 2);
                        bm.SetID(x + (intPlotSize / 2) + 1, 64, z + (intPlotSize / 2) + 1, (int)BlockType.CHEST);
                        TileEntityChest tec = new TileEntityChest();
                        tec.Items[0] = MakeItem((int)BlockType.REDSTONE_TORCH_ON, 32);
                        tec.Items[1] = MakeItem((int)BlockType.TORCH, 8);
                        bm.SetTileEntity(x + (intPlotSize / 2) + 1, 64, z + (intPlotSize / 2) + 1, tec);
                        MakeSign(x + (intPlotSize / 2), 66, z + (intPlotSize / 2) - 3, "Sewers||Currently|empty!", (int)BlockType.STONE);
                    }
                    else
                    {
                        int intRandBuilding = rand.Next(100);
                        if (intRandBuilding >= 90)
                        {
                            BlockShapes.MakeHollowLayers(x + 3, x + 9, 63, 63, z + 3, z + 9, (int)BlockType.DOUBLE_SLAB);
                            for (int a = 0; a <= 3; a++)
                            {
                                bm.SetID(x + 6, 63, z + a, (int)BlockType.DOUBLE_SLAB);
                            }
                            int x1 = x + rand.Next(5, 7);
                            int z1 = z + rand.Next(5, 7);
                            BlockShapes.MakeSolidBox(x1, x1 + 1, 63, 63, z1, z1 + 1, (int)BlockType.STATIONARY_WATER);
                            int  intFail = 0, intTrees = 10;
                            bool blnValid = true;
                            do
                            {
                                x1 = x + 1 + rand.Next(0, intPlotSize - 2);
                                z1 = z + 1 + rand.Next(0, intPlotSize - 2);
                                if (bm.GetID(x1, 63, z1) != (int)BlockType.DOUBLE_SLAB &&
                                    bm.GetID(x1, 63, z1) != (int)BlockType.STATIONARY_WATER)
                                {
                                    blnValid = true;
                                    for (int a = x1 - 4; a <= x1 + 4 && blnValid; a++)
                                    {
                                        for (int b = z1 - 4; b <= z1 + 4 && blnValid; b++)
                                        {
                                            if (bm.GetID(a, 64, b) == (int)BlockType.SAPLING)
                                            {
                                                blnValid = false;
                                            }
                                        }
                                    }
                                    if (blnValid)
                                    {
                                        bm.SetID(x1, 64, z1, (int)BlockType.SAPLING);
                                        bm.SetData(x1, 64, z1, 15);
                                        intTrees--;
                                        intFail = 0;
                                    }
                                    else
                                    {
                                        intFail++;
                                    }
                                }
                            } while (intTrees > 0 && intFail < 200);
                            for (x1 = x + 1; x1 < x + intPlotSize - 1; x1++)
                            {
                                for (z1 = z + 1; z1 < z + intPlotSize - 1; z1++)
                                {
                                    if (bm.GetID(x1, 63, z1) != (int)BlockType.STATIONARY_WATER &&
                                        bm.GetID(x1, 64, z1) != (int)BlockType.SAPLING &&
                                        bm.GetID(x1, 63, z1) != (int)BlockType.DOUBLE_SLAB)
                                    {
                                        int intRand = rand.Next(100);
                                        if (intRand > 66)
                                        {
                                            bm.SetID(x1, 64, z1, (int)BlockType.YELLOW_FLOWER);
                                        }
                                        else if (intRand > 33)
                                        {
                                            bm.SetID(x1, 64, z1, (int)BlockType.RED_ROSE);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            BlockShapes.MakeHollowBox(x + 2, x + 10, 63, 67, z + 2, z + 10, (int)BlockType.WOOD_PLANK);
                            for (int a = 0; a <= 4; a++)
                            {
                                BlockShapes.MakeSolidBox(x + 2, x + 10, 67 + a, 67 + a, z + 2 + a, z + 10 - a, (int)BlockType.WOOD);
                            }
                            BlockShapes.MakeSolidBox(x + 10, x + 10, 65, 65, z + 6, z + 8, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x + 2, x + 2, 65, 65, z + 4, z + 8, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 2, z + 2, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 10, z + 10, (int)BlockType.GLASS);
                            bm.SetID(x + 10, 64, z + 4, (int)BlockType.WOOD_DOOR);
                            bm.SetData(x + 10, 64, z + 4, 5);
                            bm.SetID(x + 10, 65, z + 4, (int)BlockType.WOOD_DOOR);
                            bm.SetData(x + 10, 65, z + 4, 13);
                        }
                    }
                    BlockShapes.MakeHollowLayers(x, x + intPlotSize, 63, 63, z, z + intPlotSize, (int)BlockType.DOUBLE_SLAB);
                }
            }
        }
예제 #22
0
        public static void MakeGuardTowers(BlockManager bm, frmMace frmLogForm)
        {
            // remove wall
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 11, 64, 79,
                                     City.FarmLength + 5, City.FarmLength + 11, BlockInfo.Air.ID, 1);
            // add tower
            BlockShapes.MakeHollowBox(City.FarmLength + 4, City.FarmLength + 12, 63, 80,
                                      City.FarmLength + 4, City.FarmLength + 12, City.WallMaterialID, 1, City.WallMaterialData);
            // divide into two rooms
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 12, 2, 72,
                                             City.FarmLength + 4, City.FarmLength + 12,
                                             City.WallMaterialID, 1, City.WallMaterialData);
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 11, 64, 67,
                                     City.FarmLength + 5, City.FarmLength + 11, BlockInfo.Air.ID, 1);

            switch (City.OutsideLightType)
            {
            case "Fire":
                BlockShapes.MakeBlock(City.FarmLength + 5, 76, City.FarmLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.FarmLength + 5, 77, City.FarmLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.FarmLength + 11, 76, City.FarmLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.FarmLength + 11, 77, City.FarmLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(City.FarmLength + 6, y, City.FarmLength + 3, City.WallMaterialID, 2);
                    BlockHelper.MakeTorch(City.FarmLength + 10, y, City.FarmLength + 3, City.WallMaterialID, 2);
                }
                break;

            case "None":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            // add torches
            BlockHelper.MakeTorch(City.FarmLength + 6, 79, City.FarmLength + 13, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 10, 79, City.FarmLength + 13, City.WallMaterialID, 2);
            // add torches inside
            BlockHelper.MakeTorch(City.FarmLength + 6, 77, City.FarmLength + 11, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 10, 77, City.FarmLength + 11, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 5, 77, City.FarmLength + 6, City.WallMaterialID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 5, 77, City.FarmLength + 10, City.WallMaterialID, 2);
            // add openings to the walls
            BlockShapes.MakeBlock(City.FarmLength + 7, 73, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 9, 73, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 7, 74, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 9, 74, City.FarmLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(City.FarmLength + 4, City.FarmLength + 12, 81, 81,
                                         City.FarmLength + 4, City.FarmLength + 12,
                                         City.WallMaterialID, 1, City.WallMaterialData);

            // alternating top blocks
            for (int x = City.FarmLength + 4; x <= City.FarmLength + 12; x += 2)
            {
                for (int z = City.FarmLength + 4; z <= City.FarmLength + 12; z += 2)
                {
                    if (x == City.FarmLength + 4 ||
                        x == City.FarmLength + 12 ||
                        z == City.FarmLength + 4 ||
                        z == City.FarmLength + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, City.WallMaterialID, 1, 100, City.WallMaterialData);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 8, City.FarmLength + 8, 73, 82,
                                             City.FarmLength + 8, City.FarmLength + 8, City.WallMaterialID, 1,
                                             City.WallMaterialData);
            BlockHelper.MakeLadder(City.FarmLength + 7, 73, 82, City.FarmLength + 8, 2, City.WallMaterialID);
            BlockHelper.MakeLadder(City.FarmLength + 9, 73, 82, City.FarmLength + 8, 2, City.WallMaterialID);
            // add torches on the roof
            BlockShapes.MakeBlock(City.FarmLength + 6, 81, City.FarmLength + 6, BlockInfo.Torch.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 6, 81, City.FarmLength + 10, BlockInfo.Torch.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 10, 81, City.FarmLength + 10, BlockInfo.Torch.ID, 1, 100, -1);
            // add cobwebs
            BlockShapes.MakeBlock(City.FarmLength + 5, 79, City.FarmLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.FarmLength + 5, 79, City.FarmLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 79, City.FarmLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 79, City.FarmLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);

            // add chests
            MakeGuardChest(bm, City.FarmLength + 11, 73, City.FarmLength + 11);
            MakeGuardChest(bm, City.MapLength - (City.FarmLength + 11), 73, City.FarmLength + 11);
            MakeGuardChest(bm, City.FarmLength + 11, 73, City.MapLength - (City.FarmLength + 11));
            MakeGuardChest(bm, City.MapLength - (City.FarmLength + 11), 73, City.MapLength - (City.FarmLength + 11));

            // add archery slots
            BlockShapes.MakeSolidBox(City.FarmLength + 4, City.FarmLength + 4, 74, 77,
                                     City.FarmLength + 8, City.FarmLength + 8, BlockInfo.Air.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 4, City.FarmLength + 4, 76, 76,
                                     City.FarmLength + 7, City.FarmLength + 9, BlockInfo.Air.ID, 2);
            if (!City.HasWalls)
            {
                BlockHelper.MakeLadder(City.FarmLength + 13, 64, 72, City.FarmLength + 8, 2, City.WallMaterialID);
            }
            // include beds
            BlockHelper.MakeBed(City.FarmLength + 5, City.FarmLength + 6, 64, City.FarmLength + 8, City.FarmLength + 8, 2);
            BlockHelper.MakeBed(City.FarmLength + 5, City.FarmLength + 6, 64, City.FarmLength + 10, City.FarmLength + 10, 2);
            BlockHelper.MakeBed(City.FarmLength + 11, City.FarmLength + 10, 64, City.FarmLength + 8, City.FarmLength + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 5, 64, 73,
                                     City.FarmLength + 5, City.FarmLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 11, City.FarmLength + 11, 64, 71,
                                     City.FarmLength + 5, City.FarmLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 5, City.FarmLength + 5, 64, 71,
                                     City.FarmLength + 11, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.FarmLength + 11, City.FarmLength + 11, 64, 71,
                                     City.FarmLength + 11, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            // add ladders
            BlockHelper.MakeLadder(City.FarmLength + 5, 64, 73, City.FarmLength + 6, 2, BlockInfo.Wood.ID);
            // make torches
            BlockHelper.MakeTorch(City.FarmLength + 10, 66, City.FarmLength + 5, BlockInfo.Wood.ID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 6, 66, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            BlockHelper.MakeTorch(City.FarmLength + 10, 66, City.FarmLength + 11, BlockInfo.Wood.ID, 2);
            // make columns for real
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 5, City.FarmLength + 5, 64, 73, City.FarmLength + 5,
                                             City.FarmLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 11, City.FarmLength + 11, 64, 71, City.FarmLength + 5,
                                             City.FarmLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 5, City.FarmLength + 5, 64, 71, City.FarmLength + 11,
                                             City.FarmLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.FarmLength + 11, City.FarmLength + 11, 64, 71, City.FarmLength + 11,
                                             City.FarmLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            // make cobwebs
            BlockShapes.MakeBlock(City.FarmLength + 11, 67, City.FarmLength + 8, BlockInfo.Cobweb.ID, 2, 75, -1);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(City.FarmLength + 11, 65, City.FarmLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockHelper.MakeDoor(City.FarmLength + 11, 64, City.FarmLength + 12, BlockInfo.GoldBlock.ID, true, 2);
            BlockShapes.MakeBlock(City.FarmLength + 11, 65, City.FarmLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 11, BlockInfo.StonePlate.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.FarmLength + 11, 64, City.FarmLength + 13, BlockInfo.StonePlate.ID, 2, 100, -1);
            //BlockShapes.MakeBlock(City.intFarmSize + 13, 64, City.intFarmSize + 11, BlockInfo.Stone.ID_PLATE, 1, 100, -1);
            // add guard tower sign
            BlockHelper.MakeSign(City.FarmLength + 12, 65, City.FarmLength + 13, "~Guard Tower~~", City.WallMaterialID, 1);
            BlockHelper.MakeSign(City.FarmLength + 8, 74, City.FarmLength + 13, "~Guard Tower~~", City.WallMaterialID, 2);
            // make beacon
            frmLogForm.UpdateLog("Creating tower addition: " + City.TowersAdditionType, true, true);
            switch (City.TowersAdditionType)
            {
            case "Fire beacon":
                BlockShapes.MakeSolidBoxWithData(City.FarmLength + 8, City.FarmLength + 8, 83, 84,
                                                 City.FarmLength + 8, City.FarmLength + 8,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBoxWithData(City.FarmLength + 6, City.FarmLength + 10, 85, 85,
                                                 City.FarmLength + 6, City.FarmLength + 10,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBox(City.FarmLength + 6, City.FarmLength + 10, 86, 86,
                                         City.FarmLength + 6, City.FarmLength + 10, BlockInfo.Netherrack.ID, 1);
                BlockShapes.MakeSolidBox(City.FarmLength + 6, City.FarmLength + 10, 87, 87,
                                         City.FarmLength + 6, City.FarmLength + 10, BlockInfo.Fire.ID, 1);
                break;

            case "Flag":
                BlockShapes.MakeSolidBox(City.FarmLength + 4, City.FarmLength + 4, 83, 91,
                                         City.FarmLength + 12, City.FarmLength + 12, BlockInfo.Fence.ID, 2);
                BlockShapes.MakeBlock(City.FarmLength + 4, 84, City.FarmLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                BlockShapes.MakeBlock(City.FarmLength + 4, 91, City.FarmLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                int[] intColours = RandomHelper.ShuffleArray(Enumerable.Range(0, 15).ToArray());
                switch (RandomHelper.Next(8))
                {
                case 0:         //2vert
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 17, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 18, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;

                case 1:         //3vert
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 15, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 16, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 19, City.FarmLength + 21, BlockInfo.Wool.ID, 2, intColours[2]);
                    break;

                case 2:         //4vert
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 14, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 15, City.FarmLength + 16, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 17, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 19, City.FarmLength + 20, BlockInfo.Wool.ID, 2, intColours[3]);
                    break;

                case 3:         //2horiz
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 87,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 88, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;

                case 4:         //3horiz
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 86,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 87, 88,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 89, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[2]);
                    break;

                case 5:         //quarters
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 87,
                                                     City.FarmLength + 13, City.FarmLength + 17, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 87,
                                                     City.FarmLength + 18, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 88, 90,
                                                     City.FarmLength + 13, City.FarmLength + 17, BlockInfo.Wool.ID, 2, intColours[2]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 88, 90,
                                                     City.FarmLength + 18, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[3]);
                    break;

                case 6:         //cross
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 87, 88,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 17, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;

                default:         // inside "circle"
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 85, 90,
                                                     City.FarmLength + 13, City.FarmLength + 22, BlockInfo.Wool.ID, 2, intColours[0]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 86, 89,
                                                     City.FarmLength + 17, City.FarmLength + 18, BlockInfo.Wool.ID, 2, intColours[1]);
                    BlockShapes.MakeSolidBoxWithData(City.FarmLength + 4, City.FarmLength + 4, 87, 88,
                                                     City.FarmLength + 16, City.FarmLength + 19, BlockInfo.Wool.ID, 2, intColours[1]);
                    break;
                }
                break;
            }
        }
예제 #23
0
        public static void MakeFarms(BetaWorld world, BlockManager bm, int intFarmLength, int intMapLength)
        {
            AddBuildings(bm, intFarmLength, intMapLength);
            int intFail  = 0;
            int intFarms = 0;

            while (intFail <= 500)
            {
                int xlen = RandomHelper.Next(8, 26);
                int x1   = RandomHelper.Next(4, intMapLength - (4 + xlen));
                int zlen = RandomHelper.Next(8, 26);
                int z1   = RandomHelper.Next(4, intMapLength - (4 + zlen));
                if (!(x1 >= intFarmLength && z1 >= intFarmLength &&
                      x1 <= intMapLength - intFarmLength && z1 <= intMapLength - intFarmLength))
                {
                    bool booValid = true;
                    for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                    {
                        for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                        {
                            // make sure it doesn't overlap with the spawn point or another farm
                            if ((x == intMapLength / 2 && z == intMapLength - (intFarmLength - 10)) ||
                                bm.GetID(x, 63, z) != BlockType.GRASS || bm.GetID(x, 64, z) != BlockType.AIR)
                            {
                                booValid = false;
                                intFail++;
                            }
                        }
                    }
                    if (booValid)
                    {
                        // first there is a 25% chance of a hill or pond
                        // if not, for large farms, there is a 50% chance it'll be an orchard
                        // if not, 33% are cactus, 33% are wheat and 33% are sugarcane

                        FarmTypes curFarm;
                        int       intFarmType = RandomHelper.Next(100);
                        if (xlen >= 10 && zlen >= 10 && intFarmType > 75)
                        {
                            if (RandomHelper.NextDouble() > 0.5)
                            {
                                curFarm = FarmTypes.Pond;
                                MakePond(bm, x1, xlen, z1, zlen, false);
                            }
                            else
                            {
                                curFarm = FarmTypes.Hill;
                                MakeHill(bm, x1, xlen, z1, zlen, false);
                            }
                        }
                        else
                        {
                            intFarmType = RandomHelper.Next(100);
                            if (((xlen >= 11 && zlen >= 16) || (xlen >= 16 && zlen >= 11)) && intFarmType > 50)
                            {
                                curFarm = FarmTypes.Orchard;
                                xlen    = ((int)((xlen - 1) / 5) * 5) + 1;
                                zlen    = ((int)((zlen - 1) / 5) * 5) + 1;
                            }
                            else
                            {
                                intFarmType = RandomHelper.Next(3);
                                if (intFarmType == 2)
                                {
                                    curFarm = FarmTypes.Cactus;
                                }
                                else if (intFarmType == 1)
                                {
                                    curFarm = FarmTypes.Wheat;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                                else
                                {
                                    curFarm = FarmTypes.SugarCane;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                            }
                        }

                        int intWallMaterial = RandomHelper.NextDouble() > 0.5 ? BlockType.FENCE : BlockType.LEAVES;

                        switch (curFarm)
                        {
                        case FarmTypes.Hill:
                        case FarmTypes.Pond:
                            intWallMaterial = 0;
                            break;

                        case FarmTypes.SugarCane:
                        case FarmTypes.Mushroom:
                            if (RandomHelper.NextDouble() > 0.5)
                            {
                                intWallMaterial = 0;
                            }
                            break;

                        case FarmTypes.Wheat:
                            intWallMaterial = BlockType.LEAVES;
                            break;
                            // no need for default - the other types don't need anything here
                        }
                        switch (intWallMaterial)
                        {
                        case BlockType.FENCE:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen,
                                                         BlockType.FENCE, 0, -1);
                            break;

                        case BlockType.LEAVES:
                            // the saplings will all disappear if one of them is broken.
                            // so we put wood beneath them to stop that happening
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 63, 63, z1, z1 + zlen,
                                                         BlockType.WOOD, 0, -1);
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 65, z1, z1 + zlen, BlockType.LEAVES, 0,
                                                         RandomHelper.RandomNumber((int)LeafType.OAK, (int)LeafType.SPRUCE,
                                                                                   (int)LeafType.BIRCH));
                            break;

                        case 0:
                            // no wall
                            break;

                        default:
                            Debug.Fail("Invalid switch result");
                            break;
                        }

                        switch (curFarm)
                        {
                        case FarmTypes.Orchard:
                            int intSaplingType = RandomHelper.RandomNumber(SaplingBirchDataID,
                                                                           SaplingOakDataID,
                                                                           SaplingSpruceDataID);
                            for (int x = x1 + 3; x <= x1 + xlen - 3; x += 5)
                            {
                                for (int z = z1 + 3; z <= z1 + zlen - 3; z += 5)
                                {
                                    bm.SetID(x, 63, z, BlockType.GRASS);
                                    BlockShapes.MakeBlock(x, 64, z, BlockType.SAPLING, intSaplingType);
                                }
                            }
                            break;

                        case FarmTypes.Cactus:
                            int intAttempts = 0;
                            do
                            {
                                int  xCactus      = RandomHelper.Next(x1 + 1, x1 + xlen);
                                int  zCactus      = RandomHelper.Next(z1 + 1, z1 + zlen);
                                bool booValidFarm = true;
                                for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                {
                                    for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                    {
                                        if (bm.GetID(xCheck, 64, zCheck) != BlockType.AIR)
                                        {
                                            booValidFarm = false;
                                        }
                                    }
                                }
                                if (booValidFarm)
                                {
                                    bm.SetID(xCactus, 64, zCactus, BlockType.CACTUS);
                                    if (RandomHelper.NextDouble() > 0.5)
                                    {
                                        bm.SetID(xCactus, 65, zCactus, BlockType.CACTUS);
                                    }
                                }
                            }while (++intAttempts < 100);
                            break;

                        case FarmTypes.Wheat:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 66, 66, z1, z1 + zlen,
                                                         BlockType.GLASS, 0, -1);
                            BlockShapes.MakeSolidBox(x1 + 1, x1 + xlen - 1, 67, 67, z1 + 1, z1 + zlen - 1,
                                                     BlockType.GLASS, 0);
                            break;
                            // no need for a default, because there's nothing to do for the other farms
                        }

                        for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                        {
                            for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                            {
                                switch (curFarm)
                                {
                                case FarmTypes.Cactus:
                                    bm.SetID(x, 63, z, BlockType.SAND);
                                    break;

                                case FarmTypes.Wheat:
                                    if (z == z1 + 1)
                                    {
                                        bm.SetID(x, 63, z, BlockType.DOUBLE_SLAB);
                                    }
                                    else if (x % 2 == 0)
                                    {
                                        BlockShapes.MakeBlock(x, 63, z, BlockType.FARMLAND, 1);
                                        bm.SetID(x, 64, z, BlockType.CROPS);
                                    }
                                    else
                                    {
                                        bm.SetID(x, 63, z, BlockType.STATIONARY_WATER);
                                    }
                                    break;

                                case FarmTypes.SugarCane:
                                    if (z != z1 + 1)
                                    {
                                        if (x % 2 == 0)
                                        {
                                            bm.SetID(x, 64, z, BlockType.SUGAR_CANE);
                                            if (RandomHelper.Next(100) > 50)
                                            {
                                                bm.SetID(x, 65, z, BlockType.SUGAR_CANE);
                                            }
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, BlockType.STATIONARY_WATER);
                                        }
                                    }
                                    break;
                                    // no need for a default, because there's nothing to do for the other farms
                                }
                            }
                        }
                        int intDoorPosition = x1 + RandomHelper.Next(1, xlen - 1);
                        if (curFarm == FarmTypes.Wheat)
                        {
                            bm.SetID(intDoorPosition, 63, z1, BlockType.DOUBLE_SLAB);
                        }
                        if (intWallMaterial != 0)
                        {
                            BlockShapes.MakeBlock(intDoorPosition, 64, z1, BlockType.WOOD_DOOR, 4);
                            BlockShapes.MakeBlock(intDoorPosition, 65, z1, BlockType.WOOD_DOOR,
                                                  4 + (int)DoorState.TOPHALF);
                        }
                        intFail = 0;
                        if (++intFarms > 10)
                        {
                            world.Save();
                            intFarms = 0;
                        }
                    }
                }
            }
            MakeMiniPondsAndHills(world, bm, intFarmLength, intMapLength);
            MakeFlowers(bm, intFarmLength, intMapLength);
        }
예제 #24
0
        public static void MakeFarms(BetaWorld world, BlockManager bm, int intFarmSize, int intMapSize)
        {
            AddMushroomFarms(bm, intFarmSize, intMapSize);
            int intFail  = 0;
            int intFarms = 0;

            while (intFail <= 500)
            {
                int xlen = rand.Next(8, 26);
                int x1   = rand.Next(4, intMapSize - (4 + xlen));
                int zlen = rand.Next(8, 26);
                int z1   = rand.Next(4, intMapSize - (4 + zlen));
                if (!(x1 >= intFarmSize && z1 >= intFarmSize &&
                      x1 <= intMapSize - intFarmSize && z1 <= intMapSize - intFarmSize))
                {
                    bool booValid = true;
                    for (int x = x1 - 2; x <= x1 + xlen + 2 && booValid; x++)
                    {
                        for (int z = z1 - 2; z <= z1 + zlen + 2 && booValid; z++)
                        {
                            // make sure it doesn't overlap with the spawn point or another farm
                            if ((x == intMapSize / 2 && z == intMapSize - (intFarmSize - 10)) ||
                                bm.GetID(x, 63, z) != (int)BlockType.GRASS || bm.GetID(x, 64, z) != (int)BlockType.AIR)
                            {
                                booValid = false;
                                intFail++;
                            }
                        }
                    }
                    if (booValid)
                    {
                        // first there is a 25% chance of a hill or pond
                        // if not, for large farms, there is a 50% chance it'll be an orchard
                        // if not, 25% are cactus, 50% are wheat and 25% are sugarcane

                        FarmTypes curFarm;
                        int       intFarmType = rand.Next(100);
                        if (xlen >= 10 && zlen >= 10 && intFarmType > 75)
                        {
                            if (rand.NextDouble() > 0.5)
                            {
                                curFarm = FarmTypes.Pond;
                                MakePond(bm, x1, xlen, z1, zlen, false);
                            }
                            else
                            {
                                curFarm = FarmTypes.Hill;
                                MakeHill(bm, x1, xlen, z1, zlen, false);
                            }
                        }
                        else
                        {
                            intFarmType = rand.Next(100);
                            if (((xlen >= 11 && zlen >= 16) || (xlen >= 16 && zlen >= 11)) && intFarmType > 50)
                            {
                                curFarm = FarmTypes.Orchard;
                                xlen    = ((int)((xlen - 1) / 5) * 5) + 1;
                                zlen    = ((int)((zlen - 1) / 5) * 5) + 1;
                            }
                            else
                            {
                                intFarmType = rand.Next(100);
                                if (intFarmType > 75)
                                {
                                    curFarm = FarmTypes.Cactus;
                                }
                                else if (intFarmType > 25)
                                {
                                    curFarm = FarmTypes.Wheat;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                                else
                                {
                                    curFarm = FarmTypes.SugarCane;
                                    xlen   += (xlen % 2) - 1;
                                    zlen   += (zlen % 2) - 1;
                                }
                            }
                        }

                        int intWallMaterial =
                            rand.NextDouble() > 0.5 ? (int)BlockType.FENCE : (int)BlockType.LEAVES;

                        switch (curFarm)
                        {
                        case FarmTypes.Hill:
                        case FarmTypes.Pond:
                            intWallMaterial = 0;
                            break;

                        case FarmTypes.SugarCane:
                        case FarmTypes.Mushroom:
                            if (rand.NextDouble() > 0.5)
                            {
                                intWallMaterial = 0;
                            }
                            break;

                        case FarmTypes.Wheat:
                            intWallMaterial = (int)BlockType.LEAVES;
                            break;
                        }
                        switch (intWallMaterial)
                        {
                        case (int)BlockType.FENCE:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 64, z1, z1 + zlen, (int)BlockType.FENCE);
                            break;

                        case (int)BlockType.LEAVES:
                            // the saplings will all disappear if one of them is broken.
                            // so we put wood beneath them to stop that happening
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 63, 63, z1, z1 + zlen, (int)BlockType.WOOD);
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 64, 65, z1, z1 + zlen, (int)BlockType.LEAVES, 0,
                                                         RandomHelper.RandomNumber((int)LeafType.OAK, (int)LeafType.SPRUCE, (int)LeafType.BIRCH));
                            break;
                        }

                        switch (curFarm)
                        {
                        case FarmTypes.Orchard:
                            int intSaplingType = RandomHelper.RandomNumber(BlockHelper.SaplingBirch,
                                                                           BlockHelper.SaplingOak,
                                                                           BlockHelper.SaplingSpruce);
                            for (int x = x1 + 3; x <= x1 + xlen - 3; x += 5)
                            {
                                for (int z = z1 + 3; z <= z1 + zlen - 3; z += 5)
                                {
                                    bm.SetID(x, 63, z, (int)BlockType.GRASS);
                                    bm.SetID(x, 64, z, (int)BlockType.SAPLING);
                                    bm.SetData(x, 64, z, intSaplingType);
                                }
                            }
                            break;

                        case FarmTypes.Cactus:
                            int intAttempts = 0;
                            do
                            {
                                int  xCactus = rand.Next(x1 + 1, x1 + xlen), zCactus = rand.Next(z1 + 1, z1 + zlen);
                                bool booValidFarm = true;
                                for (int xCheck = xCactus - 1; xCheck <= xCactus + 1 && booValidFarm; xCheck++)
                                {
                                    for (int zCheck = zCactus - 1; zCheck <= zCactus + 1 && booValidFarm; zCheck++)
                                    {
                                        if (bm.GetID(xCheck, 64, zCheck) != (int)BlockType.AIR)
                                        {
                                            booValidFarm = false;
                                        }
                                    }
                                }
                                if (booValidFarm)
                                {
                                    bm.SetID(xCactus, 64, zCactus, (int)BlockType.CACTUS);
                                    if (rand.NextDouble() > 0.5)
                                    {
                                        bm.SetID(xCactus, 65, zCactus, (int)BlockType.CACTUS);
                                    }
                                }
                                intAttempts++;
                            }while (intAttempts < 100);
                            break;

                        case FarmTypes.Wheat:
                            BlockShapes.MakeHollowLayers(x1, x1 + xlen, 66, 66, z1, z1 + zlen, (int)BlockType.GLASS);
                            BlockShapes.MakeSolidBox(x1 + 1, x1 + xlen - 1, 67, 67, z1 + 1, z1 + zlen - 1, (int)BlockType.GLASS);
                            break;
                        }

                        for (int x = x1 + 1; x <= x1 + xlen - 1; x++)
                        {
                            for (int z = z1 + 1; z <= z1 + zlen - 1; z++)
                            {
                                switch ((int)curFarm)
                                {
                                case (int)FarmTypes.Cactus:
                                    bm.SetID(x, 63, z, (int)BlockType.SAND);
                                    break;

                                case (int)FarmTypes.Wheat:
                                    if (z == z1 + 1)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.DOUBLE_SLAB);
                                    }
                                    else if (x % 2 == 0)
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.FARMLAND);
                                        bm.SetData(x, 63, z, 1);
                                        bm.SetID(x, 64, z, (int)BlockType.CROPS);
                                    }
                                    else
                                    {
                                        bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                    }
                                    break;

                                case (int)FarmTypes.SugarCane:
                                    if (z != z1 + 1)
                                    {
                                        if (x % 2 == 0)
                                        {
                                            bm.SetID(x, 64, z, (int)BlockType.SUGAR_CANE);
                                            if (rand.Next(100) > 50)
                                            {
                                                bm.SetID(x, 65, z, (int)BlockType.SUGAR_CANE);
                                            }
                                        }
                                        else
                                        {
                                            bm.SetID(x, 63, z, (int)BlockType.STATIONARY_WATER);
                                        }
                                    }
                                    break;
                                }
                            }
                        }

                        int d = rand.Next(x1 + 1, x1 + xlen - 1);
                        if (curFarm == FarmTypes.Wheat)
                        {
                            bm.SetID(d, 63, z1, (int)BlockType.DOUBLE_SLAB);
                        }
                        if (intWallMaterial != 0)
                        {
                            bm.SetID(d, 64, z1, (int)BlockType.WOOD_DOOR);
                            bm.SetData(d, 64, z1, 4);
                            bm.SetID(d, 65, z1, (int)BlockType.WOOD_DOOR);
                            bm.SetData(d, 65, z1, 4 + (int)DoorState.TOPHALF);
                        }
                        intFail = 0;
                        intFarms++;
                        if (intFarms % 10 == 0)
                        {
                            world.Save();
                        }
                    }
                }
            }
            MakeMiniPondsAndHills(world, bm, intFarmSize, intMapSize);
            MakeFlowers(bm, intFarmSize, intMapSize);
        }
예제 #25
0
        public static void MakeGuardTowers(BlockManager bm, frmMace frmLogForm)
        {
            // remove wall
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 11, 64, 79,
                                     City.EdgeLength + 5, City.EdgeLength + 11, BlockInfo.Air.ID, 1);
            // add tower
            BlockShapes.MakeHollowBox(City.EdgeLength + 4, City.EdgeLength + 12, 63, 80,
                                      City.EdgeLength + 4, City.EdgeLength + 12, City.WallMaterialID, 1, City.WallMaterialData);
            // divide into two rooms
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 4, City.EdgeLength + 12, 2, 72,
                                             City.EdgeLength + 4, City.EdgeLength + 12,
                                             City.WallMaterialID, 1, City.WallMaterialData);
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 11, 64, 67,
                                     City.EdgeLength + 5, City.EdgeLength + 11, BlockInfo.Air.ID, 1);

            switch (City.OutsideLightType)
            {
            case "Fire":
                BlockShapes.MakeBlock(City.EdgeLength + 5, 76, City.EdgeLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 5, 77, City.EdgeLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 11, 76, City.EdgeLength + 3, BlockInfo.Netherrack.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 11, 77, City.EdgeLength + 3, BlockInfo.Fire.ID, 2, 100, -1);
                break;

            case "Torches":
                for (int y = 73; y <= 80; y += 7)
                {
                    BlockHelper.MakeTorch(City.EdgeLength + 6, y, City.EdgeLength + 3, City.WallMaterialID, 2);
                    BlockHelper.MakeTorch(City.EdgeLength + 10, y, City.EdgeLength + 3, City.WallMaterialID, 2);
                }
                break;

            case "None":
            case "":
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            if (City.HasTorchesOnWalkways)
            {
                // add torches
                BlockHelper.MakeTorch(City.EdgeLength + 6, 79, City.EdgeLength + 13, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 10, 79, City.EdgeLength + 13, City.WallMaterialID, 2);
                // add torches inside
                BlockHelper.MakeTorch(City.EdgeLength + 6, 77, City.EdgeLength + 11, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 10, 77, City.EdgeLength + 11, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 5, 77, City.EdgeLength + 6, City.WallMaterialID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 5, 77, City.EdgeLength + 10, City.WallMaterialID, 2);
            }
            // add openings to the walls
            BlockShapes.MakeBlock(City.EdgeLength + 7, 73, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 9, 73, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 7, 74, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 9, 74, City.EdgeLength + 12, BlockInfo.Air.ID, 2, 100, -1);
            // add blocks on top of the towers
            BlockShapes.MakeHollowLayers(City.EdgeLength + 4, City.EdgeLength + 12, 81, 81,
                                         City.EdgeLength + 4, City.EdgeLength + 12,
                                         City.WallMaterialID, 1, City.WallMaterialData);

            // alternating top blocks
            for (int x = City.EdgeLength + 4; x <= City.EdgeLength + 12; x += 2)
            {
                for (int z = City.EdgeLength + 4; z <= City.EdgeLength + 12; z += 2)
                {
                    if (x == City.EdgeLength + 4 ||
                        x == City.EdgeLength + 12 ||
                        z == City.EdgeLength + 4 ||
                        z == City.EdgeLength + 12)
                    {
                        BlockShapes.MakeBlock(x, 82, z, City.WallMaterialID, 1, 100, City.WallMaterialData);
                    }
                }
            }
            // add central columns
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 8, City.EdgeLength + 8, 73, 82,
                                             City.EdgeLength + 8, City.EdgeLength + 8, City.WallMaterialID, 1,
                                             City.WallMaterialData);
            BlockHelper.MakeLadder(City.EdgeLength + 7, 73, 82, City.EdgeLength + 8, 2, City.WallMaterialID);
            BlockHelper.MakeLadder(City.EdgeLength + 9, 73, 82, City.EdgeLength + 8, 2, City.WallMaterialID);
            // add torches on the roof
            if (City.HasTorchesOnWalkways)
            {
                BlockShapes.MakeBlock(City.EdgeLength + 6, 81, City.EdgeLength + 6, BlockInfo.Torch.ID, 1, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 6, 81, City.EdgeLength + 10, BlockInfo.Torch.ID, 2, 100, -1);
                BlockShapes.MakeBlock(City.EdgeLength + 10, 81, City.EdgeLength + 10, BlockInfo.Torch.ID, 1, 100, -1);
            }
            // add cobwebs
            BlockShapes.MakeBlock(City.EdgeLength + 5, 79, City.EdgeLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 5, 79, City.EdgeLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 79, City.EdgeLength + 5, BlockInfo.Cobweb.ID, 1, 30, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 79, City.EdgeLength + 11, BlockInfo.Cobweb.ID, 1, 30, -1);

            // add chests
            MakeGuardChest(bm, City.EdgeLength + 11, 73, City.EdgeLength + 11);
            MakeGuardChest(bm, City.MapLength - (City.EdgeLength + 11), 73, City.EdgeLength + 11);
            MakeGuardChest(bm, City.EdgeLength + 11, 73, City.MapLength - (City.EdgeLength + 11));
            MakeGuardChest(bm, City.MapLength - (City.EdgeLength + 11), 73, City.MapLength - (City.EdgeLength + 11));

            // add archery slots
            BlockShapes.MakeSolidBox(City.EdgeLength + 4, City.EdgeLength + 4, 74, 77,
                                     City.EdgeLength + 8, City.EdgeLength + 8, BlockInfo.Air.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 4, City.EdgeLength + 4, 76, 76,
                                     City.EdgeLength + 7, City.EdgeLength + 9, BlockInfo.Air.ID, 2);
            if (!City.HasWalls)
            {
                BlockHelper.MakeLadder(City.EdgeLength + 13, 64, 72, City.EdgeLength + 8, 2, City.WallMaterialID);
            }
            // include beds
            BlockHelper.MakeBed(City.EdgeLength + 5, City.EdgeLength + 6, 64, City.EdgeLength + 8, City.EdgeLength + 8, 2);
            BlockHelper.MakeBed(City.EdgeLength + 5, City.EdgeLength + 6, 64, City.EdgeLength + 10, City.EdgeLength + 10, 2);
            BlockHelper.MakeBed(City.EdgeLength + 11, City.EdgeLength + 10, 64, City.EdgeLength + 8, City.EdgeLength + 8, 2);
            // make columns to orientate torches
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 5, 64, 73,
                                     City.EdgeLength + 5, City.EdgeLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71,
                                     City.EdgeLength + 5, City.EdgeLength + 5, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 5, City.EdgeLength + 5, 64, 71,
                                     City.EdgeLength + 11, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
            BlockShapes.MakeSolidBox(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71,
                                     City.EdgeLength + 11, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
            // add ladders
            BlockHelper.MakeLadder(City.EdgeLength + 5, 64, 73, City.EdgeLength + 6, 2, BlockInfo.Wood.ID);
            // make torches
            if (City.HasTorchesOnWalkways)
            {
                BlockHelper.MakeTorch(City.EdgeLength + 10, 66, City.EdgeLength + 5, BlockInfo.Wood.ID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 6, 66, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
                BlockHelper.MakeTorch(City.EdgeLength + 10, 66, City.EdgeLength + 11, BlockInfo.Wood.ID, 2);
            }
            // make columns for real
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 5, City.EdgeLength + 5, 64, 73, City.EdgeLength + 5,
                                             City.EdgeLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71, City.EdgeLength + 5,
                                             City.EdgeLength + 5, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 5, City.EdgeLength + 5, 64, 71, City.EdgeLength + 11,
                                             City.EdgeLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 11, City.EdgeLength + 11, 64, 71, City.EdgeLength + 11,
                                             City.EdgeLength + 11, City.WallMaterialID, 2, City.WallMaterialData);
            // make cobwebs
            BlockShapes.MakeBlock(City.EdgeLength + 11, 67, City.EdgeLength + 8, BlockInfo.Cobweb.ID, 2, 75, -1);
            // make doors from the city to the guard tower
            BlockShapes.MakeBlock(City.EdgeLength + 11, 65, City.EdgeLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 11, BlockInfo.GoldBlock.ID, 1, 100, -1);
            BlockHelper.MakeDoor(City.EdgeLength + 11, 64, City.EdgeLength + 12, BlockInfo.GoldBlock.ID, true, 2);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 65, City.EdgeLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 11, BlockInfo.Air.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 11, BlockInfo.StonePlate.ID, 1, 100, -1);
            BlockShapes.MakeBlock(City.EdgeLength + 11, 64, City.EdgeLength + 13, BlockInfo.StonePlate.ID, 2, 100, -1);
            //BlockShapes.MakeBlock(City.intFarmSize + 13, 64, City.intFarmSize + 11, BlockInfo.Stone.ID_PLATE, 1, 100, -1);
            // add guard tower sign
            BlockHelper.MakeSign(City.EdgeLength + 12, 65, City.EdgeLength + 13, "~Guard Tower~~", City.WallMaterialID, 1);
            BlockHelper.MakeSign(City.EdgeLength + 8, 74, City.EdgeLength + 13, "~Guard Tower~~", City.WallMaterialID, 2);
            // make beacon
            frmLogForm.UpdateLog("Creating tower addition: " + City.TowersAdditionType, true, true);
            switch (City.TowersAdditionType)
            {
            case "Fire beacon":
                BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 8, City.EdgeLength + 8, 83, 84,
                                                 City.EdgeLength + 8, City.EdgeLength + 8,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 6, City.EdgeLength + 10, 85, 85,
                                                 City.EdgeLength + 6, City.EdgeLength + 10,
                                                 City.WallMaterialID, 1, City.WallMaterialData);
                BlockShapes.MakeSolidBox(City.EdgeLength + 6, City.EdgeLength + 10, 86, 86,
                                         City.EdgeLength + 6, City.EdgeLength + 10, BlockInfo.Netherrack.ID, 1);
                BlockShapes.MakeSolidBox(City.EdgeLength + 6, City.EdgeLength + 10, 87, 87,
                                         City.EdgeLength + 6, City.EdgeLength + 10, BlockInfo.Fire.ID, 1);
                break;

            case "Flag":
                BlockShapes.MakeSolidBox(City.EdgeLength + 4, City.EdgeLength + 4, 83, 91,
                                         City.EdgeLength + 12, City.EdgeLength + 12, BlockInfo.Fence.ID, 2);
                BlockShapes.MakeBlock(City.EdgeLength + 4, 84, City.EdgeLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                BlockShapes.MakeBlock(City.EdgeLength + 4, 91, City.EdgeLength + 13, BlockInfo.Fence.ID, 2, 100, 0);
                int[] intColours = RNG.ShuffleArray(Enumerable.Range(0, 15).ToArray());
                // select a random flag file and turn it into an array
                string[] strFlagLines = File.ReadAllLines(RNG.RandomItemFromArray(Directory.GetFiles("Resources", "Flag_*.txt")));
                for (int x = 0; x < strFlagLines[0].Length; x++)
                {
                    for (int y = 0; y < strFlagLines.GetLength(0); y++)
                    {
                        int WoolColourID = Convert.ToInt32(strFlagLines[y].Substring(x, 1));
                        BlockShapes.MakeSolidBoxWithData(City.EdgeLength + 4, City.EdgeLength + 4,
                                                         90 - y, 90 - y,
                                                         City.EdgeLength + 13 + x, City.EdgeLength + 13 + x,
                                                         BlockInfo.Wool.ID, 2, intColours[WoolColourID]);
                    }
                }
                break;
            }
        }
예제 #26
0
        public static bool[,] MakeSewers(int intFarmSize, int intMapSize, int intPlotSize)
        {
            int intPlots = 1 + ((intMapSize - ((intFarmSize + 16) * 2)) / intPlotSize);

            bool[,] booNewSewerEntrances = MakeSewerEntrances(intPlots, false);

            Maze maze = new Maze();

            // 51, 43, 35, 27, 19, 11, 3
            for (int y = 3; y <= 51; y += 8)
            {
                bool[,] booOldSewerEntrances = booNewSewerEntrances;
                booNewSewerEntrances         = MakeSewerEntrances(intPlots, y == 51);
                bool[,] booMaze = maze.GenerateMaze((intPlots * 2) + 1, (intPlots * 2) + 1);
                booMaze         = maze.CreateLoops(booMaze, booMaze.GetLength(0) / 4);
                if (y == 3)
                {
                    booMaze = maze.DeleteDeadEnds(booMaze, booNewSewerEntrances);
                }
                else
                {
                    booMaze = maze.DeleteDeadEnds(booMaze,
                                                  MergeBooleanArrays(booNewSewerEntrances, booOldSewerEntrances));
                }
                for (int x = 0; x < booMaze.GetUpperBound(0); x++)
                {
                    for (int z = 0; z < booMaze.GetUpperBound(1); z++)
                    {
                        if (booMaze[x, z])
                        {
                            MakeSewerSection(booMaze, x, z, intFarmSize + 18 + (x * intPlotSize / 2),
                                             intFarmSize + 18 + (z * intPlotSize / 2), y, intPlotSize);
                        }
                    }
                }
                for (int x = 0; x < booMaze.GetUpperBound(0); x++)
                {
                    for (int z = 0; z < booMaze.GetUpperBound(1); z++)
                    {
                        if (booMaze[x, z])
                        {
                            if (y > 3 &&
                                x % 2 == 1 && z % 2 == 1 &&
                                booOldSewerEntrances[(x - 1) / 2, (z - 1) / 2])
                            {
                                BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2) - 1,
                                                         intFarmSize + 18 + (x * intPlotSize / 2) + 1,
                                                         y - 7, y + 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) - 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                         (int)BlockType.AIR);
                                BlockShapes.MakeHollowLayers(intFarmSize + 18 + (x * intPlotSize / 2) - 1,
                                                             intFarmSize + 18 + (x * intPlotSize / 2) + 1,
                                                             y, y,
                                                             intFarmSize + 18 + (z * intPlotSize / 2) - 1,
                                                             intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                             (int)BlockType.STONE);
                                BlockShapes.MakeSolidBox(intFarmSize + 18 + (x * intPlotSize / 2),
                                                         intFarmSize + 18 + (x * intPlotSize / 2),
                                                         y - 7, y + 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                         intFarmSize + 18 + (z * intPlotSize / 2) + 1,
                                                         (int)BlockType.STONE);
                                BlockHelper.MakeLadder(intFarmSize + 18 + (x * intPlotSize / 2), y - 7, y + 1,
                                                       intFarmSize + 18 + (z * intPlotSize / 2));
                            }
                        }
                    }
                }
            }
            return(booNewSewerEntrances);
        }
예제 #27
0
        private static void MakeLevel(BetaWorld world, BlockManager bm, int intDepth, int intMineshaftSize)
        {
            strResourceNames   = ValueFromXMLElement(Path.Combine("Resources", "MineshaftChests.xml"), "level" + intDepth, "names").Split(',');
            intResourceChances = StringArrayToIntArray(
                ValueFromXMLElement(Path.Combine("Resources", "MineshaftChests.xml"), "level" + intDepth, "chances").Split(','));
            int intTorchChance = Convert.ToInt32(ValueFromXMLElement(Path.Combine("Resources", "MineshaftChests.xml"), "level" + intDepth, "torch_chance"));

            int[,] intMap = new int[intMineshaftSize, intMineshaftSize];
            int intXPosOriginal = intMap.GetLength(0) / 2;
            int intZPosOriginal = intMap.GetLength(1) / 2;

            int[,] intArea = new int[intMap.GetLength(0) / MULTIPLIER, intMap.GetLength(1) / MULTIPLIER];
            int intXPos = intXPosOriginal / MULTIPLIER;
            int intZPos = intZPosOriginal / MULTIPLIER;

            intArea[intXPos, intZPos] = 1;
            CreateRouteXPlus(intArea, intXPos + 1, intZPos, 0);
            CreateRouteZPlus(intArea, intXPos, intZPos + 1, 1);
            CreateRouteXMinus(intArea, intXPos - 1, intZPos, 2);
            CreateRouteZMinus(intArea, intXPos, intZPos - 1, 3);
            int  intOffsetX = (intXPosOriginal - (intXPos * MULTIPLIER)) - 2;
            int  intOffsetZ = (intZPosOriginal - (intZPos * MULTIPLIER)) - 2;
            int  intGhostX = 0, intGhostZ = 0;
            bool booGhost = false;

            if (intDepth == 7)
            {
                for (int x = 1; x < intArea.GetLength(0) - 1 && !booGhost; x++)
                {
                    for (int z = 1; z < intArea.GetLength(1) - 1 && !booGhost; z++)
                    {
                        if (intArea[x, z] == 1 && intArea[x + 1, z] == 0 && intArea[x - 1, z] == 0 && intArea[x, z + 1] == 0)
                        {
                            intArea[x, z] = 9;
                            intGhostX     = (x * MULTIPLIER) + intOffsetX;
                            intGhostZ     = (z * MULTIPLIER) + intOffsetZ;
                            booGhost      = true;
                        }
                    }
                }
            }
            for (int x = 4; x < intMap.GetLength(0) - 4; x++)
            {
                for (int z = 4; z < intMap.GetLength(1) - 4; z++)
                {
                    if (intArea.GetLength(0) > x / MULTIPLIER && intArea.GetLength(1) > z / MULTIPLIER)
                    {
                        if (intMap[x + intOffsetX, z + intOffsetZ] < 4)
                        {
                            intMap[x + intOffsetX, z + intOffsetZ] = intArea[x / MULTIPLIER, z / MULTIPLIER];
                        }
                    }
                    if ((x + 3) % 5 == 0 && (z + 3) % 5 == 0 && intArea[x / MULTIPLIER, z / MULTIPLIER] == 1)
                    {
                        if (intArea[(x / MULTIPLIER) + 1, z / MULTIPLIER] == 1)
                        {
                            for (int x2 = 0; x2 < 5; x2++)
                            {
                                if (x2 == 1 || x2 == 3)
                                {
                                    intMap[x + intOffsetX + 3, z + intOffsetZ + x2 - 2] = 8;
                                    intMap[x + intOffsetX + 2, z + intOffsetZ + x2 - 2] = 8;
                                }
                                else
                                {
                                    intMap[x + intOffsetX + 3, z + intOffsetZ + x2 - 2] = 5;
                                    intMap[x + intOffsetX + 2, z + intOffsetZ + x2 - 2] = 5;
                                }
                            }
                            for (int x2 = 0; x2 <= 5; x2++)
                            {
                                if (intMap[x + intOffsetX + x2, z + intOffsetZ] == 5)
                                {
                                    intMap[x + intOffsetX + x2, z + intOffsetZ] = 4;
                                }
                                else
                                {
                                    intMap[x + intOffsetX + x2, z + intOffsetZ] = 7;
                                }
                            }
                        }
                        if (intArea[x / MULTIPLIER, (z / MULTIPLIER) + 1] == 1)
                        {
                            for (int z2 = 0; z2 < 5; z2++)
                            {
                                if (z2 == 1 || z2 == 3)
                                {
                                    intMap[x + intOffsetX + z2 - 2, z + intOffsetZ + 3] = 8;
                                    intMap[x + intOffsetX + z2 - 2, z + intOffsetZ + 2] = 8;
                                }
                                else
                                {
                                    intMap[x + intOffsetX + z2 - 2, z + intOffsetZ + 3] = 5;
                                    intMap[x + intOffsetX + z2 - 2, z + intOffsetZ + 2] = 5;
                                }
                            }
                            for (int z2 = 0; z2 <= 5; z2++)
                            {
                                if (intMap[x + intOffsetX, z + intOffsetZ + z2] == 5)
                                {
                                    intMap[x + intOffsetX, z + intOffsetZ + z2] = 4;
                                }
                                else
                                {
                                    intMap[x + intOffsetX, z + intOffsetZ + z2] = 7;
                                }
                            }
                        }
                        if (intArea[x / MULTIPLIER, z / MULTIPLIER] == 1)
                        {
                            MakeChestAndOrTorch(intArea, intMap, (x - 3) / MULTIPLIER, z / MULTIPLIER, x + intOffsetX - 2, z + intOffsetZ);
                            MakeChestAndOrTorch(intArea, intMap, (x + 3) / MULTIPLIER, z / MULTIPLIER, x + intOffsetX + 2, z + intOffsetZ);
                            MakeChestAndOrTorch(intArea, intMap, x / MULTIPLIER, (z - 3) / MULTIPLIER, x + intOffsetX, z + intOffsetZ - 2);
                            MakeChestAndOrTorch(intArea, intMap, x / MULTIPLIER, (z + 3) / MULTIPLIER, x + intOffsetX, z + intOffsetZ + 2);
                        }
                    }
                }
            }
            intMap[intXPosOriginal, intZPosOriginal] = 3;
            int intSupportMaterial = RandomHelper.RandomNumber((int)BlockType.WOOD, (int)BlockType.WOOD_PLANK, (int)BlockType.FENCE);

            intSupportMaterial = (int)BlockType.WOOD_PLANK;
            for (int x = 0; x < intMap.GetLength(0); x++)
            {
                for (int z = 0; z < intMap.GetLength(1); z++)
                {
                    switch (intMap[x, z])
                    {
                    case 0:
                        break;

                    case 1:
                        for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++)
                        {
                            bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.AIR);
                        }
                        break;

                    case 9:
                        for (int y = 39 - (5 * intDepth); y <= 41 - (5 * (intDepth - 1)); y++)
                        {
                            bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.AIR);
                        }
                        break;

                    case 2:
                        break;

                    case 4:
                        for (int y = 38 - (5 * intDepth); y <= 41 - (5 * intDepth); y++)
                        {
                            if (y == 38 - (5 * intDepth))
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.GRAVEL);
                            }
                            else if (y == 39 - (5 * intDepth))
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.RAILS);
                            }
                            else if (y == 40 - (5 * intDepth))
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.AIR);
                            }
                            else
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, intSupportMaterial);
                            }
                        }
                        break;

                    case 5:
                        for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++)
                        {
                            bm.SetID(x + intBlockStart, y, z + intBlockStart, intSupportMaterial);
                        }
                        break;

                    case 6:
                        for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++)
                        {
                            if (y == 39 - (5 * intDepth) &&
                                RandomHelper.NextDouble() > 0.9)
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.CHEST);
                                MakeChestItems(bm, x + intBlockStart, y, z + intBlockStart);
                            }
                            else if (y == 41 - (5 * intDepth) &&
                                     RandomHelper.NextDouble() < (double)intTorchChance / 100)
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.TORCH);
                                if (intMap[x - 1, z] == 0)
                                {
                                    bm.SetData(x + intBlockStart, y, z + intBlockStart, 1);
                                }
                                else if (intMap[x + 1, z] == 0)
                                {
                                    bm.SetData(x + intBlockStart, y, z + intBlockStart, 2);
                                }
                                else if (intMap[x, z - 1] == 0)
                                {
                                    bm.SetData(x + intBlockStart, y, z + intBlockStart, 3);
                                }
                                else
                                {
                                    bm.SetData(x + intBlockStart, y, z + intBlockStart, 4);
                                }
                            }
                            else
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.AIR);
                            }
                        }
                        break;

                    case 7:
                    case 3:
                        for (int y = 38 - (5 * intDepth); y <= 41 - (5 * intDepth); y++)
                        {
                            if (y == 38 - (5 * intDepth))
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.GRAVEL);
                            }
                            else if (y == 39 - (5 * intDepth))
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.RAILS);
                            }
                            else
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.AIR);
                            }
                        }
                        break;

                    case 8:
                        for (int y = 39 - (5 * intDepth); y <= 41 - (5 * intDepth); y++)
                        {
                            if (y == 41 - (5 * intDepth))
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, intSupportMaterial);
                            }
                            else
                            {
                                bm.SetID(x + intBlockStart, y, z + intBlockStart, (int)BlockType.AIR);
                            }
                        }
                        break;
                    }
                }
            }
            for (int x = 0; x < intMap.GetLength(0); x++)
            {
                for (int z = 0; z < intMap.GetLength(1); z++)
                {
                    switch (intMap[x, z])
                    {
                    case 3:
                    case 4:
                    case 7:
                        BlockHelper.MakeRail(x + intBlockStart, 39 - (5 * intDepth), z + intBlockStart);
                        break;
                    }
                }
            }
            if (booGhost)
            {
                BlockShapes.MakeSolidBox(intBlockStart + intGhostX - 1, intBlockStart + intGhostX + 5,
                                         39 - (5 * intDepth), 46 - (5 * intDepth),
                                         intBlockStart + intGhostZ - 1, intBlockStart + intGhostZ + 5, (int)BlockType.AIR, 0);
                for (int x = intBlockStart + intGhostX; x <= intBlockStart + intGhostX + 4; x++)
                {
                    for (int y = 39 - (5 * intDepth); y <= 44 - (5 * intDepth); y++)
                    {
                        for (int z = intBlockStart + intGhostZ + 3; z <= intBlockStart + intGhostZ + 4; z++)
                        {
                            bm.SetID(x, y, z, (int)BlockType.WOOL);
                            bm.SetData(x, y, z, (int)WoolColor.WHITE);
                        }
                    }
                }
                bm.SetID(intBlockStart + intGhostX + 0, 44 - (5 * intDepth), intBlockStart + intGhostZ + 3, (int)BlockType.TORCH);
                bm.SetID(intBlockStart + intGhostX + 0, 44 - (5 * intDepth), intBlockStart + intGhostZ + 4, (int)BlockType.TORCH);
                bm.SetID(intBlockStart + intGhostX + 4, 44 - (5 * intDepth), intBlockStart + intGhostZ + 3, (int)BlockType.TORCH);
                bm.SetID(intBlockStart + intGhostX + 4, 44 - (5 * intDepth), intBlockStart + intGhostZ + 4, (int)BlockType.TORCH);
                bm.SetData(intBlockStart + intGhostX + 0, 44 - (5 * intDepth), intBlockStart + intGhostZ + 3, (int)TorchOrientation.FLOOR);
                bm.SetData(intBlockStart + intGhostX + 0, 44 - (5 * intDepth), intBlockStart + intGhostZ + 4, (int)TorchOrientation.FLOOR);
                bm.SetData(intBlockStart + intGhostX + 4, 44 - (5 * intDepth), intBlockStart + intGhostZ + 3, (int)TorchOrientation.FLOOR);
                bm.SetData(intBlockStart + intGhostX + 4, 44 - (5 * intDepth), intBlockStart + intGhostZ + 4, (int)TorchOrientation.FLOOR);
                bm.SetID(intBlockStart + intGhostX + 1, 43 - (5 * intDepth), intBlockStart + intGhostZ + 3, (int)BlockType.OBSIDIAN);
                bm.SetID(intBlockStart + intGhostX + 3, 43 - (5 * intDepth), intBlockStart + intGhostZ + 3, (int)BlockType.OBSIDIAN);
                bm.SetID(intBlockStart + intGhostX + 1, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2, (int)BlockType.TORCH);
                bm.SetData(intBlockStart + intGhostX + 1, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2, (int)TorchOrientation.FLOOR);
                bm.SetID(intBlockStart + intGhostX + 2, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2, (int)BlockType.SIGN_POST);
                bm.SetData(intBlockStart + intGhostX + 2, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2, (int)SignPostOrientation.EAST);
                BlockHelper.MakeSignPost(intBlockStart + intGhostX + 2, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2,
                                         "Ghostdancer:|Victim of the|Creeper Rush|of '09");
                bm.SetID(intBlockStart + intGhostX + 3, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2, (int)BlockType.TORCH);
                bm.SetData(intBlockStart + intGhostX + 3, 39 - (5 * intDepth), intBlockStart + intGhostZ + 2, (int)TorchOrientation.FLOOR);
            }
            world.Save();
            //File.WriteAllText("c:\\output.txt", TwoDimensionalArrayToString(intMap));
        }