Route loadout templates through managed document
This commit is contained in:
parent
a873a31043
commit
8a755b9ae3
5 changed files with 41 additions and 19 deletions
|
|
@ -9281,7 +9281,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root)
|
|||
"OpenRuntimeCatalog()",
|
||||
"GetPlayerSettingsAsync()",
|
||||
"VerseHostSettingsAsync()",
|
||||
"GetLoadoutTemplatesAsync()",
|
||||
"AetheriaRuntimeLoadoutTemplatesDocument",
|
||||
"CreateEveSurfaceStateRefResolver(",
|
||||
"AetheriaRuntimeStateReader.CreateEveSurfaceCultMeshStateRefResolver(",
|
||||
"SubmitDaemonCommandAsync(",
|
||||
|
|
@ -14568,8 +14568,9 @@ static void RequireInventoryLoadoutRestoreRequestAuthority(string root)
|
|||
!rtsProjection.Contains("ProjectLoadoutRestoreOptions(", StringComparison.Ordinal) ||
|
||||
!rtsProjection.Contains("AetheriaRuntimeDaemonTradeItemQueries.TryProjectLoadoutTemplatePrice(", StringComparison.Ordinal) ||
|
||||
!rtsProjection.Contains("credits >= price", StringComparison.Ordinal) ||
|
||||
!client.Contains("GetLoadoutTemplatesAsync()", StringComparison.Ordinal) ||
|
||||
!verseClient.Contains("ProjectStationRefit(frame, loadoutTemplates, catalog)", StringComparison.Ordinal))
|
||||
!client.Contains("State.LoadoutTemplates.LatestAsync()", StringComparison.Ordinal) ||
|
||||
!verseClient.Contains("var loadoutTemplates = await loadoutTemplatesDocument.LatestAsync()", StringComparison.Ordinal) ||
|
||||
!verseClient.Contains("ProjectStationRefit(frame, loadoutTemplates.Templates, catalog)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"StationRefitAsync must publish typed loadout restore options with shared runtime pricing and daemon-target identity.");
|
||||
|
|
|
|||
|
|
@ -154,10 +154,11 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return document.ToSnapshot();
|
||||
}
|
||||
|
||||
public Task<System.Collections.Generic.IReadOnlyList<AetheriaRuntimeLoadoutTemplateSnapshot>> LoadoutTemplatesAsync()
|
||||
public async Task<System.Collections.Generic.IReadOnlyList<AetheriaRuntimeLoadoutTemplateSnapshot>> LoadoutTemplatesAsync()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
return _verse.GetLoadoutTemplatesAsync();
|
||||
var document = await State.LoadoutTemplates.LatestAsync().ConfigureAwait(false);
|
||||
return document.Templates;
|
||||
}
|
||||
|
||||
public async Task<AetheriaRuntimeLoadoutTemplateCommit> LoadoutTemplateAsync(string entityKey)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
CultMeshDocumentHandle<AetheriaRuntimeDaemonFrameDocument> latestFrame,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonSoaViewDocument> latestSoaView,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeCatalogSnapshot> catalog,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeLoadoutTemplatesDocument> loadoutTemplates,
|
||||
CultMeshDocumentHandle<AetheriaRuntimePlayerSettingsDocument> playerSettings,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeVerseHostSettingsDocument> verseHostSettings,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeCurrentZoneDocument> currentZone,
|
||||
|
|
@ -40,6 +41,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
LatestFrame = latestFrame ?? throw new ArgumentNullException(nameof(latestFrame));
|
||||
LatestSoaView = latestSoaView ?? throw new ArgumentNullException(nameof(latestSoaView));
|
||||
Catalog = catalog ?? throw new ArgumentNullException(nameof(catalog));
|
||||
LoadoutTemplates = loadoutTemplates ?? throw new ArgumentNullException(nameof(loadoutTemplates));
|
||||
Settings = new AetheriaClientSettingsState(playerSettings, verseHostSettings);
|
||||
Current = new AetheriaClientCurrentState(currentZone, currentEntity, currentDocking);
|
||||
ZoneContacts = zoneContacts ?? throw new ArgumentNullException(nameof(zoneContacts));
|
||||
|
|
@ -65,6 +67,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
LatestFrame,
|
||||
LatestSoaView,
|
||||
Catalog,
|
||||
LoadoutTemplates,
|
||||
Settings.Player,
|
||||
Settings.VerseHost,
|
||||
Current.Zone,
|
||||
|
|
@ -84,6 +87,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
public CultMeshDocumentHandle<AetheriaRuntimeCatalogSnapshot> Catalog { get; }
|
||||
|
||||
public CultMeshDocumentHandle<AetheriaRuntimeLoadoutTemplatesDocument> LoadoutTemplates { get; }
|
||||
|
||||
public AetheriaClientSettingsState Settings { get; }
|
||||
|
||||
public AetheriaClientCurrentState Current { get; }
|
||||
|
|
|
|||
|
|
@ -95,6 +95,19 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeLoadoutTemplatesDocument
|
||||
{
|
||||
public const string SchemaId = "gamecult.aetheria.loadout_templates.v1";
|
||||
|
||||
public AetheriaRuntimeLoadoutTemplatesDocument(
|
||||
IReadOnlyList<AetheriaRuntimeLoadoutTemplateSnapshot>? templates = null)
|
||||
{
|
||||
Templates = templates ?? Array.Empty<AetheriaRuntimeLoadoutTemplateSnapshot>();
|
||||
}
|
||||
|
||||
public IReadOnlyList<AetheriaRuntimeLoadoutTemplateSnapshot> Templates { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeCatalogItem
|
||||
{
|
||||
public AetheriaRuntimeCatalogItem(
|
||||
|
|
|
|||
|
|
@ -282,12 +282,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return Task.FromResult(AetheriaRuntimeCatalogStore.ReadVerseHostSettings(StatePath));
|
||||
}
|
||||
|
||||
public Task<IReadOnlyList<AetheriaRuntimeLoadoutTemplateSnapshot>> GetLoadoutTemplatesAsync()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
return Task.FromResult(AetheriaRuntimeCatalogStore.ReadLoadoutTemplates(StatePath));
|
||||
}
|
||||
|
||||
public async Task<AetheriaRuntimeObservedDaemonState?> GetObservedDaemonStateAsync()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
|
@ -728,17 +722,25 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var frameChanges = WatchLatestFrames()
|
||||
.Where(change => change.Document != null)
|
||||
.Select(change => change.Document!);
|
||||
var catalogDocument = CatalogDocument(
|
||||
"aetheria.catalog.runtime",
|
||||
() => Task.FromResult(OpenRuntimeCatalog()),
|
||||
AetheriaRuntimeCatalogSnapshot.SchemaId,
|
||||
CultMesh.ProjectionSource("catalog:aetheria.runtime"));
|
||||
var loadoutTemplatesDocument = CatalogDocument(
|
||||
"aetheria.catalog.loadout_templates",
|
||||
() => Task.FromResult(new AetheriaRuntimeLoadoutTemplatesDocument(
|
||||
AetheriaRuntimeCatalogStore.ReadLoadoutTemplates(StatePath))),
|
||||
AetheriaRuntimeLoadoutTemplatesDocument.SchemaId,
|
||||
CultMesh.ProjectionSource("catalog:aetheria.loadout_templates"));
|
||||
|
||||
return new AetheriaClientState(
|
||||
Document<AetheriaRuntimeDaemonFrameDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest),
|
||||
Document<AetheriaRuntimeDaemonSoaViewDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest),
|
||||
CatalogDocument(
|
||||
"aetheria.catalog.runtime",
|
||||
() => Task.FromResult(OpenRuntimeCatalog()),
|
||||
AetheriaRuntimeCatalogSnapshot.SchemaId,
|
||||
CultMesh.ProjectionSource("catalog:aetheria.runtime")),
|
||||
catalogDocument,
|
||||
loadoutTemplatesDocument,
|
||||
CatalogDocument(
|
||||
"aetheria.settings.player",
|
||||
() => Task.FromResult(AetheriaRuntimePlayerSettingsDocument.FromSnapshot(
|
||||
|
|
@ -879,9 +881,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
async Task<AetheriaRuntimeStationRefitDocument> ProjectStationRefitAsync(
|
||||
AetheriaRuntimeDaemonFrameDocument frame)
|
||||
{
|
||||
var loadoutTemplates = await GetLoadoutTemplatesAsync().ConfigureAwait(false);
|
||||
var catalog = OpenRuntimeCatalog();
|
||||
return AetheriaRuntimeRtsProjection.ProjectStationRefit(frame, loadoutTemplates, catalog);
|
||||
var loadoutTemplates = await loadoutTemplatesDocument.LatestAsync().ConfigureAwait(false);
|
||||
var catalog = await catalogDocument.LatestAsync().ConfigureAwait(false);
|
||||
return AetheriaRuntimeRtsProjection.ProjectStationRefit(frame, loadoutTemplates.Templates, catalog);
|
||||
}
|
||||
|
||||
async Task<AetheriaRuntimeStarbridgeSessionSummaryDocument> ProjectStarbridgeSummaryAsync(
|
||||
|
|
|
|||
Loading…
Reference in a new issue