Add a (dev) option to not load certain quests
This commit is contained in:
parent
d20a768996
commit
202abcf3a8
@ -79,6 +79,9 @@ public class QuestSourceGenerator : ISourceGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
var quest = questNode.Deserialize<QuestRoot>()!;
|
var quest = questNode.Deserialize<QuestRoot>()!;
|
||||||
|
if (quest.Disabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
quests.Add((id, quest));
|
quests.Add((id, quest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Disabled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"Comment": {
|
"Comment": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -6,6 +6,7 @@ public sealed class QuestRoot
|
|||||||
{
|
{
|
||||||
public string Author { get; set; } = null!;
|
public string Author { get; set; } = null!;
|
||||||
public List<string> Contributors { get; set; } = new();
|
public List<string> Contributors { get; set; } = new();
|
||||||
|
public bool Disabled { get; set; }
|
||||||
public string? Comment { get; set; }
|
public string? Comment { get; set; }
|
||||||
public List<ushort> TerritoryBlacklist { get; set; } = new();
|
public List<ushort> TerritoryBlacklist { get; set; } = new();
|
||||||
public List<QuestSequence> QuestSequence { get; set; } = new();
|
public List<QuestSequence> QuestSequence { get; set; } = new();
|
||||||
|
@ -130,7 +130,8 @@ internal sealed class QuestRegistry
|
|||||||
var distinctSequenceCount = quest.Root.QuestSequence.Select(x => x.Sequence).Distinct().Count();
|
var distinctSequenceCount = quest.Root.QuestSequence.Select(x => x.Sequence).Distinct().Count();
|
||||||
if (totalSequenceCount != distinctSequenceCount)
|
if (totalSequenceCount != distinctSequenceCount)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Quest has duplicate sequence numbers: {QuestId} / {QuestName}", quest.QuestId,
|
_logger.LogWarning("Quest has duplicate sequence numbers: {QuestId} / {QuestName}",
|
||||||
|
quest.QuestId,
|
||||||
quest.Info.Name);
|
quest.Info.Name);
|
||||||
++foundProblems;
|
++foundProblems;
|
||||||
}
|
}
|
||||||
@ -196,7 +197,8 @@ internal sealed class QuestRegistry
|
|||||||
{
|
{
|
||||||
_logger.LogWarning(
|
_logger.LogWarning(
|
||||||
"Quest step has duplicate completion flags: {QuestId} / {QuestName} → {Sequence} → {Flags}",
|
"Quest step has duplicate completion flags: {QuestId} / {QuestName} → {Sequence} → {Flags}",
|
||||||
quest.QuestId, quest.Info.Name, sequence.Sequence, string.Join(", ", duplicate.First()));
|
quest.QuestId, quest.Info.Name, sequence.Sequence,
|
||||||
|
string.Join(", ", duplicate.First()));
|
||||||
++foundProblems;
|
++foundProblems;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,6 +233,13 @@ internal sealed class QuestRegistry
|
|||||||
Root = JsonSerializer.Deserialize<QuestRoot>(stream)!,
|
Root = JsonSerializer.Deserialize<QuestRoot>(stream)!,
|
||||||
Info = _questData.GetQuestInfo(questId.Value),
|
Info = _questData.GetQuestInfo(questId.Value),
|
||||||
};
|
};
|
||||||
|
if (quest.Root.Disabled)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Quest {QuestId} / {QuestName} is disabled and won't be loaded", questId,
|
||||||
|
quest.Info.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_quests[questId.Value] = quest;
|
_quests[questId.Value] = quest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user