public override bool Place(Point origin, StructureMap structures) { Point point; Point point1; Point point2 = new Point(origin.X - 3, origin.Y); Searches.Down down = new Searches.Down(200); GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaAnd(6, 1) }; if (!WorldUtils.Find(point2, Searches.Chain(down, genConditionArray), out point)) { return(false); } Point point3 = new Point(point.X, point.Y - 5); Searches.Up up = new Searches.Up(120); GenCondition[] genConditionArray1 = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(6, 1) }; if (!WorldUtils.Find(point3, Searches.Chain(up, genConditionArray1), out point1) || point.Y - 5 - point1.Y > 60) { return(false); } if (point.Y - point1.Y < 30) { return(false); } if (!structures.CanPlace(new Rectangle(point.X - 30, point.Y - 60, 60, 90), 0)) { return(false); } Dictionary <ushort, int> nums = new Dictionary <ushort, int>(); Point point4 = new Point(point.X - 25, point.Y - 25); Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50); ushort[] numArray = new ushort[] { 0, 59, 147, 1 }; WorldUtils.Gen(point4, rectangle, (new Actions.TileScanner(numArray)).Output(nums)); int item = nums[0] + nums[1]; int num = nums[59]; if (nums[147] > num || item > num || num < 50) { return(false); } int y = (point.Y - point1.Y - 9) / 5; int num1 = y * 5; int num2 = 0; double num3 = GenBase._random.NextDouble() + 1; double num4 = GenBase._random.NextDouble() + 2; if (GenBase._random.Next(2) == 0) { num4 = -num4; } for (int i = 0; i < y; i++) { double num5 = (double)(i + 1) / 12; int num6 = (int)(Math.Sin(num5 * num3 * 3.14159274101257) * num4); int num7 = (num6 < num2 ? num6 - num2 : 0); Point point5 = new Point(point.X + num2 + num7, point.Y - (i + 1) * 5); Shapes.Rectangle rectangle1 = new Shapes.Rectangle(6 + Math.Abs(num6 - num2), 7); GenAction[] removeWall = new GenAction[] { new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false) }; WorldUtils.Gen(point5, rectangle1, Actions.Chain(removeWall)); Point point6 = new Point(point.X + num2 + num7 + 2, point.Y - (i + 1) * 5); Shapes.Rectangle rectangle2 = new Shapes.Rectangle(2 + Math.Abs(num6 - num2), 5); GenAction[] clearTile = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) }; WorldUtils.Gen(point6, rectangle2, Actions.Chain(clearTile)); Point point7 = new Point(point.X + num2 + 2, point.Y - i * 5); Shapes.Rectangle rectangle3 = new Shapes.Rectangle(2, 2); GenAction[] genActionArray = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) }; WorldUtils.Gen(point7, rectangle3, Actions.Chain(genActionArray)); num2 = num6; } int num8 = 6; if (num4 < 0) { num8 = 0; } List <Point> points = new List <Point>(); for (int j = 0; j < 2; j++) { double num9 = ((double)j + 1) / 3; int num10 = num8 + (int)(Math.Sin((double)y * num9 / 12 * num3 * 3.14159274101257) * num4); double num11 = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232; if (num8 == 0) { num11 = num11 - 1.57079637050629; } Point point8 = new Point(point.X + num10, point.Y - (int)((double)(y * 5) * num9)); ShapeBranch shapeBranch = (new ShapeBranch(num11, (double)GenBase._random.Next(12, 16))).OutputEndpoints(points); GenAction[] setTile = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point8, shapeBranch, Actions.Chain(setTile)); num8 = 6 - num8; } int num12 = (int)(Math.Sin((double)y / 12 * num3 * 3.14159274101257) * num4); Point point9 = new Point(point.X + 6 + num12, point.Y - num1); ShapeBranch shapeBranch1 = (new ShapeBranch(-0.685398185253143, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points); GenAction[] setTile1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point9, shapeBranch1, Actions.Chain(setTile1)); Point point10 = new Point(point.X + num12, point.Y - num1); ShapeBranch shapeBranch2 = (new ShapeBranch(-2.45619455575943, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points); GenAction[] genActionArray1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point10, shapeBranch2, Actions.Chain(genActionArray1)); foreach (Point point11 in points) { Shapes.Circle circle = new Shapes.Circle(4); GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(4, 2, 0.3), null, null, null, null }; ushort[] numArray1 = new ushort[] { 383 }; blotch[1] = new Modifiers.SkipTiles(numArray1); byte[] numArray2 = new byte[] { 78 }; blotch[2] = new Modifiers.SkipWalls(numArray2); blotch[3] = new Actions.SetTile(384, false, true); blotch[4] = new Actions.SetFrames(true); WorldUtils.Gen(point11, circle, Actions.Chain(blotch)); } for (int k = 0; k < 4; k++) { float single = (float)k / 3f * 2f + 0.57075f; WorldUtils.Gen(point, new ShapeRoot(single, (float)GenBase._random.Next(40, 60), 4f, 1f), new Actions.SetTile(383, true, true)); } WorldGen.AddBuriedChest(point.X + 3, point.Y - 1, (GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem()), false, 10); structures.AddStructure(new Rectangle(point.X - 30, point.Y - 30, 60, 60), 0); 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); }