punish v6.8.18.0
This commit is contained in:
commit
e786325cda
322 changed files with 554232 additions and 0 deletions
|
@ -0,0 +1,32 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Validation.Validators;
|
||||
|
||||
internal sealed class UniqueSinglePlayerInstanceValidator : IQuestValidator
|
||||
{
|
||||
public IEnumerable<ValidationIssue> Validate(Quest quest)
|
||||
{
|
||||
List<(QuestSequence, int, byte)> list = (from x in quest.AllSteps()
|
||||
where x.Step.InteractionType == EInteractionType.SinglePlayerDuty
|
||||
select (Sequence: x.Sequence, StepId: x.StepId, SinglePlayerDutyIndex: x.Step.SinglePlayerDutyIndex)).ToList();
|
||||
if (list.DistinctBy<(QuestSequence, int, byte), byte>(((QuestSequence Sequence, int StepId, byte SinglePlayerDutyIndex) x) => x.SinglePlayerDutyIndex).Count() >= list.Count)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
foreach (var item in list)
|
||||
{
|
||||
yield return new ValidationIssue
|
||||
{
|
||||
ElementId = quest.Id,
|
||||
Sequence = item.Item1.Sequence,
|
||||
Step = item.Item2,
|
||||
Type = EIssueType.DuplicateSinglePlayerInstance,
|
||||
Severity = EIssueSeverity.Error,
|
||||
Description = $"Duplicate singleplayer duty index: {item.Item3}"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue