punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
|
@ -0,0 +1,49 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Questionable.Data;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Common;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Validation.Validators;
|
||||
|
||||
internal sealed class AethernetShortcutValidator : IQuestValidator
|
||||
{
|
||||
private readonly AetheryteData _aetheryteData;
|
||||
|
||||
public AethernetShortcutValidator(AetheryteData aetheryteData)
|
||||
{
|
||||
_aetheryteData = aetheryteData;
|
||||
}
|
||||
|
||||
public IEnumerable<ValidationIssue> Validate(Quest quest)
|
||||
{
|
||||
return (from x in quest.AllSteps()
|
||||
select Validate(quest.Id, x.Sequence.Sequence, x.StepId, x.Step.AethernetShortcut) into x
|
||||
where x != null
|
||||
select x).Cast<ValidationIssue>();
|
||||
}
|
||||
|
||||
private ValidationIssue? Validate(ElementId elementId, int sequenceNo, int stepId, AethernetShortcut? aethernetShortcut)
|
||||
{
|
||||
if (aethernetShortcut == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ushort valueOrDefault = _aetheryteData.AethernetGroups.GetValueOrDefault(aethernetShortcut.From);
|
||||
ushort valueOrDefault2 = _aetheryteData.AethernetGroups.GetValueOrDefault(aethernetShortcut.To);
|
||||
if (valueOrDefault != valueOrDefault2)
|
||||
{
|
||||
return new ValidationIssue
|
||||
{
|
||||
ElementId = elementId,
|
||||
Sequence = (byte)sequenceNo,
|
||||
Step = stepId,
|
||||
Type = EIssueType.InvalidAethernetShortcut,
|
||||
Severity = EIssueSeverity.Error,
|
||||
Description = $"Invalid aethernet shortcut: {aethernetShortcut.From} to {aethernetShortcut.To}"
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue