private static void MarkAsSearched(ContainerModule container) { if (container.Searchable) { container.Searchable = false; container.AlreadySearched = true; } }
public ContainerBuilder CreateBuilder(IServiceCollection services) { var containerModule = new ContainerModule(configuration.GetConnectionString("Mongo")); var builder = containerModule.GetBuilder(); builder.Populate(services); return(builder); }
public UnionContainer(InteractiveRange range, ContainerModule selectedContainer) { _selectedContainer = selectedContainer; MergedContainer = new Entity().AddModule <ContainerModule>(); Union(selectedContainer); Union(range, out _); }
private void HighlightContainer(ContainerModule container) { ContainerUsefulness usefulness = UsefulContainerEntityFilter.Check(container); if (TryMakeContainerSilhouette(usefulness, out var silhouette)) { _hoverData.AddCommand(new SilhouetteCommand(container.Entity.Actor.gameObject, silhouette)); } }
public ContainerBuilder CreateBuilder(IServiceCollection services) { var containerModule = new ContainerModule(this._configuration.GetConnectionString("Mongo"), this._configuration.GetConnectionString("Lite")); var builder = containerModule.GetBuilder(); this.RegisterCustomServices(builder); builder.Populate(services); return(builder); }
public IEnumerable <Container> EnumerateContainers() { foreach (var entity in Entities) { ContainerModule container = entity.Entity.GetModule <ContainerModule>(); if (container) { ContainerUsefulness usefulness = UsefulContainerEntityFilter.Check(container); yield return(new Container(entity, container, usefulness)); } } }
private static Boolean ApplyPrefix(SearchAbilityHandler __instance) { if (!The.InputManager.IsPressed(KeyCode.LeftShift)) { return(HarmonyPrefix.CallOriginal); } ProxyAbilityHandler handler = new ProxyAbilityHandler(__instance); ActionData actionData = handler.ActionData; Entity targetEntity = actionData.TargetEntity; Character performer = actionData.Performer; ContainerModule container = targetEntity.GetModule <ContainerModule>(); if (container.AlreadySearched) { return(HarmonyPrefix.SkipOriginal); } container.AlreadySearched = true; container.Searchable = false; // Idk why performer.EnsureModule <InventoryModule>(); var merged = new UnionContainer(new InteractiveRange(), container); if (merged.Count < 2 && merged.MergedContainer.AllItems.Count == 0) { merged.Commit(); The.NotificationsManager.ShowNotificationOnPlayer("[15376]Found nothing"); return(HarmonyPrefix.SkipOriginal); } var window = Window.Create <ContainerWindow, BaseInventoryModule, BaseInventoryModule>(null, merged.MergedContainer, performer.InventoryModule); WindowManager.Instance.RegisterOnClose(window, () => merged.Commit()); InteractiveRangeVisualizer.Deactivate(); window.ShowModal(immediate: false); The.EventManager.ContainerOpened.Raise(targetEntity); return(HarmonyPrefix.SkipOriginal); }
public void Union(ContainerModule container) { Count++; MarkAsSearched(container); foreach (Item item in container.AllItems) { // When added to the union container, same items will not stack. // This is necessary to return they to their places if // the player will not pick them up before closing the exchange window. MergedContainer.AddItem(item, stackItem: false); _itemToContainer.Add(item, container); } }
public Boolean IsValid(Entity entity) { if (!entity.HasActor()) { return(false); } ContainerModule container = entity.GetModule <ContainerModule>(); if (container == null) { return(false); } return(Check(container) == ContainerUsefulness.Useful); }
public static ContainerUsefulness Check(ContainerModule container) { Boolean isSearchable = container.Searchable; container.Searchable = false; ActionData openAction = new ActionData(The.World.Avatar, Common.Abilities.System.OpenContainer, container.Entity, forceToolVisual: false); if (!openAction.IsPossible()) { container.Searchable = isSearchable; return(ContainerUsefulness.Restricted); } var reason = openAction.GetAbilityHandler().GetBlockReasons(); container.Searchable = isSearchable; if (reason == BlockReasons.None) { return(container.AllItems.Count == 0 ? ContainerUsefulness.Empty : ContainerUsefulness.Useful); } if ((reason & BlockReasons.NoWay) == BlockReasons.NoWay) { return(ContainerUsefulness.NoWay); } if ((reason & BlockReasons.Locked) == BlockReasons.Locked) { return(ContainerUsefulness.Locked); } if ((reason & BlockReasons.Protected) == BlockReasons.Protected) { return(ContainerUsefulness.Locked); } return(ContainerUsefulness.Restricted); }
public void Hover() { foreach (var targetEntity in GetEntities()) { if (!targetEntity.HasActor()) { continue; } GameObject gameObject = targetEntity.Actor.gameObject; if (_actionData.Ability.Is <AttackAbility>()) { _hoverData.AddCommand(new SilhouetteCommand(gameObject, SilhouetteType.Enemy)); continue; } if (targetEntity.Is <Character>()) { _hoverData.AddCommand(new SilhouetteCommand(gameObject, SilhouetteType.Ally)); continue; } ContainerModule container = targetEntity.GetModule <ContainerModule>(); if (container != null) { HighlightContainer(container); continue; } if (TryHighlightDoor(targetEntity)) { continue; } _hoverData.AddCommand(new SilhouetteCommand(gameObject, SilhouetteType.PointOfInterest)); } }
static public void Initialize() { ContainerModule.Initialize(); CoreModule.Initialize(); MathModule.Initialize(); EngineModule.Initialize(); InputModule.Initialize(); IOModule.Initialize(); ResourceModule.Initialize(); AudioModule.Initialize(); GraphicsModule.Initialize(); SceneModule.Initialize(); Atomic2DModule.Initialize(); Atomic3DModule.Initialize(); NavigationModule.Initialize(); NetworkModule.Initialize(); PhysicsModule.Initialize(); EnvironmentModule.Initialize(); UIModule.Initialize(); NETCoreModule.Initialize(); NETScriptModule.Initialize(); AtomicPlayer.PlayerModule.Initialize(); }
public App() { var containerModule = new ContainerModule(); container = new StandardKernel(containerModule); }