From affa8d46f2e65ae6ed30a46cee777a55fd344eb9 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 14 Apr 2025 16:29:42 +0200 Subject: [PATCH] Add option for quests to be non-interruptible --- QuestPathGenerator/QuestSourceGenerator.cs | 6 ++++-- .../832_The Things We Do for Cheese.json | 1 + QuestPaths/quest-v1.json | 6 +++++- Questionable.Model/Questing/QuestRoot.cs | 1 + Questionable/Controller/QuestController.cs | 4 +--- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/QuestPathGenerator/QuestSourceGenerator.cs b/QuestPathGenerator/QuestSourceGenerator.cs index b23bb9da..463e04bc 100644 --- a/QuestPathGenerator/QuestSourceGenerator.cs +++ b/QuestPathGenerator/QuestSourceGenerator.cs @@ -152,6 +152,7 @@ public class QuestSourceGenerator : ISourceGenerator { try { + QuestRoot emptyQuest = new(); return ObjectCreationExpression( IdentifierName(nameof(QuestRoot))) .WithInitializer( @@ -161,8 +162,9 @@ public class QuestSourceGenerator : ISourceGenerator SyntaxNodeList( AssignmentList(nameof(QuestRoot.Author), quest.Author) .AsSyntaxNodeOrToken(), - Assignment(nameof(QuestRoot.Disabled), quest.Disabled, false).AsSyntaxNodeOrToken(), - Assignment(nameof(QuestRoot.Comment), quest.Comment, null) + Assignment(nameof(QuestRoot.Disabled), quest.Disabled, emptyQuest.Disabled).AsSyntaxNodeOrToken(), + Assignment(nameof(QuestRoot.Interruptible), quest.Interruptible, emptyQuest.Interruptible).AsSyntaxNodeOrToken(), + Assignment(nameof(QuestRoot.Comment), quest.Comment, emptyQuest.Comment) .AsSyntaxNodeOrToken(), AssignmentExpression( SyntaxKind.SimpleAssignmentExpression, diff --git a/QuestPaths/2.x - A Realm Reborn/MSQ-2/B2-Eastern La Noscea, Brayflox, Cheese and Wine/832_The Things We Do for Cheese.json b/QuestPaths/2.x - A Realm Reborn/MSQ-2/B2-Eastern La Noscea, Brayflox, Cheese and Wine/832_The Things We Do for Cheese.json index 833c79f7..74b1c939 100644 --- a/QuestPaths/2.x - A Realm Reborn/MSQ-2/B2-Eastern La Noscea, Brayflox, Cheese and Wine/832_The Things We Do for Cheese.json +++ b/QuestPaths/2.x - A Realm Reborn/MSQ-2/B2-Eastern La Noscea, Brayflox, Cheese and Wine/832_The Things We Do for Cheese.json @@ -1,6 +1,7 @@ { "$schema": "https://git.carvel.li/liza/Questionable/raw/branch/master/QuestPaths/quest-v1.json", "Author": "JerryWester", + "Interruptible": false, "QuestSequence": [ { "Sequence": 0, diff --git a/QuestPaths/quest-v1.json b/QuestPaths/quest-v1.json index 925a801b..56d33fc9 100644 --- a/QuestPaths/quest-v1.json +++ b/QuestPaths/quest-v1.json @@ -22,6 +22,10 @@ "Disabled": { "type": "boolean" }, + "Interruptible": { + "type": "boolean", + "description": "If set to false, no priority quest (e.g. class quests) will be done while this is the currently active quest" + }, "Comment": { "type": "string" }, @@ -1549,4 +1553,4 @@ ] } } -} \ No newline at end of file +} diff --git a/Questionable.Model/Questing/QuestRoot.cs b/Questionable.Model/Questing/QuestRoot.cs index 99899412..d42ee869 100644 --- a/Questionable.Model/Questing/QuestRoot.cs +++ b/Questionable.Model/Questing/QuestRoot.cs @@ -15,6 +15,7 @@ public sealed class QuestRoot /// public bool Disabled { get; set; } + public bool Interruptible { get; set; } = true; public string? Comment { get; set; } public List QuestSequence { get; set; } = new(); } diff --git a/Questionable/Controller/QuestController.cs b/Questionable/Controller/QuestController.cs index 752df5b3..905c2aba 100644 --- a/Questionable/Controller/QuestController.cs +++ b/Questionable/Controller/QuestController.cs @@ -9,13 +9,11 @@ using Dalamud.Game.Gui.Toast; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game; -using Lumina.Excel.Sheets; using Microsoft.Extensions.Logging; using Questionable.Controller.Steps; using Questionable.Controller.Steps.Interactions; using Questionable.Controller.Steps.Shared; using Questionable.Data; -using Questionable.External; using Questionable.Functions; using Questionable.Model; using Questionable.Model.Questing; @@ -812,7 +810,7 @@ internal sealed class QuestController : MiniTaskController return false; var (currentQuest, type) = details.Value; - if (type != ECurrentQuestType.Normal || currentQuest.Sequence == 0) + if (type != ECurrentQuestType.Normal || !currentQuest.Quest.Root.Interruptible || currentQuest.Sequence == 0) return false; if (ManualPriorityQuests.Contains(currentQuest.Quest)) -- 2.30.2