From 619b5431d5b9459df644db4652bafecaee0c916a Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sat, 28 Sep 2024 15:47:48 +0200 Subject: [PATCH] Skip loading unknown quests (e.g. for CN) shipped with the plugin --- Questionable/Controller/QuestRegistry.cs | 27 +++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Questionable/Controller/QuestRegistry.cs b/Questionable/Controller/QuestRegistry.cs index 502630519..724acaf4c 100644 --- a/Questionable/Controller/QuestRegistry.cs +++ b/Questionable/Controller/QuestRegistry.cs @@ -92,17 +92,24 @@ internal sealed class QuestRegistry foreach ((ElementId questId, QuestRoot questRoot) in AssemblyQuestLoader.GetQuests()) { - var questInfo = _questData.GetQuestInfo(questId); - if (questInfo is LeveInfo leveInfo) - _leveData.AddQuestSteps(leveInfo, questRoot); - Quest quest = new() + try { - Id = questId, - Root = questRoot, - Info = questInfo, - Source = Quest.ESource.Assembly, - }; - _quests[quest.Id] = quest; + var questInfo = _questData.GetQuestInfo(questId); + if (questInfo is LeveInfo leveInfo) + _leveData.AddQuestSteps(leveInfo, questRoot); + Quest quest = new() + { + Id = questId, + Root = questRoot, + Info = questInfo, + Source = Quest.ESource.Assembly, + }; + _quests[quest.Id] = quest; + } + catch (Exception e) + { + _logger.LogWarning("Not loading unknown quest {QuestId} from assembly: {Message}", questId, e.Message); + } } _logger.LogInformation("Loaded {Count} quests from assembly", _quests.Count);