feat(Variables) Added variable service and new game patch
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Model;
|
||||||
using Model.Doc;
|
using Model.Doc;
|
||||||
using Model.Git;
|
using Model.Git;
|
||||||
using Model.Notes;
|
using Model.Notes;
|
||||||
@@ -29,6 +30,7 @@ public class DatabaseContext : DbContext
|
|||||||
public DbSet<NoteContentModel> NoteContentModels { get; set; } = default!;
|
public DbSet<NoteContentModel> NoteContentModels { get; set; } = default!;
|
||||||
public DbSet<NoteConnectionModel> NoteConnectionModels { get; set; } = default!;
|
public DbSet<NoteConnectionModel> NoteConnectionModels { get; set; } = default!;
|
||||||
public DbSet<NoteSectionModel> NoteSectionModels { get; set; } = default!;
|
public DbSet<NoteSectionModel> NoteSectionModels { get; set; } = default!;
|
||||||
|
public DbSet<Variable> Variables { get; set; } = default!;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+14
-2
@@ -1,9 +1,13 @@
|
|||||||
@inject HttpClient httpClient
|
@inject HttpClient httpClient
|
||||||
|
@inject IVariableService variableService
|
||||||
|
|
||||||
<Router AppAssembly="@typeof(App).Assembly">
|
<Router AppAssembly="@typeof(App).Assembly">
|
||||||
<Found Context="routeData">
|
<Found Context="routeData">
|
||||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
|
@if (isLoaded)
|
||||||
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
|
{
|
||||||
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
|
||||||
|
<FocusOnNavigate RouteData="@routeData" Selector="h1"/>
|
||||||
|
}
|
||||||
</Found>
|
</Found>
|
||||||
<NotFound>
|
<NotFound>
|
||||||
<PageTitle>Not found</PageTitle>
|
<PageTitle>Not found</PageTitle>
|
||||||
@@ -68,5 +72,13 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private bool isLoaded = false;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await variableService.Load();
|
||||||
|
isLoaded = true;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -5,6 +5,7 @@
|
|||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
||||||
@inject IEntityDisplayService entityDisplayService
|
@inject IEntityDisplayService entityDisplayService
|
||||||
|
@inject IVariableService variableService
|
||||||
|
|
||||||
<LayoutLargeContentComponent>
|
<LayoutLargeContentComponent>
|
||||||
<WebsiteTitleComponent>Database</WebsiteTitleComponent>
|
<WebsiteTitleComponent>Database</WebsiteTitleComponent>
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
<PaperComponent>
|
<PaperComponent>
|
||||||
<FormDisplayComponent Label="Patch">
|
<FormDisplayComponent Label="Patch">
|
||||||
<Display>
|
<Display>
|
||||||
Game Patch: @EntityModel.GameVersion
|
Game Patch: @variableService.Variables["GamePatch"]
|
||||||
</Display>
|
</Display>
|
||||||
</FormDisplayComponent>
|
</FormDisplayComponent>
|
||||||
</PaperComponent>
|
</PaperComponent>
|
||||||
@@ -66,7 +67,7 @@
|
|||||||
Is this database updated to the latest version?
|
Is this database updated to the latest version?
|
||||||
</InfoQuestionComponent>
|
</InfoQuestionComponent>
|
||||||
<InfoAnswerComponent>
|
<InfoAnswerComponent>
|
||||||
Maybe. Check this <b>@EntityModel.GameVersion</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
|
Maybe. Check this <b>@variableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
|
||||||
</InfoAnswerComponent>
|
</InfoAnswerComponent>
|
||||||
</InfoBodyComponent>
|
</InfoBodyComponent>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
@inject IEntityDisplayService entityDisplayService
|
@inject IEntityDisplayService entityDisplayService
|
||||||
|
|
||||||
|
@inject IVariableService variableService
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
||||||
<LayoutLargeContentComponent>
|
<LayoutLargeContentComponent>
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
<PaperComponent>
|
<PaperComponent>
|
||||||
<FormDisplayComponent Label="Patch">
|
<FormDisplayComponent Label="Patch">
|
||||||
<Display>
|
<Display>
|
||||||
Game Patch: @EntityModel.GameVersion
|
Game Patch: @variableService.Variables["GamePatch"]
|
||||||
</Display>
|
</Display>
|
||||||
</FormDisplayComponent>
|
</FormDisplayComponent>
|
||||||
</PaperComponent>
|
</PaperComponent>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Globalization;
|
|||||||
using IGP;
|
using IGP;
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
using Microsoft.AspNetCore.Components.WebAssembly.Services;
|
using Microsoft.AspNetCore.Components.WebAssembly.Services;
|
||||||
|
using Model;
|
||||||
using Services;
|
using Services;
|
||||||
using Services.Development;
|
using Services.Development;
|
||||||
using Services.Immortal;
|
using Services.Immortal;
|
||||||
@@ -39,6 +40,7 @@ builder.Services.AddSingleton<IGitService, GitService>();
|
|||||||
builder.Services.AddSingleton<INoteService, NoteService>();
|
builder.Services.AddSingleton<INoteService, NoteService>();
|
||||||
builder.Services.AddSingleton<IDocumentationService, DocumentationService>();
|
builder.Services.AddSingleton<IDocumentationService, DocumentationService>();
|
||||||
builder.Services.AddSingleton<ISearchService, SearchService>();
|
builder.Services.AddSingleton<ISearchService, SearchService>();
|
||||||
|
builder.Services.AddSingleton<IVariableService, VariableService>();
|
||||||
|
|
||||||
builder.Services.AddSingleton<IEconomyComparisonService, EconomyComparisionService>();
|
builder.Services.AddSingleton<IEconomyComparisonService, EconomyComparisionService>();
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
[{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":28,"Name":"Passive Patch","Date":"2022-04-12T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":29,"Name":"0.0.6.9121a Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":30,"Name":"Stream Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":31,"Name":"BuildCalc Hotfix","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":32,"Name":"Search Patch","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":33,"Name":"Search Hotfix","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":34,"Name":"Stream Patch","Date":"2022-04-17T00:00:00","GitChangeModels":[],"Important":"False"}]
|
[{"Id":1,"Name":"Database UX Patch","Date":"2022-03-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":2,"Name":"Thrum Stats Hotfix","Date":"2022-03-12T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":3,"Name":"Memory Tester Patch","Date":"2022-03-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":4,"Name":"Hide Pyre Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":5,"Name":"Stream Patch","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":6,"Name":"Agile UI Hotfix","Date":"2022-02-20T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":7,"Name":"Armor Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":8,"Name":"Home Page Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":9,"Name":"Mobile Menu Hotfix 2","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":10,"Name":"Mobile Menu Hotfix","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":11,"Name":"Mobile Menu Patch","Date":"2022-02-19T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":12,"Name":"0.0.6.8375a Patch","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":13,"Name":"Google Tracking Hotfix","Date":"2022-02-18T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":14,"Name":"Privacy Policy Patch","Date":"2022-02-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":15,"Name":"Home Page Quick Hotfix","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":16,"Name":"Early Agile Patch","Date":"2022-02-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":17,"Name":"Form Text Rendering Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":18,"Name":"Reducing Timing Interval Hotfix","Date":"2022-02-15T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":19,"Name":"Changelog Patch","Date":"2022-02-14T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":20,"Name":"SQL Patch","Date":"2022-03-26T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":21,"Name":"Stream Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":22,"Name":"0.0.6.8900a Patch","Date":"2022-03-30T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":23,"Name":"Database Links Patch","Date":"2022-04-01T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":24,"Name":"Open Source Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":25,"Name":"Stream Patch","Date":"2022-04-03T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":26,"Name":"Notes/Docs Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":27,"Name":"Stream Patch","Date":"2022-04-10T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":28,"Name":"Passive Patch","Date":"2022-04-12T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":29,"Name":"0.0.6.9121a Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"True"},{"Id":30,"Name":"Stream Patch","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":31,"Name":"BuildCalc Hotfix","Date":"2022-04-13T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":32,"Name":"Search Patch","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":33,"Name":"Search Hotfix","Date":"2022-04-16T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":34,"Name":"Stream Patch","Date":"2022-04-17T00:00:00","GitChangeModels":[],"Important":"False"},{"Id":35,"Name":"v0.0.6.9201a Patch","Date":"2022-04-18T00:00:00","GitChangeModels":[],"Important":"True"}]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[{"Key":"GamePatch","Value":"v0.0.6.9201a"}]
|
||||||
@@ -27,4 +27,6 @@ using (var db = new DatabaseContext(options.Options))
|
|||||||
File.WriteAllTextAsync($"{webPath}/NoteContentModels.json", JsonSerializer.Serialize(db.NoteContentModels));
|
File.WriteAllTextAsync($"{webPath}/NoteContentModels.json", JsonSerializer.Serialize(db.NoteContentModels));
|
||||||
File.WriteAllTextAsync($"{webPath}/NoteConnectionModels.json", JsonSerializer.Serialize(db.NoteConnectionModels));
|
File.WriteAllTextAsync($"{webPath}/NoteConnectionModels.json", JsonSerializer.Serialize(db.NoteConnectionModels));
|
||||||
File.WriteAllTextAsync($"{webPath}/NoteSectionModels.json", JsonSerializer.Serialize(db.NoteSectionModels));
|
File.WriteAllTextAsync($"{webPath}/NoteSectionModels.json", JsonSerializer.Serialize(db.NoteSectionModels));
|
||||||
|
|
||||||
|
File.WriteAllTextAsync($"{webPath}/Variables.json", JsonSerializer.Serialize(db.Variables));
|
||||||
}
|
}
|
||||||
@@ -2368,7 +2368,7 @@ public class DATA
|
|||||||
.AddPart(new EntityProductionModel { DefensiveLayer = 30, Cooldown = 40 })
|
.AddPart(new EntityProductionModel { DefensiveLayer = 30, Cooldown = 40 })
|
||||||
.AddPart(new EntityRequirementModel { Id = DataType.UPGRADE_RadiantWard })
|
.AddPart(new EntityRequirementModel { Id = DataType.UPGRADE_RadiantWard })
|
||||||
.AddPart(new EntityVitalityModel
|
.AddPart(new EntityVitalityModel
|
||||||
{ Health = 30, DefenseLayer = 30, Lasts = 30, Armor = ArmorType.Light, IsStructure = true })
|
{ Health = 30, DefenseLayer = 30, Lasts = 30, Armor = ArmorType.Light })
|
||||||
.AddPart(new EntityRequirementModel
|
.AddPart(new EntityRequirementModel
|
||||||
{
|
{
|
||||||
Id = DataType.BUILDING_HouseOfFadingSaints,
|
Id = DataType.BUILDING_HouseOfFadingSaints,
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ namespace Model.Entity;
|
|||||||
|
|
||||||
public class EntityModel
|
public class EntityModel
|
||||||
{
|
{
|
||||||
public static readonly string GameVersion = "0.0.6.9121a";
|
|
||||||
|
|
||||||
private static Dictionary<string, EntityModel> _database = null!;
|
private static Dictionary<string, EntityModel> _database = null!;
|
||||||
|
|
||||||
private static List<EntityModel> _entityModels = null!;
|
private static List<EntityModel> _entityModels = null!;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Model;
|
||||||
|
|
||||||
|
public class Variable
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public string Key { get; set; } = "";
|
||||||
|
public string Value { get; set; } = "";
|
||||||
|
}
|
||||||
@@ -45,6 +45,13 @@ public interface ISearchService
|
|||||||
void Hide();
|
void Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IVariableService
|
||||||
|
{
|
||||||
|
public Dictionary<string, string> Variables { get; set; }
|
||||||
|
public Task Load();
|
||||||
|
public bool IsLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
public interface IEconomyComparisonService
|
public interface IEconomyComparisonService
|
||||||
{
|
{
|
||||||
public List<BuildToCompareModel> BuildsToCompare { get; set; }
|
public List<BuildToCompareModel> BuildsToCompare { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using System.Net.Http.Json;
|
||||||
|
using Model;
|
||||||
|
|
||||||
|
namespace Services.Website;
|
||||||
|
|
||||||
|
public class VariableService : IVariableService
|
||||||
|
{
|
||||||
|
private readonly HttpClient httpClient;
|
||||||
|
|
||||||
|
private bool isLoaded;
|
||||||
|
|
||||||
|
|
||||||
|
public VariableService(HttpClient httpClient)
|
||||||
|
{
|
||||||
|
this.httpClient = httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, string> Variables { get; set; } = new();
|
||||||
|
|
||||||
|
public bool IsLoaded()
|
||||||
|
{
|
||||||
|
return isLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Load()
|
||||||
|
{
|
||||||
|
if (isLoaded) return;
|
||||||
|
|
||||||
|
var variables = (await httpClient.GetFromJsonAsync<Variable[]>("generated/Variables.json"))!
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
foreach (var variable in variables)
|
||||||
|
{
|
||||||
|
Variables.Add(variable.Key, variable.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user