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
|
|
|
|
|
{
|
2024-08-04 14:03:23 +00:00
|
|
|
|
public required ElementId Id { get; init; }
|
2024-07-11 00:56:42 +00:00
|
|
|
|
public required QuestRoot Root { get; init; }
|
2024-08-04 14:03:23 +00:00
|
|
|
|
public required IQuestInfo Info { get; init; }
|
2024-08-15 19:38:47 +00:00
|
|
|
|
public required ESource Source { get; init; }
|
2024-05-26 19:45:26 +00:00
|
|
|
|
|
|
|
|
|
public QuestSequence? FindSequence(byte currentSequence)
|
2024-07-11 00:56:42 +00:00
|
|
|
|
=> 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-15 19:38:47 +00:00
|
|
|
|
|
|
|
|
|
public enum ESource
|
|
|
|
|
{
|
|
|
|
|
Assembly,
|
|
|
|
|
ProjectDirectory,
|
|
|
|
|
UserDirectory,
|
|
|
|
|
}
|
2024-05-25 21:51:37 +00:00
|
|
|
|
}
|