Questionable/QuestPaths/AssemblyQuestLoader.cs

34 lines
1013 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
2024-07-16 08:54:47 +00:00
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
2024-06-14 09:37:33 +00:00
using Questionable.Model.V1;
2024-06-01 20:01:50 +00:00
namespace Questionable.QuestPaths;
2024-07-16 08:54:47 +00:00
[SuppressMessage("ReSharper", "PartialTypeWithSinglePart", Justification = "Required for RELEASE")]
2024-06-14 09:37:33 +00:00
public static partial class AssemblyQuestLoader
2024-06-01 20:01:50 +00:00
{
private static Dictionary<ushort, QuestRoot>? _quests;
public static IReadOnlyDictionary<ushort, QuestRoot> GetQuests()
{
if (_quests == null)
{
_quests = [];
2024-07-15 01:05:37 +00:00
#if RELEASE
LoadQuests();
#endif
}
return _quests ?? throw new InvalidOperationException("quest data is not initialized");
}
public static Stream QuestSchema =>
typeof(AssemblyQuestLoader).Assembly.GetManifestResourceStream("Questionable.QuestPaths.QuestSchema")!;
[SuppressMessage("ReSharper", "UnusedMember.Local")]
private static void AddQuest(ushort questId, QuestRoot root) => _quests![questId] = root;
2024-07-15 01:05:37 +00:00
}