Open typed catalog from Unity state package
This commit is contained in:
parent
57985666d1
commit
12dcd0c39f
7 changed files with 490 additions and 18 deletions
|
|
@ -9,6 +9,7 @@ var statePath = args.Length > 1
|
|||
|
||||
await using var client = await AetheriaRuntimeCatalogClient.OpenAsync(statePath);
|
||||
var catalog = client.ReadCatalog();
|
||||
var packageCatalog = AetheriaRuntimeCatalogStore.OpenReadOnly(statePath);
|
||||
var surface = await client.ReadCatalogSurfaceAsync();
|
||||
|
||||
if (catalog.Items.Count != 115)
|
||||
|
|
@ -16,6 +17,15 @@ if (catalog.Items.Count != 115)
|
|||
throw new InvalidOperationException($"Expected 115 runtime catalog items, found {catalog.Items.Count}.");
|
||||
}
|
||||
|
||||
if (packageCatalog.Items.Count != catalog.Items.Count ||
|
||||
packageCatalog.Corporations.Count != catalog.Corporations.Count ||
|
||||
packageCatalog.NameFiles.Count != catalog.NameFiles.Count)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Package catalog store mismatch: {packageCatalog.Items.Count}/{packageCatalog.Corporations.Count}/{packageCatalog.NameFiles.Count} " +
|
||||
$"!= {catalog.Items.Count}/{catalog.Corporations.Count}/{catalog.NameFiles.Count}.");
|
||||
}
|
||||
|
||||
if (catalog.TradeItems.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException("Runtime catalog has no trade items.");
|
||||
|
|
@ -28,6 +38,14 @@ if (catalog.EquipmentItems.Count == 0)
|
|||
|
||||
var shaped = catalog.Items.FirstOrDefault(item => item.ShapeCells.Count > 0)
|
||||
?? throw new InvalidOperationException("Runtime catalog has no typed shape masks.");
|
||||
var packageShaped = packageCatalog.FindItemByLegacyId(shaped.LegacyId);
|
||||
if (packageShaped == null ||
|
||||
packageShaped.Name != shaped.Name ||
|
||||
packageShaped.ShapeCells.Count != shaped.ShapeCells.Count)
|
||||
{
|
||||
throw new InvalidOperationException($"Package catalog store did not read the expected typed item payload for {shaped.Name}.");
|
||||
}
|
||||
|
||||
if (shaped.ShapeCells.Count != shaped.OccupiedCells)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
|
|
@ -90,6 +108,12 @@ if (catalog.GetManufacturer(manufactured) == null)
|
|||
throw new InvalidOperationException($"Runtime catalog manufacturer lookup failed for {manufactured.Name}.");
|
||||
}
|
||||
|
||||
var packageCorporation = packageCatalog.Corporations.FirstOrDefault(corporation => !string.IsNullOrWhiteSpace(corporation.GeonameFileLegacyId));
|
||||
if (packageCorporation == null || packageCatalog.GetNameFile(packageCorporation) == null)
|
||||
{
|
||||
throw new InvalidOperationException("Package catalog store did not read corporation/name-file links.");
|
||||
}
|
||||
|
||||
if (surface?.Schema != "gamecult.eve.surface.v1" ||
|
||||
surface.Surface.Id != AetheriaCatalogSurfaceProjector.SurfaceId)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue