@layout PageLayout @inherits BasePage @page "/database" @using Model @implements IDisposable @inject IEntityDisplayService EntityDisplayService Database Game Patch: @Variables.GamePatch
@if (searches != null) {
@foreach (var entity in searches) { }
}
What is this tool? This is a reference database. Mostly so unit stats can be reviewed outside of the game, IMMORTAL: Gates of Pyre. Is this database complete? No. A lot of content is missing, that needs to be manually transfered from screenshots of IMMORTAL: Gates of Pyre. This will happen slowly over-time. Is this database updated to the latest version? Maybe. Check this @Variables.GamePatch version number, and compare it to the number on discord, in the #game-updates channel. That should give a general sense of how out of date the data is. This database has some errors in it. Yup. The content is being transferred by hand, so some mistakes are expected.
@code { [Inject] public IEntityFilterService EntityFilterService { get; set; } = default!; readonly List defaults = (from entity in EntityModel.GetList() where entity.IsSpeculative == false select entity).ToList(); List factions = default!; List immortals = default!; List entities = default!; List searches = default!; string selectedFactionType = DataType.Any; string selectedImmortalType = DataType.Any; string selectedEntityType = EntityType.Army; string searchText = ""; protected override void OnInitialized() { base.OnInitialized(); RefreshFactionSearch(); EntityFilterService.Subscribe(OnChange); EntityDisplayService.Subscribe(StateHasChanged); } void IDisposable.Dispose() { EntityFilterService.Unsubscribe(OnChange); EntityDisplayService.Unsubscribe(StateHasChanged); } void OnChange(EntityFilterEvent filterEntityEvent) { if (filterEntityEvent == EntityFilterEvent.OnRefreshFaction) { RefreshFactionSearch(); } if (filterEntityEvent == EntityFilterEvent.OnRefreshImmortal) { RefreshImmortalSearch(); } if (filterEntityEvent == EntityFilterEvent.OnRefreshEntity) { RefreshEntitySearch(); } if (filterEntityEvent == EntityFilterEvent.OnRefreshSearch) { RefreshTextSearch(); } } void RefreshFactionSearch() { selectedFactionType = EntityFilterService.GetFactionType(); if (selectedFactionType == DataType.Any) { factions = defaults.ToList(); } else { factions = (from entity in defaults where entity.Faction() != null && entity.Faction().Faction == selectedFactionType select entity).ToList(); } RefreshImmortalSearch(); } void OnImmortalChanged(ChangeEventArgs e) { selectedImmortalType = e.Value!.ToString()!; RefreshImmortalSearch(); } void RefreshImmortalSearch() { selectedImmortalType = EntityFilterService.GetImmortalType(); if (selectedImmortalType == DataType.Any) { immortals = factions.ToList(); } else { immortals = (from entity in factions where entity.VanguardAdded() == null || entity.VanguardAdded().ImmortalId == selectedImmortalType select entity).ToList(); } RefreshEntitySearch(); } void OnEntityChanged(ChangeEventArgs e) { selectedEntityType = e.Value!.ToString()!; RefreshEntitySearch(); } void RefreshEntitySearch() { selectedEntityType = EntityFilterService.GetEntityType(); if (selectedEntityType == EntityType.Any) { entities = immortals.ToList(); } else { entities = (from entity in immortals where entity.EntityType == selectedEntityType select entity).ToList(); } RefreshTextSearch(); } void OnSearchTextChanged(ChangeEventArgs e) { searchText = e.Value!.ToString()!; RefreshTextSearch(); } void RefreshTextSearch() { searchText = EntityFilterService.GetSearchText(); if (searchText.Trim() == "") { searches = entities.ToList(); } else { searches = (from entity in entities where entity.Info().Name.ToLower().Contains(searchText.ToLower()) select entity).ToList(); } StateHasChanged(); } }