Use typed catalog keys for faction lookups
This commit is contained in:
parent
977fa52b18
commit
7f87373886
13 changed files with 182 additions and 40 deletions
Binary file not shown.
|
|
@ -118,9 +118,11 @@ if (!catalog.FindItemsByHardpoint(equipment.HardpointType).Any())
|
|||
|
||||
var manufactured = catalog.Items.FirstOrDefault(item => !string.IsNullOrWhiteSpace(item.ManufacturerLegacyId))
|
||||
?? throw new InvalidOperationException("Runtime catalog has no manufactured item.");
|
||||
if (catalog.GetManufacturer(manufactured) == null)
|
||||
if (string.IsNullOrWhiteSpace(manufactured.ManufacturerKey) ||
|
||||
catalog.FindCorporation(manufactured.ManufacturerKey) == null ||
|
||||
catalog.GetManufacturer(manufactured) == null)
|
||||
{
|
||||
throw new InvalidOperationException($"Runtime catalog manufacturer lookup failed for {manufactured.Name}.");
|
||||
throw new InvalidOperationException($"Runtime catalog typed manufacturer lookup failed for {manufactured.Name}.");
|
||||
}
|
||||
|
||||
var packageCorporation = packageCatalog.Corporations.FirstOrDefault(corporation => !string.IsNullOrWhiteSpace(corporation.GeonameFileLegacyId));
|
||||
|
|
@ -130,9 +132,14 @@ if (packageCorporation == null)
|
|||
}
|
||||
|
||||
var packageNameFile = packageCatalog.GetNameFile(packageCorporation);
|
||||
if (packageNameFile == null || packageNameFile.Names.Count == 0 || packageNameFile.Names.Count != packageNameFile.NameCount)
|
||||
if (string.IsNullOrWhiteSpace(packageCorporation.GeonameFileKey) ||
|
||||
packageCatalog.FindNameFile(packageCorporation.GeonameFileKey) == null ||
|
||||
packageNameFile == null ||
|
||||
string.IsNullOrWhiteSpace(packageNameFile.NameFileKey) ||
|
||||
packageNameFile.Names.Count == 0 ||
|
||||
packageNameFile.Names.Count != packageNameFile.NameCount)
|
||||
{
|
||||
throw new InvalidOperationException("Package catalog store did not read corporation/name-file links with full names.");
|
||||
throw new InvalidOperationException("Package catalog store did not read typed corporation/name-file links with full names.");
|
||||
}
|
||||
|
||||
if (packageCorporation.Allegiances.Count == 0 || packageCorporation.Allegiances.Count != packageCorporation.AllegianceCount)
|
||||
|
|
|
|||
|
|
@ -356,19 +356,23 @@ if (!catalog.FindItemsByHardpoint(hardpointType).Any())
|
|||
|
||||
var manufacturedItem = items.FirstOrDefault(item => !string.IsNullOrWhiteSpace(item.ManufacturerLegacyId))
|
||||
?? throw new InvalidOperationException("Cannot verify typed catalog manufacturer lookup: no manufactured item.");
|
||||
if (catalog.GetManufacturer(manufacturedItem) == null)
|
||||
if (string.IsNullOrWhiteSpace(manufacturedItem.ManufacturerKey) ||
|
||||
catalog.FindCorporation(manufacturedItem.ManufacturerKey) == null ||
|
||||
catalog.GetManufacturer(manufacturedItem) == null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Typed catalog manufacturer lookup failed for item {manufacturedItem.Name}.");
|
||||
$"Typed catalog manufacturer-key lookup failed for item {manufacturedItem.Name}.");
|
||||
}
|
||||
|
||||
var corporationWithNames = corporations.FirstOrDefault(corporation =>
|
||||
!string.IsNullOrWhiteSpace(corporation.GeonameFileLegacyId))
|
||||
?? throw new InvalidOperationException("Cannot verify typed catalog name-file lookup: no linked corporation.");
|
||||
if (catalog.GetNameFile(corporationWithNames) == null)
|
||||
if (string.IsNullOrWhiteSpace(corporationWithNames.GeonameFileKey) ||
|
||||
catalog.FindNameFile(corporationWithNames.GeonameFileKey) == null ||
|
||||
catalog.GetNameFile(corporationWithNames) == null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Typed catalog name-file lookup failed for corporation {corporationWithNames.Name}.");
|
||||
$"Typed catalog name-file-key lookup failed for corporation {corporationWithNames.Name}.");
|
||||
}
|
||||
|
||||
if (surface.Schema != "gamecult.eve.surface.v1" ||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ public sealed class AetheriaCatalogSnapshot
|
|||
{
|
||||
private readonly Dictionary<string, AetheriaItemDefinition> _itemsByLegacyId;
|
||||
private readonly Dictionary<string, AetheriaCorporation> _corporationsByLegacyId;
|
||||
private readonly Dictionary<string, AetheriaCorporation> _corporationsByKey;
|
||||
private readonly Dictionary<string, AetheriaNameFile> _nameFilesByLegacyId;
|
||||
private readonly Dictionary<string, AetheriaNameFile> _nameFilesByKey;
|
||||
|
||||
public AetheriaCatalogSnapshot(
|
||||
IEnumerable<AetheriaItemDefinition> items,
|
||||
|
|
@ -26,9 +28,15 @@ public sealed class AetheriaCatalogSnapshot
|
|||
_corporationsByLegacyId = Corporations
|
||||
.Where(corporation => !string.IsNullOrWhiteSpace(corporation.LegacyId))
|
||||
.ToDictionary(corporation => corporation.LegacyId, StringComparer.OrdinalIgnoreCase);
|
||||
_corporationsByKey = Corporations
|
||||
.Where(corporation => !string.IsNullOrWhiteSpace(corporation.CorporationKey))
|
||||
.ToDictionary(corporation => corporation.CorporationKey, StringComparer.OrdinalIgnoreCase);
|
||||
_nameFilesByLegacyId = NameFiles
|
||||
.Where(nameFile => !string.IsNullOrWhiteSpace(nameFile.LegacyId))
|
||||
.ToDictionary(nameFile => nameFile.LegacyId, StringComparer.OrdinalIgnoreCase);
|
||||
_nameFilesByKey = NameFiles
|
||||
.Where(nameFile => !string.IsNullOrWhiteSpace(nameFile.NameFileKey))
|
||||
.ToDictionary(nameFile => nameFile.NameFileKey, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public IReadOnlyList<AetheriaItemDefinition> Items { get; }
|
||||
|
|
@ -72,11 +80,21 @@ public sealed class AetheriaCatalogSnapshot
|
|||
return TryGet(_corporationsByLegacyId, legacyId);
|
||||
}
|
||||
|
||||
public AetheriaCorporation? FindCorporation(string corporationKey)
|
||||
{
|
||||
return TryGet(_corporationsByKey, corporationKey);
|
||||
}
|
||||
|
||||
public AetheriaNameFile? FindNameFileByLegacyId(string legacyId)
|
||||
{
|
||||
return TryGet(_nameFilesByLegacyId, legacyId);
|
||||
}
|
||||
|
||||
public AetheriaNameFile? FindNameFile(string nameFileKey)
|
||||
{
|
||||
return TryGet(_nameFilesByKey, nameFileKey);
|
||||
}
|
||||
|
||||
public AetheriaCorporation? FindCorporationByNamePrefix(string namePrefix)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(namePrefix)
|
||||
|
|
@ -87,12 +105,12 @@ public sealed class AetheriaCatalogSnapshot
|
|||
|
||||
public AetheriaCorporation? GetManufacturer(AetheriaItemDefinition item)
|
||||
{
|
||||
return FindCorporationByLegacyId(item.ManufacturerLegacyId);
|
||||
return FindCorporation(item.ManufacturerKey);
|
||||
}
|
||||
|
||||
public AetheriaNameFile? GetNameFile(AetheriaCorporation corporation)
|
||||
{
|
||||
return FindNameFileByLegacyId(corporation.GeonameFileLegacyId);
|
||||
return FindNameFile(corporation.GeonameFileKey);
|
||||
}
|
||||
|
||||
private static T? TryGet<T>(IReadOnlyDictionary<string, T> dictionary, string key) where T : class
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ public sealed class AetheriaCorporation
|
|||
[CultIndex("legacyId")]
|
||||
public string LegacyId { get; set; } = "";
|
||||
|
||||
[IgnoreMember]
|
||||
public string CorporationKey => string.IsNullOrWhiteSpace(LegacyId)
|
||||
? ""
|
||||
: $"aetheria.corporation:legacy:{LegacyId}";
|
||||
|
||||
[Key(2)]
|
||||
public string ShortName { get; set; } = "";
|
||||
|
||||
|
|
@ -25,10 +30,20 @@ public sealed class AetheriaCorporation
|
|||
[CultIndex("geonameFileLegacyId")]
|
||||
public string GeonameFileLegacyId { get; set; } = "";
|
||||
|
||||
[IgnoreMember]
|
||||
public string GeonameFileKey => string.IsNullOrWhiteSpace(GeonameFileLegacyId)
|
||||
? ""
|
||||
: $"aetheria.name_file:legacy:{GeonameFileLegacyId}";
|
||||
|
||||
[Key(5)]
|
||||
[CultIndex("bossHullLegacyId")]
|
||||
public string BossHullLegacyId { get; set; } = "";
|
||||
|
||||
[IgnoreMember]
|
||||
public string BossHullItemKey => string.IsNullOrWhiteSpace(BossHullLegacyId)
|
||||
? ""
|
||||
: $"aetheria.item_definition:legacy:{BossHullLegacyId}";
|
||||
|
||||
[Key(6)]
|
||||
public int InfluenceDistance { get; set; }
|
||||
|
||||
|
|
@ -54,6 +69,11 @@ public sealed class AetheriaCorporationAllegiance
|
|||
[Key(0)]
|
||||
public string CorporationLegacyId { get; set; } = "";
|
||||
|
||||
[IgnoreMember]
|
||||
public string CorporationKey => string.IsNullOrWhiteSpace(CorporationLegacyId)
|
||||
? ""
|
||||
: $"aetheria.corporation:legacy:{CorporationLegacyId}";
|
||||
|
||||
[Key(1)]
|
||||
public double Weight { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public sealed class AetheriaItemDefinition
|
|||
[CultIndex("manufacturerLegacyId")]
|
||||
public string ManufacturerLegacyId { get; set; } = "";
|
||||
|
||||
[IgnoreMember]
|
||||
public string ManufacturerKey => string.IsNullOrWhiteSpace(ManufacturerLegacyId)
|
||||
? ""
|
||||
: $"aetheria.corporation:legacy:{ManufacturerLegacyId}";
|
||||
|
||||
[Key(8)]
|
||||
public int Price { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ public sealed class AetheriaNameFile
|
|||
[CultIndex("legacyId")]
|
||||
public string LegacyId { get; set; } = "";
|
||||
|
||||
[IgnoreMember]
|
||||
public string NameFileKey => string.IsNullOrWhiteSpace(LegacyId)
|
||||
? ""
|
||||
: $"aetheria.name_file:legacy:{LegacyId}";
|
||||
|
||||
[Key(2)]
|
||||
public int NameCount { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ instances for target stats instead of reading behavior config objects directly.
|
|||
`ItemManager` currently owns the explicit typed-payload-to-config bridge.
|
||||
Typed name-file documents are `aetheria.name_file.v2` records. They carry the
|
||||
legacy ID, display name, count, compact sample names for surfaces, and the full
|
||||
name array needed to move `Galaxy`/Markov name generation off legacy
|
||||
`NameFile.Names`.
|
||||
name array used by `Galaxy`/Markov name generation through typed name-file
|
||||
keys rather than legacy `NameFile.Names`.
|
||||
Legacy GUID references that are `Guid.Empty` are imported as absent references,
|
||||
not as resolvable catalog links.
|
||||
Before materializing state, the importer clears the generated `.cc`,
|
||||
|
|
@ -186,9 +186,10 @@ catalog inputs are captured first and are not deleted. This lets schema changes
|
|||
rebuild the typed artifact instead of failing on a stale embedded schema catalog.
|
||||
|
||||
`AetheriaCatalogSnapshot` is the typed read surface over materialized catalog
|
||||
documents. It exposes trade items, legacy-ID lookup, manufacturer lookup,
|
||||
corporation prefix lookup, corporation name-file lookup, equipment items,
|
||||
behavior lookup, and hardpoint lookup without reading runtime projection DTOs.
|
||||
documents. It exposes trade items, legacy-ID migration lookup, typed
|
||||
manufacturer/corporation/name-file key lookup, corporation prefix lookup,
|
||||
equipment items, behavior lookup, and hardpoint lookup without reading runtime
|
||||
projection DTOs.
|
||||
|
||||
`AetheriaCatalogSurfaceProjector` publishes the first Eve-compatible provider
|
||||
surface from typed catalog state. The importer materializes
|
||||
|
|
@ -210,10 +211,13 @@ packaging is available.
|
|||
`Galaxy` now consumes this package-owned runtime catalog for faction selection
|
||||
and name generation, so generated sectors use typed corporation v2 and
|
||||
`aetheria.name_file.v2` records instead of legacy `Faction`/`NameFile`
|
||||
catalog documents. It still projects typed corporations into temporary
|
||||
`Faction` DTOs, including allegiance dictionaries and local GUID equality,
|
||||
catalog documents. Loadout manufacturer-distance weighting also resolves
|
||||
manufacturers through typed corporation keys rather than parsing manufacturer
|
||||
legacy IDs. `Galaxy` still projects typed corporations into temporary `Faction`
|
||||
DTOs, including local GUID equality for the surviving simulation surface,
|
||||
because the surrounding simulation has not yet been rebuilt around typed
|
||||
corporation records.
|
||||
corporation records. The DTOs now carry typed faction/name-file keys and typed
|
||||
allegiance edges so they cannot reclaim catalog lookup authority.
|
||||
|
||||
`Aetheria.State.Smoke` writes and reopens full typed player settings plus a
|
||||
typed loadout template in addition to world, catalog, run state, zone state, and
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Unity.Mathematics;
|
|||
public class Faction : INamedEntry
|
||||
{
|
||||
public Guid ID = Guid.NewGuid();
|
||||
public string FactionKey;
|
||||
|
||||
[Inspectable]
|
||||
public string Name;
|
||||
|
|
@ -33,6 +34,7 @@ public class Faction : INamedEntry
|
|||
[InspectableColor]
|
||||
public float3 SecondaryColor;
|
||||
public Guid GeonameFile;
|
||||
public string GeonameFileKey;
|
||||
public Guid BossHull;
|
||||
|
||||
[Inspectable]
|
||||
|
|
@ -40,6 +42,7 @@ public class Faction : INamedEntry
|
|||
|
||||
[InspectableRangedFloat(0, 1)]
|
||||
public Dictionary<Guid, float> Allegiance = new Dictionary<Guid, float>();
|
||||
public Dictionary<string, float> AllegianceByKey = new Dictionary<string, float>();
|
||||
|
||||
[InspectableSoundBank]
|
||||
public uint OverworldMusic;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public class Galaxy
|
|||
public bool IsPrelude { get; }
|
||||
|
||||
private HashSet<Guid> _containedFactions;
|
||||
private HashSet<string> _containedFactionKeys;
|
||||
private GalaxyZone[] _exitPath;
|
||||
private Dictionary<Faction, MarkovNameGenerator> _nameGenerators = new Dictionary<Faction, MarkovNameGenerator>();
|
||||
private readonly AetheriaRuntimeCatalogSnapshot _runtimeCatalog;
|
||||
|
|
@ -243,6 +244,12 @@ public class Galaxy
|
|||
{
|
||||
factions[index].Allegiance[corporationId] = (float) allegiance.Weight;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(allegiance.CorporationKey) &&
|
||||
factionsByLegacyId.ContainsKey(allegiance.CorporationLegacyId))
|
||||
{
|
||||
factions[index].AllegianceByKey[allegiance.CorporationKey] = (float) allegiance.Weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -254,10 +261,12 @@ public class Galaxy
|
|||
return new Faction
|
||||
{
|
||||
ID = ParseLegacyId(corporation.LegacyId, nameof(corporation.LegacyId), corporation.Name),
|
||||
FactionKey = corporation.CorporationKey,
|
||||
Name = corporation.Name,
|
||||
ShortName = corporation.ShortName,
|
||||
Description = corporation.Description,
|
||||
GeonameFile = ParseLegacyId(corporation.GeonameFileLegacyId, nameof(corporation.GeonameFileLegacyId), corporation.Name),
|
||||
GeonameFileKey = corporation.GeonameFileKey,
|
||||
BossHull = ParseOptionalLegacyId(corporation.BossHullLegacyId),
|
||||
InfluenceDistance = corporation.InfluenceDistance,
|
||||
};
|
||||
|
|
@ -358,10 +367,10 @@ public class Galaxy
|
|||
progressCallback?.Invoke($"Feeding Markov Chains: {i + 1} / {Factions.Length}");
|
||||
//if(progressCallback!=null) Thread.Sleep(250); // Inserting Delay to make it seem like it's doing more work lmao
|
||||
var faction = Factions[i];
|
||||
var nameFile = _runtimeCatalog.FindNameFileByLegacyId(faction.GeonameFile.ToString());
|
||||
var nameFile = _runtimeCatalog.FindNameFile(faction.GeonameFileKey);
|
||||
if (nameFile == null || nameFile.Names.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException($"Typed catalog has no name file for faction {faction.Name} ({faction.GeonameFile}).");
|
||||
throw new InvalidOperationException($"Typed catalog has no name file for faction {faction.Name} ({faction.GeonameFileKey}).");
|
||||
}
|
||||
|
||||
_nameGenerators[faction] = new MarkovNameGenerator(ref random, nameFile.Names, nameGeneratorSettings);
|
||||
|
|
@ -470,6 +479,16 @@ public class Galaxy
|
|||
return _containedFactions.Contains(factionID);
|
||||
}
|
||||
|
||||
public bool ContainsFaction(string factionKey)
|
||||
{
|
||||
_containedFactionKeys ??= new HashSet<string>(
|
||||
Factions
|
||||
.Select(f => f.FactionKey)
|
||||
.Where(key => !string.IsNullOrWhiteSpace(key)),
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
return !string.IsNullOrWhiteSpace(factionKey) && _containedFactionKeys.Contains(factionKey);
|
||||
}
|
||||
|
||||
public Faction ResolveFaction(Guid factionID)
|
||||
{
|
||||
if (factionID == Guid.Empty)
|
||||
|
|
@ -486,6 +505,22 @@ public class Galaxy
|
|||
return _allFactions.FirstOrDefault(f => f.ID == factionID);
|
||||
}
|
||||
|
||||
public Faction ResolveFactionByKey(string factionKey)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(factionKey))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var faction = Factions.FirstOrDefault(f => string.Equals(f.FactionKey, factionKey, StringComparison.OrdinalIgnoreCase));
|
||||
if (faction != null)
|
||||
{
|
||||
return faction;
|
||||
}
|
||||
|
||||
return _allFactions.FirstOrDefault(f => string.Equals(f.FactionKey, factionKey, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
class DijkstraVertex
|
||||
{
|
||||
public float Cost;
|
||||
|
|
|
|||
|
|
@ -150,24 +150,24 @@ public class LoadoutGenerator
|
|||
.Where(item => IsTypedCandidate(item, candidateKind))
|
||||
.Where(item =>
|
||||
item.Price > 0 &&
|
||||
Guid.TryParse(item.ManufacturerLegacyId, out var manufacturer) &&
|
||||
manufacturer != Guid.Empty &&
|
||||
(Galaxy.IsPrelude || Galaxy.ContainsFaction(manufacturer) &&
|
||||
(Faction == null || Faction.Allegiance.ContainsKey(manufacturer))) &&
|
||||
!string.IsNullOrWhiteSpace(item.ManufacturerKey) &&
|
||||
(Galaxy.IsPrelude || Galaxy.ContainsFaction(item.ManufacturerKey) &&
|
||||
(Faction == null || Faction.AllegianceByKey.ContainsKey(item.ManufacturerKey))) &&
|
||||
(typedFilter?.Invoke(item) ?? true))
|
||||
.WeightedRandomElements(ref Random, item =>
|
||||
{
|
||||
if (!Guid.TryParse(item.ManufacturerLegacyId, out var manufacturer))
|
||||
var manufacturerKey = item.ManufacturerKey;
|
||||
if (string.IsNullOrWhiteSpace(manufacturerKey))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var allegianceWeight = Faction == null
|
||||
? 1
|
||||
: manufacturer == Faction.ID
|
||||
: string.Equals(manufacturerKey, Faction.FactionKey, StringComparison.OrdinalIgnoreCase)
|
||||
? 1
|
||||
: Faction.Allegiance.TryGetValue(manufacturer, out var allegiance)
|
||||
? allegiance / ManufacturerDistancePenalty(manufacturer)
|
||||
: Faction.AllegianceByKey.TryGetValue(manufacturerKey, out var allegiance)
|
||||
? allegiance / ManufacturerDistancePenalty(manufacturerKey)
|
||||
: 0;
|
||||
return allegianceWeight *
|
||||
pow(item.OccupiedCells, sizeExponent) / // Prioritize larger items
|
||||
|
|
@ -196,14 +196,14 @@ public class LoadoutGenerator
|
|||
}
|
||||
}
|
||||
|
||||
private float ManufacturerDistancePenalty(Guid manufacturer)
|
||||
private float ManufacturerDistancePenalty(string manufacturerKey)
|
||||
{
|
||||
if (Galaxy == null || Zone == null || !Galaxy.ContainsFaction(manufacturer))
|
||||
if (Galaxy == null || Zone == null || !Galaxy.ContainsFaction(manufacturerKey))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
var faction = Galaxy.ResolveFaction(manufacturer);
|
||||
var faction = Galaxy.ResolveFactionByKey(manufacturerKey);
|
||||
return faction != null && Galaxy.HomeZones.TryGetValue(faction, out var homeZone)
|
||||
? Zone.Distance[homeZone]
|
||||
: 1;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ namespace GameCult.Aetheria.State.Unity
|
|||
private readonly Dictionary<string, AetheriaRuntimeCatalogItem> _itemsByLegacyId;
|
||||
private readonly Dictionary<string, AetheriaRuntimeCatalogItem> _itemsByKey;
|
||||
private readonly Dictionary<string, AetheriaRuntimeCorporation> _corporationsByLegacyId;
|
||||
private readonly Dictionary<string, AetheriaRuntimeCorporation> _corporationsByKey;
|
||||
private readonly Dictionary<string, AetheriaRuntimeNameFile> _nameFilesByLegacyId;
|
||||
private readonly Dictionary<string, AetheriaRuntimeNameFile> _nameFilesByKey;
|
||||
|
||||
public AetheriaRuntimeCatalogSnapshot(
|
||||
AetheriaRuntimeCatalogItem[] items,
|
||||
|
|
@ -33,9 +35,15 @@ namespace GameCult.Aetheria.State.Unity
|
|||
_corporationsByLegacyId = corporations
|
||||
.Where(corporation => !string.IsNullOrWhiteSpace(corporation.LegacyId))
|
||||
.ToDictionary(corporation => corporation.LegacyId, StringComparer.OrdinalIgnoreCase);
|
||||
_corporationsByKey = corporations
|
||||
.Where(corporation => !string.IsNullOrWhiteSpace(corporation.CorporationKey))
|
||||
.ToDictionary(corporation => corporation.CorporationKey, StringComparer.OrdinalIgnoreCase);
|
||||
_nameFilesByLegacyId = nameFiles
|
||||
.Where(nameFile => !string.IsNullOrWhiteSpace(nameFile.LegacyId))
|
||||
.ToDictionary(nameFile => nameFile.LegacyId, StringComparer.OrdinalIgnoreCase);
|
||||
_nameFilesByKey = nameFiles
|
||||
.Where(nameFile => !string.IsNullOrWhiteSpace(nameFile.NameFileKey))
|
||||
.ToDictionary(nameFile => nameFile.NameFileKey, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public IReadOnlyList<AetheriaRuntimeCatalogItem> Items { get; }
|
||||
|
|
@ -63,11 +71,21 @@ namespace GameCult.Aetheria.State.Unity
|
|||
return TryGet(_corporationsByLegacyId, legacyId);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeCorporation? FindCorporation(string corporationKey)
|
||||
{
|
||||
return TryGet(_corporationsByKey, corporationKey);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeNameFile? FindNameFileByLegacyId(string legacyId)
|
||||
{
|
||||
return TryGet(_nameFilesByLegacyId, legacyId);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeNameFile? FindNameFile(string nameFileKey)
|
||||
{
|
||||
return TryGet(_nameFilesByKey, nameFileKey);
|
||||
}
|
||||
|
||||
public IEnumerable<AetheriaRuntimeCatalogItem> FindItemsByBehavior(string behaviorKind)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(behaviorKind)
|
||||
|
|
@ -84,12 +102,12 @@ namespace GameCult.Aetheria.State.Unity
|
|||
|
||||
public AetheriaRuntimeCorporation? GetManufacturer(AetheriaRuntimeCatalogItem item)
|
||||
{
|
||||
return FindCorporationByLegacyId(item.ManufacturerLegacyId);
|
||||
return FindCorporation(item.ManufacturerKey);
|
||||
}
|
||||
|
||||
public AetheriaRuntimeNameFile? GetNameFile(AetheriaRuntimeCorporation corporation)
|
||||
{
|
||||
return FindNameFileByLegacyId(corporation.GeonameFileLegacyId);
|
||||
return FindNameFile(corporation.GeonameFileKey);
|
||||
}
|
||||
|
||||
private static T? TryGet<T>(IReadOnlyDictionary<string, T> dictionary, string key) where T : class
|
||||
|
|
@ -156,6 +174,9 @@ namespace GameCult.Aetheria.State.Unity
|
|||
Category = category;
|
||||
Description = description;
|
||||
ManufacturerLegacyId = manufacturerLegacyId;
|
||||
ManufacturerKey = string.IsNullOrWhiteSpace(manufacturerLegacyId)
|
||||
? ""
|
||||
: $"aetheria.corporation:legacy:{manufacturerLegacyId}";
|
||||
Price = price;
|
||||
Mass = mass;
|
||||
SpecificHeat = specificHeat;
|
||||
|
|
@ -207,6 +228,7 @@ namespace GameCult.Aetheria.State.Unity
|
|||
public string Category { get; }
|
||||
public string Description { get; }
|
||||
public string ManufacturerLegacyId { get; }
|
||||
public string ManufacturerKey { get; }
|
||||
public int Price { get; }
|
||||
public double Mass { get; }
|
||||
public double SpecificHeat { get; }
|
||||
|
|
@ -470,17 +492,23 @@ namespace GameCult.Aetheria.State.Unity
|
|||
Description = description;
|
||||
GeonameFileLegacyId = geonameFileLegacyId;
|
||||
BossHullLegacyId = bossHullLegacyId;
|
||||
CorporationKey = string.IsNullOrWhiteSpace(legacyId) ? "" : $"aetheria.corporation:legacy:{legacyId}";
|
||||
GeonameFileKey = string.IsNullOrWhiteSpace(geonameFileLegacyId) ? "" : $"aetheria.name_file:legacy:{geonameFileLegacyId}";
|
||||
BossHullItemKey = string.IsNullOrWhiteSpace(bossHullLegacyId) ? "" : $"aetheria.item_definition:legacy:{bossHullLegacyId}";
|
||||
InfluenceDistance = influenceDistance;
|
||||
AllegianceCount = allegianceCount;
|
||||
Allegiances = allegiances;
|
||||
}
|
||||
|
||||
public string LegacyId { get; }
|
||||
public string CorporationKey { get; }
|
||||
public string Name { get; }
|
||||
public string ShortName { get; }
|
||||
public string Description { get; }
|
||||
public string GeonameFileLegacyId { get; }
|
||||
public string GeonameFileKey { get; }
|
||||
public string BossHullLegacyId { get; }
|
||||
public string BossHullItemKey { get; }
|
||||
public int InfluenceDistance { get; }
|
||||
public int AllegianceCount { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeCorporationAllegiance> Allegiances { get; }
|
||||
|
|
@ -491,10 +519,14 @@ namespace GameCult.Aetheria.State.Unity
|
|||
public AetheriaRuntimeCorporationAllegiance(string corporationLegacyId, double weight)
|
||||
{
|
||||
CorporationLegacyId = corporationLegacyId;
|
||||
CorporationKey = string.IsNullOrWhiteSpace(corporationLegacyId)
|
||||
? ""
|
||||
: $"aetheria.corporation:legacy:{corporationLegacyId}";
|
||||
Weight = weight;
|
||||
}
|
||||
|
||||
public string CorporationLegacyId { get; }
|
||||
public string CorporationKey { get; }
|
||||
public double Weight { get; }
|
||||
}
|
||||
|
||||
|
|
@ -508,6 +540,7 @@ namespace GameCult.Aetheria.State.Unity
|
|||
IReadOnlyList<string> names)
|
||||
{
|
||||
LegacyId = legacyId;
|
||||
NameFileKey = string.IsNullOrWhiteSpace(legacyId) ? "" : $"aetheria.name_file:legacy:{legacyId}";
|
||||
Name = name;
|
||||
NameCount = nameCount;
|
||||
SampleNames = sampleNames;
|
||||
|
|
@ -515,6 +548,7 @@ namespace GameCult.Aetheria.State.Unity
|
|||
}
|
||||
|
||||
public string LegacyId { get; }
|
||||
public string NameFileKey { get; }
|
||||
public string Name { get; }
|
||||
public int NameCount { get; }
|
||||
public IReadOnlyList<string> SampleNames { get; }
|
||||
|
|
|
|||
|
|
@ -394,8 +394,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
legacy-ID record key mapping for migrated item, corporation, and name-file
|
||||
documents.
|
||||
- `AetheriaCatalogSnapshot` is the typed catalog read surface over materialized
|
||||
`.cc` records. It exposes trade-item, manufacturer, corporation prefix, and
|
||||
corporation name-file queries, plus equipment, hardpoint, and behavior
|
||||
`.cc` records. It exposes trade-item, typed
|
||||
manufacturer/corporation/name-file key queries, corporation prefix queries,
|
||||
and legacy-ID migration lookup, plus equipment, hardpoint, and behavior
|
||||
queries without touching runtime projection DTOs.
|
||||
- `ItemManager` can now ask its typed runtime item reader for the owning
|
||||
`AetheriaRuntimeCatalogItem` row by item ID. Its generic mass, thermal-mass,
|
||||
|
|
@ -415,7 +416,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
read path for .NET smokes. Neither is a simulation owner and neither writes
|
||||
state.
|
||||
`Aetheria.Shared.Unity` references this package directly so `Galaxy` can
|
||||
consume typed name files without loading legacy `NameFile` documents. The
|
||||
consume typed corporation and name-file keys without loading legacy `Faction`
|
||||
or `NameFile` documents. The
|
||||
package also owns Unity's typed runtime commit log writer for settings,
|
||||
loadout-template, and run-checkpoint command documents under
|
||||
`aetheria-world.cc.pending`. This log is command-only: it cannot decide
|
||||
|
|
@ -797,7 +799,7 @@ First Aetheria surfaces to publish:
|
|||
`DatabaseEntry` union fields into typed item/faction/name-file catalog
|
||||
documents without making `Aetheria.State` depend on Unity's legacy model.
|
||||
- Done: promote typed name files to `aetheria.name_file.v2` with full name
|
||||
arrays, so future `Galaxy` name generation has a Verse-owned replacement
|
||||
arrays, so `Galaxy` name generation has a Verse-owned replacement
|
||||
for legacy `NameFile.Names`.
|
||||
- Done: promote typed corporations to `aetheria.corporation.v2` with full
|
||||
allegiance edges, so temporary `Faction` DTO projection can preserve
|
||||
|
|
@ -913,9 +915,14 @@ First Aetheria surfaces to publish:
|
|||
- Done: move `Galaxy` faction selection and name generation to the typed
|
||||
runtime catalog; legacy `Faction`/`NameFile` catalog entries no longer
|
||||
decide generated sector factions or zone names.
|
||||
- Done: move entity faction restore and loadout manufacturer-distance
|
||||
weighting to `Galaxy.ResolveFaction`, so legacy `Faction` catalog entries
|
||||
no longer decide runtime faction references after generation.
|
||||
- Done: move entity faction restore to `Galaxy.ResolveFaction`, so legacy
|
||||
`Faction` catalog entries no longer decide runtime faction references
|
||||
after generation.
|
||||
- Done: move package and canonical manufacturer/corporation/name-file lookup
|
||||
to typed keys (`ManufacturerKey`, `CorporationKey`, `GeonameFileKey`,
|
||||
and `NameFileKey`), and move loadout manufacturer-distance weighting to
|
||||
`Galaxy.ResolveFactionByKey`, so loadout code no longer parses
|
||||
manufacturer legacy GUIDs to find faction influence.
|
||||
- Done: move `LoadoutGenerator` weighted candidate selection, hardpoint fit,
|
||||
station bay fit, cargo/capacitor fit, selected-item reuse, hull/category,
|
||||
hull type, hull conductivity setup, and behavior-kind prefilters onto typed
|
||||
|
|
|
|||
Loading…
Reference in a new issue