public override bool Place(Point origin, StructureMap structures)
 {
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point = new Point(origin.X - 25, origin.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 59, 147, 1 };
     WorldUtils.Gen(point, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     int item = nums[0] + nums[1];
     int num = nums[59];
     int item1 = nums[147];
     if (item1 <= num || item1 <= item)
     {
         return false;
     }
     int num1 = 0;
     for (int i = GenBase._random.Next(10, 15); i > 5; i--)
     {
         int num2 = GenBase._random.Next(-5, 5);
         Point point1 = new Point(origin.X + num2, origin.Y + num1);
         Shapes.Circle circle = new Shapes.Circle(i);
         GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(4, 0.3), null, null };
         ushort[] numArray1 = new ushort[] { 147, 161, 224, 0, 1 };
         blotch[1] = new Modifiers.OnlyTiles(numArray1);
         blotch[2] = new Actions.SetTile(162, true, true);
         WorldUtils.Gen(point1, circle, Actions.Chain(blotch));
         Point point2 = new Point(origin.X + num2, origin.Y + num1);
         Shapes.Circle circle1 = new Shapes.Circle(i);
         GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(4, 0.3), new Modifiers.HasLiquid(-1, -1), new Actions.SetTile(162, true, true), new Actions.SetLiquid(0, 0) };
         WorldUtils.Gen(point2, circle1, Actions.Chain(genActionArray));
         num1 = num1 + (i - 2);
     }
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point y;
     Point point;
     Dictionary<ushort, int> nums = new Dictionary<ushort, int>();
     Point point1 = new Point(origin.X - 25, origin.Y - 25);
     Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50);
     ushort[] numArray = new ushort[] { 0, 1 };
     WorldUtils.Gen(point1, rectangle, (new Actions.TileScanner(numArray)).Output(nums));
     if (nums[0] + nums[1] < 1250)
     {
         return false;
     }
     Searches.Up up = new Searches.Up(1000);
     GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(1, 50).Not() };
     bool flag = WorldUtils.Find(origin, Searches.Chain(up, genConditionArray), out y);
     Point point2 = origin;
     Searches.Up up1 = new Searches.Up(origin.Y - y.Y);
     GenCondition[] isTile = new GenCondition[1];
     ushort[] numArray1 = new ushort[] { 53 };
     isTile[0] = new Conditions.IsTile(numArray1);
     if (WorldUtils.Find(point2, Searches.Chain(up1, isTile), out point))
     {
         return false;
     }
     if (!flag)
     {
         return false;
     }
     y.Y = y.Y + 50;
     ShapeData shapeDatum = new ShapeData();
     ShapeData shapeDatum1 = new ShapeData();
     Point point3 = new Point(origin.X, origin.Y + 20);
     Point point4 = new Point(origin.X, origin.Y + 30);
     float single = 0.8f + GenBase._random.NextFloat() * 0.5f;
     if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 0))
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(origin.X, y.Y + 10, 1, origin.Y - y.Y - 9), 2))
     {
         return false;
     }
     Shapes.Slime slime = new Shapes.Slime(20, single, 1f);
     GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.4), (new Actions.ClearTile(true)).Output(shapeDatum) };
     WorldUtils.Gen(point3, slime, Actions.Chain(blotch));
     Shapes.Mound mound = new Shapes.Mound(14, 14);
     GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), (new Actions.SetFrames(true)).Output(shapeDatum1) };
     WorldUtils.Gen(point4, mound, Actions.Chain(genActionArray));
     shapeDatum.Subtract(shapeDatum1, point3, point4);
     ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true);
     GenAction[] setTile = new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) };
     WorldUtils.Gen(point3, innerOutline, Actions.Chain(setTile));
     ModShapes.All all = new ModShapes.All(shapeDatum);
     GenAction[] rectangleMask = new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) };
     WorldUtils.Gen(point3, all, Actions.Chain(rectangleMask));
     ModShapes.All all1 = new ModShapes.All(shapeDatum);
     GenAction[] placeWall = new GenAction[] { new Actions.PlaceWall(68, true), null, null, null };
     ushort[] numArray2 = new ushort[] { 2 };
     placeWall[1] = new Modifiers.OnlyTiles(numArray2);
     placeWall[2] = new Modifiers.Offset(0, 1);
     placeWall[3] = new ActionVines(3, 5, 52);
     WorldUtils.Gen(point3, all1, Actions.Chain(placeWall));
     ShapeData shapeDatum2 = new ShapeData();
     Point point5 = new Point(origin.X, y.Y + 10);
     Shapes.Rectangle rectangle1 = new Shapes.Rectangle(1, origin.Y - y.Y - 9);
     GenAction[] onlyTile = new GenAction[] { new Modifiers.Blotches(2, 0.2), (new Actions.ClearTile(false)).Output(shapeDatum2), new Modifiers.Expand(1), null, null };
     ushort[] numArray3 = new ushort[] { 53 };
     onlyTile[3] = new Modifiers.OnlyTiles(numArray3);
     onlyTile[4] = (new Actions.SetTile(397, false, true)).Output(shapeDatum2);
     WorldUtils.Gen(point5, rectangle1, Actions.Chain(onlyTile));
     WorldUtils.Gen(new Point(origin.X, y.Y + 10), new ModShapes.All(shapeDatum2), new Actions.SetFrames(true));
     if (GenBase._random.Next(3) != 0)
     {
         WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15);
     }
     else
     {
         WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17);
     }
     ModShapes.All all2 = new ModShapes.All(shapeDatum1);
     GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, -1), null, null, null };
     ushort[] numArray4 = new ushort[] { 2 };
     offset[1] = new Modifiers.OnlyTiles(numArray4);
     offset[2] = new Modifiers.Offset(0, -1);
     offset[3] = new ActionGrass();
     WorldUtils.Gen(point4, all2, Actions.Chain(offset));
     structures.AddStructure(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 4);
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Ref<int> @ref = new Ref<int>(0);
     Ref<int> ref1 = new Ref<int>(0);
     Ref<int> ref2 = new Ref<int>(0);
     Ref<int> ref3 = new Ref<int>(0);
     Shapes.Circle circle = new Shapes.Circle(15);
     GenAction[] scanner = new GenAction[] { new Actions.Scanner(ref2), new Modifiers.IsSolid(), new Actions.Scanner(@ref), null, null, null, null };
     ushort[] numArray = new ushort[] { 60, 59 };
     scanner[3] = new Modifiers.OnlyTiles(numArray);
     scanner[4] = new Actions.Scanner(ref1);
     ushort[] numArray1 = new ushort[] { 60 };
     scanner[5] = new Modifiers.OnlyTiles(numArray1);
     scanner[6] = new Actions.Scanner(ref3);
     WorldUtils.Gen(origin, circle, Actions.Chain(scanner));
     if ((float)ref1.Value / (float)@ref.Value < 0.75f || ref3.Value < 2)
     {
         return false;
     }
     if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0))
     {
         return false;
     }
     int x = origin.X;
     int y = origin.Y;
     int num = 150;
     for (int i = x - num; i < x + num; i = i + 10)
     {
         if (i > 0 && i <= Main.maxTilesX - 1)
         {
             for (int j = y - num; j < y + num; j = j + 10)
             {
                 if (j > 0 && j <= Main.maxTilesY - 1)
                 {
                     if (Main.tile[i, j].active() && Main.tile[i, j].type == 226)
                     {
                         return false;
                     }
                     if (Main.tile[i, j].wall == 87 || Main.tile[i, j].wall == 3 || Main.tile[i, j].wall == 83)
                     {
                         return false;
                     }
                 }
             }
         }
     }
     int x1 = origin.X;
     int y1 = origin.Y;
     int num1 = 0;
     int[] x2 = new int[10];
     int[] y2 = new int[10];
     Vector2 vector2 = new Vector2((float)x1, (float)y1);
     Vector2 vector21 = vector2;
     int num2 = WorldGen.genRand.Next(2, 5);
     for (int k = 0; k < num2; k++)
     {
         int num3 = WorldGen.genRand.Next(2, 5);
         for (int l = 0; l < num3; l++)
         {
             vector21 = WorldGen.Hive((int)vector2.X, (int)vector2.Y);
         }
         vector2 = vector21;
         x2[num1] = (int)vector2.X;
         y2[num1] = (int)vector2.Y;
         num1++;
     }
     for (int m = 0; m < num1; m++)
     {
         int num4 = x2[m];
         int num5 = y2[m];
         bool flag = false;
         int num6 = 1;
         if (WorldGen.genRand.Next(2) == 0)
         {
             num6 = -1;
         }
         while (num4 > 10 && num4 < Main.maxTilesX - 10 && num5 > 10 && num5 < Main.maxTilesY - 10 && (!Main.tile[num4, num5].active() || !Main.tile[num4, num5 + 1].active() || !Main.tile[num4 + 1, num5].active() || !Main.tile[num4 + 1, num5 + 1].active()))
         {
             num4 = num4 + num6;
             if (Math.Abs(num4 - x2[m]) <= 50)
             {
                 continue;
             }
             flag = true;
             break;
         }
         if (!flag)
         {
             num4 = num4 + num6;
             for (int n = num4 - 1; n <= num4 + 2; n++)
             {
                 for (int o = num5 - 1; o <= num5 + 2; o++)
                 {
                     if (n < 10 || n > Main.maxTilesX - 10)
                     {
                         flag = true;
                     }
                     else if (Main.tile[n, o].active() && Main.tile[n, o].type != 225)
                     {
                         flag = true;
                         break;
                     }
                 }
             }
             if (!flag)
             {
                 for (int p = num4 - 1; p <= num4 + 2; p++)
                 {
                     for (int q = num5 - 1; q <= num5 + 2; q++)
                     {
                         if (p < num4 || p > num4 + 1 || q < num5 || q > num5 + 1)
                         {
                             Main.tile[p, q].active(true);
                             Main.tile[p, q].type = 225;
                         }
                         else
                         {
                             Main.tile[p, q].active(false);
                             Main.tile[p, q].liquid = 255;
                             Main.tile[p, q].honey(true);
                         }
                     }
                 }
                 num6 = num6 * -1;
                 num5++;
                 int num7 = 0;
                 while ((num7 < 4 || WorldGen.SolidTile(num4, num5)) && num4 > 10 && num4 < Main.maxTilesX - 10)
                 {
                     num7++;
                     num4 = num4 + num6;
                     if (!WorldGen.SolidTile(num4, num5))
                     {
                         continue;
                     }
                     WorldGen.PoundTile(num4, num5);
                     if (Main.tile[num4, num5 + 1].active())
                     {
                         continue;
                     }
                     Main.tile[num4, num5 + 1].active(true);
                     Main.tile[num4, num5 + 1].type = 225;
                 }
             }
         }
     }
     WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp<int>((int)vector2.X, 5, Main.maxTilesX - 5);
     WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp<int>((int)vector2.Y, 5, Main.maxTilesY - 5);
     WorldGen.numLarva = WorldGen.numLarva + 1;
     int x3 = (int)vector2.X;
     int y3 = (int)vector2.Y;
     for (int r = x3 - 1; r <= x3 + 1 && r > 0 && r < Main.maxTilesX; r++)
     {
         for (int s = y3 - 2; s <= y3 + 1 && s > 0 && s < Main.maxTilesY; s++)
         {
             if (s == y3 + 1)
             {
                 Main.tile[r, s].active(true);
                 Main.tile[r, s].type = 225;
                 Main.tile[r, s].slope(0);
                 Main.tile[r, s].halfBrick(false);
             }
             else
             {
                 Main.tile[r, s].active(false);
             }
         }
     }
     structures.AddStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5);
     return true;
 }
 public override bool Place(Point origin, StructureMap structures)
 {
     Point point;
     Ref<int> @ref = new Ref<int>(0);
     Ref<int> ref1 = new Ref<int>(0);
     Shapes.Circle circle = new Shapes.Circle(10);
     GenAction[] scanner = new GenAction[] { new Actions.Scanner(ref1), new Modifiers.IsSolid(), new Actions.Scanner(@ref) };
     WorldUtils.Gen(origin, circle, Actions.Chain(scanner));
     if (@ref.Value < ref1.Value - 5)
     {
         return false;
     }
     int num = GenBase._random.Next(6, 10);
     int num1 = GenBase._random.Next(5);
     if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 0))
     {
         return false;
     }
     ShapeData shapeDatum = new ShapeData();
     Shapes.Slime slime = new Shapes.Slime(num);
     GenAction[] onlyTile = new GenAction[] { (new Modifiers.Blotches(num1, num1, num1, 1, 0.3)).Output(shapeDatum), new Modifiers.Offset(0, -2), null, null, null, null };
     ushort[] numArray = new ushort[] { 53 };
     onlyTile[2] = new Modifiers.OnlyTiles(numArray);
     onlyTile[3] = new Actions.SetTile(397, true, true);
     onlyTile[4] = new Modifiers.OnlyWalls(new byte[1]);
     onlyTile[5] = new Actions.PlaceWall(16, true);
     WorldUtils.Gen(origin, slime, Actions.Chain(onlyTile));
     ModShapes.All all = new ModShapes.All(shapeDatum);
     GenAction[] clearTile = new GenAction[] { new Actions.ClearTile(false), new Actions.SetLiquid(0, 0), new Actions.SetFrames(true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true) };
     WorldUtils.Gen(origin, all, Actions.Chain(clearTile));
     Searches.Down down = new Searches.Down(10);
     GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() };
     if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out point))
     {
         return false;
     }
     int y = point.Y - 1;
     bool flag = GenBase._random.Next() % 2 == 0;
     if (GenBase._random.Next() % 10 != 0)
     {
         int num2 = GenBase._random.Next(1, 4);
         int num3 = (flag ? 4 : -(num >> 1));
         for (int i = 0; i < num2; i++)
         {
             int num4 = GenBase._random.Next(1, 3);
             for (int j = 0; j < num4; j++)
             {
                 WorldGen.PlaceTile(origin.X + num3 - i, y - j, 331, false, false, -1, 0);
             }
         }
     }
     int num5 = (num - 3) * (flag ? -1 : 1);
     if (GenBase._random.Next() % 10 != 0)
     {
         WorldGen.PlaceTile(origin.X + num5, y, 186, false, false, -1, 0);
     }
     if (GenBase._random.Next() % 10 != 0)
     {
         WorldGen.PlaceTile(origin.X, y, 215, true, false, -1, 0);
         if (GenBase._tiles[origin.X, y].active() && GenBase._tiles[origin.X, y].type == 215)
         {
             Tile tile = GenBase._tiles[origin.X, y];
             tile.frameY = (short)(tile.frameY + 36);
             Tile tile1 = GenBase._tiles[origin.X - 1, y];
             tile1.frameY = (short)(tile1.frameY + 36);
             Tile tile2 = GenBase._tiles[origin.X + 1, y];
             tile2.frameY = (short)(tile2.frameY + 36);
             Tile tile3 = GenBase._tiles[origin.X, y - 1];
             tile3.frameY = (short)(tile3.frameY + 36);
             Tile tile4 = GenBase._tiles[origin.X - 1, y - 1];
             tile4.frameY = (short)(tile4.frameY + 36);
             Tile tile5 = GenBase._tiles[origin.X + 1, y - 1];
             tile5.frameY = (short)(tile5.frameY + 36);
         }
     }
     structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
     return true;
 }
		public override bool Place(Point origin, StructureMap structures)
		{
			Ref<int> @ref = new Ref<int>(0);
			Ref<int> ref2 = new Ref<int>(0);
			WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new GenAction[]
			{
				new Actions.Scanner(ref2),
				new Modifiers.IsSolid(),
				new Actions.Scanner(@ref)
			}));
			if (@ref.Value < ref2.Value - 5)
			{
				return false;
			}
			int num = GenBase._random.Next(6, 10);
			int num2 = GenBase._random.Next(5);
			if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 0))
			{
				return false;
			}
			ShapeData data = new ShapeData();
			Point arg_12A_0 = origin;
			GenShape arg_12A_1 = new Shapes.Slime(num);
			GenAction[] array = new GenAction[6];
			array[0] = new Modifiers.Blotches(num2, num2, num2, 1, 0.3).Output(data);
			array[1] = new Modifiers.Offset(0, -2);
			array[2] = new Modifiers.OnlyTiles(new ushort[]
			{
				53
			});
			array[3] = new Actions.SetTile(397, true, true);
			GenAction[] arg_116_0 = array;
			int arg_116_1 = 4;
			byte[] types = new byte[1];
			arg_116_0[arg_116_1] = new Modifiers.OnlyWalls(types);
			array[5] = new Actions.PlaceWall(16, true);
			WorldUtils.Gen(arg_12A_0, arg_12A_1, Actions.Chain(array));
			Point arg_185_0 = origin;
			GenShape arg_185_1 = new ModShapes.All(data);
			GenAction[] array2 = new GenAction[5];
			array2[0] = new Actions.ClearTile(false);
			array2[1] = new Actions.SetLiquid(0, 0);
			array2[2] = new Actions.SetFrames(true);
			GenAction[] arg_171_0 = array2;
			int arg_171_1 = 3;
			byte[] types2 = new byte[1];
			arg_171_0[arg_171_1] = new Modifiers.OnlyWalls(types2);
			array2[4] = new Actions.PlaceWall(16, true);
			WorldUtils.Gen(arg_185_0, arg_185_1, Actions.Chain(array2));
			Point point;
			if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new GenCondition[]
			{
				new Conditions.IsSolid()
			}), out point))
			{
				return false;
			}
			int num3 = point.Y - 1;
			bool flag = GenBase._random.Next() % 2 == 0;
			if (GenBase._random.Next() % 10 != 0)
			{
				int num4 = GenBase._random.Next(1, 4);
				int num5 = flag ? 4 : (-(num >> 1));
				for (int i = 0; i < num4; i++)
				{
					int num6 = GenBase._random.Next(1, 3);
					for (int j = 0; j < num6; j++)
					{
						WorldGen.PlaceTile(origin.X + num5 - i, num3 - j, 331, false, false, -1, 0);
					}
				}
			}
			int num7 = (num - 3) * (flag ? -1 : 1);
			if (GenBase._random.Next() % 10 != 0)
			{
				WorldGen.PlaceTile(origin.X + num7, num3, 186, false, false, -1, 0);
			}
			if (GenBase._random.Next() % 10 != 0)
			{
				WorldGen.PlaceTile(origin.X, num3, 215, true, false, -1, 0);
				if (GenBase._tiles[origin.X, num3].active() && GenBase._tiles[origin.X, num3].type == 215)
				{
					Tile expr_305 = GenBase._tiles[origin.X, num3];
					expr_305.frameY += 36;
					Tile expr_329 = GenBase._tiles[origin.X - 1, num3];
					expr_329.frameY += 36;
					Tile expr_34D = GenBase._tiles[origin.X + 1, num3];
					expr_34D.frameY += 36;
					Tile expr_371 = GenBase._tiles[origin.X, num3 - 1];
					expr_371.frameY += 36;
					Tile expr_397 = GenBase._tiles[origin.X - 1, num3 - 1];
					expr_397.frameY += 36;
					Tile expr_3BD = GenBase._tiles[origin.X + 1, num3 - 1];
					expr_3BD.frameY += 36;
				}
			}
			structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
			return true;
		}