26 lines
1.2 KiB
C#
26 lines
1.2 KiB
C#
using System.Collections.ObjectModel;
|
|
|
|
namespace NeonSprawl.Server.Game.Encounters;
|
|
|
|
/// <summary>In-memory reward-table catalog loaded at startup (NEO-101). Game callers should use injectable registries (NEO-102).</summary>
|
|
public sealed class RewardTableDefinitionCatalog(
|
|
string rewardTablesDirectory,
|
|
IReadOnlyDictionary<string, RewardTableDefRow> byId,
|
|
int catalogJsonFileCount)
|
|
{
|
|
/// <summary>Absolute path to the directory that was enumerated for <c>*_reward_tables.json</c> catalogs.</summary>
|
|
public string RewardTablesDirectory { get; } = rewardTablesDirectory;
|
|
|
|
public IReadOnlyDictionary<string, RewardTableDefRow> ById { get; } =
|
|
new ReadOnlyDictionary<string, RewardTableDefRow>(new Dictionary<string, RewardTableDefRow>(byId, StringComparer.Ordinal));
|
|
|
|
public int DistinctRewardTableCount => ById.Count;
|
|
|
|
/// <summary>Number of <c>*_reward_tables.json</c> files under <see cref="RewardTablesDirectory"/>.</summary>
|
|
public int CatalogJsonFileCount { get; } = catalogJsonFileCount;
|
|
|
|
/// <summary>Resolves a catalog row by stable reward-table <paramref name="id"/>.</summary>
|
|
public bool TryGetRewardTable(string id, out RewardTableDefRow? row) =>
|
|
ById.TryGetValue(id, out row);
|
|
}
|