Questionable/Questionable/Model/Quest.cs

38 lines
1.0 KiB
C#
Raw Normal View History

2024-07-16 12:43:31 +00:00
using System.Collections.Generic;
using System.Linq;
2024-08-02 16:30:21 +00:00
using Questionable.Model.Questing;
2024-05-25 21:51:37 +00:00
2024-06-01 20:01:50 +00:00
namespace Questionable.Model;
2024-05-25 21:51:37 +00:00
internal sealed class Quest
{
public required ElementId Id { get; init; }
public required QuestRoot Root { get; init; }
public required IQuestInfo Info { get; init; }
public required ESource Source { get; init; }
2024-05-26 19:45:26 +00:00
public QuestSequence? FindSequence(byte currentSequence)
=> Root.QuestSequence.SingleOrDefault(seq => seq.Sequence == currentSequence);
2024-07-16 12:43:31 +00:00
public IEnumerable<QuestSequence> AllSequences() => Root.QuestSequence;
public IEnumerable<(QuestSequence Sequence, int StepId, QuestStep Step)> AllSteps()
{
foreach (var sequence in Root.QuestSequence)
{
for (int i = 0; i < sequence.Steps.Count; ++i)
{
var step = sequence.Steps[i];
yield return (sequence, i, step);
}
}
}
public enum ESource
{
Assembly,
ProjectDirectory,
UserDirectory,
}
2024-05-25 21:51:37 +00:00
}