muffin v6.12
This commit is contained in:
parent
e786325cda
commit
0950798597
64 changed files with 40100 additions and 58121 deletions
|
@ -4,6 +4,7 @@ public enum EIssueType
|
|||
{
|
||||
None,
|
||||
InvalidJsonSchema,
|
||||
InvalidJsonSyntax,
|
||||
MissingSequence0,
|
||||
MissingSequence,
|
||||
DuplicateSequence,
|
||||
|
|
|
@ -39,15 +39,21 @@ internal sealed class QuestValidator
|
|||
_validationIssues.Clear();
|
||||
}
|
||||
|
||||
public void AddValidationIssue(ValidationIssue issue)
|
||||
{
|
||||
_validationIssues.Add(issue);
|
||||
}
|
||||
|
||||
public void Validate(IEnumerable<Quest> quests)
|
||||
{
|
||||
Task.Factory.StartNew(delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
List<ValidationIssue> first = _validationIssues.ToList();
|
||||
_validationIssues.Clear();
|
||||
List<ValidationIssue> list = new List<ValidationIssue>();
|
||||
Dictionary<EAlliedSociety, int> dictionary = new Dictionary<EAlliedSociety, int>();
|
||||
Dictionary<EAlliedSociety, List<ElementId>> dictionary = new Dictionary<EAlliedSociety, List<ElementId>>();
|
||||
foreach (Quest quest in quests)
|
||||
{
|
||||
foreach (IQuestValidator validator in _validators)
|
||||
|
@ -56,8 +62,12 @@ internal sealed class QuestValidator
|
|||
{
|
||||
if (item.Type == EIssueType.QuestDisabled && quest.Info.AlliedSociety != EAlliedSociety.None)
|
||||
{
|
||||
dictionary.TryAdd(quest.Info.AlliedSociety, 0);
|
||||
dictionary[quest.Info.AlliedSociety]++;
|
||||
if (!dictionary.TryGetValue(quest.Info.AlliedSociety, out var value))
|
||||
{
|
||||
value = new List<ElementId>();
|
||||
dictionary[quest.Info.AlliedSociety] = value;
|
||||
}
|
||||
value.Add(quest.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -69,10 +79,9 @@ internal sealed class QuestValidator
|
|||
List<ElementId> disabledQuests = (from x in list
|
||||
where x.Type == EIssueType.QuestDisabled
|
||||
select x.ElementId).ToList();
|
||||
_validationIssues = (from x in list
|
||||
where !disabledQuests.Contains(x.ElementId) || x.Type == EIssueType.QuestDisabled
|
||||
_validationIssues = (from x in first.Concat(list.Where((ValidationIssue x) => !disabledQuests.Contains(x.ElementId) || x.Type == EIssueType.QuestDisabled)).Concat(DisabledTribesAsIssues(dictionary))
|
||||
orderby x.ElementId, x.Sequence, x.Step, x.Description
|
||||
select x).Concat(DisabledTribesAsIssues(dictionary)).ToList();
|
||||
select x).ToList();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -86,11 +95,12 @@ internal sealed class QuestValidator
|
|||
return _validationIssues.Where((ValidationIssue x) => x.ElementId == elementId).ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<ValidationIssue> DisabledTribesAsIssues(Dictionary<EAlliedSociety, int> disabledTribeQuests)
|
||||
private static IEnumerable<ValidationIssue> DisabledTribesAsIssues(Dictionary<EAlliedSociety, List<ElementId>> disabledTribeQuests)
|
||||
{
|
||||
return from x in disabledTribeQuests
|
||||
orderby x.Key
|
||||
select new ValidationIssue
|
||||
return disabledTribeQuests.OrderBy<KeyValuePair<EAlliedSociety, List<ElementId>>, EAlliedSociety>((KeyValuePair<EAlliedSociety, List<ElementId>> x) => x.Key).Select(delegate(KeyValuePair<EAlliedSociety, List<ElementId>> x)
|
||||
{
|
||||
string value = ((x.Value.Count > 0) ? string.Join(", ", x.Value.Select((ElementId id) => id.ToString())) : "(none)");
|
||||
return new ValidationIssue
|
||||
{
|
||||
ElementId = null,
|
||||
Sequence = null,
|
||||
|
@ -98,7 +108,8 @@ internal sealed class QuestValidator
|
|||
AlliedSociety = x.Key,
|
||||
Type = EIssueType.QuestDisabled,
|
||||
Severity = EIssueSeverity.None,
|
||||
Description = $"{x.Value} disabled quest(s)"
|
||||
Description = $"{x.Value.Count} disabled quest(s): {value}"
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue