27 lines
671 B
C#
27 lines
671 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Validation.Validators;
|
|
|
|
internal sealed class NextQuestValidator : IQuestValidator
|
|
{
|
|
public IEnumerable<ValidationIssue> Validate(Quest quest)
|
|
{
|
|
foreach (var item in from x in quest.AllSteps()
|
|
where x.Step.NextQuestId == quest.Id
|
|
select x)
|
|
{
|
|
yield return new ValidationIssue
|
|
{
|
|
ElementId = quest.Id,
|
|
Sequence = item.Item1.Sequence,
|
|
Step = item.Item2,
|
|
Type = EIssueType.InvalidNextQuestId,
|
|
Severity = EIssueSeverity.Error,
|
|
Description = "Next quest should not reference itself"
|
|
};
|
|
}
|
|
}
|
|
}
|