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. 31
      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. 81
      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. 233
      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. 53
      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

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 class="dialogContent">
<CascadingValue Value="@entity">
<CascadingValue Value="@refresh">
<EntityVanguardAddedComponent ></EntityVanguardAddedComponent>
<EntityInfoComponent ></EntityInfoComponent>
<EntityVanguardsComponent ></EntityVanguardsComponent>
<EntityProductionComponent ></EntityProductionComponent>
<EntityStatsComponent ></EntityStatsComponent>
<EntityMechanicsComponent ></EntityMechanicsComponent>
<EntityPassivesComponent ></EntityPassivesComponent>
<EntityPyreSpellsComponent ></EntityPyreSpellsComponent>
<EntityUpgradesComponent ></EntityUpgradesComponent>
<EntityWeaponsComponent ></EntityWeaponsComponent>
<EntityAbilitiesComponent ></EntityAbilitiesComponent>
</CascadingValue>
</CascadingValue>
<CascadingValue Value="@entity">
<EntityVanguardAddedComponent />
<EntityInfoComponent />
<EntityVanguardsComponent />
<EntityProductionComponent />
<EntityStatsComponent />
<EntityMechanicsComponent />
<EntityPassivesComponent />
<EntityPyreSpellsComponent />
<EntityUpgradesComponent />
<EntityWeaponsComponent />
<EntityAbilitiesComponent />
</CascadingValue>
</div>
<div class="dialogFooter"></div>

31
IGP/Pages/Database/DatabasePage.razor

@ -4,17 +4,23 @@
@implements IDisposable
@inject IEntityDisplayService entityDisplayService
<LayoutLargeContentComponent>
<WebsiteTitleComponent>Database</WebsiteTitleComponent>
<PaperComponent>
<FormDisplayComponent Label="Patch">
<Display>
Game Patch: @EntityModel.GameVersion
</Display>
</FormDisplayComponent>
<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>
<PaperComponent>
<EntityFilterComponent></EntityFilterComponent>
@ -22,7 +28,9 @@
<div class="databaseItems">
@foreach (var entity in searches) {
<CascadingValue Value="entity">
<EntityViewComponent></EntityViewComponent>
<CascadingValue Value="@entityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent>
</CascadingValue>
</CascadingValue>
}
</div>
@ -91,6 +99,13 @@
border-bottom: 4px solid var(--accent);
padding: 4px;
}
.databaseInfoContainer {
display: flex;
gap: 24px;
}
</style>
@ -118,10 +133,12 @@
RefreshFactionSearch();
EntityFilterService.Subscribe(OnChange);
entityDisplayService.Subscribe(StateHasChanged);
}
void IDisposable.Dispose() {
EntityFilterService.Subscribe(OnChange);
EntityFilterService.Unsubscribe(OnChange);
entityDisplayService.Unsubscribe(StateHasChanged);
}
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">
<EntityHeaderComponent></EntityHeaderComponent>
<CascadingValue Value="@Entity">
<div class="entityPartsContainer">
<EntityVanguardAddedComponent></EntityVanguardAddedComponent>
<EntityInfoComponent></EntityInfoComponent>
<EntityVanguardsComponent></EntityVanguardsComponent>
<EntityProductionComponent></EntityProductionComponent>
<EntityStatsComponent></EntityStatsComponent>
<EntityMechanicsComponent></EntityMechanicsComponent>
<EntityPassivesComponent></EntityPassivesComponent>
<EntityPyreSpellsComponent></EntityPyreSpellsComponent>
<EntityUpgradesComponent></EntityUpgradesComponent>
<EntityWeaponsComponent></EntityWeaponsComponent>
<EntityAbilitiesComponent></EntityAbilitiesComponent>
</div>
</CascadingValue>
<div class="entityPartsContainer">
<EntityVanguardAddedComponent></EntityVanguardAddedComponent>
<EntityInfoComponent></EntityInfoComponent>
<EntityVanguardsComponent></EntityVanguardsComponent>
<EntityProductionComponent></EntityProductionComponent>
<EntityStatsComponent></EntityStatsComponent>
<EntityMechanicsComponent></EntityMechanicsComponent>
<EntityPassivesComponent></EntityPassivesComponent>
<EntityPyreSpellsComponent></EntityPyreSpellsComponent>
<EntityUpgradesComponent></EntityUpgradesComponent>
<EntityWeaponsComponent></EntityWeaponsComponent>
<EntityAbilitiesComponent></EntityAbilitiesComponent>
</div>
</div>
}
@ -52,4 +49,7 @@
@code {
[CascadingParameter]
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) {
<EntityDisplayComponent Title="Abilities">
@if (StyleType.Equals("Plain"))
{
@foreach (var idAbility in Entity.IdAbilities()) {
var spell = EntityModel.Get(idAbility.Id);
@ -8,15 +9,15 @@
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
<b>Ability Name:</b> @spell.Info().Name
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
<b>- Description:</b> @((MarkupString)info.Description)
</div>
@if (!info.Notes.Trim().Equals("")) {
<div>
<b>Notes:</b> @((MarkupString)info.Notes)
<b>- Notes:</b> @((MarkupString)info.Notes)
</div>
}
@ -24,24 +25,73 @@
@if (production != null) {
if (production.Energy != 0) {
<div>
<b> Energy: </b> @production.Energy
<b>- Energy: </b> @production.Energy
</div>
}
if (production.BuildTime != 0) {
<div>
<b> BuildTime: </b> @production.BuildTime
<b>- BuildTime: </b> @production.BuildTime
</div>
}
if (production.Cooldown != 0) {
<div>
<b> Cooldown: </b> @production.Cooldown
<b>- Cooldown: </b> @production.Cooldown
</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]
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">
<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>
}
@if (StyleType.Equals("Plain"))
{
<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>
<style>
<style>
.entityHeader {
display: flex;
flex-direction: row;
@ -36,11 +48,15 @@
}
}
</style>
}
@code {
[CascadingParameter]
public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
}

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

@ -1,4 +1,6 @@
<EntityDisplayComponent Title="Info">

@if (StyleType.Equals("Plain"))
{
@if (Entity.Info().Description != "") {
<div>
<b>Description:</b> @((MarkupString)Entity.Info().Description)
@ -6,9 +8,9 @@
}
@if (Entity.Info().Notes != "") {
<div>
<b>Notes:</b> @((MarkupString)Entity.Info().Notes)
</div>
<div>
<b>Notes:</b> @((MarkupString)Entity.Info().Notes)
</div>
}
@ -40,25 +42,76 @@
</div>
}
</div>
</EntityDisplayComponent>
}
else
{
<EntityDisplayComponent Title="Info">
@if (Entity.Info().Description != "") {
<div>
<b>Description:</b> @((MarkupString)Entity.Info().Description)
</div>
}
<style>
.infoDisplayContainer {
display: flex;
gap: 32px;
}
@if (Entity.Info().Notes != "") {
<div>
<b>Notes:</b> @((MarkupString)Entity.Info().Notes)
</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 {
flex-direction: column;
gap: 4px;
display: flex;
gap: 32px;
}
@@media only screen and (max-width: 1025px) {
.infoDisplayContainer {
flex-direction: column;
gap: 4px;
}
}
}
</style>
}
@code {
[CascadingParameter]
public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
}

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

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

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

@ -1,79 +1,157 @@
@if (@Production != null || Supply != null || Requirements.Count > 0) {
<EntityDisplayComponent Title="Production">
<div class="ProductionContainer">
@if (Production != null || Supply != null || Requirements.Count > 0) {
@if (StyleType.Equals("Plain"))
{
@if (Requirements.Count() > 0) {
<div>
@foreach (var requirement in Requirements) {
<div>
<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>
}
<div>
@foreach (var requirement in Requirements)
{
var replaced = DATA.Get()[requirement.DataType];
<div>
<span>
<b>@requirement.Requirement.Replace("_", " "):</b> @replaced.Info().Name
</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>
}
}
else
{
<style>
<EntityDisplayComponent Title="Production">
<div class="ProductionContainer">
@if (Requirements.Count() > 0) {
<div>
@foreach (var requirement in Requirements) {
<div>
<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 {
display: flex;
gap: 32px;
@ -87,12 +165,19 @@
}
</style>
}
}
@code {
[CascadingParameter]
public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
private EntityProductionModel Production => Entity.Production();
private List<EntityRequirementModel> Requirements => Entity.Requirements();
private EntitySupplyModel Supply => Entity.Supply();

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

@ -1,5 +1,7 @@
@if (Entity.IdPyreSpells().Count > 0) {
<EntityDisplayComponent Title="Pyre Spells">
@if (Entity.IdPyreSpells().Count > 0)
{
@if (StyleType.Equals("Plain"))
{
@foreach (var pyreSpell in Entity.IdPyreSpells()) {
var spell = EntityModel.Get(pyreSpell.Id);
@ -8,30 +10,68 @@
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
<b>Spell Name:</b> @spell.Info().Name
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)
<b>- Description:</b> @((MarkupString)info.Description)
</div>
<div>
@if (production != null) {
if (production.Pyre != 0) {
<b> Pyre: </b>
<b>- Pyre: </b>
@production.Pyre
}
if (production.BuildTime != 0) {
<b> BuildTime: </b>
<b>- BuildTime: </b>
@production.BuildTime
}
if (production.Cooldown != 0) {
<b> Cooldown: </b>
<b>- Cooldown: </b>
@production.Cooldown
}
}
</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]
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) {
<EntityDisplayComponent Title="Stats">
<div class="statContainer">
@if (Vitality != null) {
<div>
@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 (StyleType.Equals("Plain"))
{
@if (Vitality != null) {
<div>
@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>
}
@if (Vitality.IsEtheric) {
<div>
<b> + Etheric</b>
</div>
}
@if (Vitality.IsStructure) {
<div>
<b> + Structure</b>
</div>
}
</div>
}
@if (Movement != null) {
<div>
@if (!Movement.Speed.Equals(0)) {
<div>
<b>Speed:</b> @Movement.Speed
</div>
}
else {
@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>Speed:</b> Immobile
<b>Move Type:</b> @Movement.Movement
</div>
}
</div>
}
}
else
{
<EntityDisplayComponent Title="Stats">
<div class="statContainer">
@if (Vitality != null) {
<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>
</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 {
display: flex;
gap: 32px;
@ -74,10 +133,20 @@
}
</style>
}
}
@code {
[CascadingParameter]
public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
private EntityVitalityModel Vitality => Entity.Vitality();
private EntityMovementModel Movement => Entity.Movement();
}

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

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

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

@ -1,31 +1,46 @@
@{
var vanguard = Entity.VanguardAdded();
var isNull = Entity.VanguardAdded() == null ? "null" : "not null";
}
@if (vanguard != null) {
var immortalId = Entity.VanguardAdded().ImmortalId;
@if (Vanguard != null) {
var immortalId = Vanguard.ImmortalId;
var immortal = DATA.Get()[immortalId];
var replaced = DATA.Get()[Vanguard.ReplaceId];
<EntityDisplayComponent Title="Vanguard">
@if (StyleType.Equals("Plain"))
{
<div>
<b>Immortal:</b> @immortal.Info().Name
</div>
@if (!Vanguard.ReplaceId.Equals("")) {
<div>
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/>
<b>Replaces:</b> @replaced.Info().Name
</div>
@if (!Entity.VanguardAdded().ReplaceId.Equals("")) {
}
}
else
{
<EntityDisplayComponent Title="Vanguard">
<div>
<div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@Entity.VanguardAdded().ReplaceId"></EntityLabelComponent>
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/>
</div>
}
</div>
</EntityDisplayComponent>
@if (!Vanguard.ReplaceId.Equals("")) {
<div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@Vanguard.ReplaceId"></EntityLabelComponent>
</div>
}
</div>
</EntityDisplayComponent>
}
}
@code {
[CascadingParameter]
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) {
<EntityDisplayComponent Title="Vanguards">
@if (StyleType.Equals("Plain"))
{
@foreach (var data in Entity.IdVanguards()) {
var entity = EntityModel.Get(data.Id);
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
where building.Requirement == RequirementType.Production_Building
select building).First().DataType;
<div>
<div>
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
<b>Name:</b> @entity.Info().Name
</div>
<div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@vanguard.ReplaceId"/>
<b>- Replaces:</b> @replaced.Info().Name
</div>
<div>
<b>Built From:</b> <EntityLabelComponent EntityId="@productionBuilding"/>
<b>- Built From:</b> @immortal.Info().Name
</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 {
@ -29,4 +62,8 @@
[CascadingParameter]
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">
<div class="weaponsContainer">
@foreach (var data in Entity.Weapons()) {
@foreach (var data in Entity.Weapons())
{
<div>
<div>
<div class="damageContainer">
<div>
<b>Damage:</b> @data.Damage
</div>
@if (data.LightDamage != 0) {
@if (data.LightDamage != 0)
{
<div class="alternateDamage">
<i>vs Light: @data.LightDamage</i>&nbsp;
</div>
}
@if (data.MediumDamage != 0) {
@if (data.MediumDamage != 0)
{
<div class="alternateDamage">
<i>vs Medium: @data.MediumDamage</i>&nbsp;
</div>
}
@if (data.HeavyDamage != 0) {
@if (data.HeavyDamage != 0)
{
<div class="alternateDamage">
<i>vs Heavy: @data.HeavyDamage</i>&nbsp;
</div>
}
@if (data.EthericDamageBonus != 0) {
@if (data.EthericDamageBonus != 0)
{
<div class="alternateDamage">
<i>vs Etheric +@data.EthericDamageBonus</i>&nbsp;
</div>
}
@if (data.StructureDamageBonus != 0) {
@if (data.StructureDamageBonus != 0)
{
<div class="alternateDamage">
<i>vs Structure: +@data.StructureDamageBonus</i>&nbsp;
</div>
@ -38,7 +150,8 @@
<div>
<b>Range:</b> @data.Range
</div>
@if (data.SecondsBetweenAttacks > 0) {
@if (data.SecondsBetweenAttacks > 0)
{
<div>
<b>AttacksPerSecond:</b> @(1 / data.SecondsBetweenAttacks)
</div>
@ -46,7 +159,8 @@
(or <b>SecondsBetweenAttacks:</b> @data.SecondsBetweenAttacks)
</div>
}
else if (data.AttacksPerSecond > 0) {
else if (data.AttacksPerSecond > 0)
{
<div>
<b>AttacksPerSecond:</b> @data.AttacksPerSecond
</div>
@ -58,33 +172,36 @@
<div>
<b>Targets:</b> @data.Targets
</div>
@if (data.AttacksPerSecond != 0) {
<span>
@if (data.AttacksPerSecond != 0)
{
<div>
<b>DPS:</b> @(Math.Round(data.Damage * data.AttacksPerSecond))&nbsp;
</span>
@if (data.LightDamage != 0) {
<span>
<i>L: @(Math.Round(data.LightDamage * data.AttacksPerSecond))</i>&nbsp;
</span>
</div>
@if (data.LightDamage != 0)
{
<div>
<i>Light DPS: @(Math.Round(data.LightDamage * data.AttacksPerSecond))</i>&nbsp;
</div>
}
@if (data.MediumDamage != 0) {
<span>
<i>M: @(Math.Round(data.MediumDamage * data.AttacksPerSecond))</i>&nbsp;
</span>
@if (data.MediumDamage != 0)
{
<div>
<i>Medium DPS: @(Math.Round(data.MediumDamage * data.AttacksPerSecond))</i>&nbsp;
</div>
}
@if (data.HeavyDamage != 0) {
<span>
<i>H: @(Math.Round(data.HeavyDamage * data.AttacksPerSecond))</i>&nbsp;
</span>
@if (data.HeavyDamage != 0)
{
<div>
<i>Heavy DPS: @(Math.Round(data.HeavyDamage * data.AttacksPerSecond))</i>&nbsp;
</div>
}
}
</div>
}
</div>
</EntityDisplayComponent>
}
<style>
<style>
.weaponsContainer {
display: flex;
gap: 32px;
@ -106,9 +223,16 @@
}
</style>
}
}
@code {
[CascadingParameter]
public EntityModel? Entity { get; set; }
[CascadingParameter]
public string StyleType { get; set; } = "Detailed";
}

6
IGP/Pages/Documentation/DocumentationPage.razor

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

4
IGP/Program.cs

@ -13,6 +13,7 @@ using Services;
using Services.Immortal;
using Services.Website;
using Services.Development;
using IEntityDisplayService = Services.IEntityDisplayService;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Logging.SetMinimumLevel(LogLevel.Warning);
@ -33,6 +34,9 @@ builder.Services.AddSingleton<ITimingService, TimingService>();
builder.Services.AddSingleton<IMemoryTesterService, MemoryTesterService>();
builder.Services.AddSingleton<IEntityFilterService, EntityFilterService>();
builder.Services.AddSingleton<IEntityDisplayService, EntityDisplayService>();
builder.Services.AddSingleton(new HttpClient {
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.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.Immortal.Entity.Data;
using Model.Immortal.Entity.Parts;
using Model.Immortal.Types;
using YamlDotNet.Serialization;
namespace Model.Immortal.Entity;
@ -28,6 +28,13 @@ public class EntityModel {
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; }
// TODO Serilization currently being used for build orders
@ -71,6 +78,8 @@ public class EntityModel {
}
public static List<EntityModel> GetList() {
if (entityModels == null) entityModels = DATA.Get().Values.ToList();

1
Model/Model.csproj

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

13
Services/IServices.cs

@ -190,10 +190,23 @@ public interface IEntityFilterService {
public void Unsubscribe(EntityFilterAction action);
}
public interface IEntityService {
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 string GetFactionType();
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();
}
}
Loading…
Cancel
Save