punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Questionable.Data;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Validation.Validators;
|
||||
|
||||
internal sealed class SinglePlayerInstanceValidator : IQuestValidator
|
||||
{
|
||||
private readonly Dictionary<ElementId, List<byte>> _questIdToDutyIndexes;
|
||||
|
||||
public SinglePlayerInstanceValidator(TerritoryData territoryData)
|
||||
{
|
||||
_questIdToDutyIndexes = (from x in territoryData.GetAllQuestsWithQuestBattles()
|
||||
group x by x.QuestId).ToDictionary((IGrouping<ElementId, (ElementId QuestId, byte Index, TerritoryData.ContentFinderConditionData Data)> x) => x.Key, (IGrouping<ElementId, (ElementId QuestId, byte Index, TerritoryData.ContentFinderConditionData Data)> x) => x.Select(((ElementId QuestId, byte Index, TerritoryData.ContentFinderConditionData Data) y) => y.Index).ToList());
|
||||
}
|
||||
|
||||
public IEnumerable<ValidationIssue> Validate(Quest quest)
|
||||
{
|
||||
if (!_questIdToDutyIndexes.TryGetValue(quest.Id, out List<byte> value))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
foreach (byte index in value)
|
||||
{
|
||||
if (!quest.AllSteps().Any<(QuestSequence, int, QuestStep)>(((QuestSequence Sequence, int StepId, QuestStep Step) x) => x.Step.InteractionType == EInteractionType.SinglePlayerDuty && x.Step.SinglePlayerDutyIndex == index))
|
||||
{
|
||||
yield return new ValidationIssue
|
||||
{
|
||||
ElementId = quest.Id,
|
||||
Sequence = null,
|
||||
Step = null,
|
||||
Type = EIssueType.UnusedSinglePlayerInstance,
|
||||
Severity = EIssueSeverity.Error,
|
||||
Description = $"Single player instance {index} not used"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue