Browse Source

feat(Database) Direct database/Throne links now work in the database. Added a Detailed/Plain view button

main
Jonathan McCaffrey 4 years ago
parent
commit
28087b58d9
  1. 87
      Components/Inputs/ButtonGroupComponent.razor
  2. BIN
      IGP/Database.db
  3. BIN
      IGP/Database.db-shm
  4. BIN
      IGP/Database.db-wal
  5. 28
      IGP/Dialog/EntityDialogComponent.razor
  6. 33
      IGP/Pages/Database/DatabasePage.razor
  7. 78
      IGP/Pages/Database/DatabaseSinglePage.razor
  8. 32
      IGP/Pages/Database/Entity/EntityViewComponent.razor
  9. 69
      IGP/Pages/Database/Entity/Parts/EntityAbilitiesComponent.razor
  10. 44
      IGP/Pages/Database/Entity/Parts/EntityHeaderComponent.razor
  11. 83
      IGP/Pages/Database/Entity/Parts/EntityInfoComponent.razor
  12. 3
      IGP/Pages/Database/Entity/Parts/EntityMechanicsComponent.razor
  13. 69
      IGP/Pages/Database/Entity/Parts/EntityPassivesComponent.razor
  14. 231
      IGP/Pages/Database/Entity/Parts/EntityProductionComponent.razor
  15. 60
      IGP/Pages/Database/Entity/Parts/EntityPyreSpellsComponent.razor
  16. 175
      IGP/Pages/Database/Entity/Parts/EntityStatsComponent.razor
  17. 55
      IGP/Pages/Database/Entity/Parts/EntityUpgradesComponent.razor
  18. 45
      IGP/Pages/Database/Entity/Parts/EntityVanguardAddedComponent.razor
  19. 49
      IGP/Pages/Database/Entity/Parts/EntityVanguardsComponent.razor
  20. 176
      IGP/Pages/Database/Entity/Parts/EntityWeaponsComponent.razor
  21. 6
      IGP/Pages/Documentation/DocumentationPage.razor
  22. 4
      IGP/Program.cs
  23. 2
      IGP/wwwroot/generated/TaskModels.json
  24. 15
      Model/Entity/EntityModel.cs
  25. 1
      Model/Model.csproj
  26. 13
      Services/IServices.cs
  27. 41
      Services/Immortal/EntityDisplayService.cs
  28. 4
      Services/Immortal/EntityFilterService.cs

87
Components/Inputs/ButtonGroupComponent.razor

@ -0,0 +1,87 @@
<div class="groupButtonContainerContainer">
<div class="groupButtonContainer">
@foreach (var choice in Choices) {
var styleClass = "";
if (choice.Equals(Choice)) {
styleClass = "selected";
}
<button @onclick="@(e => OnChangeChoice(choice))" class="groupChoiceButton @styleClass">@choice</button>
}
</div>
</div>
<style>
.groupButtonContainerContainer {
margin: auto;
display: flex;
flex-direction: column;
justify-content: flex-start;
justify-items: flex-start;
}
.groupButtonContainer {
display: flex;
background-color: var(--background);
gap: 2px;
margin-right: auto;
border-radius: 8px;
}
.groupChoiceButton {
background-color: var(--primary);
color: white;
padding: 12px;
border: 1px solid var(--primary);
}
.groupChoiceButton:hover {
background-color: var(--primary-hover);
border-color: var(--primary-border-hover);
}
.selected {
background-color: var(--secondary);
color: white;
font-style: normal;
font-weight: bold;
}
.selected:hover {
background-color: var(--secondary-hover);
border-color: var(--secondary-border-hover);
}
.groupButtonContainer .groupChoiceButton:first-child {
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
}
.groupButtonContainer .groupChoiceButton:last-child {
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
}
</style>
@code {
[Parameter]
public string Choice { get; set; }
[Parameter]
public List<string> Choices { get; set; }
[Parameter]
public EventCallback<string> OnClick { get; set; }
protected override void OnInitialized() { }
void OnChangeChoice(string choice)
{
Choice = choice;
OnClick.InvokeAsync(choice);
}
}

BIN
IGP/Database.db

Binary file not shown.

BIN
IGP/Database.db-shm

Binary file not shown.

BIN
IGP/Database.db-wal

Binary file not shown.

28
IGP/Dialog/EntityDialogComponent.razor

@ -26,21 +26,19 @@
</div> </div>
<div class="dialogContent"> <div class="dialogContent">
<CascadingValue Value="@entity"> <CascadingValue Value="@entity">
<CascadingValue Value="@refresh"> <EntityVanguardAddedComponent />
<EntityVanguardAddedComponent ></EntityVanguardAddedComponent> <EntityInfoComponent />
<EntityInfoComponent ></EntityInfoComponent> <EntityVanguardsComponent />
<EntityVanguardsComponent ></EntityVanguardsComponent> <EntityProductionComponent />
<EntityProductionComponent ></EntityProductionComponent> <EntityStatsComponent />
<EntityStatsComponent ></EntityStatsComponent> <EntityMechanicsComponent />
<EntityMechanicsComponent ></EntityMechanicsComponent> <EntityPassivesComponent />
<EntityPassivesComponent ></EntityPassivesComponent> <EntityPyreSpellsComponent />
<EntityPyreSpellsComponent ></EntityPyreSpellsComponent> <EntityUpgradesComponent />
<EntityUpgradesComponent ></EntityUpgradesComponent> <EntityWeaponsComponent />
<EntityWeaponsComponent ></EntityWeaponsComponent> <EntityAbilitiesComponent />
<EntityAbilitiesComponent ></EntityAbilitiesComponent> </CascadingValue>
</CascadingValue>
</CascadingValue>
</div> </div>
<div class="dialogFooter"></div> <div class="dialogFooter"></div>

33
IGP/Pages/Database/DatabasePage.razor

@ -4,17 +4,23 @@
@implements IDisposable @implements IDisposable
@inject IEntityDisplayService entityDisplayService
<LayoutLargeContentComponent> <LayoutLargeContentComponent>
<WebsiteTitleComponent>Database</WebsiteTitleComponent> <WebsiteTitleComponent>Database</WebsiteTitleComponent>
<PaperComponent> <PaperComponent>
<FormDisplayComponent Label="Patch"> <FormDisplayComponent Label="Patch">
<Display> <Display>
Game Patch: @EntityModel.GameVersion Game Patch: @EntityModel.GameVersion
</Display> </Display>
</FormDisplayComponent> </FormDisplayComponent>
</PaperComponent> </PaperComponent>
<div style="margin-left: 8px">
<ButtonGroupComponent OnClick="((choice => { entityDisplayService.SetDisplayType(choice); }))" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent>
</div>
<PaperComponent> <PaperComponent>
<EntityFilterComponent></EntityFilterComponent> <EntityFilterComponent></EntityFilterComponent>
@ -22,7 +28,9 @@
<div class="databaseItems"> <div class="databaseItems">
@foreach (var entity in searches) { @foreach (var entity in searches) {
<CascadingValue Value="entity"> <CascadingValue Value="entity">
<EntityViewComponent></EntityViewComponent> <CascadingValue Value="@entityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
</CascadingValue> </CascadingValue>
} }
</div> </div>
@ -91,6 +99,13 @@
border-bottom: 4px solid var(--accent); border-bottom: 4px solid var(--accent);
padding: 4px; padding: 4px;
} }
.databaseInfoContainer {
display: flex;
gap: 24px;
}
</style> </style>
@ -118,10 +133,12 @@
RefreshFactionSearch(); RefreshFactionSearch();
EntityFilterService.Subscribe(OnChange); EntityFilterService.Subscribe(OnChange);
entityDisplayService.Subscribe(StateHasChanged);
} }
void IDisposable.Dispose() { void IDisposable.Dispose() {
EntityFilterService.Subscribe(OnChange); EntityFilterService.Unsubscribe(OnChange);
entityDisplayService.Unsubscribe(StateHasChanged);
} }
void OnChange(EntityFilterEvent filterEntityEvent) { void OnChange(EntityFilterEvent filterEntityEvent) {

78
IGP/Pages/Database/DatabaseSinglePage.razor

@ -0,0 +1,78 @@
@layout PageLayout
@page "/database/{text}"
@inject IEntityDisplayService entityDisplayService
@implements IDisposable
<LayoutLargeContentComponent>
<PaperComponent>
<FormDisplayComponent Label="Patch">
<Display>
Game Patch: @EntityModel.GameVersion
</Display>
</FormDisplayComponent>
</PaperComponent>
<div style="margin-left: 8px">
<ButtonGroupComponent OnClick="((choice => { entityDisplayService.SetDisplayType(choice); }))" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent>
</div>
@if (entity == null)
{
<div>Invalid entity name entered: @Text</div>
<div>No such entity. Did you mean <b>"Throne"</b>?</div>
}
else
{
<PaperComponent>
<CascadingValue Value="entity">
<CascadingValue Value="@entityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
</CascadingValue>
</PaperComponent>
}
</LayoutLargeContentComponent>
<style>
.databaseInfoContainer {
display: flex;
gap: 24px;
}
</style>
@code {
[Parameter]
public string? Text { get; set; }
private EntityModel? entity = null;
protected override void OnInitialized()
{
entityDisplayService.Subscribe(StateHasChanged);
foreach (var e in DATA.Get().Values)
{
if (e.Info().Name.Equals(Text))
{
entity = e;
return;
}
}
}
void IDisposable.Dispose() {
entityDisplayService.Unsubscribe(StateHasChanged);
}
}

32
IGP/Pages/Database/Entity/EntityViewComponent.razor

@ -3,22 +3,19 @@
<div class="enititiesContainer @isVanguard"> <div class="enititiesContainer @isVanguard">
<EntityHeaderComponent></EntityHeaderComponent> <EntityHeaderComponent></EntityHeaderComponent>
<div class="entityPartsContainer">
<CascadingValue Value="@Entity"> <EntityVanguardAddedComponent></EntityVanguardAddedComponent>
<div class="entityPartsContainer"> <EntityInfoComponent></EntityInfoComponent>
<EntityVanguardAddedComponent></EntityVanguardAddedComponent> <EntityVanguardsComponent></EntityVanguardsComponent>
<EntityInfoComponent></EntityInfoComponent> <EntityProductionComponent></EntityProductionComponent>
<EntityVanguardsComponent></EntityVanguardsComponent> <EntityStatsComponent></EntityStatsComponent>
<EntityProductionComponent></EntityProductionComponent> <EntityMechanicsComponent></EntityMechanicsComponent>
<EntityStatsComponent></EntityStatsComponent> <EntityPassivesComponent></EntityPassivesComponent>
<EntityMechanicsComponent></EntityMechanicsComponent> <EntityPyreSpellsComponent></EntityPyreSpellsComponent>
<EntityPassivesComponent></EntityPassivesComponent> <EntityUpgradesComponent></EntityUpgradesComponent>
<EntityPyreSpellsComponent></EntityPyreSpellsComponent> <EntityWeaponsComponent></EntityWeaponsComponent>
<EntityUpgradesComponent></EntityUpgradesComponent> <EntityAbilitiesComponent></EntityAbilitiesComponent>
<EntityWeaponsComponent></EntityWeaponsComponent> </div>
<EntityAbilitiesComponent></EntityAbilitiesComponent>
</div>
</CascadingValue>
</div> </div>
} }
@ -52,4 +49,7 @@
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string? StyleType { get; set; }
} }

69
IGP/Pages/Database/Entity/Parts/EntityAbilitiesComponent.razor

@ -1,5 +1,6 @@
@if (Entity.IdAbilities().Count > 0) { @if (Entity.IdAbilities().Count > 0) {
<EntityDisplayComponent Title="Abilities"> @if (StyleType.Equals("Plain"))
{
@foreach (var idAbility in Entity.IdAbilities()) { @foreach (var idAbility in Entity.IdAbilities()) {
var spell = EntityModel.Get(idAbility.Id); var spell = EntityModel.Get(idAbility.Id);
@ -8,15 +9,15 @@
<div> <div>
<div> <div>
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/> <b>Ability Name:</b> @spell.Info().Name
</div> </div>
<div> <div>
<b>Description:</b> @((MarkupString)info.Description) <b>- Description:</b> @((MarkupString)info.Description)
</div> </div>
@if (!info.Notes.Trim().Equals("")) { @if (!info.Notes.Trim().Equals("")) {
<div> <div>
<b>Notes:</b> @((MarkupString)info.Notes) <b>- Notes:</b> @((MarkupString)info.Notes)
</div> </div>
} }
@ -24,24 +25,73 @@
@if (production != null) { @if (production != null) {
if (production.Energy != 0) { if (production.Energy != 0) {
<div> <div>
<b> Energy: </b> @production.Energy <b>- Energy: </b> @production.Energy
</div> </div>
} }
if (production.BuildTime != 0) { if (production.BuildTime != 0) {
<div> <div>
<b> BuildTime: </b> @production.BuildTime <b>- BuildTime: </b> @production.BuildTime
</div> </div>
} }
if (production.Cooldown != 0) { if (production.Cooldown != 0) {
<div> <div>
<b> Cooldown: </b> @production.Cooldown <b>- Cooldown: </b> @production.Cooldown
</div> </div>
} }
} }
</div> </div>
</div> </div>
} }
</EntityDisplayComponent>
}
else
{
<EntityDisplayComponent Title="Abilities">
@foreach (var idAbility in Entity.IdAbilities()) {
var spell = EntityModel.Get(idAbility.Id);
var info = spell.Info();
var production = spell.Production();
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
</div>
@if (!info.Notes.Trim().Equals("")) {
<div>
<b>Notes:</b> @((MarkupString)info.Notes)
</div>
}
<div>
@if (production != null) {
if (production.Energy != 0) {
<div>
<b> Energy: </b> @production.Energy
</div>
}
if (production.BuildTime != 0) {
<div>
<b> BuildTime: </b> @production.BuildTime
</div>
}
if (production.Cooldown != 0) {
<div>
<b> Cooldown: </b> @production.Cooldown
</div>
}
}
</div>
</div>
}
</EntityDisplayComponent>
}
} }
@ -50,5 +100,8 @@
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

44
IGP/Pages/Database/Entity/Parts/EntityHeaderComponent.razor

@ -1,18 +1,30 @@
<div class="entityHeader"> @if (StyleType.Equals("Plain"))
<div class="entityHeaderText"> {
@Entity.Info().Name <div><b>@Entity?.Info().Name</b>
@if (Entity?.Info().Descriptive != DescriptiveType.None)
{
<span>, @Entity?.Info().Descriptive.Replace("_", " ")</span>
}
</div>
}
else
{
<div class="entityHeader">
<div class="entityHeaderText">
@Entity?.Info().Name
</div>
<div style="font-size:1.4rem;">
<b>@Entity?.EntityType.Replace("_", " ")</b>
@if (Entity?.Info().Descriptive != DescriptiveType.None)
{
<span>
<b>:</b> @Entity.Info().Descriptive.Replace("_", " ")
</span>
}
</div>
</div> </div>
<div style="font-size:1.4rem;">
<b>@Entity.EntityType.Replace("_", " ")</b>
@if (Entity.Info().Descriptive != DescriptiveType.None) {
<span>
<b>:</b> @Entity.Info().Descriptive.Replace("_", " ")
</span>
}
</div>
</div>
<style> <style>
.entityHeader { .entityHeader {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -36,11 +48,15 @@
} }
} }
</style> </style>
}
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

83
IGP/Pages/Database/Entity/Parts/EntityInfoComponent.razor

@ -1,4 +1,6 @@
<EntityDisplayComponent Title="Info"> 
@if (StyleType.Equals("Plain"))
{
@if (Entity.Info().Description != "") { @if (Entity.Info().Description != "") {
<div> <div>
<b>Description:</b> @((MarkupString)Entity.Info().Description) <b>Description:</b> @((MarkupString)Entity.Info().Description)
@ -6,9 +8,9 @@
} }
@if (Entity.Info().Notes != "") { @if (Entity.Info().Notes != "") {
<div> <div>
<b>Notes:</b> @((MarkupString)Entity.Info().Notes) <b>Notes:</b> @((MarkupString)Entity.Info().Notes)
</div> </div>
} }
@ -40,25 +42,76 @@
</div> </div>
} }
</div> </div>
</EntityDisplayComponent> }
else
{
<EntityDisplayComponent Title="Info">
@if (Entity.Info().Description != "") {
<div>
<b>Description:</b> @((MarkupString)Entity.Info().Description)
</div>
}
<style> @if (Entity.Info().Notes != "") {
.infoDisplayContainer { <div>
display: flex; <b>Notes:</b> @((MarkupString)Entity.Info().Notes)
gap: 32px; </div>
} }
<div class="infoDisplayContainer">
<div>
@if (Entity.Faction() != null) {
<div>
<b>Faction:</b> @Entity.Faction().Faction
</div>
}
@if (Entity.Tier() != null) {
<div>
<b>Tier:</b> @Entity.Tier().Tier
</div>
}
</div>
@if (Entity.Hotkey() != null) {
<div>
<div>
<b>Hotkey Group:</b> @Entity.Hotkey().HotkeyGroup
</div>
<div>
<b>Hotkey:</b> @Entity.Hotkey().Hotkey
</div>
<div>
<b>Hold Space:</b> @(Entity.Hotkey().HoldSpace ? "Yes" : "No")
</div>
</div>
}
</div>
</EntityDisplayComponent>
@@media only screen and (max-width: 1025px) { <style>
.infoDisplayContainer { .infoDisplayContainer {
flex-direction: column; display: flex;
gap: 4px; gap: 32px;
} }
}
</style> @@media only screen and (max-width: 1025px) {
.infoDisplayContainer {
flex-direction: column;
gap: 4px;
}
}
</style>
}
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

3
IGP/Pages/Database/Entity/Parts/EntityMechanicsComponent.razor

@ -23,5 +23,8 @@
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

69
IGP/Pages/Database/Entity/Parts/EntityPassivesComponent.razor

@ -1,5 +1,6 @@
@if (Entity.IdPassives().Count > 0) { @if (Entity.IdPassives().Count > 0) {
<EntityDisplayComponent Title="Passives"> @if (StyleType.Equals("Plain"))
{
@foreach (var idPassive in Entity.IdPassives()) { @foreach (var idPassive in Entity.IdPassives()) {
var passive = EntityModel.Get(idPassive.Id); var passive = EntityModel.Get(idPassive.Id);
@ -9,16 +10,16 @@
<div> <div>
<div> <div>
<b>Name:</b> <EntityLabelComponent EntityId="@passive.DataType"/> <b>Name:</b> @info.Name
</div> </div>
<div style="max-width: 600px;"> <div>
<b>Description:</b> @((MarkupString)info.Description) <b>- Description:</b> @((MarkupString)info.Description)
</div> </div>
@if (!info.Notes.Trim().Equals("")) { @if (!info.Notes.Trim().Equals("")) {
<div style="max-width: 600px;"> <div>
<b>Description:</b> @((MarkupString)info.Notes) <b>- Description:</b> @((MarkupString)info.Notes)
</div> </div>
} }
</div> </div>
@ -27,18 +28,64 @@
<div> <div>
@if (production.Pyre != 0) { @if (production.Pyre != 0) {
<div> <div>
<b>Pyre:</b> @production.Pyre <b>- Pyre:</b> @production.Pyre
</div> </div>
} }
@if (production.Cooldown != 0) { @if (production.Cooldown != 0) {
<div> <div>
<b>Cooldown:</b> @production.Cooldown.ToString()s <b>- Cooldown:</b> @production.Cooldown.ToString()s
</div> </div>
} }
</div> </div>
} }
} }
</EntityDisplayComponent>
}
else
{
<EntityDisplayComponent Title="Passives">
@foreach (var idPassive in Entity.IdPassives()) {
var passive = EntityModel.Get(idPassive.Id);
var info = passive.Info();
var production = passive.Production();
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@passive.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
</div>
@if (!info.Notes.Trim().Equals("")) {
<div>
<b>Description:</b> @((MarkupString)info.Notes)
</div>
}
</div>
@if (production != null) {
<div>
@if (production.Pyre != 0) {
<div>
<b>Pyre:</b> @production.Pyre
</div>
}
@if (production.Cooldown != 0) {
<div>
<b>Cooldown:</b> @production.Cooldown.ToString()s
</div>
}
</div>
}
}
</EntityDisplayComponent>
}
} }
@ -47,4 +94,8 @@
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

231
IGP/Pages/Database/Entity/Parts/EntityProductionComponent.razor

@ -1,79 +1,157 @@
@if (@Production != null || Supply != null || Requirements.Count > 0) { @if (Production != null || Supply != null || Requirements.Count > 0) {
<EntityDisplayComponent Title="Production">
<div class="ProductionContainer"> @if (StyleType.Equals("Plain"))
{
@if (Requirements.Count() > 0) { @if (Requirements.Count() > 0) {
<div> <div>
@foreach (var requirement in Requirements) { @foreach (var requirement in Requirements)
<div> {
var replaced = DATA.Get()[requirement.DataType];
<span> <div>
<b>@requirement.Requirement.Replace("_", " "):</b> <EntityLabelComponent EntityId="@requirement.DataType"/>
</span> <span>
</div> <b>@requirement.Requirement.Replace("_", " "):</b> @replaced.Info().Name
} </span>
</div> </div>
} }
</div>
@if (Production != null && (!Production.Alloy.Equals(0) }
|| !Production.Ether.Equals(0)
|| !Production.BuildTime.Equals(0) @if (Production != null && (!Production.Alloy.Equals(0)
|| !Production.Cooldown.Equals(0))) { || !Production.Ether.Equals(0)
<div> || !Production.BuildTime.Equals(0)
@if (!Production.Alloy.Equals(0)) { || !Production.Cooldown.Equals(0))) {
<div> <div>
<b>Alloy:</b> @Production.Alloy @if (!Production.Alloy.Equals(0)) {
</div> <div>
} <b>Alloy:</b> @Production.Alloy
@if (!Production.Ether.Equals(0)) { </div>
<div> }
<b>Ether:</b> @Production.Ether @if (!Production.Ether.Equals(0)) {
</div> <div>
} <b>Ether:</b> @Production.Ether
@if (!Production.Pyre.Equals(0)) { </div>
<div> }
<b>Pyre:</b> @Production.Pyre @if (!Production.Pyre.Equals(0)) {
</div> <div>
} <b>Pyre:</b> @Production.Pyre
</div>
@if (!Production.BuildTime.Equals(0)) { }
<div>
<b>Build Time:</b> @Production.BuildTime.ToString()s @if (!Production.BuildTime.Equals(0)) {
</div> <div>
} <b>Build Time:</b> @Production.BuildTime.ToString()s
</div>
}
@if (!Production.Energy.Equals(0)) { @if (!Production.Energy.Equals(0)) {
<div> <div>
<b>Energy:</b> @Production.Energy <b>Energy:</b> @Production.Energy
</div> </div>
} }
@if (!Production.Cooldown.Equals(0)) { @if (!Production.Cooldown.Equals(0)) {
<div> <div>
<b>Cooldown:</b> @Production.Cooldown.ToString()s <b>Cooldown:</b> @Production.Cooldown.ToString()s
</div> </div>
} }
</div> </div>
} }
@if (Supply != null) { @if (Supply != null) {
<div> <div>
@if (!Supply.Grants.Equals(0)) { @if (!Supply.Grants.Equals(0)) {
<div> <div>
<b>Grants:</b> @Supply.Grants <b>Grants:</b> @Supply.Grants
</div> </div>
} }
@if (!Supply.Takes.Equals(0)) { @if (!Supply.Takes.Equals(0)) {
<div> <div>
<b>Takes:</b> @Supply.Takes Supply <b>Takes:</b> @Supply.Takes Supply
</div> </div>
} }
</div> </div>
} }
</div> }
</EntityDisplayComponent>
} else
{
<EntityDisplayComponent Title="Production">
<div class="ProductionContainer">
@if (Requirements.Count() > 0) {
<div>
@foreach (var requirement in Requirements) {
<div>
<style> <span>
<b>@requirement.Requirement.Replace("_", " "):</b> <EntityLabelComponent EntityId="@requirement.DataType"/>
</span>
</div>
}
</div>
}
@if (Production != null && (!Production.Alloy.Equals(0)
|| !Production.Ether.Equals(0)
|| !Production.BuildTime.Equals(0)
|| !Production.Cooldown.Equals(0))) {
<div>
@if (!Production.Alloy.Equals(0)) {
<div>
<b>Alloy:</b> @Production.Alloy
</div>
}
@if (!Production.Ether.Equals(0)) {
<div>
<b>Ether:</b> @Production.Ether
</div>
}
@if (!Production.Pyre.Equals(0)) {
<div>
<b>Pyre:</b> @Production.Pyre
</div>
}
@if (!Production.BuildTime.Equals(0)) {
<div>
<b>Build Time:</b> @Production.BuildTime.ToString()s
</div>
}
@if (!Production.Energy.Equals(0)) {
<div>
<b>Energy:</b> @Production.Energy
</div>
}
@if (!Production.Cooldown.Equals(0)) {
<div>
<b>Cooldown:</b> @Production.Cooldown.ToString()s
</div>
}
</div>
}
@if (Supply != null) {
<div>
@if (!Supply.Grants.Equals(0)) {
<div>
<b>Grants:</b> @Supply.Grants
</div>
}
@if (!Supply.Takes.Equals(0)) {
<div>
<b>Takes:</b> @Supply.Takes Supply
</div>
}
</div>
}
</div>
</EntityDisplayComponent>
<style>
.ProductionContainer { .ProductionContainer {
display: flex; display: flex;
gap: 32px; gap: 32px;
@ -87,11 +165,18 @@
} }
</style> </style>
}
}
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
private EntityProductionModel Production => Entity.Production(); private EntityProductionModel Production => Entity.Production();
private List<EntityRequirementModel> Requirements => Entity.Requirements(); private List<EntityRequirementModel> Requirements => Entity.Requirements();

60
IGP/Pages/Database/Entity/Parts/EntityPyreSpellsComponent.razor

@ -1,5 +1,7 @@
@if (Entity.IdPyreSpells().Count > 0) { @if (Entity.IdPyreSpells().Count > 0)
<EntityDisplayComponent Title="Pyre Spells"> {
@if (StyleType.Equals("Plain"))
{
@foreach (var pyreSpell in Entity.IdPyreSpells()) { @foreach (var pyreSpell in Entity.IdPyreSpells()) {
var spell = EntityModel.Get(pyreSpell.Id); var spell = EntityModel.Get(pyreSpell.Id);
@ -8,30 +10,68 @@
<div> <div>
<div> <div>
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/> <b>Spell Name:</b> @spell.Info().Name
</div> </div>
<div> <div>
<b>Description:</b> @((MarkupString)info.Description) <b>- Description:</b> @((MarkupString)info.Description)
</div> </div>
<div> <div>
@if (production != null) { @if (production != null) {
if (production.Pyre != 0) { if (production.Pyre != 0) {
<b> Pyre: </b> <b>- Pyre: </b>
@production.Pyre @production.Pyre
} }
if (production.BuildTime != 0) { if (production.BuildTime != 0) {
<b> BuildTime: </b> <b>- BuildTime: </b>
@production.BuildTime @production.BuildTime
} }
if (production.Cooldown != 0) { if (production.Cooldown != 0) {
<b> Cooldown: </b> <b>- Cooldown: </b>
@production.Cooldown @production.Cooldown
} }
} }
</div> </div>
</div> </div>
} }
</EntityDisplayComponent>
}
else
{
<EntityDisplayComponent Title="Pyre Spells">
@foreach (var pyreSpell in Entity.IdPyreSpells()) {
var spell = EntityModel.Get(pyreSpell.Id);
var info = spell.Info();
var production = spell.Production();
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
</div>
<div>
@if (production != null) {
if (production.Pyre != 0) {
<b> Pyre: </b>
@production.Pyre
}
if (production.BuildTime != 0) {
<b> BuildTime: </b>
@production.BuildTime
}
if (production.Cooldown != 0) {
<b> Cooldown: </b>
@production.Cooldown
}
}
</div>
</div>
}
</EntityDisplayComponent>
}
} }
@ -40,4 +80,8 @@
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

175
IGP/Pages/Database/Entity/Parts/EntityStatsComponent.razor

@ -1,66 +1,125 @@
 
@if (Vitality != null || Movement != null) { @if (Vitality != null || Movement != null) {
<EntityDisplayComponent Title="Stats"> @if (StyleType.Equals("Plain"))
<div class="statContainer"> {
@if (Vitality != null) { @if (Vitality != null) {
<div> <div>
@if (!Vitality.DefenseLayer.Equals(0)) { @if (!Vitality.DefenseLayer.Equals(0)) {
<div> <div>
<b>Shield:</b> @Vitality.DefenseLayer <b>Shield:</b> @Vitality.DefenseLayer
</div> </div>
} }
@if (!Vitality.Health.Equals(0)) { @if (!Vitality.Health.Equals(0)) {
<div> <div>
<b>Health:</b> @Vitality.Health <b>Health:</b> @Vitality.Health
</div> </div>
} }
@if (!Vitality.Energy.Equals(0)) { @if (!Vitality.Energy.Equals(0)) {
<div> <div>
<b>Energy:</b> @Vitality.Energy <b>Energy:</b> @Vitality.Energy
</div> </div>
} }
@if (Vitality.Armor != "") { @if (Vitality.Armor != "") {
<div> <div>
<b>Armor:</b> @Vitality.Armor <b>Armor:</b> @Vitality.Armor
</div> </div>
} }
@if (Vitality.IsEtheric) { @if (Vitality.IsEtheric) {
<div> <div>
<b> + Etheric</b> <b> + Etheric</b>
</div> </div>
} }
@if (Vitality.IsStructure) { @if (Vitality.IsStructure) {
<div> <div>
<b> + Structure</b> <b> + Structure</b>
</div> </div>
} }
</div> </div>
} }
@if (Movement != null) { @if (Movement != null) {
<div> <div>
@if (!Movement.Speed.Equals(0)) { @if (!Movement.Speed.Equals(0)) {
<div> <div>
<b>Speed:</b> @Movement.Speed <b>Speed:</b> @Movement.Speed
</div> </div>
} }
else { else {
<div>
<b>Speed:</b> Immobile
</div>
}
<div> <div>
<b>Speed:</b> Immobile <b>Move Type:</b> @Movement.Movement
</div> </div>
} </div>
}
}
else
{
<EntityDisplayComponent Title="Stats">
<div class="statContainer">
@if (Vitality != null) {
<div> <div>
<b>Move Type:</b> @Movement.Movement @if (!Vitality.DefenseLayer.Equals(0)) {
<div>
<b>Shield:</b> @Vitality.DefenseLayer
</div>
}
@if (!Vitality.Health.Equals(0)) {
<div>
<b>Health:</b> @Vitality.Health
</div>
}
@if (!Vitality.Energy.Equals(0)) {
<div>
<b>Energy:</b> @Vitality.Energy
</div>
}
@if (Vitality.Armor != "") {
<div>
<b>Armor:</b> @Vitality.Armor
</div>
}
@if (Vitality.IsEtheric) {
<div>
<b> + Etheric</b>
</div>
}
@if (Vitality.IsStructure) {
<div>
<b> + Structure</b>
</div>
}
</div> </div>
</div> }
}
</div>
</EntityDisplayComponent>
}
<style> @if (Movement != null) {
<div>
@if (!Movement.Speed.Equals(0)) {
<div>
<b>Speed:</b> @Movement.Speed
</div>
}
else {
<div>
<b>Speed:</b> Immobile
</div>
}
<div>
<b>Move Type:</b> @Movement.Movement
</div>
</div>
}
</div>
</EntityDisplayComponent>
<style>
.statContainer { .statContainer {
display: flex; display: flex;
gap: 32px; gap: 32px;
@ -74,10 +133,20 @@
} }
</style> </style>
}
}
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
private EntityVitalityModel Vitality => Entity.Vitality(); private EntityVitalityModel Vitality => Entity.Vitality();
private EntityMovementModel Movement => Entity.Movement(); private EntityMovementModel Movement => Entity.Movement();
} }

55
IGP/Pages/Database/Entity/Parts/EntityUpgradesComponent.razor

@ -1,22 +1,39 @@
@if (Entity.IdUpgrades().Count > 0) { @if (Entity.IdUpgrades().Count > 0) {
<EntityDisplayComponent Title="Upgrades"> @if (StyleType.Equals("Plain"))
<div class="upgradesContainer"> {
@foreach (var upgradeId in Entity.IdUpgrades()) { @foreach (var upgradeId in Entity.IdUpgrades()) {
var entity = EntityModel.Get(upgradeId.Id); var entity = EntityModel.Get(upgradeId.Id);
<div>
<div> <div>
<b>Upgrade Name:</b> @entity.Info().Name
</div>
<div>
<b>- Description:</b> @entity.Info().Description
</div>
</div>
}
}
else
{
<EntityDisplayComponent Title="Upgrades">
<div class="upgradesContainer">
@foreach (var upgradeId in Entity.IdUpgrades()) {
var entity = EntityModel.Get(upgradeId.Id);
<div> <div>
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/> <div>
</div> <b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
<div> </div>
<b>Description:</b> @entity.Info().Description <div>
<b>Description:</b> @entity.Info().Description
</div>
</div> </div>
</div> }
} </div>
</div> </EntityDisplayComponent>
</EntityDisplayComponent>
}
<style>
<style>
.upgradesContainer { .upgradesContainer {
display: flex; display: flex;
gap: 32px; gap: 32px;
@ -29,10 +46,18 @@
} }
} }
</style> </style>
}
}
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

45
IGP/Pages/Database/Entity/Parts/EntityVanguardAddedComponent.razor

@ -1,31 +1,46 @@
@{ @if (Vanguard != null) {
var vanguard = Entity.VanguardAdded(); var immortalId = Vanguard.ImmortalId;
var isNull = Entity.VanguardAdded() == null ? "null" : "not null";
}
@if (vanguard != null) {
var immortalId = Entity.VanguardAdded().ImmortalId;
var immortal = DATA.Get()[immortalId]; var immortal = DATA.Get()[immortalId];
var replaced = DATA.Get()[Vanguard.ReplaceId];
<EntityDisplayComponent Title="Vanguard"> @if (StyleType.Equals("Plain"))
{
<div> <div>
<b>Immortal:</b> @immortal.Info().Name
</div>
@if (!Vanguard.ReplaceId.Equals("")) {
<div> <div>
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/> <b>Replaces:</b> @replaced.Info().Name
</div> </div>
@if (!Entity.VanguardAdded().ReplaceId.Equals("")) { }
}
else
{
<EntityDisplayComponent Title="Vanguard">
<div>
<div> <div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@Entity.VanguardAdded().ReplaceId"></EntityLabelComponent> <b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/>
</div> </div>
} @if (!Vanguard.ReplaceId.Equals("")) {
</div> <div>
</EntityDisplayComponent> <b>Replaces:</b> <EntityLabelComponent EntityId="@Vanguard.ReplaceId"></EntityLabelComponent>
</div>
}
</div>
</EntityDisplayComponent>
}
} }
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
private EntityVanguardAddedModel? Vanguard => Entity?.VanguardAdded();
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

49
IGP/Pages/Database/Entity/Parts/EntityVanguardsComponent.razor

@ -1,27 +1,60 @@
@if (Entity.IdVanguards().Count > 0) { @if (Entity.IdVanguards().Count > 0) {
<EntityDisplayComponent Title="Vanguards"> @if (StyleType.Equals("Plain"))
{
@foreach (var data in Entity.IdVanguards()) { @foreach (var data in Entity.IdVanguards()) {
var entity = EntityModel.Get(data.Id); var entity = EntityModel.Get(data.Id);
var requirements = entity.Requirements(); var requirements = entity.Requirements();
var vanguard = entity.VanguardAdded(); var vanguardAdded = entity.VanguardAdded();
var replaced = DATA.Get()[vanguardAdded.ReplaceId];
var immortal = DATA.Get()[vanguardAdded.ImmortalId];
var productionBuilding = (from building in requirements var productionBuilding = (from building in requirements
where building.Requirement == RequirementType.Production_Building where building.Requirement == RequirementType.Production_Building
select building).First().DataType; select building).First().DataType;
<div> <div>
<div> <div>
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/> <b>Name:</b> @entity.Info().Name
</div> </div>
<div> <div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@vanguard.ReplaceId"/> <b>- Replaces:</b> @replaced.Info().Name
</div> </div>
<div> <div>
<b>Built From:</b> <EntityLabelComponent EntityId="@productionBuilding"/> <b>- Built From:</b> @immortal.Info().Name
</div> </div>
</div> </div>
} }
</EntityDisplayComponent> }
else
{
<EntityDisplayComponent Title="Vanguards">
@foreach (var data in Entity.IdVanguards()) {
var entity = EntityModel.Get(data.Id);
var requirements = entity.Requirements();
var vanguard = entity.VanguardAdded();
var productionBuilding = (from building in requirements
where building.Requirement == RequirementType.Production_Building
select building).First().DataType;
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
</div>
<div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@vanguard.ReplaceId"/>
</div>
<div>
<b>Built From:</b> <EntityLabelComponent EntityId="@productionBuilding"/>
</div>
</div>
}
</EntityDisplayComponent>
}
} }
@code { @code {
@ -29,4 +62,8 @@
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

176
IGP/Pages/Database/Entity/Parts/EntityWeaponsComponent.razor

@ -1,34 +1,146 @@
@if (Entity.Weapons().Count > 0) { @if (Entity.Weapons().Count > 0)
{
@if (StyleType.Equals("Plain"))
{
int index = 0;
foreach (var data in Entity.Weapons())
{
index++;
<div>
<div>
<div class="damageContainer">
<div>
<b>Weapon @index</b>
</div>
<div>
<b>- Damage:</b> @data.Damage
</div>
@if (data.LightDamage != 0)
{
<div class="alternateDamage">
<i>- vs Light: @data.LightDamage</i>&nbsp;
</div>
}
@if (data.MediumDamage != 0)
{
<div class="alternateDamage">
<i>- vs Medium: @data.MediumDamage</i>&nbsp;
</div>
}
@if (data.HeavyDamage != 0)
{
<div class="alternateDamage">
<i>- vs Heavy: @data.HeavyDamage</i>&nbsp;
</div>
}
@if (data.EthericDamageBonus != 0)
{
<div class="alternateDamage">
<i>- vs Etheric +@data.EthericDamageBonus</i>&nbsp;
</div>
}
@if (data.StructureDamageBonus != 0)
{
<div class="alternateDamage">
<i>- vs Structure: +@data.StructureDamageBonus</i>&nbsp;
</div>
}
</div>
</div>
<div>
<b>- Range:</b> @data.Range
</div>
@if (data.SecondsBetweenAttacks > 0)
{
<div>
<b>- AttacksPerSecond:</b> @(1 / data.SecondsBetweenAttacks)
</div>
<div>
- (or <b>SecondsBetweenAttacks:</b> @data.SecondsBetweenAttacks)
</div>
}
else if (data.AttacksPerSecond > 0)
{
<div>
<b>- AttacksPerSecond:</b> @data.AttacksPerSecond
</div>
<div>
- (or <b>SecondsBetweenAttacks:</b> @(1 / data.AttacksPerSecond))
</div>
}
<div>
<b>- Targets:</b> @data.Targets
</div>
@if (data.AttacksPerSecond != 0)
{
<span>
<b>- DPS:</b> @(Math.Round(data.Damage * data.AttacksPerSecond))&nbsp;
</span>
@if (data.LightDamage != 0)
{
<span>
<i>- Light DPS: @(Math.Round(data.LightDamage * data.AttacksPerSecond))</i>&nbsp;
</span>
}
@if (data.MediumDamage != 0)
{
<span>
<i>- Medium DPS: @(Math.Round(data.MediumDamage * data.AttacksPerSecond))</i>&nbsp;
</span>
}
@if (data.HeavyDamage != 0)
{
<span>
<i>- Heavy DPS: @(Math.Round(data.HeavyDamage * data.AttacksPerSecond))</i>&nbsp;
</span>
}
}
</div>
}
}
else
{
<EntityDisplayComponent Title="Weapons"> <EntityDisplayComponent Title="Weapons">
<div class="weaponsContainer"> <div class="weaponsContainer">
@foreach (var data in Entity.Weapons()) { @foreach (var data in Entity.Weapons())
{
<div> <div>
<div> <div>
<div class="damageContainer"> <div class="damageContainer">
<div> <div>
<b>Damage:</b> @data.Damage <b>Damage:</b> @data.Damage
</div> </div>
@if (data.LightDamage != 0) { @if (data.LightDamage != 0)
{
<div class="alternateDamage"> <div class="alternateDamage">
<i>vs Light: @data.LightDamage</i>&nbsp; <i>vs Light: @data.LightDamage</i>&nbsp;
</div> </div>
} }
@if (data.MediumDamage != 0) { @if (data.MediumDamage != 0)
{
<div class="alternateDamage"> <div class="alternateDamage">
<i>vs Medium: @data.MediumDamage</i>&nbsp; <i>vs Medium: @data.MediumDamage</i>&nbsp;
</div> </div>
} }
@if (data.HeavyDamage != 0) { @if (data.HeavyDamage != 0)
{
<div class="alternateDamage"> <div class="alternateDamage">
<i>vs Heavy: @data.HeavyDamage</i>&nbsp; <i>vs Heavy: @data.HeavyDamage</i>&nbsp;
</div> </div>
} }
@if (data.EthericDamageBonus != 0) { @if (data.EthericDamageBonus != 0)
{
<div class="alternateDamage"> <div class="alternateDamage">
<i>vs Etheric +@data.EthericDamageBonus</i>&nbsp; <i>vs Etheric +@data.EthericDamageBonus</i>&nbsp;
</div> </div>
} }
@if (data.StructureDamageBonus != 0) { @if (data.StructureDamageBonus != 0)
{
<div class="alternateDamage"> <div class="alternateDamage">
<i>vs Structure: +@data.StructureDamageBonus</i>&nbsp; <i>vs Structure: +@data.StructureDamageBonus</i>&nbsp;
</div> </div>
@ -38,7 +150,8 @@
<div> <div>
<b>Range:</b> @data.Range <b>Range:</b> @data.Range
</div> </div>
@if (data.SecondsBetweenAttacks > 0) { @if (data.SecondsBetweenAttacks > 0)
{
<div> <div>
<b>AttacksPerSecond:</b> @(1 / data.SecondsBetweenAttacks) <b>AttacksPerSecond:</b> @(1 / data.SecondsBetweenAttacks)
</div> </div>
@ -46,7 +159,8 @@
(or <b>SecondsBetweenAttacks:</b> @data.SecondsBetweenAttacks) (or <b>SecondsBetweenAttacks:</b> @data.SecondsBetweenAttacks)
</div> </div>
} }
else if (data.AttacksPerSecond > 0) { else if (data.AttacksPerSecond > 0)
{
<div> <div>
<b>AttacksPerSecond:</b> @data.AttacksPerSecond <b>AttacksPerSecond:</b> @data.AttacksPerSecond
</div> </div>
@ -58,33 +172,36 @@
<div> <div>
<b>Targets:</b> @data.Targets <b>Targets:</b> @data.Targets
</div> </div>
@if (data.AttacksPerSecond != 0) { @if (data.AttacksPerSecond != 0)
<span> {
<div>
<b>DPS:</b> @(Math.Round(data.Damage * data.AttacksPerSecond))&nbsp; <b>DPS:</b> @(Math.Round(data.Damage * data.AttacksPerSecond))&nbsp;
</span> </div>
@if (data.LightDamage != 0) { @if (data.LightDamage != 0)
<span> {
<i>L: @(Math.Round(data.LightDamage * data.AttacksPerSecond))</i>&nbsp; <div>
</span> <i>Light DPS: @(Math.Round(data.LightDamage * data.AttacksPerSecond))</i>&nbsp;
</div>
} }
@if (data.MediumDamage != 0) { @if (data.MediumDamage != 0)
<span> {
<i>M: @(Math.Round(data.MediumDamage * data.AttacksPerSecond))</i>&nbsp; <div>
</span> <i>Medium DPS: @(Math.Round(data.MediumDamage * data.AttacksPerSecond))</i>&nbsp;
</div>
} }
@if (data.HeavyDamage != 0) { @if (data.HeavyDamage != 0)
<span> {
<i>H: @(Math.Round(data.HeavyDamage * data.AttacksPerSecond))</i>&nbsp; <div>
</span> <i>Heavy DPS: @(Math.Round(data.HeavyDamage * data.AttacksPerSecond))</i>&nbsp;
</div>
} }
} }
</div> </div>
} }
</div> </div>
</EntityDisplayComponent> </EntityDisplayComponent>
}
<style> <style>
.weaponsContainer { .weaponsContainer {
display: flex; display: flex;
gap: 32px; gap: 32px;
@ -106,9 +223,16 @@
} }
</style> </style>
}
}
@code { @code {
[CascadingParameter] [CascadingParameter]
public EntityModel? Entity { get; set; } public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
} }

6
IGP/Pages/Documentation/DocumentationPage.razor

@ -4,7 +4,8 @@
@using Markdig @using Markdig
@implements IDisposable @implements IDisposable
@page "/docs" @page "/docs/{text?}"
@if (!DocumentationService.IsLoaded()) @if (!DocumentationService.IsLoaded())
{ {
@ -119,6 +120,9 @@ else
@code { @code {
[Parameter]
public string? Text { get; set; }
string selectedSection = "All"; string selectedSection = "All";
protected override void OnInitialized() protected override void OnInitialized()

4
IGP/Program.cs

@ -13,6 +13,7 @@ using Services;
using Services.Immortal; using Services.Immortal;
using Services.Website; using Services.Website;
using Services.Development; using Services.Development;
using IEntityDisplayService = Services.IEntityDisplayService;
var builder = WebAssemblyHostBuilder.CreateDefault(args); var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Logging.SetMinimumLevel(LogLevel.Warning); builder.Logging.SetMinimumLevel(LogLevel.Warning);
@ -33,6 +34,9 @@ builder.Services.AddSingleton<ITimingService, TimingService>();
builder.Services.AddSingleton<IMemoryTesterService, MemoryTesterService>(); builder.Services.AddSingleton<IMemoryTesterService, MemoryTesterService>();
builder.Services.AddSingleton<IEntityFilterService, EntityFilterService>(); builder.Services.AddSingleton<IEntityFilterService, EntityFilterService>();
builder.Services.AddSingleton<IEntityDisplayService, EntityDisplayService>();
builder.Services.AddSingleton(new HttpClient { builder.Services.AddSingleton(new HttpClient {
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
}); });

2
IGP/wwwroot/generated/TaskModels.json

File diff suppressed because one or more lines are too long

15
Model/Entity/EntityModel.cs

@ -1,10 +1,10 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text;
using Model.Immortal.Entity.Data; using Model.Immortal.Entity.Data;
using Model.Immortal.Entity.Parts; using Model.Immortal.Entity.Parts;
using Model.Immortal.Types; using Model.Immortal.Types;
using YamlDotNet.Serialization;
namespace Model.Immortal.Entity; namespace Model.Immortal.Entity;
@ -28,6 +28,13 @@ public class EntityModel {
IsSpeculative = isSpeculative; IsSpeculative = isSpeculative;
} }
public string AsYaml() {
var stringBuilder = new StringBuilder();
var serializer = new Serializer();
stringBuilder.AppendLine(serializer.Serialize(this));
return stringBuilder.ToString();
}
public string DataType { get; set; } public string DataType { get; set; }
// TODO Serilization currently being used for build orders // TODO Serilization currently being used for build orders
@ -71,6 +78,8 @@ public class EntityModel {
} }
public static List<EntityModel> GetList() { public static List<EntityModel> GetList() {
if (entityModels == null) entityModels = DATA.Get().Values.ToList(); if (entityModels == null) entityModels = DATA.Get().Values.ToList();

1
Model/Model.csproj

@ -13,5 +13,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

13
Services/IServices.cs

@ -190,10 +190,23 @@ public interface IEntityFilterService {
public void Unsubscribe(EntityFilterAction action); public void Unsubscribe(EntityFilterAction action);
} }
public interface IEntityService { public interface IEntityService {
public List<EntityModel> GetEntities(); public List<EntityModel> GetEntities();
} }
public interface IEntityDisplayService
{
public List<string> DefaultChoices();
public string GetDisplayType();
public void SetDisplayType(string displayType);
public void Subscribe(Action action);
public void Unsubscribe(Action action);
}
public interface IImmortalSelectionService { public interface IImmortalSelectionService {
public string GetFactionType(); public string GetFactionType();
public string GetImmortalType(); public string GetImmortalType();

41
Services/Immortal/EntityDisplayService.cs

@ -0,0 +1,41 @@
using Model.Immortal.Types;
namespace Services.Immortal;
public class EntityDisplayService : IEntityDisplayService {
private string displayType = "Detailed";
private event Action _onChange;
public List<string> DefaultChoices()
{
return new List<string>() { "Detailed", "Plain" };
}
public void Subscribe(Action action) {
_onChange += action;
}
public void Unsubscribe(Action action) {
_onChange -= action;
}
private void NotifyDataChanged() {
_onChange?.Invoke();
}
public Action OnChange() {
return _onChange;
}
public string GetDisplayType()
{
return displayType;
}
public void SetDisplayType(string displayType)
{
this.displayType = displayType;
NotifyDataChanged();
}
}

4
Services/Immortal/EntityFilterService.cs

@ -21,7 +21,7 @@ public class EntityFilterService : IEntityFilterService {
private string _selectedFaction = FactionType.Any; private string _selectedFaction = FactionType.Any;
private string _selectedImmortal = ImmortalType.Any; private string _selectedImmortal = ImmortalType.Any;
public EntityFilterService() { public EntityFilterService() {
RefreshImmortalChoices(); RefreshImmortalChoices();
RefreshEntityChoices(); RefreshEntityChoices();
@ -46,7 +46,7 @@ public class EntityFilterService : IEntityFilterService {
public string GetImmortalType() { public string GetImmortalType() {
return _selectedImmortal; return _selectedImmortal;
} }
public bool SelectFactionType(string factionType) { public bool SelectFactionType(string factionType) {
if (_selectedFaction == factionType) { if (_selectedFaction == factionType) {

Loading…
Cancel
Save