public void Process(Type type, StructureMap.Configuration.DSL.Registry registry) { if (type.CanBeCastTo(typeof(Controller)) && !type.IsAbstract) { registry.For(type).LifecycleIs(new UniquePerRequestLifecycle()); } }
protected override void ConfigureApplicationContainer(StructureMap.IContainer existingContainer) { base.ConfigureApplicationContainer(existingContainer); existingContainer.Configure(x => x.AddRegistry<RavenDbBootstrapper>()); existingContainer.Configure(x => x.For<HandlerModule<RobotCreatedEvent>>().Use<RobotCreatedEventHandler>()); HandlerCentral.Container = existingContainer; }
public override void Register(StructureMap.IContainer container, List<SiteRoute> routes, System.Web.Mvc.ViewEngineCollection viewEngines, System.Web.Mvc.ModelBinderDictionary modelBinders, ICollection<AtomSite.Domain.Asset> assets) { RegisterController<AssetController>(container); //this.AddRoute(routes, new SiteRoute() { Name = "IgnoreImages", Route = new Route("img/{file}.{ext}", new StopRoutingHandler()) }); //this.AddRoute(routes, new SiteRoute() { Name = "IgnoreImages2", Route = new Route("img/{theme}/{file}.{ext}", new StopRoutingHandler()) }); this.AddRoute(routes, new SiteRoute() { Merit = DefaultMerit, Name = "AssetGroupJs", Route = new System.Web.Routing.Route("js/combined/{group}.js", new RouteValueDictionary(new { controller = "Asset", action = "GroupJs" }), new MvcRouteHandler()) }); //this.AddRoute(routes, new SiteRoute() { Name = "IgnoreJavascript", Route = new Route("js/{*pathInfo}", new StopRoutingHandler()) }); this.AddRoute(routes, new SiteRoute() { Merit = DefaultMerit, Name = "AssetGroupCss", Route = new System.Web.Routing.Route("css/combined/{group}.css", new RouteValueDictionary(new { controller = "Asset", action = "GroupCss" }), new MvcRouteHandler()) }); //this.AddRoute(routes, new SiteRoute() { Name = "IgnoreStyles", Route = new Route("css/{*pathInfo}", new StopRoutingHandler()) }); }
protected override void ConfigureApplicationContainer(StructureMap.IContainer existingContainer) { base.ConfigureApplicationContainer(existingContainer); existingContainer.Configure(x => x.For<IDocumentStore>().Singleton().Use(CurrentDocumentStore())); existingContainer.Configure(x => x.For<IDocumentSession>().HybridHttpOrThreadLocalScoped().Use(y => y.GetInstance<IDocumentStore>().OpenSession())); existingContainer.Configure(x => x.For<HandlerModule<UserCreatedEvent>>().Use<UserCreatedEventHandler>()); HandlerCentral.Container = existingContainer; }
public ScopeContainer(StructureMap.IContainer container) { if (container == null) { throw new ArgumentNullException("container"); } this.container = container; }
protected override void ConfigureApplicationContainer(StructureMap.IContainer existingContainer) { base.ConfigureApplicationContainer(existingContainer); existingContainer.Configure(x => x.SelectConstructor(() => new FakeNancyModule())); existingContainer.Configure(x => x.For<IDocumentStore>().Singleton().Use(GetEmbededInMemoryStore)); existingContainer.Configure(x => x.For<IDocumentSession>().HybridHttpOrThreadLocalScoped().Use(y => y.GetInstance<IDocumentStore>().OpenSession())); existingContainer.Configure(x => x.For<HandlerModule<RobotCreatedEvent>>().Use<RobotCreatedEventHandler>()); HandlerCentral.Container = existingContainer; }
protected override void ApplicationStartup(StructureMap.IContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); StaticConfiguration.DisableCaches = true; StaticConfiguration.DisableErrorTraces = false; this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts")); CookieBasedSessions.Enable(pipelines); }
protected override void OnUpdatePageModel(StructureMap.IContainer container) { base.OnUpdatePageModel(container); // special, update page model with config includes foreach (Include include in Includes.Select(i => i.ConfigInclude).Where(i => i != null)) { var w = container.TryGetInstance<IWidget>(include.Name); if (w != null) w.UpdatePageModel(this, include); } }
public static void SetupAllDatabases(DB_TestingHelper dbTestingHelper, Autofac.IContainer autofacContainer, StructureMap.IContainer structureMapContainer) { TI.trace("Begin database setup"); SetupServerDb(dbTestingHelper, autofacContainer); SetupHubDistributr(dbTestingHelper, structureMapContainer); SetupHubLocal(dbTestingHelper); SetupMongo(dbTestingHelper); }
protected override void ConfigureApplicationContainer(StructureMap.IContainer existingContainer) { existingContainer.Configure(c => c.Scan(s => { s.AssemblyContainingType<IConvertStrings>(); s.IncludeNamespaceContainingType<Md5Encoder>(); s.AddAllTypesOf<IConvertStrings>(); s.RegisterConcreteTypesAgainstTheFirstInterface(); s.WithDefaultConventions().OnAddedPluginTypes(t => t.Singleton()); })); existingContainer.Configure(a => a.For<IRazorConfiguration>().Singleton().Use<RazorConfiguration>()); existingContainer.Configure(c => c.For<IConverterRepository>().Singleton().Use<ConverterRepository>()); ServiceLocator.SetLocatorProvider(() => new StructureMapServiceLocator(existingContainer)); base.ConfigureApplicationContainer(existingContainer); }
public void Process(Type type, StructureMap.Configuration.DSL.Registry registry) { if (type.IsAbstract) { return; } if (type.IsInterface) { return; } var originalInterface = type.GetInterfaces().Where(t => t.IsGenericType && t.GetGenericTypeDefinition() == baseInterface).FirstOrDefault(); if (originalInterface == null) return; Type[] wrappedTypes = originalInterface.GetGenericArguments(); // Create the created type Type implementationType = baseInterface.MakeGenericType(wrappedTypes); // And specify what we're going to use registry.For(implementationType).Use(type); }
public void Process(Type type, StructureMap.Configuration.DSL.Registry registry) { if (!type.IsInterface) { return; } if (type.IsGenericTypeDefinition) { return; } Assembly containingAssembly = type.Assembly; var matchedType = containingAssembly.GetTypes() .Where(x => x.Namespace == type.Namespace && x.GetInterface(type.FullName) != null) .FirstOrDefault(); if (matchedType == null) { return; } registry.For(type).Use(matchedType); }
public override void Register(StructureMap.IContainer container, List<SiteRoute> routes, System.Web.Mvc.ViewEngineCollection viewEngines, System.Web.Mvc.ModelBinderDictionary modelBinders, ICollection<AtomSite.Domain.Asset> globalAssets) { RegisterWidget(container, new CompositeWidget("RecentPostsForCategoryWidget", "AdditionalWidgets", "RecentPostsForCategoryWidget") { Description = "This widget shows the recent posts for a category.", SupportedScopes = SupportedScopes.All, OnGetConfigInclude = (s) => { return new ConfigLinkInclude() { Controller = "AdditionalWidgets", Action = "RecentPostsForCategorySetupWidget", IncludePath = s }; }, OnValidate = (i) => new AdditionalWidgetsIncludes.RecentPostsForCategoryInclude(i).HasCategory, AreaHints = new[] { "sidetop", "sidemid", "sidebot" } }); RegisterController<AdditionalWidgetsController>(container); }
public override void Register(StructureMap.IContainer container, List<SiteRoute> routes, System.Web.Mvc.ViewEngineCollection viewEngines, System.Web.Mvc.ModelBinderDictionary modelBinders, ICollection<Domain.Asset> globalAssets) { container.Inject(typeof (IThemeSwitcherService), new ThemeSwitcherService(container.GetInstance<IThemeService>(), container.GetInstance<IAtomPubService>(), container.GetInstance<IAppServiceRepository>())); RegisterWidget(container, new CompositeWidget("ThemeSwitcherWidget", "ThemeSwitcher", "Widget") { Assets = new string[] { "ThemeSwitcher.css", "ThemeSwitcher.js" }.Select(a => new Asset(a)), SupportedScopes = SupportedScopes.All, AreaHints = new[] { "content" } }); RegisterWidget(container, new CompositeWidget("ThemeWidget", "ThemeSwitcher", "ThemeWidget") { SupportedScopes = SupportedScopes.All, }); RegisterController<ThemeSwitcherController>(container); SetupIncludeInPageArea(container, "Site", "tail", "ThemeSwitcherWidget"); }
public override AtomSite.Domain.PluginState Upgrade(StructureMap.IContainer container, string appPath, System.Version previous, System.Version current) { //fix non named pages to specify group if (previous >= ServerApp.Version12 && previous < ServerApp.Version14) { LogService.Info("Updating non named page includes in configuration to the default site master page, and getting rid of group specifier if there is one"); var svcRepo = container.GetInstance<IAppServiceRepository>(); var appSvc = svcRepo.GetService(); bool changes = false; var pages = appSvc.Pages.Where(p => string.IsNullOrEmpty(p.Name)); foreach (var page in pages) { page.Name = "Site"; page.SetProperty<string>("group", null); changes = true; } if (changes) { LogService.Info("Saving changes to service configuration"); svcRepo.UpdateService(appSvc); } } return base.Upgrade(container, appPath, previous, current); }
// Token: 0x06000FBA RID: 4026 RVA: 0x003F75D4 File Offset: 0x003F57D4 public override bool Place(Point origin, StructureMap structures) { Point point; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(200), new GenCondition[] { new Conditions.IsSolid() }), out point) || point == origin) { return(false); } Rectangle room = this.GetRoom(point); Rectangle rectangle = this.GetRoom(new Point(room.Center.X, room.Y + 1)); Rectangle rectangle2 = this.GetRoom(new Point(room.Center.X, room.Y + room.Height + 10)); rectangle2.Y = room.Y + room.Height - 1; float num = this.RoomSolidPrecentage(rectangle); float num2 = this.RoomSolidPrecentage(rectangle2); room.Y += 3; rectangle.Y += 3; rectangle2.Y += 3; List <Rectangle> list = new List <Rectangle>(); if (GenBase._random.NextFloat() > num + 0.2f) { list.Add(rectangle); } else { rectangle = room; } list.Add(room); if (GenBase._random.NextFloat() > num2 + 0.2f) { list.Add(rectangle2); } else { rectangle2 = room; } foreach (Rectangle current in list) { if (current.Y + current.Height > Main.maxTilesY - 220) { bool result = false; return(result); } } Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>(); foreach (Rectangle current2 in list) { WorldUtils.Gen(new Point(current2.X - 10, current2.Y - 10), new Shapes.Rectangle(current2.Width + 20, current2.Height + 20), new Actions.TileScanner(new ushort[] { 0, 59, 147, 1, 161, 53, 396, 397, 368, 367, 60, 70 }).Output(dictionary)); } List <Tuple <CaveHouseBiome.BuildData, int> > expr_1FD = new List <Tuple <CaveHouseBiome.BuildData, int> >(); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Default, dictionary[0] + dictionary[1])); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Jungle, dictionary[59] + dictionary[60] * 10)); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Mushroom, dictionary[59] + dictionary[70] * 10)); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Snow, dictionary[147] + dictionary[161])); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Desert, dictionary[397] + dictionary[396] + dictionary[53])); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Granite, dictionary[368])); expr_1FD.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Marble, dictionary[367])); expr_1FD.Sort(new Comparison <Tuple <CaveHouseBiome.BuildData, int> >(this.SortBiomeResults)); CaveHouseBiome.BuildData item = expr_1FD[0].Item1; foreach (Rectangle current3 in list) { Point point2; if (item != CaveHouseBiome.BuildData.Granite && WorldUtils.Find(new Point(current3.X - 2, current3.Y - 2), Searches.Chain(new Searches.Rectangle(current3.Width + 4, current3.Height + 4).RequireAll(false), new GenCondition[] { new Conditions.HasLava() }), out point2)) { bool result = false; return(result); } if (!structures.CanPlace(current3, CaveHouseBiome._blacklistedTiles, 5)) { bool result = false; return(result); } } int num3 = room.X; int num4 = room.X + room.Width - 1; List <Rectangle> list2 = new List <Rectangle>(); foreach (Rectangle current4 in list) { num3 = Math.Min(num3, current4.X); num4 = Math.Max(num4, current4.X + current4.Width - 1); } int num5 = 6; while (num5 > 4 && (num4 - num3) % num5 != 0) { num5--; } for (int i = num3; i <= num4; i += num5) { for (int j = 0; j < list.Count; j++) { Rectangle rectangle3 = list[j]; if (i >= rectangle3.X && i < rectangle3.X + rectangle3.Width) { int num6 = rectangle3.Y + rectangle3.Height; int num7 = 50; for (int k = j + 1; k < list.Count; k++) { if (i >= list[k].X && i < list[k].X + list[k].Width) { num7 = Math.Min(num7, list[k].Y - num6); } } if (num7 > 0) { Point point3; bool flag = WorldUtils.Find(new Point(i, num6), Searches.Chain(new Searches.Down(num7), new GenCondition[] { new Conditions.IsSolid() }), out point3); if (num7 < 50) { flag = true; point3 = new Point(i, num6 + num7); } if (flag) { list2.Add(new Rectangle(i, num6, 1, point3.Y - num6)); } } } } } List <Point> list3 = new List <Point>(); foreach (Rectangle current5 in list) { int y; if (this.FindSideExit(new Rectangle(current5.X + current5.Width, current5.Y + 1, 1, current5.Height - 2), false, out y)) { list3.Add(new Point(current5.X + current5.Width - 1, y)); } if (this.FindSideExit(new Rectangle(current5.X, current5.Y + 1, 1, current5.Height - 2), true, out y)) { list3.Add(new Point(current5.X, y)); } } List <Tuple <Point, Point> > list4 = new List <Tuple <Point, Point> >(); for (int l = 1; l < list.Count; l++) { Rectangle rectangle4 = list[l]; Rectangle rectangle5 = list[l - 1]; int arg_6C3_0 = rectangle5.X - rectangle4.X; int num8 = rectangle4.X + rectangle4.Width - (rectangle5.X + rectangle5.Width); if (arg_6C3_0 > num8) { list4.Add(new Tuple <Point, Point>(new Point(rectangle4.X + rectangle4.Width - 1, rectangle4.Y + 1), new Point(rectangle4.X + rectangle4.Width - rectangle4.Height + 1, rectangle4.Y + rectangle4.Height - 1))); } else { list4.Add(new Tuple <Point, Point>(new Point(rectangle4.X, rectangle4.Y + 1), new Point(rectangle4.X + rectangle4.Height - 1, rectangle4.Y + rectangle4.Height - 1))); } } List <Point> list5 = new List <Point>(); int x; if (this.FindVerticalExit(new Rectangle(rectangle.X + 2, rectangle.Y, rectangle.Width - 4, 1), true, out x)) { list5.Add(new Point(x, rectangle.Y)); } if (this.FindVerticalExit(new Rectangle(rectangle2.X + 2, rectangle2.Y + rectangle2.Height - 1, rectangle2.Width - 4, 1), false, out x)) { list5.Add(new Point(x, rectangle2.Y + rectangle2.Height - 1)); } foreach (Rectangle current6 in list) { WorldUtils.Gen(new Point(current6.X, current6.Y), new Shapes.Rectangle(current6.Width, current6.Height), Actions.Chain(new GenAction[] { new Actions.SetTile(item.Tile, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(new Point(current6.X + 1, current6.Y + 1), new Shapes.Rectangle(current6.Width - 2, current6.Height - 2), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(item.Wall, true) })); structures.AddStructure(current6, 8); } foreach (Tuple <Point, Point> expr_906 in list4) { Point item2 = expr_906.Item1; Point item3 = expr_906.Item2; int num9 = (item3.X > item2.X) ? 1 : -1; ShapeData shapeData = new ShapeData(); for (int m = 0; m < item3.Y - item2.Y; m++) { shapeData.Add(num9 * (m + 1), m); } WorldUtils.Gen(item2, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetSlope((num9 == 1) ? 1 : 2), new Actions.SetFrames(true) })); WorldUtils.Gen(new Point(item2.X + ((num9 == 1) ? 1 : -4), item2.Y - 1), new Shapes.Rectangle(4, 1), Actions.Chain(new GenAction[] { new Actions.Clear(), new Actions.PlaceWall(item.Wall, true), new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetFrames(true) })); } foreach (Point current7 in list3) { WorldUtils.Gen(current7, new Shapes.Rectangle(1, 3), new Actions.ClearTile(true)); WorldGen.PlaceTile(current7.X, current7.Y, 10, true, true, -1, item.DoorStyle); } using (List <Point> .Enumerator enumerator3 = list5.GetEnumerator()) { while (enumerator3.MoveNext()) { WorldUtils.Gen(enumerator3.Current, new Shapes.Rectangle(3, 1), Actions.Chain(new GenAction[] { new Actions.ClearMetadata(), new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetFrames(true) })); } } foreach (Rectangle current8 in list2) { if (current8.Height > 1 && GenBase._tiles[current8.X, current8.Y - 1].type != 19) { WorldUtils.Gen(new Point(current8.X, current8.Y), new Shapes.Rectangle(current8.Width, current8.Height), Actions.Chain(new GenAction[] { new Actions.SetTile(124, false, true), new Actions.SetFrames(true) })); Tile expr_BA5 = GenBase._tiles[current8.X, current8.Y + current8.Height]; expr_BA5.slope(0); expr_BA5.halfBrick(false); } } Point[] choices = new Point[] { new Point(14, item.TableStyle), new Point(16, 0), new Point(18, item.WorkbenchStyle), new Point(86, 0), new Point(87, item.PianoStyle), new Point(94, 0), new Point(101, item.BookcaseStyle) }; foreach (Rectangle current9 in list) { int num10 = current9.Width / 8; int num11 = current9.Width / (num10 + 1); int num12 = GenBase._random.Next(2); for (int n = 0; n < num10; n++) { int num13 = (n + 1) * num11 + current9.X; int num14 = n + num12 % 2; if (num14 != 0) { if (num14 == 1) { int num15 = current9.Y + 1; WorldGen.PlaceTile(num13, num15, 34, true, false, -1, GenBase._random.Next(6)); for (int num16 = -1; num16 < 2; num16++) { for (int num17 = 0; num17 < 3; num17++) { Tile expr_D5C = GenBase._tiles[num16 + num13, num17 + num15]; expr_D5C.frameX += 54; } } } } else { int num15 = current9.Y + Math.Min(current9.Height / 2, current9.Height - 5); Vector2 expr_CEA = WorldGen.randHousePicture(); int type = (int)expr_CEA.X; int style = (int)expr_CEA.Y; if (!WorldGen.nearPicture(num13, num15)) { WorldGen.PlaceTile(num13, num15, type, true, false, -1, style); } } } int num18 = current9.Width / 8 + 3; WorldGen.SetupStatueList(); while (num18 > 0) { int num19 = GenBase._random.Next(current9.Width - 3) + 1 + current9.X; int num20 = current9.Y + current9.Height - 2; switch (GenBase._random.Next(4)) { case 0: WorldGen.PlaceSmallPile(num19, num20, GenBase._random.Next(31, 34), 1, 185); break; case 1: WorldGen.PlaceTile(num19, num20, 186, true, false, -1, GenBase._random.Next(22, 26)); break; case 2: { int num21 = GenBase._random.Next(2, WorldGen.statueList.Length); WorldGen.PlaceTile(num19, num20, (int)WorldGen.statueList[num21].X, true, false, -1, (int)WorldGen.statueList[num21].Y); if (WorldGen.StatuesWithTraps.Contains(num21)) { WorldGen.PlaceStatueTrap(num19, num20); } break; } case 3: { Point point4 = Utils.SelectRandom <Point>(GenBase._random, choices); WorldGen.PlaceTile(num19, num20, point4.X, true, false, -1, point4.Y); break; } } num18--; } } foreach (Rectangle current10 in list) { item.ProcessRoom(current10); } bool flag2 = false; foreach (Rectangle current11 in list) { int num22 = current11.Height - 1 + current11.Y; int style2 = (num22 > (int)Main.worldSurface) ? item.ChestStyle : 0; int num23 = 0; while (num23 < 10 && !(flag2 = WorldGen.AddBuriedChest(GenBase._random.Next(2, current11.Width - 2) + current11.X, num22, 0, false, style2))) { num23++; } if (flag2) { break; } int num24 = current11.X + 2; while (num24 <= current11.X + current11.Width - 2 && !(flag2 = WorldGen.AddBuriedChest(num24, num22, 0, false, style2))) { num24++; } if (flag2) { break; } } if (!flag2) { foreach (Rectangle current12 in list) { int num25 = current12.Y - 1; int style3 = (num25 > (int)Main.worldSurface) ? item.ChestStyle : 0; int num26 = 0; while (num26 < 10 && !(flag2 = WorldGen.AddBuriedChest(GenBase._random.Next(2, current12.Width - 2) + current12.X, num25, 0, false, style3))) { num26++; } if (flag2) { break; } int num27 = current12.X + 2; while (num27 <= current12.X + current12.Width - 2 && !(flag2 = WorldGen.AddBuriedChest(num27, num25, 0, false, style3))) { num27++; } if (flag2) { break; } } } if (!flag2) { for (int num28 = 0; num28 < 1000; num28++) { int arg_1175_0 = GenBase._random.Next(list[0].X - 30, list[0].X + 30); int num29 = GenBase._random.Next(list[0].Y - 30, list[0].Y + 30); int style4 = (num29 > (int)Main.worldSurface) ? item.ChestStyle : 0; if (flag2 = WorldGen.AddBuriedChest(arg_1175_0, num29, 0, false, style4)) { break; } } } if (item == CaveHouseBiome.BuildData.Jungle && this._sharpenerCount < GenBase._random.Next(2, 5)) { bool flag3 = false; foreach (Rectangle current13 in list) { int num30 = current13.Height - 2 + current13.Y; for (int num31 = 0; num31 < 10; num31++) { int num32 = GenBase._random.Next(2, current13.Width - 2) + current13.X; WorldGen.PlaceTile(num32, num30, 377, true, true, -1, 0); if (flag3 = (GenBase._tiles[num32, num30].active() && GenBase._tiles[num32, num30].type == 377)) { break; } } if (flag3) { break; } int num33 = current13.X + 2; while (num33 <= current13.X + current13.Width - 2 && !(flag3 = WorldGen.PlaceTile(num33, num30, 377, true, true, -1, 0))) { num33++; } if (flag3) { break; } } if (flag3) { this._sharpenerCount++; } } if (item == CaveHouseBiome.BuildData.Desert && this._extractinatorCount < GenBase._random.Next(2, 5)) { bool flag4 = false; foreach (Rectangle current14 in list) { int num34 = current14.Height - 2 + current14.Y; for (int num35 = 0; num35 < 10; num35++) { int num36 = GenBase._random.Next(2, current14.Width - 2) + current14.X; WorldGen.PlaceTile(num36, num34, 219, true, true, -1, 0); if (flag4 = (GenBase._tiles[num36, num34].active() && GenBase._tiles[num36, num34].type == 219)) { break; } } if (flag4) { break; } int num37 = current14.X + 2; while (num37 <= current14.X + current14.Width - 2 && !(flag4 = WorldGen.PlaceTile(num37, num34, 219, true, true, -1, 0))) { num37++; } if (flag4) { break; } } if (flag4) { this._extractinatorCount++; } } return(true); }
public override bool Place(Point origin, StructureMap structures) { if (_slabs == null) { _slabs = new Slab[56, 26]; } var num1 = _random.Next(80, 150) / 3; var num2 = _random.Next(40, 60) / 3; var num3 = (num2 * 3 - _random.Next(20, 30)) / 3; origin.X -= num1 * 3 / 2; origin.Y -= num2 * 3 / 2; for (var index1 = -1; index1 < num1 + 1; ++index1) { var num4 = (float)((index1 - num1 / 2) / (double)num1 + 0.5); var num5 = (int)((0.5 - Math.Abs(num4 - 0.5f)) * 5.0) - 2; for (var index2 = -1; index2 < num2 + 1; ++index2) { var hasWall = true; var flag1 = false; var flag2 = IsGroupSolid(index1 * 3 + origin.X, index2 * 3 + origin.Y, 3); var num6 = Math.Abs(index2 - num2 / 2) - num3 / 4 + num5; if (num6 > 3) { flag1 = flag2; hasWall = false; } else if (num6 > 0) { flag1 = index2 - num2 / 2 > 0 || flag2; hasWall = index2 - num2 / 2 < 0 || num6 <= 2; } else if (num6 == 0) { flag1 = _random.Next(2) == 0 && (index2 - num2 / 2 > 0 || flag2); } if (Math.Abs(num4 - 0.5f) > 0.349999994039536 + _random.NextFloat() * 0.100000001490116 && !flag2) { hasWall = false; flag1 = false; } _slabs[index1 + 1, index2 + 1] = Slab.Create( flag1 ? SlabStates.Solid : new SlabState(SlabStates.Empty), hasWall); } } for (var index1 = 0; index1 < num1; ++index1) { for (var index2 = 0; index2 < num2; ++index2) { SmoothSlope(index1 + 1, index2 + 1); } } var num7 = num1 / 2; var val1 = num2 / 2; var num8 = (val1 + 1) * (val1 + 1); var num9 = (float)(_random.NextFloat() * 2.0 - 1.0); var num10 = (float)(_random.NextFloat() * 2.0 - 1.0); var num11 = (float)(_random.NextFloat() * 2.0 - 1.0); var num12 = 0.0f; for (var index1 = 0; index1 <= num1; ++index1) { var num4 = val1 / (float)num7 * (index1 - num7); var num5 = Math.Min(val1, (int)Math.Sqrt(Math.Max(0.0f, num8 - num4 * num4))); if (index1 < num1 / 2) { num12 += MathHelper.Lerp(num9, num10, index1 / (float)(num1 / 2)); } else { num12 += MathHelper.Lerp(num10, num11, (float)(index1 / (double)(num1 / 2) - 1.0)); } for (var index2 = val1 - num5; index2 <= val1 + num5; ++index2) { PlaceSlab(_slabs[index1 + 1, index2 + 1], index1 * 3 + origin.X, index2 * 3 + origin.Y + (int)num12, 3); } } return(true); }
protected override void ConfigureApplicationContainer(StructureMap.IContainer existingContainer) { Container.Configure(existingContainer); }
/* public override void Initialize(StructureMap.Graph.IAssemblyScanner scan) { base.Initialize(scan); } */ public override void Initialize(StructureMap.ConfigurationExpression config) { config.For<Script>().Use(() => Script.Load(ScriptPath)); }
public SampleStage1(ILog log, StructureMap.IContainer container) : base(log, container) { }
public override bool Place(Point origin, StructureMap structures) { Mod mod = CSkies.inst; ushort tileGrass = (ushort)ModContent.TileType <AbyssGrass>(), tileStone = (ushort)ModContent.TileType <AbyssStone>(), tileIce = (ushort)ModContent.TileType <Abice>(), tileSand = (ushort)ModContent.TileType <AbyssSand>(), tileSandHardened = (ushort)ModContent.TileType <HardenedAbyssSand>(), tileSandstone = (ushort)ModContent.TileType <AbyssSandstone>(), tileMoss = (ushort)ModContent.TileType <AbyssMoss>(); byte StoneWall = (byte)ModContent.WallType <AbyssStoneWall>(), SandstoneWall = (byte)ModContent.WallType <AbyssSandstoneWall>(), HardenedSandWall = (byte)ModContent.WallType <HardenedAbyssSandWall>(), GrassWall = (byte)ModContent.WallType <AbyssLeafWall>(); int biomeRadius = 89; Dictionary <Color, int> colorToTile = new Dictionary <Color, int> { [new Color(0, 0, 255)] = mod.TileType("AbyssBricks"), [new Color(0, 255, 0)] = mod.TileType("AbyssDoor"), [new Color(255, 255, 255)] = -2, [Color.Black] = -1 }; Dictionary <Color, int> colorToWall = new Dictionary <Color, int> { [new Color(255, 255, 255)] = mod.WallType("AbyssWall"), [Color.Black] = -1 }; TexGen gen = BaseWorldGenTex.GetTexGenerator(mod.GetTexture("Worldgen/AbyssVault"), colorToTile, mod.GetTexture("Worldgen/AbyssVaultWall"), colorToWall, null, mod.GetTexture("Worldgen/AbyssVaultSlopes")); Point newOrigin = new Point(origin.X, origin.Y); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //grass... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Grass, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileGrass, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //moss... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.BlueMoss, TileID.BrownMoss, TileID.GreenMoss, TileID.LavaMoss, TileID.LongMoss, TileID.PurpleMoss, TileID.RedMoss }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileMoss, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //stone... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Stone, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileStone, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //ice... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.IceBlock, TileID.CorruptIce, TileID.FleshIce }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileIce, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //sand... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Sand, TileID.Ebonsand, TileID.Crimsand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileSand, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //hardened sand... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.HardenedSand, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileSandHardened, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //...and sandstone. { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Sandstone, TileID.CorruptSandstone, TileID.CrimsonSandstone }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileSandstone, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.Stone, WallID.EbonstoneUnsafe, WallID.CrimstoneUnsafe }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(StoneWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.Sandstone, WallID.CorruptSandstone, WallID.CrimsonSandstone }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(SandstoneWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.HardenedSand, WallID.CorruptHardenedSand, WallID.CrimsonHardenedSand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(HardenedSandWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.HardenedSand, WallID.CorruptHardenedSand, WallID.CrimsonHardenedSand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(HardenedSandWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.GrassUnsafe, WallID.CorruptGrassUnsafe, WallID.CrimsonGrassUnsafe }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(GrassWall, true) })); int genX = origin.X - (gen.width / 2); int genY = origin.Y - 30; gen.Generate(genX, genY, true, true); if (CWorld.VaultCount == 0) { CUtils.ObectPlace(genX + 29, genY + 31, mod.TileType("HeartAltar2")); } else if (CWorld.VaultCount == 1) { CUtils.ObectPlace(genX + 29, genY + 31, mod.TileType("HeartAltar3")); } else if (CWorld.VaultCount == 2) { CUtils.ObectPlace(genX + 29, genY + 31, mod.TileType("HeartAltar4")); } return(true); }
public override void Register(StructureMap.IContainer container, List<SiteRoute> routes, System.Web.Mvc.ViewEngineCollection viewEngines, System.Web.Mvc.ModelBinderDictionary modelBinders, ICollection<AtomSite.Domain.Asset> globalAssets) { throw new NotImplementedException(); }
public StructureMapContainer(StructureMap.IContainer container) { this.container = container; }
public override bool Place(Point origin, StructureMap structures) { Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(0, 1).Output(dictionary)); if (dictionary[0] + dictionary[1] < 1250) { return(false); } Point result; bool flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result); if (WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - result.Y), new Conditions.IsTile(53)), out Point _)) { return(false); } if (!flag) { return(false); } result.Y += 50; ShapeData shapeData = new ShapeData(); ShapeData shapeData2 = new ShapeData(); Point point = new Point(origin.X, origin.Y + 20); Point point2 = new Point(origin.X, origin.Y + 30); bool[] array = new bool[TileID.Sets.GeneralPlacementTiles.Length]; for (int i = 0; i < array.Length; i++) { array[i] = TileID.Sets.GeneralPlacementTiles[i]; } array[21] = false; array[467] = false; float num = 0.8f + GenBase._random.NextFloat() * 0.5f; if (!structures.CanPlace(new Rectangle(point.X - (int)(20f * num), point.Y - 20, (int)(40f * num), 40), array)) { return(false); } if (!structures.CanPlace(new Rectangle(origin.X, result.Y + 10, 1, origin.Y - result.Y - 9), array, 2)) { return(false); } WorldUtils.Gen(point, new Shapes.Slime(20, num, 1f), Actions.Chain(new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(frameNeighbors: true).Output(shapeData))); WorldUtils.Gen(point2, new Shapes.Mound(14, 14), Actions.Chain(new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0), new Actions.SetFrames(frameNeighbors: true).Output(shapeData2))); shapeData.Subtract(shapeData2, point, point2); WorldUtils.Gen(point, new ModShapes.InnerOutline(shapeData), Actions.Chain(new Actions.SetTile(2), new Actions.SetFrames(frameNeighbors: true))); WorldUtils.Gen(point, new ModShapes.All(shapeData), Actions.Chain(new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid())); WorldUtils.Gen(point, new ModShapes.All(shapeData), Actions.Chain(new Actions.PlaceWall(68), new Modifiers.OnlyTiles(2), new Modifiers.Offset(0, 1), new ActionVines(3, 5, 382))); if (GenBase._random.NextFloat() <= _chanceOfEntrance) { ShapeData data = new ShapeData(); WorldUtils.Gen(new Point(origin.X, result.Y + 10), new Shapes.Rectangle(1, origin.Y - result.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Modifiers.SkipTiles(191, 192), new Actions.ClearTile().Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(53), new Actions.SetTile(397).Output(data))); WorldUtils.Gen(new Point(origin.X, result.Y + 10), new ModShapes.All(data), new Actions.SetFrames(frameNeighbors: true)); } if (GenBase._random.NextFloat() <= _chanceOfRealSword) { WorldGen.PlaceTile(point2.X, point2.Y - 15, 187, mute: true, forced: false, -1, 17); } else { WorldGen.PlaceTile(point2.X, point2.Y - 15, 186, mute: true, forced: false, -1, 15); } WorldUtils.Gen(point2, new ModShapes.All(shapeData2), Actions.Chain(new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(2), new Modifiers.Offset(0, -1), new ActionGrass())); structures.AddProtectedStructure(new Rectangle(point.X - (int)(20f * num), point.Y - 20, (int)(40f * num), 40), 10); return(true); }
public void RegisterServices(StructureMap.IContainer container) { // todo: add custom services. container.Configure(cfg => { cfg.For<IArticlesService>().Use<EfArticlesService>(); }); }
public static void Cofigure(StructureMap.IInitializationExpression x) { x.For<IAccountRepository>().HttpContextScoped().Use<AccountRepository>(); }
public override bool Place(Point origin, StructureMap structures) { Mod mod = CSkies.inst; Dictionary <Color, int> colorToTile = new Dictionary <Color, int> { [new Color(0, 255, 0)] = ModContent.TileType <StarBrickUnsafe>(), [new Color(255, 0, 0)] = ModContent.TileType <StarglassUnsafe>(), [new Color(0, 0, 255)] = ModContent.TileType <StarCircuitUnsafe>(), [new Color(255, 255, 255)] = -2, [Color.Black] = -1 }; Dictionary <Color, int> colorToWall = new Dictionary <Color, int> { [new Color(0, 255, 0)] = ModContent.WallType <StarBrickWallUnsafe>(), [new Color(255, 0, 0)] = ModContent.WallType <StarglassWallUnsafe>(), [new Color(0, 0, 255)] = ModContent.WallType <StarCircuitWallUnsafe>(), [Color.Black] = -1 }; TexGen gen = BaseWorldGenTex.GetTexGenerator(mod.GetTexture("Worldgen/Observatory"), colorToTile, mod.GetTexture("Worldgen/ObservatoryWalls"), colorToWall, null, mod.GetTexture("Worldgen/ObservatorySlopes")); gen.Generate(origin.X, origin.Y, true, true); #region Decorations CUtils.ObectPlace(origin.X + 145, origin.Y + 118, mod.TileType("BrokenArtemis")); #region Lanterns CUtils.ObectPlace(origin.X + 134, origin.Y + 57, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 165, origin.Y + 57, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 54, origin.Y + 63, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 59, origin.Y + 63, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 240, origin.Y + 63, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 245, origin.Y + 63, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 41, origin.Y + 66, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 258, origin.Y + 66, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 129, origin.Y + 70, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 170, origin.Y + 70, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 40, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 70, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 78, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 81, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 218, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 221, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 229, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 259, origin.Y + 75, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 89, origin.Y + 80, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 210, origin.Y + 80, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 71, origin.Y + 88, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 76, origin.Y + 88, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 223, origin.Y + 88, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 228, origin.Y + 88, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 33, origin.Y + 91, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 37, origin.Y + 91, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 44, origin.Y + 91, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 255, origin.Y + 91, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 262, origin.Y + 91, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 266, origin.Y + 91, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 34, origin.Y + 99, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 37, origin.Y + 99, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 262, origin.Y + 99, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 265, origin.Y + 99, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 67, origin.Y + 102, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 70, origin.Y + 102, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 229, origin.Y + 102, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 232, origin.Y + 102, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 37, origin.Y + 111, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 79, origin.Y + 111, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 220, origin.Y + 111, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 262, origin.Y + 111, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 93, origin.Y + 112, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 96, origin.Y + 112, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 99, origin.Y + 112, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 200, origin.Y + 112, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 203, origin.Y + 112, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 206, origin.Y + 112, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 79, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 82, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 85, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 88, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 211, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 214, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 217, origin.Y + 123, mod.TileType("ObservatoryLantern")); CUtils.ObectPlace(origin.X + 220, origin.Y + 123, mod.TileType("ObservatoryLantern")); #endregion #region Chandeliers CUtils.ObectPlace(origin.X + 140, origin.Y + 48, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 159, origin.Y + 48, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 31, origin.Y + 66, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 269, origin.Y + 66, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 100, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 106, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 112, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 118, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 181, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 187, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 193, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 199, origin.Y + 80, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 40, origin.Y + 83, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 45, origin.Y + 83, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 254, origin.Y + 83, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 259, origin.Y + 83, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 6, origin.Y + 93, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 293, origin.Y + 93, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 103, origin.Y + 90, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 196, origin.Y + 90, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 95, origin.Y + 91, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 203, origin.Y + 91, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 49, origin.Y + 99, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 250, origin.Y + 99, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 63, origin.Y + 102, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 73, origin.Y + 102, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 225, origin.Y + 102, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 236, origin.Y + 102, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 15, origin.Y + 103, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 20, origin.Y + 103, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 278, origin.Y + 103, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 284, origin.Y + 103, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 29, origin.Y + 107, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 270, origin.Y + 107, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 44, origin.Y + 111, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 50, origin.Y + 111, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 133, origin.Y + 111, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 166, origin.Y + 111, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 249, origin.Y + 111, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 254, origin.Y + 111, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 16, origin.Y + 112, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 283, origin.Y + 112, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 128, origin.Y + 121, mod.TileType("ObservatoryChandelier")); CUtils.ObectPlace(origin.X + 171, origin.Y + 121, mod.TileType("ObservatoryChandelier")); #endregion #endregion return(true); }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y)) { return(false); } ushort type = Utils.SelectRandom <ushort>(GenBase._random, WorldGen.goldBar == 19 ? (ushort)8 : (ushort)169, WorldGen.silverBar == 21 ? (ushort)9 : (ushort)168, WorldGen.ironBar == 22 ? (ushort)6 : (ushort)167, WorldGen.copperBar == 20 ? (ushort)7 : (ushort)166); double num = GenBase._random.NextDouble() * 2.0 - 1.0; if (!WorldUtils.Find(origin, Searches.Chain(num > 0.0 ? (GenSearch) new Searches.Right(40) : (GenSearch) new Searches.Left(40), (GenCondition) new Conditions.IsSolid()), out origin)) { return(false); } if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out origin)) { return(false); } ShapeData shapeData = new ShapeData(); Ref <int> count1 = new Ref <int>(0); Ref <int> count2 = new Ref <int>(0); WorldUtils.Gen(origin, new ShapeRunner(10f, 20, new Vector2((float)num, 1f)).Output(shapeData), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Actions.Scanner(count1), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count2))); if (count2.Value < count1.Value / 2) { return(false); } Rectangle area = new Rectangle(origin.X - 15, origin.Y - 10, 30, 20); if (!structures.CanPlace(area, 0)) { return(false); } WorldUtils.Gen(origin, (GenShape) new ModShapes.All(shapeData), (GenAction) new Actions.SetTile(type, true, true)); WorldUtils.Gen(new Point(origin.X - (int)(num * -5.0), origin.Y - 5), (GenShape) new Shapes.Circle(5), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Actions.ClearTile(true))); Point result1; Point result2; int num2 = (GenBase._random.Next(4) == 0) ? 3 : 7; if (((((true ? 1 : 0) & (WorldUtils.Find(new Point(origin.X - (num > 0.0 ? (-num2) : num2), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result1) ? 1 : 0)) != 0 ? 1 : 0) & (WorldUtils.Find(new Point(origin.X - (num > 0.0 ? -3 : 3), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result2) ? 1 : 0)) == 0) { return(false); } --result1.Y; --result2.Y; Tile tile1 = GenBase._tiles[result1.X, result1.Y + 1]; tile1.slope((byte)0); tile1.halfBrick(false); for (int index = -1; index <= 1; ++index) { WorldUtils.ClearTile(result2.X + index, result2.Y, false); Tile tile2 = GenBase._tiles[result2.X + index, result2.Y + 1]; if (!WorldGen.SolidOrSlopedTile(tile2)) { tile2.ResetToType((ushort)1); tile2.active(true); } tile2.slope((byte)0); tile2.halfBrick(false); WorldUtils.TileFrame(result2.X + index, result2.Y + 1, true); } WorldGen.PlaceTile(result1.X, result1.Y, 141, false, false, -1, 0); WorldGen.PlaceTile(result2.X, result2.Y, 411, true, true, -1, 0); WorldUtils.WireLine(result1, result2); structures.AddStructure(area, 5); return(true); }
public override bool Place(Point origin, StructureMap structures) { Point result1, result2; if (!WorldUtils.Find(new Point(origin.X - 3, origin.Y), Searches.Chain(new Searches.Down(200), new Conditions.IsSolid().AreaAnd(6, 1)), out result1)) { return(false); } if (!WorldUtils.Find(new Point(result1.X, result1.Y - 5), Searches.Chain(new Searches.Up(120), new Conditions.IsSolid().AreaOr(6, 1)), out result2) || result1.Y - 5 - result2.Y > 60 || (result1.Y - result2.Y < 30 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result1.X - 30, result1.Y - 60, 60, 90), 0))) { return(false); } Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(result1.X - 25, result1.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[4] { 0, 59, 147, 1 }).Output(resultsOutput)); int num1 = resultsOutput[0] + resultsOutput[1]; int num2 = resultsOutput[59]; if (resultsOutput[147] > num2 || num1 > num2 || num2 < 50) { return(false); } int num3 = (result1.Y - result2.Y - 9) / 5; int num4 = num3 * 5; int num5 = 0; double num6 = GenBase._random.NextDouble() + 1.0; double num7 = GenBase._random.NextDouble() + 2.0; if (GenBase._random.Next(2) == 0) { num7 = -num7; } for (int index = 0; index < num3; ++index) { int num8 = (int)(Math.Sin((index + 1) / 12.0 * num6 * 3.14159274101257) * num7); int num9 = num8 < num5 ? num8 - num5 : 0; WorldUtils.Gen(new Point(result1.X + num5 + num9, result1.Y - (index + 1) * 5), new Shapes.Rectangle(6 + Math.Abs(num8 - num5), 7), Actions.Chain(new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false))); WorldUtils.Gen(new Point(result1.X + num5 + num9 + 2, result1.Y - (index + 1) * 5), new Shapes.Rectangle(2 + Math.Abs(num8 - num5), 5), Actions.Chain(new Actions.ClearTile(true), new Actions.PlaceWall(78, true))); WorldUtils.Gen(new Point(result1.X + num5 + 2, result1.Y - index * 5), new Shapes.Rectangle(2, 2), Actions.Chain(new Actions.ClearTile(true), new Actions.PlaceWall(78, true))); num5 = num8; } int num10 = 6; if (num7 < 0.0) { num10 = 0; } List <Point> endpoints = new List <Point>(); for (int index = 0; index < 2; ++index) { double num8 = ((double)index + 1.0) / 3.0; int num9 = num10 + (int)(Math.Sin((double)num3 * num8 / 12.0 * num6 * 3.14159274101257) * num7); double angle = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232; if (num10 == 0) { angle -= 1.57079637050629; } WorldUtils.Gen(new Point(result1.X + num9, result1.Y - (int)((num3 * 5) * num8)), new ShapeBranch(angle, GenBase._random.Next(12, 16)).OutputEndpoints(endpoints), Actions.Chain(new Actions.SetTile(383, false, true), new Actions.SetFrames(true))); num10 = 6 - num10; } int num11 = (int)(Math.Sin(num3 / 12.0 * num6 * 3.14159274101257) * num7); WorldUtils.Gen(new Point(result1.X + 6 + num11, result1.Y - num4), new ShapeBranch(-0.685398185253143, GenBase._random.Next(16, 22)).OutputEndpoints(endpoints), Actions.Chain(new Actions.SetTile(383, false, true), new Actions.SetFrames(true))); WorldUtils.Gen(new Point(result1.X + num11, result1.Y - num4), new ShapeBranch(-2.45619455575943, GenBase._random.Next(16, 22)).OutputEndpoints(endpoints), Actions.Chain(new Actions.SetTile(383, false, true), new Actions.SetFrames(true))); foreach (Point origin1 in endpoints) { Shapes.Circle circle = new Shapes.Circle(4); GenAction action = Actions.Chain(new Modifiers.Blotches(4, 2, 0.3), new Modifiers.SkipTiles(new ushort[1] { 383 }), new Modifiers.SkipWalls(new byte[1] { 78 }), new Actions.SetTile(384, false, true), new Actions.SetFrames(true)); WorldUtils.Gen(origin1, circle, action); } for (int index = 0; index < 4; ++index) { float angle = (float)(index / 3.0 * 2.0 + 0.570749998092651); WorldUtils.Gen(result1, new ShapeRoot(angle, (float)GenBase._random.Next(40, 60), 4f, 1f), new Actions.SetTile(383, true, true)); } WorldGen.AddBuriedChest(result1.X + 3, result1.Y - 1, GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem(), false, 10); structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result1.X - 30, result1.Y - 30, 60, 60), 0); return(true); }
public override bool Place(Point origin, StructureMap structures) { ushort tileGrass = (ushort)ModContent.TileType <AbyssGrass>(), tileStone = (ushort)ModContent.TileType <AbyssStone>(), tileIce = (ushort)ModContent.TileType <Abice>(), tileSand = (ushort)ModContent.TileType <AbyssSand>(), tileSandHardened = (ushort)ModContent.TileType <HardenedAbyssSand>(), tileSandstone = (ushort)ModContent.TileType <AbyssSandstone>(), tileMoss = (ushort)ModContent.TileType <AbyssMoss>(); byte StoneWall = (byte)ModContent.WallType <AbyssStoneWall>(), SandstoneWall = (byte)ModContent.WallType <AbyssSandstoneWall>(), HardenedSandWall = (byte)ModContent.WallType <HardenedAbyssSandWall>(), GrassWall = (byte)ModContent.WallType <AbyssLeafWall>(); int biomeRadius = 100; Point newOrigin = new Point(origin.X - biomeRadius, origin.Y - 10); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //grass... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Grass, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileGrass, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //moss... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.BlueMoss, TileID.BrownMoss, TileID.GreenMoss, TileID.LavaMoss, TileID.LongMoss, TileID.PurpleMoss, TileID.RedMoss }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileMoss, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //stone... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Stone, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileStone, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //ice... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.IceBlock, TileID.CorruptIce, TileID.FleshIce }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileIce, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //sand... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Sand, TileID.Ebonsand, TileID.Crimsand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileSand, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //hardened sand... { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.HardenedSand, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileSandHardened, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //...and sandstone. { new InWorld(), new Modifiers.OnlyTiles(new ushort[] { TileID.Sandstone, TileID.CorruptSandstone, TileID.CrimsonSandstone }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new SetModTile(tileSandstone, true, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.Stone, WallID.EbonstoneUnsafe, WallID.CrimstoneUnsafe }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(StoneWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.Sandstone, WallID.CorruptSandstone, WallID.CrimsonSandstone }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(SandstoneWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.HardenedSand, WallID.CorruptHardenedSand, WallID.CrimsonHardenedSand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(HardenedSandWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.HardenedSand, WallID.CorruptHardenedSand, WallID.CrimsonHardenedSand }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(HardenedSandWall, true) })); WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //Walls { new InWorld(), new Modifiers.OnlyWalls(new byte[] { WallID.GrassUnsafe, WallID.CorruptGrassUnsafe, WallID.CrimsonGrassUnsafe }), new Modifiers.RadialDither(biomeRadius - 5, biomeRadius), new PlaceModWall(GrassWall, true) })); return(true); }
public override bool Place(Point origin, StructureMap structures) { Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[] { 0, 1 }).Output(dictionary)); int num = dictionary[0] + dictionary[1]; if (num < 1250) { return(false); } Point point; bool flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new GenCondition[] { new Conditions.IsSolid().AreaOr(1, 50).Not() }), out point); Point point2; bool flag2 = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - point.Y), new GenCondition[] { new Conditions.IsTile(new ushort[] { 53 }) }), out point2); if (flag2) { return(false); } if (!flag) { return(false); } point.Y += 50; ShapeData shapeData = new ShapeData(); ShapeData shapeData2 = new ShapeData(); Point point3 = new Point(origin.X, origin.Y + 20); Point point4 = new Point(origin.X, origin.Y + 30); float num2 = 0.8f + GenBase._random.NextFloat() * 0.5f; if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * num2), point3.Y - 20, (int)(40f * num2), 40), 0)) { return(false); } if (!structures.CanPlace(new Rectangle(origin.X, point.Y + 10, 1, origin.Y - point.Y - 9), 2)) { return(false); } WorldUtils.Gen(point3, new Shapes.Slime(20, num2, 1f), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(shapeData) })); WorldUtils.Gen(point4, new Shapes.Mound(14, 14), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), new Actions.SetFrames(true).Output(shapeData2) })); shapeData.Subtract(shapeData2, point3, point4); WorldUtils.Gen(point3, new ModShapes.InnerOutline(shapeData, true), Actions.Chain(new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(point3, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) })); WorldUtils.Gen(point3, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.PlaceWall(68, true), new Modifiers.OnlyTiles(new ushort[] { 2 }), new Modifiers.Offset(0, 1), new ActionVines(3, 5, 52) })); ShapeData data = new ShapeData(); WorldUtils.Gen(new Point(origin.X, point.Y + 10), new Shapes.Rectangle(1, origin.Y - point.Y - 9), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.2), new Actions.ClearTile(false).Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(new ushort[] { 53 }), new Actions.SetTile(397, false, true).Output(data) })); WorldUtils.Gen(new Point(origin.X, point.Y + 10), new ModShapes.All(data), new Actions.SetFrames(true)); if (GenBase._random.Next(3) == 0) { WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17); } else { WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15); } WorldUtils.Gen(point4, new ModShapes.All(shapeData2), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(new ushort[] { 2 }), new Modifiers.Offset(0, -1), new ActionGrass() })); structures.AddStructure(new Rectangle(point3.X - (int)(20f * num2), point3.Y - 20, (int)(40f * num2), 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) { Ref <int> count1 = new Ref <int>(0); Ref <int> count2 = new Ref <int>(0); WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(10), Actions.Chain((GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1))); if (count1.Value < count2.Value - 5) { return(false); } int radius = GenBase._random.Next(6, 10); int num1 = GenBase._random.Next(5); if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 0)) { return(false); } ushort type1 = (ushort)(byte)(196 + WorldGen.genRand.Next(4)); for (int index1 = origin.X - radius; index1 <= origin.X + radius; ++index1) { for (int index2 = origin.Y - radius; index2 <= origin.Y + radius; ++index2) { if (Main.tile[index1, index2].active()) { int type2 = (int)Main.tile[index1, index2].type; if (type2 == 53 || type2 == 396 || (type2 == 397 || type2 == 404)) { type1 = (ushort)187; } if (type2 == 161 || type2 == 147) { type1 = (ushort)40; } if (type2 == 60) { type1 = (ushort)(byte)(204 + WorldGen.genRand.Next(4)); } if (type2 == 367) { type1 = (ushort)178; } if (type2 == 368) { type1 = (ushort)180; } } } } ShapeData data = new ShapeData(); WorldUtils.Gen(origin, (GenShape) new Shapes.Slime(radius), Actions.Chain(new Modifiers.Blotches(num1, num1, num1, 1, 0.3).Output(data), (GenAction) new Modifiers.Offset(0, -2), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)53 }), (GenAction) new Actions.SetTile((ushort)397, true, true), (GenAction) new Modifiers.OnlyWalls(new ushort[1]), (GenAction) new Actions.PlaceWall(type1, true))); WorldUtils.Gen(origin, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Actions.ClearTile(false), (GenAction) new Actions.SetLiquid(0, (byte)0), (GenAction) new Actions.SetFrames(true), (GenAction) new Modifiers.OnlyWalls(new ushort[1]), (GenAction) new Actions.PlaceWall(type1, true))); Point result; if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result)) { return(false); } int j = result.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 : -(radius >> 1); for (int index1 = 0; index1 < num2; ++index1) { int num4 = GenBase._random.Next(1, 3); for (int index2 = 0; index2 < num4; ++index2) { WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 332, true, false, -1, 0); } } } int num5 = (radius - 3) * (flag ? -1 : 1); if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X + num5, j, 186, false, false, -1, 0); } if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X, j, 215, true, false, -1, 0); if (GenBase._tiles[origin.X, j].active() && GenBase._tiles[origin.X, j].type == (ushort)215) { GenBase._tiles[origin.X, j].frameY += (short)36; GenBase._tiles[origin.X - 1, j].frameY += (short)36; GenBase._tiles[origin.X + 1, j].frameY += (short)36; GenBase._tiles[origin.X, j - 1].frameY += (short)36; GenBase._tiles[origin.X - 1, j - 1].frameY += (short)36; GenBase._tiles[origin.X + 1, j - 1].frameY += (short)36; } } structures.AddProtectedStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4); return(true); }
public object Process(object target, StructureMap.IContext context) { return _dynamicProxy.CreateInterfaceProxyWithTarget(target.GetType().GetInterfaces().First(), target, this); }
public SmDependencyResolver(StructureMap.IContainer container) : base (container) { }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.BiomeTileCheck(origin.X, origin.Y)) { return(false); } if (_slabs == null) { _slabs = new Slab[56, 26]; } int num = GenBase._random.Next(80, 150) / 3; int num2 = GenBase._random.Next(40, 60) / 3; int num3 = (num2 * 3 - GenBase._random.Next(20, 30)) / 3; origin.X -= num * 3 / 2; origin.Y -= num2 * 3 / 2; for (int i = -1; i < num + 1; i++) { double num4 = (double)(i - num / 2) / (double)num + 0.5; int num5 = (int)((0.5 - Math.Abs(num4 - 0.5)) * 5.0) - 2; for (int j = -1; j < num2 + 1; j++) { bool hasWall = true; bool flag = false; bool flag2 = IsGroupSolid(i * 3 + origin.X, j * 3 + origin.Y, 3); int num6 = Math.Abs(j - num2 / 2) - num3 / 4 + num5; if (num6 > 3) { flag = flag2; hasWall = false; } else if (num6 > 0) { flag = ((j - num2 / 2 > 0) | flag2); hasWall = (j - num2 / 2 < 0 || num6 <= 2); } else if (num6 == 0) { flag = (GenBase._random.Next(2) == 0 && ((j - num2 / 2 > 0) | flag2)); } if (Math.Abs(num4 - 0.5) > (double)(0.35f + GenBase._random.NextFloat() * 0.1f) && !flag2) { hasWall = false; flag = false; } _slabs[i + 1, j + 1] = Slab.Create(flag ? new SlabState(SlabStates.Solid) : new SlabState(SlabStates.Empty), hasWall); } } for (int k = 0; k < num; k++) { for (int l = 0; l < num2; l++) { SmoothSlope(k + 1, l + 1); } } int num7 = num / 2; int num8 = num2 / 2; int num9 = (num8 + 1) * (num8 + 1); float value = GenBase._random.NextFloat() * 2f - 1f; float num10 = GenBase._random.NextFloat() * 2f - 1f; float value2 = GenBase._random.NextFloat() * 2f - 1f; float num11 = 0f; for (int m = 0; m <= num; m++) { float num12 = (float)num8 / (float)num7 * (float)(m - num7); int num13 = Math.Min(num8, (int)Math.Sqrt(Math.Max(0f, (float)num9 - num12 * num12))); num11 = ((m >= num / 2) ? (num11 + MathHelper.Lerp(num10, value2, (float)m / (float)(num / 2) - 1f)) : (num11 + MathHelper.Lerp(value, num10, (float)m / (float)(num / 2)))); for (int n = num8 - num13; n <= num8 + num13; n++) { PlaceSlab(_slabs[m + 1, n + 1], m * 3 + origin.X, n * 3 + origin.Y + (int)num11, 3); } } structures.AddStructure(new Rectangle(origin.X, origin.Y, num * 3, num2 * 3), 8); return(true); }
public override bool Place(Point origin, StructureMap structures) { Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[2] { 0, 1 }).Output(resultsOutput)); if (resultsOutput[0] + resultsOutput[1] < 1250) { return(false); } Point result1; bool flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result1); Point result2; if (WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - result1.Y), new Conditions.IsTile(new ushort[1] { 53 })), out result2) || !flag) { return(false); } result1.Y += 50; ShapeData data1 = new ShapeData(); ShapeData shapeData = new ShapeData(); Point point1 = new Point(origin.X, origin.Y + 20); Point point2 = new Point(origin.X, origin.Y + 30); float xScale = (float)(0.800000011920929 + Utils.NextFloat(GenBase._random) * 0.5); if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(point1.X - (int)(20.0 * xScale), point1.Y - 20, (int)(40.0 * xScale), 40), 0) || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X, result1.Y + 10, 1, origin.Y - result1.Y - 9), 2)) { return(false); } WorldUtils.Gen(point1, new Shapes.Slime(20, xScale, 1f), Actions.Chain(new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(data1))); WorldUtils.Gen(point2, new Shapes.Mound(14, 14), Actions.Chain(new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), new Actions.SetFrames(true).Output(shapeData))); data1.Subtract(shapeData, point1, point2); WorldUtils.Gen(point1, new ModShapes.InnerOutline(data1, true), Actions.Chain(new Actions.SetTile((ushort)2, false, true), new Actions.SetFrames(true))); WorldUtils.Gen(point1, new ModShapes.All(data1), Actions.Chain(new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid())); WorldUtils.Gen(point1, new ModShapes.All(data1), Actions.Chain(new Actions.PlaceWall((byte)68, true), new Modifiers.OnlyTiles(new ushort[1] { 2 }), new Modifiers.Offset(0, 1), new ActionVines(3, 5, 52))); ShapeData data2 = new ShapeData(); WorldUtils.Gen(new Point(origin.X, result1.Y + 10), new Shapes.Rectangle(1, origin.Y - result1.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Actions.ClearTile(false).Output(data2), new Modifiers.Expand(1), new Modifiers.OnlyTiles(new ushort[1] { 53 }), new Actions.SetTile(397, false, true).Output(data2))); WorldUtils.Gen(new Point(origin.X, result1.Y + 10), new ModShapes.All(data2), new Actions.SetFrames(true)); if (GenBase._random.Next(3) == 0) { WorldGen.PlaceTile(point2.X, point2.Y - 15, 187, true, false, -1, 17); } else { WorldGen.PlaceTile(point2.X, point2.Y - 15, 186, true, false, -1, 15); } WorldUtils.Gen(point2, new ModShapes.All(shapeData), Actions.Chain(new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(new ushort[1] { 2 }), new Modifiers.Offset(0, -1), new ActionGrass())); structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(point1.X - (int)(20.0 * xScale), point1.Y - 20, (int)(40.0 * xScale), 40), 4); return(true); }
public override bool Place(Point origin, StructureMap structures) { Ref <int> count1 = new Ref <int>(0); Ref <int> count2 = new Ref <int>(0); WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(10), Actions.Chain((GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1))); if (count1.Value < count2.Value - 5) { return(false); } int radius = GenBase._random.Next(6, 10); int num1 = GenBase._random.Next(5); if (!structures.CanPlace(new Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 0)) { return(false); } ShapeData data = new ShapeData(); WorldUtils.Gen(origin, (GenShape) new Shapes.Slime(radius), Actions.Chain(new Modifiers.Blotches(num1, num1, num1, 1, 0.3).Output(data), (GenAction) new Modifiers.Offset(0, -2), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)53 }), (GenAction) new Actions.SetTile((ushort)397, true, true), (GenAction) new Modifiers.OnlyWalls(new byte[1]), (GenAction) new Actions.PlaceWall((byte)16, true))); WorldUtils.Gen(origin, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Actions.ClearTile(false), (GenAction) new Actions.SetLiquid(0, (byte)0), (GenAction) new Actions.SetFrames(true), (GenAction) new Modifiers.OnlyWalls(new byte[1]), (GenAction) new Actions.PlaceWall((byte)16, true))); Point result; if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result)) { return(false); } int j = result.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 : -(radius >> 1); for (int index1 = 0; index1 < num2; ++index1) { int num4 = GenBase._random.Next(1, 3); for (int index2 = 0; index2 < num4; ++index2) { WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 331, false, false, -1, 0); } } } int num5 = (radius - 3) * (flag ? -1 : 1); if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X + num5, j, 186, false, false, -1, 0); } if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile((int)origin.X, j, 215, true, false, -1, 0); if (GenBase._tiles[(int)origin.X, j].active() && (int)GenBase._tiles[(int)origin.X, j].type == 215) { GenBase._tiles[(int)origin.X, j].frameY += (short)36; GenBase._tiles[origin.X - 1, j].frameY += (short)36; GenBase._tiles[origin.X + 1, j].frameY += (short)36; GenBase._tiles[(int)origin.X, j - 1].frameY += (short)36; GenBase._tiles[origin.X - 1, j - 1].frameY += (short)36; GenBase._tiles[origin.X + 1, j - 1].frameY += (short)36; } } structures.AddStructure(new Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4); return(true); }
public ServicesMessageMapperFactory(StructureMap.Container serviceProvider) { _serviceProvider = serviceProvider; }
public override void Initialize(StructureMap.IInitializationExpression config) { }
public override bool Place(Point origin, StructureMap structures) { Ref <int> count1 = new Ref <int>(0); Ref <int> count2 = new Ref <int>(0); Ref <int> count3 = new Ref <int>(0); Ref <int> count4 = new Ref <int>(0); WorldUtils.Gen(origin, (GenShape) new Shapes.Circle(15), Actions.Chain((GenAction) new Actions.Scanner(count3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1), (GenAction) new Modifiers.OnlyTiles(new ushort[2] { (ushort)60, (ushort)59 }), (GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)60 }), (GenAction) new Actions.Scanner(count4))); if ((double)count2.Value / (double)count1.Value < 0.75 || count4.Value < 2 || !structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0)) { return(false); } int x1 = (int)origin.X; int y1 = (int)origin.Y; int num1 = 150; int index1 = x1 - num1; while (index1 < x1 + num1) { if (index1 > 0 && index1 <= Main.maxTilesX - 1) { int index2 = y1 - num1; while (index2 < y1 + num1) { if (index2 > 0 && index2 <= Main.maxTilesY - 1 && (Main.tile[index1, index2].active() && (int)Main.tile[index1, index2].type == 226 || ((int)Main.tile[index1, index2].wall == 87 || (int)Main.tile[index1, index2].wall == 3) || (int)Main.tile[index1, index2].wall == 83)) { return(false); } index2 += 10; } } index1 += 10; } int x2 = (int)origin.X; int y2 = (int)origin.Y; int index3 = 0; int[] numArray1 = new int[10]; int[] numArray2 = new int[10]; Vector2 vector2_1; // ISSUE: explicit reference operation ((Vector2)@vector2_1).\u002Ector((float)x2, (float)y2); Vector2 vector2_2 = vector2_1; int num2 = WorldGen.genRand.Next(2, 5); for (int index2 = 0; index2 < num2; ++index2) { int num3 = WorldGen.genRand.Next(2, 5); for (int index4 = 0; index4 < num3; ++index4) { vector2_2 = WorldGen.Hive((int)vector2_1.X, (int)vector2_1.Y); } vector2_1 = vector2_2; numArray1[index3] = (int)vector2_1.X; numArray2[index3] = (int)vector2_1.Y; ++index3; } for (int index2 = 0; index2 < index3; ++index2) { int index4 = numArray1[index2]; int index5 = numArray2[index2]; bool flag = false; int num3 = 1; if (WorldGen.genRand.Next(2) == 0) { num3 = -1; } while (index4 > 10 && index4 < Main.maxTilesX - 10 && (index5 > 10 && index5 < Main.maxTilesY - 10) && (!Main.tile[index4, index5].active() || !Main.tile[index4, index5 + 1].active() || (!Main.tile[index4 + 1, index5].active() || !Main.tile[index4 + 1, index5 + 1].active()))) { index4 += num3; if (Math.Abs(index4 - numArray1[index2]) > 50) { flag = true; break; } } if (!flag) { int i = index4 + num3; for (int index6 = i - 1; index6 <= i + 2; ++index6) { for (int index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 < 10 || index6 > Main.maxTilesX - 10) { flag = true; } else if (Main.tile[index6, index7].active() && (int)Main.tile[index6, index7].type != 225) { flag = true; break; } } } if (!flag) { for (int index6 = i - 1; index6 <= i + 2; ++index6) { for (int index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 >= i && index6 <= i + 1 && (index7 >= index5 && index7 <= index5 + 1)) { Main.tile[index6, index7].active(false); Main.tile[index6, index7].liquid = byte.MaxValue; Main.tile[index6, index7].honey(true); } else { Main.tile[index6, index7].active(true); Main.tile[index6, index7].type = (ushort)225; } } } int num4 = num3 * -1; int j = index5 + 1; int num5 = 0; while ((num5 < 4 || WorldGen.SolidTile(i, j)) && (i > 10 && i < Main.maxTilesX - 10)) { ++num5; i += num4; if (WorldGen.SolidTile(i, j)) { WorldGen.PoundTile(i, j); if (!Main.tile[i, j + 1].active()) { Main.tile[i, j + 1].active(true); Main.tile[i, j + 1].type = (ushort)225; } } } } } } WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp <int>((int)vector2_1.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp <int>((int)vector2_1.Y, 5, Main.maxTilesY - 5); ++WorldGen.numLarva; int x3 = (int)vector2_1.X; int y3 = (int)vector2_1.Y; for (int index2 = x3 - 1; index2 <= x3 + 1 && (index2 > 0 && index2 < Main.maxTilesX); ++index2) { for (int index4 = y3 - 2; index4 <= y3 + 1 && (index4 > 0 && index4 < Main.maxTilesY); ++index4) { if (index4 != y3 + 1) { Main.tile[index2, index4].active(false); } else { Main.tile[index2, index4].active(true); Main.tile[index2, index4].type = (ushort)225; Main.tile[index2, index4].slope((byte)0); Main.tile[index2, index4].halfBrick(false); } } } structures.AddStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); 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); }
public override bool Place(Point origin, StructureMap structures) { if (this._slabs == null) { this._slabs = new MarbleBiome.Slab[56, 26]; } int num1 = GenBase._random.Next(80, 150) / 3; int num2 = GenBase._random.Next(40, 60) / 3; int num3 = (num2 * 3 - GenBase._random.Next(20, 30)) / 3; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Point& local1 = @origin; // ISSUE: explicit reference operation int num4 = (^ local1).X - num1 * 3 / 2; // ISSUE: explicit reference operation (^ local1).X = (__Null)num4; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Point& local2 = @origin; // ISSUE: explicit reference operation int num5 = (^ local2).Y - num2 * 3 / 2; // ISSUE: explicit reference operation (^ local2).Y = (__Null)num5; for (int index1 = -1; index1 < num1 + 1; ++index1) { float num6 = (float)((double)(index1 - num1 / 2) / (double)num1 + 0.5); int num7 = (int)((0.5 - (double)Math.Abs(num6 - 0.5f)) * 5.0) - 2; for (int index2 = -1; index2 < num2 + 1; ++index2) { bool hasWall = true; bool flag1 = false; bool flag2 = this.IsGroupSolid(index1 * 3 + origin.X, index2 * 3 + origin.Y, 3); int num8 = Math.Abs(index2 - num2 / 2) - num3 / 4 + num7; if (num8 > 3) { flag1 = flag2; hasWall = false; } else if (num8 > 0) { flag1 = index2 - num2 / 2 > 0 || flag2; hasWall = index2 - num2 / 2 < 0 || num8 <= 2; } else if (num8 == 0) { flag1 = GenBase._random.Next(2) == 0 && (index2 - num2 / 2 > 0 || flag2); } if ((double)Math.Abs(num6 - 0.5f) > 0.349999994039536 + (double)GenBase._random.NextFloat() * 0.100000001490116 && !flag2) { hasWall = false; flag1 = false; } this._slabs[index1 + 1, index2 + 1] = MarbleBiome.Slab.Create(flag1 ? new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid) : new MarbleBiome.SlabState(MarbleBiome.SlabStates.Empty), hasWall); } } for (int index1 = 0; index1 < num1; ++index1) { for (int index2 = 0; index2 < num2; ++index2) { this.SmoothSlope(index1 + 1, index2 + 1); } } int num9 = num1 / 2; int val1 = num2 / 2; int num10 = (val1 + 1) * (val1 + 1); float num11 = (float)((double)GenBase._random.NextFloat() * 2.0 - 1.0); float num12 = (float)((double)GenBase._random.NextFloat() * 2.0 - 1.0); float num13 = (float)((double)GenBase._random.NextFloat() * 2.0 - 1.0); float num14 = 0.0f; for (int index1 = 0; index1 <= num1; ++index1) { float num6 = (float)val1 / (float)num9 * (float)(index1 - num9); int num7 = Math.Min(val1, (int)Math.Sqrt((double)Math.Max(0.0f, (float)num10 - num6 * num6))); if (index1 < num1 / 2) { num14 += MathHelper.Lerp(num11, num12, (float)index1 / (float)(num1 / 2)); } else { num14 += MathHelper.Lerp(num12, num13, (float)((double)index1 / (double)(num1 / 2) - 1.0)); } for (int index2 = val1 - num7; index2 <= val1 + num7; ++index2) { this.PlaceSlab(this._slabs[index1 + 1, index2 + 1], index1 * 3 + origin.X, index2 * 3 + origin.Y + (int)num14, 3); } } return(true); }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y)) { return(false); } if (Main.tile[origin.X, origin.Y].wall == 216 || Main.tile[origin.X, origin.Y].wall == 187) { return(false); } ushort type = Utils.SelectRandom <ushort>(GenBase._random, (ushort)((WorldGen.goldBar == 19) ? 8 : 169), (ushort)((WorldGen.silverBar == 21) ? 9 : 168), (ushort)((WorldGen.ironBar == 22) ? 6 : 167), (ushort)((WorldGen.copperBar == 20) ? 7 : 166)); double num = GenBase._random.NextDouble() * 2.0 - 1.0; if (!WorldUtils.Find(origin, Searches.Chain((num > 0.0) ? ((GenSearch) new Searches.Right(40)) : ((GenSearch) new Searches.Left(40)), new Conditions.IsSolid()), out origin)) { return(false); } if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new Conditions.IsSolid()), out origin)) { return(false); } ShapeData shapeData = new ShapeData(); Ref <int> @ref = new Ref <int>(0); Ref <int> ref2 = new Ref <int>(0); WorldUtils.Gen(origin, new ShapeRunner(10f, 20, new Vector2((float)num, 1f)).Output(shapeData), Actions.Chain(new Modifiers.Blotches(), new Actions.Scanner(@ref), new Modifiers.IsSolid(), new Actions.Scanner(ref2))); if (ref2.Value < @ref.Value / 2) { return(false); } Rectangle area = new Rectangle(origin.X - 15, origin.Y - 10, 30, 20); if (!structures.CanPlace(area)) { return(false); } WorldUtils.Gen(origin, new ModShapes.All(shapeData), new Actions.SetTile(type, setSelfFrames: true)); WorldUtils.Gen(new Point(origin.X - (int)(num * -5.0), origin.Y - 5), new Shapes.Circle(5), Actions.Chain(new Modifiers.Blotches(), new Actions.ClearTile(frameNeighbors: true))); Point result; int num2 = 1 & (WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? 3 : (-3)), origin.Y - 3), Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out result) ? 1 : 0); int num3 = (GenBase._random.Next(4) == 0) ? 3 : 7; if ((num2 & (WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? (-num3) : num3), origin.Y - 3), Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out Point result2) ? 1 : 0)) == 0) { return(false); } result.Y--; result2.Y--; Tile tile = GenBase._tiles[result.X, result.Y + 1]; tile.slope(0); tile.halfBrick(halfBrick: false); for (int i = -1; i <= 1; i++) { WorldUtils.ClearTile(result2.X + i, result2.Y); Tile tile2 = GenBase._tiles[result2.X + i, result2.Y + 1]; if (!WorldGen.SolidOrSlopedTile(tile2)) { tile2.ResetToType(1); tile2.active(active: true); } tile2.slope(0); tile2.halfBrick(halfBrick: false); WorldUtils.TileFrame(result2.X + i, result2.Y + 1, frameNeighbors: true); } WorldGen.PlaceTile(result.X, result.Y, 141); WorldGen.PlaceTile(result2.X, result2.Y, 411, mute: true, forced: true); WorldUtils.WireLine(result, result2); structures.AddProtectedStructure(area, 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) { Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[2] { (ushort)0, (ushort)1 }).Output(resultsOutput)); if (resultsOutput[(ushort)0] + resultsOutput[(ushort)1] < 1250) { return(false); } Point result1; bool flag = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result1); Point result2; if (WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up((int)(origin.Y - result1.Y)), (GenCondition) new Conditions.IsTile(new ushort[1] { (ushort)53 })), out result2) || !flag) { return(false); } // ISSUE: explicit reference operation // ISSUE: variable of a reference type Point& local = @result1; // ISSUE: explicit reference operation int num = (^ local).Y + 50; // ISSUE: explicit reference operation (^ local).Y = (__Null)num; ShapeData data1 = new ShapeData(); ShapeData shapeData = new ShapeData(); Point point1; // ISSUE: explicit reference operation ((Point)@point1).\u002Ector((int)origin.X, origin.Y + 20); Point point2; // ISSUE: explicit reference operation ((Point)@point2).\u002Ector((int)origin.X, origin.Y + 30); float xScale = (float)(0.800000011920929 + (double)GenBase._random.NextFloat() * 0.5); if (!structures.CanPlace(new Rectangle(point1.X - (int)(20.0 * (double)xScale), point1.Y - 20, (int)(40.0 * (double)xScale), 40), 0) || !structures.CanPlace(new Rectangle((int)origin.X, result1.Y + 10, 1, origin.Y - result1.Y - 9), 2)) { return(false); } WorldUtils.Gen(point1, (GenShape) new Shapes.Slime(20, xScale, 1f), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(data1))); WorldUtils.Gen(point2, (GenShape) new Shapes.Mound(14, 14), Actions.Chain((GenAction) new Modifiers.Blotches(2, 1, 0.8), (GenAction) new Actions.SetTile((ushort)0, false, true), new Actions.SetFrames(true).Output(shapeData))); data1.Subtract(shapeData, point1, point2); WorldUtils.Gen(point1, (GenShape) new ModShapes.InnerOutline(data1, true), Actions.Chain((GenAction) new Actions.SetTile((ushort)2, false, true), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Modifiers.RectangleMask(-40, 40, 0, 40), (GenAction) new Modifiers.IsEmpty(), (GenAction) new Actions.SetLiquid(0, byte.MaxValue))); WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Actions.PlaceWall((byte)68, true), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)2 }), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionVines(3, 5, 52))); ShapeData data2 = new ShapeData(); WorldUtils.Gen(new Point((int)origin.X, result1.Y + 10), (GenShape) new Shapes.Rectangle(1, origin.Y - result1.Y - 9), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.2), new Actions.ClearTile(false).Output(data2), (GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)53 }), new Actions.SetTile((ushort)397, false, true).Output(data2))); WorldUtils.Gen(new Point((int)origin.X, result1.Y + 10), (GenShape) new ModShapes.All(data2), (GenAction) new Actions.SetFrames(true)); if (GenBase._random.Next(3) == 0) { WorldGen.PlaceTile((int)point2.X, point2.Y - 15, 187, true, false, -1, 17); } else { WorldGen.PlaceTile((int)point2.X, point2.Y - 15, 186, true, false, -1, 15); } WorldUtils.Gen(point2, (GenShape) new ModShapes.All(shapeData), Actions.Chain((GenAction) new Modifiers.Offset(0, -1), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)2 }), (GenAction) new Modifiers.Offset(0, -1), (GenAction) new ActionGrass())); structures.AddStructure(new Rectangle(point1.X - (int)(20.0 * (double)xScale), point1.Y - 20, (int)(40.0 * (double)xScale), 40), 4); return(true); }
public void Process(Type type, StructureMap.Configuration.DSL.Registry registry) { if (type.GetInterfaces().Contains(typeof(IModule))) registry.AddType(typeof(IModule), type); }
// Token: 0x06000FD2 RID: 4050 RVA: 0x003FBA94 File Offset: 0x003F9C94 public override bool Place(Point origin, StructureMap structures) { Point point; if (!WorldUtils.Find(new Point(origin.X - 3, origin.Y), Searches.Chain(new Searches.Down(200), new GenCondition[] { new Conditions.IsSolid().AreaAnd(6, 1) }), out point)) { return(false); } Point point2; if (!WorldUtils.Find(new Point(point.X, point.Y - 5), Searches.Chain(new Searches.Up(120), new GenCondition[] { new Conditions.IsSolid().AreaOr(6, 1) }), out point2) || point.Y - 5 - point2.Y > 60) { return(false); } if (point.Y - point2.Y < 30) { return(false); } if (!structures.CanPlace(new Rectangle(point.X - 30, point.Y - 60, 60, 90), 0)) { return(false); } Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(point.X - 25, point.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[] { 0, 59, 147, 1 }).Output(dictionary)); int num = dictionary[0] + dictionary[1]; int num2 = dictionary[59]; if (dictionary[147] > num2 || num > num2 || num2 < 50) { return(false); } int num3 = (point.Y - point2.Y - 9) / 5; int num4 = num3 * 5; int num5 = 0; double num6 = GenBase._random.NextDouble() + 1.0; double num7 = GenBase._random.NextDouble() + 2.0; if (GenBase._random.Next(2) == 0) { num7 = -num7; } for (int i = 0; i < num3; i++) { int num8 = (int)(Math.Sin((double)(i + 1) / 12.0 * num6 * 3.1415927410125732) * num7); int num9 = (num8 < num5) ? (num8 - num5) : 0; WorldUtils.Gen(new Point(point.X + num5 + num9, point.Y - (i + 1) * 5), new Shapes.Rectangle(6 + Math.Abs(num8 - num5), 7), Actions.Chain(new GenAction[] { new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false) })); WorldUtils.Gen(new Point(point.X + num5 + num9 + 2, point.Y - (i + 1) * 5), new Shapes.Rectangle(2 + Math.Abs(num8 - num5), 5), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) })); WorldUtils.Gen(new Point(point.X + num5 + 2, point.Y - i * 5), new Shapes.Rectangle(2, 2), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) })); num5 = num8; } int num10 = 6; if (num7 < 0.0) { num10 = 0; } List <Point> list = new List <Point>(); for (int j = 0; j < 2; j++) { double num11 = ((double)j + 1.0) / 3.0; int num12 = num10 + (int)(Math.Sin((double)num3 * num11 / 12.0 * num6 * 3.1415927410125732) * num7); double num13 = GenBase._random.NextDouble() * 0.78539818525314331 - 0.78539818525314331 - 0.20000000298023224; if (num10 == 0) { num13 -= 1.5707963705062866; } WorldUtils.Gen(new Point(point.X + num12, point.Y - (int)((double)(num3 * 5) * num11)), new ShapeBranch(num13, (double)GenBase._random.Next(12, 16)).OutputEndpoints(list), Actions.Chain(new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) })); num10 = 6 - num10; } int num14 = (int)(Math.Sin((double)num3 / 12.0 * num6 * 3.1415927410125732) * num7); WorldUtils.Gen(new Point(point.X + 6 + num14, point.Y - num4), new ShapeBranch(-0.68539818525314333, (double)GenBase._random.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(new Point(point.X + num14, point.Y - num4), new ShapeBranch(-2.4561944961547852, (double)GenBase._random.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) })); using (List <Point> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { WorldUtils.Gen(enumerator.Current, new Shapes.Circle(4), Actions.Chain(new GenAction[] { new Modifiers.Blotches(4, 2, 0.3), new Modifiers.SkipTiles(new ushort[] { 383 }), new Modifiers.SkipWalls(new byte[] { 78 }), new Actions.SetTile(384, false, true), new Actions.SetFrames(true) })); } } for (int k = 0; k < 4; k++) { float angle = (float)k / 3f * 2f + 0.57075f; WorldUtils.Gen(point, new ShapeRoot(angle, (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 StructureMapDependencyResolver(StructureMap.IContainer container) { _container = container; }
public override bool Place(Point origin, StructureMap structures) { Point result; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(200), new Conditions.IsSolid()), out result) || result == origin) { return(false); } Rectangle room = GetRoom(result); Rectangle rectangle = GetRoom(new Point(room.Center.X, room.Y + 1)); Rectangle rectangle2 = GetRoom(new Point(room.Center.X, room.Y + room.Height + 10)); rectangle2.Y = room.Y + room.Height - 1; float num = RoomSolidPrecentage(rectangle); float num2 = RoomSolidPrecentage(rectangle2); room.Y += 3; rectangle.Y += 3; rectangle2.Y += 3; List <Rectangle> list = new List <Rectangle>(); if (GenBase._random.NextFloat() > num + 0.2f) { list.Add(rectangle); } else { rectangle = room; } list.Add(room); if (GenBase._random.NextFloat() > num2 + 0.2f) { list.Add(rectangle2); } else { rectangle2 = room; } Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>(); foreach (Rectangle item in list) { WorldUtils.Gen(new Point(item.X - 5, item.Y - 5), new Shapes.Rectangle(item.Width + 10, item.Height + 10), new Actions.TileScanner(0, 59, 147, 1, 161, 53, 396, 397, 368, 367, 60, 70).Output(dictionary)); } List <Tuple <BuildData, int> > list2 = new List <Tuple <BuildData, int> >(); list2.Add(Tuple.Create(BuildData.Default, dictionary[0] + dictionary[1])); list2.Add(Tuple.Create(BuildData.Jungle, dictionary[59] + dictionary[60] * 10)); list2.Add(Tuple.Create(BuildData.Mushroom, dictionary[59] + dictionary[70] * 10)); list2.Add(Tuple.Create(BuildData.Snow, dictionary[147] + dictionary[161])); list2.Add(Tuple.Create(BuildData.Desert, dictionary[397] + dictionary[396] + dictionary[53])); list2.Add(Tuple.Create(BuildData.Granite, dictionary[368])); list2.Add(Tuple.Create(BuildData.Marble, dictionary[367])); list2.Sort(SortBiomeResults); BuildData ıtem = list2[0].Item1; foreach (Rectangle item2 in list) { Point result2; if (ıtem != BuildData.Granite && WorldUtils.Find(new Point(item2.X - 2, item2.Y - 2), Searches.Chain(new Searches.Rectangle(item2.Width + 4, item2.Height + 4).RequireAll(false), new Conditions.HasLava()), out result2)) { return(false); } if (!structures.CanPlace(item2, _blacklistedTiles, 5)) { return(false); } } int num3 = room.X; int num4 = room.X + room.Width - 1; List <Rectangle> list3 = new List <Rectangle>(); foreach (Rectangle item3 in list) { num3 = Math.Min(num3, item3.X); num4 = Math.Max(num4, item3.X + item3.Width - 1); } int num5 = 6; while (num5 > 4 && (num4 - num3) % num5 != 0) { num5--; } for (int i = num3; i <= num4; i += num5) { for (int j = 0; j < list.Count; j++) { Rectangle rectangle3 = list[j]; if (i < rectangle3.X || i >= rectangle3.X + rectangle3.Width) { continue; } int num6 = rectangle3.Y + rectangle3.Height; int num7 = 50; for (int k = j + 1; k < list.Count; k++) { if (i >= list[k].X && i < list[k].X + list[k].Width) { num7 = Math.Min(num7, list[k].Y - num6); } } if (num7 > 0) { Point result3; bool flag = WorldUtils.Find(new Point(i, num6), Searches.Chain(new Searches.Down(num7), new Conditions.IsSolid()), out result3); if (num7 < 50) { flag = true; result3 = new Point(i, num6 + num7); } if (flag) { list3.Add(new Rectangle(i, num6, 1, result3.Y - num6)); } } } } List <Point> list4 = new List <Point>(); foreach (Rectangle item4 in list) { int exitY; if (FindSideExit(new Rectangle(item4.X + item4.Width, item4.Y + 1, 1, item4.Height - 2), false, out exitY)) { list4.Add(new Point(item4.X + item4.Width - 1, exitY)); } if (FindSideExit(new Rectangle(item4.X, item4.Y + 1, 1, item4.Height - 2), true, out exitY)) { list4.Add(new Point(item4.X, exitY)); } } List <Tuple <Point, Point> > list5 = new List <Tuple <Point, Point> >(); for (int l = 1; l < list.Count; l++) { Rectangle rectangle4 = list[l]; Rectangle rectangle5 = list[l - 1]; int num8 = rectangle5.X - rectangle4.X; int num9 = rectangle4.X + rectangle4.Width - (rectangle5.X + rectangle5.Width); if (num8 > num9) { list5.Add(new Tuple <Point, Point>(new Point(rectangle4.X + rectangle4.Width - 1, rectangle4.Y + 1), new Point(rectangle4.X + rectangle4.Width - rectangle4.Height + 1, rectangle4.Y + rectangle4.Height - 1))); } else { list5.Add(new Tuple <Point, Point>(new Point(rectangle4.X, rectangle4.Y + 1), new Point(rectangle4.X + rectangle4.Height - 1, rectangle4.Y + rectangle4.Height - 1))); } } List <Point> list6 = new List <Point>(); int exitX; if (FindVerticalExit(new Rectangle(rectangle.X + 2, rectangle.Y, rectangle.Width - 4, 1), true, out exitX)) { list6.Add(new Point(exitX, rectangle.Y)); } if (FindVerticalExit(new Rectangle(rectangle2.X + 2, rectangle2.Y + rectangle2.Height - 1, rectangle2.Width - 4, 1), false, out exitX)) { list6.Add(new Point(exitX, rectangle2.Y + rectangle2.Height - 1)); } foreach (Rectangle item5 in list) { WorldUtils.Gen(new Point(item5.X, item5.Y), new Shapes.Rectangle(item5.Width, item5.Height), Actions.Chain(new Actions.SetTile(ıtem.Tile), new Actions.SetFrames(true))); WorldUtils.Gen(new Point(item5.X + 1, item5.Y + 1), new Shapes.Rectangle(item5.Width - 2, item5.Height - 2), Actions.Chain(new Actions.ClearTile(true), new Actions.PlaceWall(ıtem.Wall))); structures.AddStructure(item5, 8); } foreach (Tuple <Point, Point> item6 in list5) { Point ıtem2 = item6.Item1; Point ıtem3 = item6.Item2; int num10 = (ıtem3.X > ıtem2.X) ? 1 : (-1); ShapeData shapeData = new ShapeData(); for (int m = 0; m < ıtem3.Y - ıtem2.Y; m++) { shapeData.Add(num10 * (m + 1), m); } WorldUtils.Gen(ıtem2, new ModShapes.All(shapeData), Actions.Chain(new Actions.PlaceTile(19, ıtem.PlatformStyle), new Actions.SetSlope((num10 == 1) ? 1 : 2), new Actions.SetFrames(true))); WorldUtils.Gen(new Point(ıtem2.X + ((num10 == 1) ? 1 : (-4)), ıtem2.Y - 1), new Shapes.Rectangle(4, 1), Actions.Chain(new Actions.Clear(), new Actions.PlaceWall(ıtem.Wall), new Actions.PlaceTile(19, ıtem.PlatformStyle), new Actions.SetFrames(true))); } foreach (Point item7 in list4) { WorldUtils.Gen(item7, new Shapes.Rectangle(1, 3), new Actions.ClearTile(true)); WorldGen.PlaceTile(item7.X, item7.Y, 10, true, true, -1, ıtem.DoorStyle); } foreach (Point item8 in list6) { WorldUtils.Gen(item8, new Shapes.Rectangle(3, 1), Actions.Chain(new Actions.ClearMetadata(), new Actions.PlaceTile(19, ıtem.PlatformStyle), new Actions.SetFrames(true))); } foreach (Rectangle item9 in list3) { if (item9.Height > 1 && GenBase._tiles[item9.X, item9.Y - 1].type != 19) { WorldUtils.Gen(new Point(item9.X, item9.Y), new Shapes.Rectangle(item9.Width, item9.Height), Actions.Chain(new Actions.SetTile(124), new Actions.SetFrames(true))); Tile tile = GenBase._tiles[item9.X, item9.Y + item9.Height]; tile.slope(0); tile.halfBrick(false); } } Point[] choices = new Point[7] { new Point(14, ıtem.TableStyle), new Point(16, 0), new Point(18, ıtem.WorkbenchStyle), new Point(86, 0), new Point(87, ıtem.PianoStyle), new Point(94, 0), new Point(101, ıtem.BookcaseStyle) }; foreach (Rectangle item10 in list) { int num11 = item10.Width / 8; int num12 = item10.Width / (num11 + 1); int num13 = GenBase._random.Next(2); for (int n = 0; n < num11; n++) { int num14 = (n + 1) * num12 + item10.X; switch (n + num13 % 2) { case 0: { int num15 = item10.Y + Math.Min(item10.Height / 2, item10.Height - 5); Vector2 vector = WorldGen.randHousePicture(); int type = (int)vector.X; int style = (int)vector.Y; if (!WorldGen.nearPicture(num14, num15)) { WorldGen.PlaceTile(num14, num15, type, true, false, -1, style); } break; } case 1: { int num15 = item10.Y + 1; WorldGen.PlaceTile(num14, num15, 34, true, false, -1, GenBase._random.Next(6)); for (int num16 = -1; num16 < 2; num16++) { for (int num17 = 0; num17 < 3; num17++) { GenBase._tiles[num16 + num14, num17 + num15].frameX += 54; } } break; } } } int num18 = item10.Width / 8 + 3; WorldGen.SetupStatueList(); while (num18 > 0) { int num19 = GenBase._random.Next(item10.Width - 3) + 1 + item10.X; int num20 = item10.Y + item10.Height - 2; switch (GenBase._random.Next(4)) { case 0: WorldGen.PlaceSmallPile(num19, num20, GenBase._random.Next(31, 34), 1, 185); break; case 1: WorldGen.PlaceTile(num19, num20, 186, true, false, -1, GenBase._random.Next(22, 26)); break; case 2: { int num21 = GenBase._random.Next(2, WorldGen.statueList.Length); WorldGen.PlaceTile(num19, num20, WorldGen.statueList[num21].X, true, false, -1, WorldGen.statueList[num21].Y); if (WorldGen.StatuesWithTraps.Contains(num21)) { WorldGen.PlaceStatueTrap(num19, num20); } break; } case 3: { Point point = Utils.SelectRandom(GenBase._random, choices); WorldGen.PlaceTile(num19, num20, point.X, true, false, -1, point.Y); break; } } num18--; } } foreach (Rectangle item11 in list) { ıtem.ProcessRoom(item11); } bool flag2 = false; foreach (Rectangle item12 in list) { int num22 = item12.Height - 1 + item12.Y; int style2 = (num22 > (int)Main.worldSurface) ? ıtem.ChestStyle : 0; for (int num23 = 0; num23 < 10; num23++) { int i2 = GenBase._random.Next(2, item12.Width - 2) + item12.X; if (flag2 = WorldGen.AddBuriedChest(i2, num22, 0, false, style2)) { break; } } if (flag2) { break; } for (int num24 = item12.X + 2; num24 <= item12.X + item12.Width - 2; num24++) { if (flag2 = WorldGen.AddBuriedChest(num24, num22, 0, false, style2)) { break; } } if (flag2) { break; } } if (!flag2) { foreach (Rectangle item13 in list) { int num25 = item13.Y - 1; int style3 = (num25 > (int)Main.worldSurface) ? ıtem.ChestStyle : 0; for (int num26 = 0; num26 < 10; num26++) { int i3 = GenBase._random.Next(2, item13.Width - 2) + item13.X; if (flag2 = WorldGen.AddBuriedChest(i3, num25, 0, false, style3)) { break; } } if (flag2) { break; } for (int num27 = item13.X + 2; num27 <= item13.X + item13.Width - 2; num27++) { if (flag2 = WorldGen.AddBuriedChest(num27, num25, 0, false, style3)) { break; } } if (flag2) { break; } } } if (!flag2) { for (int num28 = 0; num28 < 1000; num28++) { int i4 = GenBase._random.Next(list[0].X - 30, list[0].X + 30); int num29 = GenBase._random.Next(list[0].Y - 30, list[0].Y + 30); int style4 = (num29 > (int)Main.worldSurface) ? ıtem.ChestStyle : 0; if (flag2 = WorldGen.AddBuriedChest(i4, num29, 0, false, style4)) { break; } } } if (ıtem == BuildData.Jungle && _sharpenerCount < GenBase._random.Next(2, 5)) { bool flag3 = false; foreach (Rectangle item14 in list) { int num30 = item14.Height - 2 + item14.Y; for (int num31 = 0; num31 < 10; num31++) { int num32 = GenBase._random.Next(2, item14.Width - 2) + item14.X; WorldGen.PlaceTile(num32, num30, 377, true, true); if (flag3 = (GenBase._tiles[num32, num30].active() && GenBase._tiles[num32, num30].type == 377)) { break; } } if (flag3) { break; } for (int num33 = item14.X + 2; num33 <= item14.X + item14.Width - 2; num33++) { if (flag3 = WorldGen.PlaceTile(num33, num30, 377, true, true)) { break; } } if (flag3) { break; } } if (flag3) { _sharpenerCount++; } } if (ıtem == BuildData.Desert && _extractinatorCount < GenBase._random.Next(2, 5)) { bool flag4 = false; foreach (Rectangle item15 in list) { int num34 = item15.Height - 2 + item15.Y; for (int num35 = 0; num35 < 10; num35++) { int num36 = GenBase._random.Next(2, item15.Width - 2) + item15.X; WorldGen.PlaceTile(num36, num34, 219, true, true); if (flag4 = (GenBase._tiles[num36, num34].active() && GenBase._tiles[num36, num34].type == 219)) { break; } } if (flag4) { break; } for (int num37 = item15.X + 2; num37 <= item15.X + item15.Width - 2; num37++) { if (flag4 = WorldGen.PlaceTile(num37, num34, 219, true, true)) { break; } } if (flag4) { break; } } if (flag4) { _extractinatorCount++; } } return(true); }
public override void Initialize(StructureMap.Graph.IAssemblyScanner scan) { base.Initialize(scan); scan.AssemblyContainingType(typeof (Microsoft.TeamFoundation.Client.TfsTeamProjectCollection)); }
public override bool Place(Point origin, StructureMap structures) { if (this._slabs == null) { this._slabs = new MarbleBiome.Slab[56, 26]; } int num = GenBase._random.Next(80, 150) / 3; int num2 = GenBase._random.Next(40, 60) / 3; int num3 = (num2 * 3 - GenBase._random.Next(20, 30)) / 3; origin.X -= num * 3 / 2; origin.Y -= num2 * 3 / 2; for (int i = -1; i < num + 1; i++) { float num4 = (float)(i - num / 2) / (float)num + 0.5f; int num5 = (int)((0.5f - Math.Abs(num4 - 0.5f)) * 5f) - 2; for (int j = -1; j < num2 + 1; j++) { bool hasWall = true; bool flag = false; bool flag2 = this.IsGroupSolid(i * 3 + origin.X, j * 3 + origin.Y, 3); int num6 = Math.Abs(j - num2 / 2); int num7 = num6 - num3 / 4 + num5; if (num7 > 3) { flag = flag2; hasWall = false; } else if (num7 > 0) { flag = (j - num2 / 2 > 0 || flag2); hasWall = (j - num2 / 2 < 0 || num7 <= 2); } else if (num7 == 0) { flag = (GenBase._random.Next(2) == 0 && (j - num2 / 2 > 0 || flag2)); } if (Math.Abs(num4 - 0.5f) > 0.35f + GenBase._random.NextFloat() * 0.1f && !flag2) { hasWall = false; flag = false; } this._slabs[i + 1, j + 1] = MarbleBiome.Slab.Create(flag ? new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid) : new MarbleBiome.SlabState(MarbleBiome.SlabStates.Empty), hasWall); } } for (int k = 0; k < num; k++) { for (int l = 0; l < num2; l++) { this.SmoothSlope(k + 1, l + 1); } } int num8 = num / 2; int num9 = num2 / 2; int num10 = (num9 + 1) * (num9 + 1); float value = GenBase._random.NextFloat() * 2f - 1f; float num11 = GenBase._random.NextFloat() * 2f - 1f; float value2 = GenBase._random.NextFloat() * 2f - 1f; float num12 = 0f; for (int m = 0; m <= num; m++) { float num13 = (float)num9 / (float)num8 * (float)(m - num8); int num14 = Math.Min(num9, (int)Math.Sqrt((double)Math.Max(0f, (float)num10 - num13 * num13))); if (m < num / 2) { num12 += MathHelper.Lerp(value, num11, (float)m / (float)(num / 2)); } else { num12 += MathHelper.Lerp(num11, value2, (float)m / (float)(num / 2) - 1f); } for (int n = num9 - num14; n <= num9 + num14; n++) { this.PlaceSlab(this._slabs[m + 1, n + 1], m * 3 + origin.X, n * 3 + origin.Y + (int)num12, 3); } } return(true); }