forked from liza/Questionable
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>()!;
|
||||
if (quest.Disabled)
|
||||
continue;
|
||||
|
||||
quests.Add((id, quest));
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,9 @@
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Disabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"Comment": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -6,6 +6,7 @@ public sealed class QuestRoot
|
||||
{
|
||||
public string Author { get; set; } = null!;
|
||||
public List<string> Contributors { get; set; } = new();
|
||||
public bool Disabled { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public List<ushort> TerritoryBlacklist { 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();
|
||||
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);
|
||||
++foundProblems;
|
||||
}
|
||||
@ -196,7 +197,8 @@ internal sealed class QuestRegistry
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"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;
|
||||
}
|
||||
}
|
||||
@ -231,6 +233,13 @@ internal sealed class QuestRegistry
|
||||
Root = JsonSerializer.Deserialize<QuestRoot>(stream)!,
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user