26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using System.Collections.ObjectModel;
|
|
|
|
namespace NeonSprawl.Server.Game.Quests;
|
|
|
|
/// <summary>In-memory quest catalog loaded at startup (NEO-113). Game callers should use <see cref="IQuestDefinitionRegistry"/> (NEO-114).</summary>
|
|
public sealed class QuestDefinitionCatalog(
|
|
string questsDirectory,
|
|
IReadOnlyDictionary<string, QuestDefRow> byId,
|
|
int catalogJsonFileCount)
|
|
{
|
|
/// <summary>Absolute path to the directory that was enumerated for <c>*_quests.json</c> catalogs.</summary>
|
|
public string QuestsDirectory { get; } = questsDirectory;
|
|
|
|
public IReadOnlyDictionary<string, QuestDefRow> ById { get; } =
|
|
new ReadOnlyDictionary<string, QuestDefRow>(new Dictionary<string, QuestDefRow>(byId, StringComparer.Ordinal));
|
|
|
|
public int DistinctQuestCount => ById.Count;
|
|
|
|
/// <summary>Number of <c>*_quests.json</c> files under <see cref="QuestsDirectory"/>.</summary>
|
|
public int CatalogJsonFileCount { get; } = catalogJsonFileCount;
|
|
|
|
/// <summary>Resolves a catalog row by stable quest <paramref name="id"/>.</summary>
|
|
public bool TryGetQuest(string id, out QuestDefRow? row) =>
|
|
ById.TryGetValue(id, out row);
|
|
}
|