Browse Source

feat(Database) Adding entity dialog

main
Jonathan McCaffrey 4 years ago
parent
commit
a9d3920237
  1. 10
      Components/Dialog/EntityComponent.razor
  2. 4
      Components/Dialog/EntityComponent.razor.css
  3. 38
      Components/Inputs/EntityLabelComponent.razor
  4. 27
      Components/Inputs/EntityLabelComponent.razor.css
  5. 2
      Components/Navigation/DesktopNavComponent.razor
  6. 1
      IGP/App.razor
  7. 66
      IGP/Dialog/EntityDialogComponent.razor
  8. 58
      IGP/Dialog/EntityDialogComponent.razor.css
  9. 11
      IGP/IGP.csproj
  10. 4
      IGP/Index.razor
  11. 6
      IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor
  12. 2
      IGP/Pages/BuildCalculator/Parts/InputPanelComponent.razor
  13. 2
      IGP/Pages/Database/DatabasePage.razor
  14. 25
      IGP/Pages/Database/Entity/EntityViewComponent.razor
  15. 2
      IGP/Pages/Database/Entity/Parts/EntityAbilitiesComponent.razor
  16. 2
      IGP/Pages/Database/Entity/Parts/EntityPassivesComponent.razor
  17. 9
      IGP/Pages/Database/Entity/Parts/EntityProductionComponent.razor
  18. 2
      IGP/Pages/Database/Entity/Parts/EntityPyreSpellsComponent.razor
  19. 2
      IGP/Pages/Database/Entity/Parts/EntityUpgradesComponent.razor
  20. 31
      IGP/Pages/Database/Entity/Parts/EntityVanguardAddedComponent.razor
  21. 21
      IGP/Pages/Database/Entity/Parts/EntityVanguardComponent.razor
  22. 13
      IGP/Pages/Database/Entity/Parts/EntityVanguardsComponent.razor
  23. 15
      IGP/Pages/Database/Parts/EntityFilterComponent.razor
  24. 27
      IGP/Portals/EntityDialogPortal.razor
  25. 2
      IGP/Program.cs
  26. 2
      IGP/_Imports.razor
  27. 4
      IGP/wwwroot/css/app.css
  28. 60
      Model/Entity/Data/DATA.cs
  29. 16
      Model/Entity/EntityModel.cs
  30. 10
      Model/Entity/Parts/EntityVanguardAddedModel.cs
  31. 7
      Model/Entity/Parts/EntityVanguardReplacedModel.cs
  32. 18
      Services/IServices.cs
  33. 18
      Services/Immortal/EntityFilterService.cs
  34. 3
      Services/Website/DialogService.cs
  35. 49
      Services/Website/EntityDialogService.cs
  36. 10
      Services/Website/WebsiteService.cs

10
Components/Dialog/EntityComponent.razor

@ -1,10 +0,0 @@

@code {
[Parameter]
public RenderFragment ChildContent { get; set; }
}

4
Components/Dialog/EntityComponent.razor.css

@ -1,4 +0,0 @@

.entityDialogBackground {
}

38
Components/Inputs/EntityLabelComponent.razor

@ -0,0 +1,38 @@
@using Model.Immortal.Entity
@using Services.Website
@using System.ComponentModel.DataAnnotations
@using Model.Immortal.Entity.Data
@using Services
@inject IEntityDialogService entityDialogService
@if (entity == null)
{
<div>Add a entity</div>
}
else
{
<button class="entityLabel @entity.Descriptive.ToLower()" @onclick="EntityLabelClicked">@entity.Info().Name</button>
}
@code {
[Parameter] public string EntityId { get; set; }
private EntityModel entity = null;
protected override void OnInitialized()
{
entity = DATA.Get()[EntityId];
Console.Write(entity.Info().Name);
}
void EntityLabelClicked()
{
Console.WriteLine("EntityLabelClicked()");
entityDialogService.AddDialog(EntityId);
}
}

27
Components/Inputs/EntityLabelComponent.razor.css

@ -0,0 +1,27 @@

.entityLabel {
font-weight: bolder;
box-shadow: 1px 1px 0 0 rgba(0,0,0,0.2);
padding-right: 4px;
}
.entityLabel:hover {
background-color: var(--primary-hover);
}
.army {
color: cyan;
}
.building {
color: greenyellow;
}
.ability {
color: red;
}
.passive {
color: yellow;
}

2
Components/Navigation/DesktopNavComponent.razor

@ -7,7 +7,6 @@
@implements IDisposable
<div onmouseleave="@HoverOut" class="desktopNavContainer">
<div class="menuHeader" @onmouseover="() => NavigationService.ChangeNavigationState(NavigationStateType.Hovering_Menu)">
<NavLink href="/" class="websiteTitle">
@ -42,7 +41,6 @@
width: 100vw;
height: 40px;
background-color: rgba(255,255,255,0.1);
z-index: 1001;
}
.menuHeader {

1
IGP/App.razor

@ -13,6 +13,7 @@
</NotFound>
</Router>
<EntityDialogPortal/>
<style>
a {

66
IGP/Dialog/EntityDialogComponent.razor

@ -0,0 +1,66 @@
@inject IEntityDialogService entityDialogService
<div class="dialogBackground" onclick="@CloseDialog">
<div class="dialogContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
@if (entity == null)
{
<div>Entity is null</div>
}
else
{
<div class="dialogHeader">
<div class="dialogTitle">
@entity.Info().Name
</div>
</div>
<div class="dialogContent">
<div>
<EntityVanguardAddedComponent Entity=@entity></EntityVanguardAddedComponent>
<EntityInfoComponent Entity=@entity></EntityInfoComponent>
<EntityVanguardsComponent Entity=@entity></EntityVanguardsComponent>
<EntityProductionComponent Entity=@entity></EntityProductionComponent>
<EntityStatsComponent Entity=@entity></EntityStatsComponent>
<EntityMechanicsComponent Entity=@entity></EntityMechanicsComponent>
<EntityPassivesComponent Entity=@entity></EntityPassivesComponent>
<EntityPyreSpellsComponent Entity=@entity></EntityPyreSpellsComponent>
<EntityUpgradesComponent Entity=@entity></EntityUpgradesComponent>
<EntityWeaponsComponent Entity=@entity></EntityWeaponsComponent>
<EntityAbilitiesComponent Entity=@entity></EntityAbilitiesComponent>
</div>
</div>
<div class="dialogFooter"></div>
}
</div>
</div>
@code {
private EntityModel entity = null;
[Parameter] public string EntityId { get; set; }
protected override void OnParametersSet()
{
if (entityDialogService.GetEntityId() == null)
{
return;
}
entity = DATA.Get()[EntityId];
}
public void CloseDialog()
{
entityDialogService.CloseDialog();
}
}

58
IGP/Dialog/EntityDialogComponent.razor.css

@ -0,0 +1,58 @@

.dialogBackground {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
}
.dialogContainer {
margin-left: auto;
margin-right: auto;
margin-top: 64px;
width: 800px;
height: 600px;
background-color: var(--background);
border-width: var(--dialog-border-width);
border-style: solid;
border-color: var(--dialog-border-color);
border-radius: var(--dialog-radius);
box-shadow: 1px 2px 2px black;
}
.dialogHeader {
width: 100%;
background-color: var(--accent);
border-top-left-radius: var(--dialog-radius);
border-top-right-radius: var(--dialog-radius);
border-bottom: 4px solid black;
}
.dialogTitle {
padding: 16px;
font-size: 2rem;
font-weight: bold;
}
.dialogContent {
flex-grow: 1;
padding: 6px;
overflow-y: auto;
overflow-x: hidden;
height: 500px;
}
.dialogFooter {
width: 100%;
height: 6px;
background-color: var(--paper);
}

11
IGP/IGP.csproj

@ -15,16 +15,6 @@
<DefineConstants>TRACE;NO_SQL</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="Pages\Agile\AgilePage.razor.css" />
<None Remove="Pages\ChangeLogPage.razor.css" />
</ItemGroup>
<ItemGroup>
<Content Include="Pages\Agile\AgilePage.razor.css" />
<Content Include="Pages\ChangeLogPage.razor.css" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all" />
@ -45,4 +35,5 @@
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Services\Services.csproj" />
</ItemGroup>
</Project>

4
IGP/Index.razor

@ -2,5 +2,7 @@
@layout PageLayout
<HomePage></HomePage>
<HomePage></HomePage>

6
IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor

@ -52,7 +52,7 @@
continue;
}
var isVanguard = entity.Vanguard() != null;
var isVanguard = entity.VanguardAdded() != null;
var style = isVanguard ? "font-weight: bold;" : "";
<div style="@style">@entity.Info()?.Name</div>
@ -126,7 +126,7 @@
// Move to Filter Service
bool InvalidVanguard(EntityModel entity) {
if (entity.Vanguard() != null && entity.Vanguard()?.Immortal != FilterService.GetImmortalType() && FilterService.GetImmortalType() != ImmortalType.Any) {
if (entity.VanguardAdded() != null && entity.VanguardAdded()?.ImmortalId != FilterService.GetImmortalType() && FilterService.GetImmortalType() != ImmortalType.Any) {
return true;
}
@ -138,7 +138,7 @@
if (entity.Replaceds().Count > 0) {
var isReplaced = false;
foreach (var replaced in entity.Replaceds()) {
if (FilterService.GetImmortalType() == replaced.Immortal) {
if (FilterService.GetImmortalType() == replaced.ImmortalId) {
isReplaced = true;
break;
}

2
IGP/Pages/BuildCalculator/Parts/InputPanelComponent.razor

@ -3,7 +3,7 @@
@onkeydown="HandleKeyDown"
@onkeyup="HandleKeyUp"
@onkeydown:preventDefault="true"
colorwn:stopPropagation="true">
@onkeydown:stopPropagation="true">
@ChildContent
</div>

2
IGP/Pages/Database/DatabasePage.razor

@ -170,7 +170,7 @@
}
else {
immortals = (from entity in factions
where entity.Vanguard() == null || entity.Vanguard().Immortal == selectedImmortalType
where entity.VanguardAdded() == null || entity.VanguardAdded().ImmortalId == selectedImmortalType
select entity).ToList();
}

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

@ -1,11 +1,11 @@
@if (Entity != null) {
var isVanguard = Entity.Vanguard() != null ? " vanguard" : "";
var isVanguard = Entity.VanguardAdded() != null ? " vanguard" : "";
<div class="enititiesContainer @isVanguard">
<EntityHeaderComponent Entity=Entity></EntityHeaderComponent>
<div class="entityPartsContainer">
<EntityVanguardComponent Entity=Entity></EntityVanguardComponent>
<div>
<EntityVanguardAddedComponent Entity=Entity></EntityVanguardAddedComponent>
<EntityInfoComponent Entity=Entity></EntityInfoComponent>
<EntityVanguardsComponent Entity=Entity></EntityVanguardsComponent>
<EntityProductionComponent Entity=Entity></EntityProductionComponent>
@ -30,28 +30,11 @@
display: flex;
flex-wrap: wrap;
}
.vanguard {
border: 4px solid var(--accent);
border-radius: 8px;
}
.entityPartsContainer {
display: flex;
flex-direction: column;
flex-wrap: wrap;
width: 100%;
}
@@media only screen and (max-width: 1025px) {
.enititiesContainer {
padding: 0px;
}
.entityPartsContainer {
margin: 0px;
}
}
</style>

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

@ -8,7 +8,7 @@
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)

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

@ -9,7 +9,7 @@
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@passive.DataType"/>
</div>
<div style="max-width: 600px;">
<b>Description:</b> @((MarkupString)info.Description)

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

@ -13,7 +13,7 @@
<div>
<span>
<b>@requirement.Requirement.Replace("_", " "):</b> @requirement.Name
<b>@requirement.Requirement.Replace("_", " "):</b> <EntityLabelComponent EntityId="@requirement.DataType"/>
</span>
</div>
}
@ -46,6 +46,13 @@
<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>

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

@ -8,7 +8,7 @@
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@spell.DataType"/>
</div>
<div>
<b>Description:</b> @((MarkupString)info.Description)

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

@ -5,7 +5,7 @@
var entity = EntityModel.Get(upgradeId.Id);
<div>
<div>
<b>Name:</b> @entity.Info().Name
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
</div>
<div>
<b>Description:</b> @entity.Info().Description

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

@ -0,0 +1,31 @@
@{
var vanguard = Entity.VanguardAdded();
var isNull = Entity.VanguardAdded() == null ? "null" : "not null";
}
@if (vanguard != null) {
var immortalId = Entity.VanguardAdded().ImmortalId;
var immortal = DATA.Get()[immortalId];
<EntityDisplayComponent Title="Vanguard">
<div>
<div>
<b>Immortal:</b> <EntityLabelComponent EntityId="@immortal.DataType"/>
</div>
@if (!Entity.VanguardAdded().ReplaceId.Equals("")) {
<div>
<b>Replaces:</b> <EntityLabelComponent EntityId="@Entity.VanguardAdded().ReplaceId"></EntityLabelComponent>
</div>
}
</div>
</EntityDisplayComponent>
}
@code {
[Parameter]
public EntityModel Entity { get; set; }
}

21
IGP/Pages/Database/Entity/Parts/EntityVanguardComponent.razor

@ -1,21 +0,0 @@
@if (Entity.Vanguard() != null) {
<EntityDisplayComponent Title="Vanguard">
<div>
<div>
<b>Immortal:</b> @Entity.Vanguard().Immortal.Replace("_", " ")
</div>
@if (Entity.Vanguard().Replaces != "") {
<div>
<b>Replaces:</b> @Entity.Vanguard().Replaces.Replace("_", " ")
</div>
}
</div>
</EntityDisplayComponent>
}
@code {
[Parameter]
public EntityModel Entity { get; set; }
}

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

@ -3,24 +3,21 @@
@foreach (var data in Entity.IdVanguards()) {
var entity = EntityModel.Get(data.Id);
var info = entity.Info();
var production = entity.Production();
var requirements = entity.Requirements();
var vanguard = entity.Vanguard();
var vanguard = entity.VanguardAdded();
var productionBuilding = (from building in requirements
where building.Requirement == RequirementType.Production_Building
select building).First().Name;
select building).First().DataType;
<div>
<div>
<b>Name:</b> @info.Name
<b>Name:</b> <EntityLabelComponent EntityId="@entity.DataType"/>
</div>
<div>
<b>Replaces:</b> @vanguard.Replaces
<b>Replaces:</b> <EntityLabelComponent EntityId="@vanguard.ReplaceId"/>
</div>
<div>
<b>Built From:</b> @productionBuilding
<b>Built From:</b> <EntityLabelComponent EntityId="@productionBuilding"/>
</div>
</div>
}

15
IGP/Pages/Database/Parts/EntityFilterComponent.razor

@ -13,12 +13,15 @@
@if (EntityFilterService.GetFactionType() != "Any" && EntityFilterService.GetFactionType() != "None") {
<div class="filterContainer">
@foreach (var choice in EntityFilterService.GetImmortalChoices()) {
@foreach (var choice in EntityFilterService.GetImmortalChoices())
{
var name = DATA.Get()[choice].Info().Name;
var styleClass = "";
if (choice.Equals(EntityFilterService.GetImmortalType())) {
styleClass = "selected";
}
<button class="choiceButton @styleClass" @onclick="@(e => OnChangeImmortal(choice))">@choice</button>
<button class="choiceButton @styleClass" @onclick="@(e => OnChangeImmortal(choice))">@name</button>
}
</div>
}
@ -52,10 +55,10 @@
<FormLabelComponent>Immortal</FormLabelComponent>
<ChildContent>
<option value="@ImmortalType.Any" selected>Any</option>
<option value="@ImmortalType.Mala">Mala</option>
<option value="@ImmortalType.Xol">Xol</option>
<option value="@ImmortalType.Orzum">Orzum</option>
<option value="@ImmortalType.Ajari">Ajari</option>
<option value="@DataType.IMMORTAL_Mala">Mala</option>
<option value="@DataType.IMMORTAL_Xol">Xol</option>
<option value="@DataType.IMMORTAL_Orzum">Orzum</option>
<option value="@DataType.IMMORTAL_Ajari">Ajari</option>
</ChildContent>
</FormSelectComponent>

27
IGP/Portals/EntityDialogPortal.razor

@ -0,0 +1,27 @@
@implements IDisposable;
@inject IEntityDialogService entityDialogService
@if (entityDialogService.HasDialog())
{
<EntityDialogComponent EntityId="@entityDialogService.GetEntityId()"></EntityDialogComponent>
}
@code {
protected override void OnInitialized()
{
entityDialogService.Subscribe(OnUpdate);
}
public void Dispose() {
entityDialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}

2
IGP/Program.cs

@ -38,6 +38,8 @@ builder.Services.AddSingleton(new HttpClient {
});
builder.Services.AddSingleton<IEntityDialogService, EntityDialogService>();
#if NO_SQL
#else

2
IGP/_Imports.razor

@ -9,7 +9,9 @@
@using Components.Navigation
@using Components.Shared
@using Components.Utils
@using IGP.Portals
@using IGP.Pages
@using IGP.Dialog
@using IGP.Pages.Agile.Parts
@using IGP.Pages.BuildCalculator.Parts
@using IGP.Pages.Database.Entity

4
IGP/wwwroot/css/app.css

@ -17,6 +17,10 @@
--paper-border: #151516;
--info: #451376;
--info-border: #210b36;
--dialog-border-color: black;
--dialog-border-width: 2px;
--dialog-radius: 6px;
}
html {

60
Model/Entity/Data/DATA.cs

@ -466,7 +466,7 @@ public class DATA {
.AddPart(new EntityTierModel { Tier = 1 })
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Replaces = "Sipari", Immortal = ImmortalType.Orzum })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_Sipari, ImmortalId = DataType.IMMORTAL_Orzum })
.AddPart(new EntityProductionModel { Alloy = 100, BuildTime = 24 })
.AddPart(new EntitySupplyModel { Takes = 4 })
.AddPart(new EntityVitalityModel { Health = 180, DefenseLayer = 100, Armor = ArmorType.Light })
@ -504,7 +504,7 @@ public class DATA {
Name = "Angelarium", DataType = DataType.BUILDING_Angelarium,
Requirement = RequirementType.Production_Building
})
.AddPart(new EntityVanguardAddedModel { Replaces = "Warden", Immortal = ImmortalType.Orzum })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_Warden, ImmortalId = DataType.IMMORTAL_Orzum })
.AddPart(new EntityMovementModel { Speed = 340, Movement = MovementType.Air })
}, {
DataType.VANGUARD_Saoshin_Ajari,
@ -517,7 +517,7 @@ public class DATA {
.AddPart(new EntityTierModel { Tier = 1.5f })
.AddPart(new EntityHotkeyModel { Hotkey = "E", HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Replaces = "Magi", Immortal = ImmortalType.Ajari })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_Magi, ImmortalId = DataType.IMMORTAL_Ajari })
.AddPart(new EntityProductionModel { Alloy = 75, Ether = 75, BuildTime = 35 })
.AddPart(new EntitySupplyModel { Takes = 4 })
.AddPart(new EntityVitalityModel
@ -546,7 +546,7 @@ public class DATA {
.AddPart(new EntityTierModel { Tier = 2 })
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HoldSpace = true, HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Replaces = "Hallower", Immortal = ImmortalType.Ajari })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_Hallower, ImmortalId = DataType.IMMORTAL_Ajari })
.AddPart(new EntityProductionModel { Alloy = 150, Ether = 100, BuildTime = 40 })
.AddPart(new EntitySupplyModel { Takes = 5 })
.AddPart(new EntityVitalityModel
@ -578,7 +578,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HoldSpace = true, HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Replaces = "Under Spine", Immortal = ImmortalType.Mala })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_Underspine, ImmortalId = DataType.IMMORTAL_Mala })
.AddPart(new EntityProductionModel { Alloy = 175, Ether = 50, BuildTime = 35 })
.AddPart(new EntitySupplyModel { Takes = 5 })
.AddPart(new EntityVitalityModel
@ -602,7 +602,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "F", HoldSpace = true, HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Replaces = "Red Seer", Immortal = ImmortalType.Mala })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_RedSeer, ImmortalId = DataType.IMMORTAL_Mala })
.AddPart(new EntityProductionModel { Alloy = 60, Ether = 150, BuildTime = 45 })
.AddPart(new EntitySupplyModel { Takes = 4 })
.AddPart(new EntityVitalityModel {
@ -627,7 +627,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "W", HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Replaces = "Masked Hunter", Immortal = ImmortalType.Xol })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_MaskedHunter, ImmortalId = DataType.IMMORTAL_Xol })
.AddPart(new EntityProductionModel { Alloy = 50, Ether = 0, BuildTime = 40 })
.AddPart(new EntitySupplyModel { Takes = 2 })
.AddPart(new EntityVitalityModel
@ -650,7 +650,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "E", HotkeyGroup = "Z" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Replaces = "Bloodbound", Immortal = ImmortalType.Xol })
.AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UNIT_Bloodbound, ImmortalId = DataType.IMMORTAL_Xol })
.AddPart(new EntityProductionModel { Alloy = 80, Ether = 80, BuildTime = 35 })
.AddPart(new EntitySupplyModel { Takes = 4 })
.AddPart(new EntityVitalityModel {
@ -686,7 +686,7 @@ public class DATA {
})
.AddPart(new EntityTierModel { Tier = 1 })
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HotkeyGroup = "Z" })
.AddPart(new EntityVanguardReplacedModel { Immortal = ImmortalType.Orzum, ReplacedBy = "Zentari" })
.AddPart(new EntityVanguardReplacedModel { ImmortalId = DataType.IMMORTAL_Orzum, ReplacedById = DataType.VANGUARD_Zentari_Orzum })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityProductionModel { Alloy = 75, BuildTime = 25 })
.AddPart(new EntitySupplyModel { Takes = 3 })
@ -713,7 +713,7 @@ public class DATA {
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityProductionModel { Alloy = 75, Ether = 75, BuildTime = 35 })
.AddPart(new EntitySupplyModel { Takes = 3 })
.AddPart(new EntityVanguardReplacedModel { Immortal = ImmortalType.Ajari, ReplacedBy = "Saoshin" })
.AddPart(new EntityVanguardReplacedModel { ImmortalId = DataType.IMMORTAL_Ajari, ReplacedById = DataType.VANGUARD_Saoshin_Ajari })
.AddPart(new EntityRequirementModel {
Name = "Legion Hall", DataType = DataType.BUILDING_LegionHall,
Requirement = RequirementType.Production_Building
@ -851,7 +851,7 @@ public class DATA {
.AddPart(new EntityTierModel { Tier = 2.5f })
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HoldSpace = true, HotkeyGroup = "Z" })
.AddPart(new EntityVanguardReplacedModel
{ Immortal = ImmortalType.Ajari, ReplacedBy = "Ark Mother" })
{ ImmortalId = DataType.IMMORTAL_Ajari, ReplacedById = DataType.VANGUARD_ArkMother_Ajari })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityProductionModel { Alloy = 150, Ether = 75, BuildTime = 35 })
.AddPart(new EntitySupplyModel { Takes = 5 })
@ -932,7 +932,7 @@ public class DATA {
})
.AddPart(new EntityTierModel { Tier = 3 })
.AddPart(new EntityHotkeyModel { Hotkey = "R", HoldSpace = true, HotkeyGroup = "Z" })
.AddPart(new EntityVanguardReplacedModel { Immortal = ImmortalType.Orzum, ReplacedBy = "Sceptre" })
.AddPart(new EntityVanguardReplacedModel { ImmortalId = DataType.IMMORTAL_Orzum, ReplacedById = DataType.VANGUARD_Sceptre_Orzum })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityProductionModel { Alloy = 175, Ether = 100, BuildTime = 40 })
.AddPart(new EntitySupplyModel { Takes = 6 })
@ -997,7 +997,7 @@ public class DATA {
.AddPart(new EntityTierModel { Tier = 1 })
.AddPart(new EntityHotkeyModel { Hotkey = "W", HotkeyGroup = "Z" })
.AddPart(new EntityVanguardReplacedModel
{ Immortal = ImmortalType.Xol, ReplacedBy = "Bone Stalker" })
{ ImmortalId = DataType.IMMORTAL_Xol, ReplacedById = DataType.VANGUARD_BoneStalker_Xol })
.AddPart(new EntityRequirementModel {
Name = "Altar of the Worthy", DataType = DataType.BUILDING_AltarOfTheWorthy,
Requirement = RequirementType.Production_Building
@ -1043,7 +1043,7 @@ public class DATA {
.AddPart(new EntityInfoModel { Name = "Bloodbound", Descriptive = DescriptiveType.Assassin })
.AddPart(new EntityTierModel { Tier = 3 })
.AddPart(new EntityVanguardReplacedModel
{ Immortal = ImmortalType.Xol, ReplacedBy = "White Wood Wraith" })
{ ImmortalId = DataType.IMMORTAL_Xol, ReplacedById = DataType.VANGUARD_WhiteWoodReaper_Xol })
.AddPart(new EntityRequirementModel {
Name = "Altar of the Worthy", DataType = DataType.BUILDING_AltarOfTheWorthy,
Requirement = RequirementType.Production_Building
@ -1071,7 +1071,7 @@ public class DATA {
.AddPart(new EntityInfoModel { Name = "Red Seer", Descriptive = DescriptiveType.Elite_Caster })
.AddPart(new EntityTierModel { Tier = 3 })
.AddPart(new EntityVanguardReplacedModel
{ Immortal = ImmortalType.Mala, ReplacedBy = "Dread Sister" })
{ ImmortalId = DataType.IMMORTAL_Mala, ReplacedById = DataType.VANGUARD_DreadSister_Mala })
.AddPart(new EntityRequirementModel {
Name = "Altar of the Worthy", DataType = DataType.BUILDING_AltarOfTheWorthy,
Requirement = RequirementType.Production_Building
@ -1100,7 +1100,7 @@ public class DATA {
.AddPart(new EntityInfoModel
{ Name = "Underspine", Descriptive = DescriptiveType.Force_Multiplier, Notes = "Has +5 HP regen when burrowed."})
.AddPart(new EntityTierModel { Tier = 2 })
.AddPart(new EntityVanguardReplacedModel { Immortal = ImmortalType.Mala, ReplacedBy = "Incubator" })
.AddPart(new EntityVanguardReplacedModel { ImmortalId = DataType.IMMORTAL_Mala, ReplacedById = DataType.VANGUARD_Incubator_Mala })
.AddPart(new EntityRequirementModel {
Name = "Amber Womb", DataType = DataType.BUILDING_AmberWomb,
Requirement = RequirementType.Production_Building
@ -1502,7 +1502,7 @@ public class DATA {
})
.AddPart(new EntityProductionModel { Alloy = 75, Ether = 120, BuildTime = 80 })
.AddPart(new EntityVanguardReplacedModel
{ Immortal = ImmortalType.Xol, ReplacedBy = "Birthing Storm" })
{ ImmortalId = DataType.IMMORTAL_Xol, ReplacedById = DataType.ABILITY_BirthingStorm })
},
{
DataType.UPGRADE_BirthingStorm,
@ -1515,7 +1515,7 @@ public class DATA {
Requirement = RequirementType.Research_Building
})
.AddPart(new EntityProductionModel { Alloy = 75, Ether = 120, BuildTime = 80 })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Mala, Replaces = "Blood Plague" })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Mala, ReplaceId = DataType.ABILITY_BloodPlague })
},
@ -1783,7 +1783,7 @@ public class DATA {
"After a short delay, enemy units in the target area receive a debuff which causes them to take double damage from all attacks for a duration."
})
.AddPart(new EntityHotkeyModel { Hotkey = "R", HotkeyGroup = "D" })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Xol, Replaces = "Culling Strike" })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Xol, ReplaceId = DataType.ABILITY_CullingStrike })
.AddPart(new EntityProductionModel { Energy = 40 })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
}, {
@ -1838,7 +1838,7 @@ public class DATA {
"Roots all units for several seconds, then leaves them slowed for several seconds after."
})
.AddPart(new EntityHotkeyModel { Hotkey = "Q", HotkeyGroup = "D" })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Mala })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Mala })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityProductionModel { Energy = 50, Cooldown = 10 })
}, {
@ -1851,7 +1851,7 @@ public class DATA {
Notes = "Deals 20 damage + 15% of max life of the target immediately upon affecting the enemy unit. It deals the same damage again after 8 seconds. If the unit dies during those 8 seconds (including the final burst), spawns 1 quitl every 2 supply of the dead unit, rounded up"
})
.AddPart(new EntityHotkeyModel { Hotkey = "W", HotkeyGroup = "D" })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Mala })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Mala })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityProductionModel { Energy = 80, Cooldown = 2 })
}, {
@ -1863,7 +1863,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "R", HoldSpace = true, HotkeyGroup = "D" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Mala, Replaces = "Acaaluk" })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Mala, ReplaceId = DataType.UNIT_Acaaluk })
.AddPart(new EntityProductionModel { Energy = 80, BuildTime = 4, Cooldown = 20 })
.AddPart(new EntitySupplyModel { Takes = 0 })
.AddPart(new EntityRequirementModel { Name = "Red Seer", DataType = DataType.UNIT_RedSeer })
@ -1919,7 +1919,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "R", HotkeyGroup = "1" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Orzum })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Orzum })
.AddPart(new EntityProductionModel { Pyre = 100, Cooldown = 15 })
}, {
DataType.ISPELL_EmpireUnbroken,
@ -1930,8 +1930,8 @@ public class DATA {
@"Structures in target area <b style=""color:lime"">reduce incoming damage significantly</b> for several seconds."
})
.AddPart(new EntityHotkeyModel { Hotkey = "E", HotkeyGroup = "1" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Orzum })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Orzum })
.AddPart(new EntityProductionModel { Pyre = 50, Cooldown = 15 })
}, {
DataType.ISPELL_InfuseTroops,
@ -1954,7 +1954,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "E", HotkeyGroup = "1" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Ajari })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Ajari })
.AddPart(new EntityProductionModel { Pyre = 50, Cooldown = 60 })
}, {
DataType.ISPELL_HeavensAegis,
@ -1966,7 +1966,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "R", HotkeyGroup = "1" })
.AddPart(new EntityFactionModel { Faction = FactionType.QRath })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Ajari })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Ajari })
.AddPart(new EntityProductionModel { Pyre = 150, Cooldown = 120 })
},
// Immortal Spells
@ -2004,7 +2004,7 @@ public class DATA {
Description = "Sacrifice target unit to create an area that regenerates life and mana."
})
.AddPart(new EntityHotkeyModel { Hotkey = "E", HotkeyGroup = "1" })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Mala })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Mala })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityProductionModel { Pyre = 40, Cooldown = 60 })
}, {
@ -2016,7 +2016,7 @@ public class DATA {
})
.AddPart(new EntityHotkeyModel { Hotkey = "R", HotkeyGroup = "1" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Mala })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Mala })
.AddPart(new EntityProductionModel { Pyre = 130, Cooldown = 30 })
}, {
DataType.ISPELL_GreatHunt,
@ -2024,7 +2024,7 @@ public class DATA {
.AddPart(new EntityInfoModel { Name = "Great Hunt" })
.AddPart(new EntityHotkeyModel { Hotkey = "R", HotkeyGroup = "1" })
.AddPart(new EntityFactionModel { Faction = FactionType.Aru })
.AddPart(new EntityVanguardAddedModel { Immortal = ImmortalType.Xol })
.AddPart(new EntityVanguardAddedModel { ImmortalId = DataType.IMMORTAL_Xol })
.AddPart(new EntityProductionModel { Pyre = 150, Cooldown = 120 })
},

16
Model/Entity/EntityModel.cs

@ -28,10 +28,6 @@ public class EntityModel {
IsSpeculative = isSpeculative;
}
[Key] public int Id { get; set; } = 1;
public string DataType { get; set; }
// TODO Serilization currently being used for build orders
@ -41,12 +37,7 @@ public class EntityModel {
public bool IsSpeculative { get; set; }
//TODO Use these values
public string Name { get; set; } = "";
public string Descriptive { get; set; } = DescriptiveType.None;
public string Description { get; set; } = "";
public string Notes { get; set; }
public EntityModel Clone() {
return (EntityModel)MemberwiseClone();
@ -124,13 +115,14 @@ public class EntityModel {
string immortal) {
if (hotkey == null || hotkey == "") return null;
//TODO
var foundList = from entity in GetEntitiesByHotkey()[hotkey]
where entity.Hotkey()?.HotkeyGroup == hotkeyGroup
&& entity.Hotkey()?.HoldSpace == holdSpace
&& entity.Faction()?.Faction == faction
&& (entity.Vanguard()?.Immortal == immortal || entity.Vanguard() == null)
&& (entity.VanguardAdded()?.ImmortalId == immortal || entity.VanguardAdded() == null)
&& (entity.Replaceds().Count == 0 || (from replace in entity.Replaceds()
where replace.Immortal == immortal
where replace.ImmortalId == immortal
select replace).ToList().Count == 0)
select entity;
@ -190,7 +182,7 @@ public class EntityModel {
}
public EntityVanguardAddedModel Vanguard() {
public EntityVanguardAddedModel VanguardAdded() {
return (EntityVanguardAddedModel)EntityParts.Find(x => x.GetType() == typeof(EntityVanguardAddedModel));
}

10
Model/Entity/Parts/EntityVanguardAddedModel.cs

@ -1,9 +1,13 @@
using Model.Immortal.Types;
using System;
using Model.Immortal.Entity.Data;
using Model.Immortal.Types;
namespace Model.Immortal.Entity.Parts;
public class EntityVanguardAddedModel : IEntityPartInterface {
public string Type { get; set; } = "EntityVanguardAddedModel";
public string Immortal { get; set; } = ImmortalType.Ajari;
public string Replaces { get; set; } = "";
public string ImmortalId { get; set; } = DataType.IMMORTAL_Ajari;
public string ReplaceId { get; set; } = "";
}

7
Model/Entity/Parts/EntityVanguardReplacedModel.cs

@ -1,9 +1,10 @@
using Model.Immortal.Types;
using Model.Immortal.Entity.Data;
using Model.Immortal.Types;
namespace Model.Immortal.Entity.Parts;
public class EntityVanguardReplacedModel : IEntityPartInterface {
public string Type { get; set; } = "EntityVanguardReplacedModel";
public string Immortal { get; set; } = ImmortalType.Ajari;
public string ReplacedBy { get; set; } = "";
public string ImmortalId { get; set; } = DataType.IMMORTAL_Xol;
public string ReplacedById { get; set; } = "";
}

18
Services/IServices.cs

@ -1,10 +1,14 @@

#if NO_SQL
#else
using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
using Model.Immortal.BuildOrders;
using Model.Immortal.Economy;
using Model.Immortal.Entity;
using Model.Immortal.Entity.Data;
using Model.Immortal.MemoryTester;
using Model.Website;
using Model.Website.Enums;
@ -14,6 +18,20 @@ using Services.Immortal;
namespace Services;
public interface IEntityDialogService
{
public void Subscribe(Action action);
public void Unsubscribe(Action action);
public void AddDialog(string entityId);
public void CloseDialog();
public string? GetEntityId();
public bool HasDialog();
}
public interface IWebsiteService {
#if NO_SQL
public List<WebPageModel> WebPageModels { get; set; }

18
Services/Immortal/EntityFilterService.cs

@ -14,12 +14,12 @@ public enum EntityFilterEvent {
public class EntityFilterService : IEntityFilterService {
private readonly List<string> _entityChoices = new();
private readonly List<string> _factionChoices = new() { FactionType.QRath, FactionType.Aru, FactionType.Any };
private readonly List<string> _factionChoices = new() { FactionType.Any, FactionType.QRath, FactionType.Aru };
private readonly List<string> _immortalChoices = new();
private string _entityType = EntityType.Army;
private string _searchText = "";
private string _selectedFaction = FactionType.QRath;
private string _selectedImmortal = ImmortalType.Orzum;
private string _selectedFaction = FactionType.Any;
private string _selectedImmortal = ImmortalType.Any;
public EntityFilterService() {
@ -118,7 +118,7 @@ public class EntityFilterService : IEntityFilterService {
_immortalChoices.Clear();
//TODO Consider getting these values from the database
if (_selectedFaction == FactionType.QRath || _selectedFaction == FactionType.Any) {
/*if (_selectedFaction == FactionType.QRath || _selectedFaction == FactionType.Any) {
_immortalChoices.Add(ImmortalType.Orzum);
_immortalChoices.Add(ImmortalType.Ajari);
}
@ -126,6 +126,16 @@ public class EntityFilterService : IEntityFilterService {
if (_selectedFaction == FactionType.Aru || _selectedFaction == FactionType.Any) {
_immortalChoices.Add(ImmortalType.Mala);
_immortalChoices.Add(ImmortalType.Xol);
}*/
if (_selectedFaction == FactionType.QRath || _selectedFaction == FactionType.Any) {
_immortalChoices.Add(DataType.IMMORTAL_Orzum);
_immortalChoices.Add(DataType.IMMORTAL_Ajari);
}
if (_selectedFaction == FactionType.Aru || _selectedFaction == FactionType.Any) {
_immortalChoices.Add(DataType.IMMORTAL_Mala);
_immortalChoices.Add(DataType.IMMORTAL_Xol);
}
}

3
Services/Website/DialogService.cs

@ -1,3 +0,0 @@
namespace Services.Website;
public class DialogService { }

49
Services/Website/EntityDialogService.cs

@ -0,0 +1,49 @@
using Model.Immortal.Entity;
namespace Services.Website;
public class EntityDialogService : IEntityDialogService
{
private string? entityId = null;
private event Action _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}
public void Subscribe(Action action) {
_onChange += action;
}
public void Unsubscribe(Action action) {
_onChange += action;
}
public void AddDialog(string id)
{
entityId = id;
NotifyDataChanged();
}
public void CloseDialog()
{
entityId = null;
NotifyDataChanged();
}
public bool HasDialog()
{
return entityId != null;
}
public string? GetEntityId()
{
return entityId;
}
}

10
Services/Website/WebsiteService.cs

@ -1,6 +1,10 @@
using System.Net.Http.Json;
#if !NO_SQL
using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
using Model.Website;
namespace Services.Work;
@ -10,6 +14,10 @@ public class WebsiteService : IWebsiteService {
private bool isLoaded;
private event Action _onChange;
public WebsiteService(HttpClient httpClient) {
this.httpClient = httpClient;
}
@ -76,8 +84,6 @@ public class WebsiteService : IWebsiteService {
NotifyDataChanged();
}
private event Action _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}

Loading…
Cancel
Save