punish v6.8.18.0
This commit is contained in:
commit
060278c1b7
317 changed files with 554155 additions and 0 deletions
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Questionable.Controller.Utils;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Validation.Validators;
|
||||
|
||||
internal sealed class CompletionFlagsValidator : IQuestValidator
|
||||
{
|
||||
public IEnumerable<ValidationIssue> Validate(Quest quest)
|
||||
{
|
||||
if (quest.Id.Value == 5149)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
foreach (QuestSequence sequence in quest.AllSequences())
|
||||
{
|
||||
List<long> mappedCompletionFlags = sequence.Steps.Select((QuestStep x) => QuestWorkUtils.HasCompletionFlags(x.CompletionQuestVariablesFlags) ? Enumerable.Range(0, 6).Select(delegate(int y)
|
||||
{
|
||||
QuestWorkValue questWorkValue = x.CompletionQuestVariablesFlags[y];
|
||||
return (long)((questWorkValue == null) ? 0 : BitOperations.RotateLeft((ulong)(questWorkValue.High.GetValueOrDefault() * 16 + questWorkValue.Low.GetValueOrDefault()), 8 * y));
|
||||
}).Sum() : 0).ToList();
|
||||
int i = 0;
|
||||
while (i < sequence.Steps.Count)
|
||||
{
|
||||
long flags = mappedCompletionFlags[i];
|
||||
if (flags != 0L && mappedCompletionFlags.Count((long x) => x == flags) >= 2)
|
||||
{
|
||||
yield return new ValidationIssue
|
||||
{
|
||||
ElementId = quest.Id,
|
||||
Sequence = sequence.Sequence,
|
||||
Step = i,
|
||||
Type = EIssueType.DuplicateCompletionFlags,
|
||||
Severity = EIssueSeverity.Error,
|
||||
Description = "Duplicate completion flags: " + string.Join(", ", sequence.Steps[i].CompletionQuestVariablesFlags)
|
||||
};
|
||||
}
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue