diff --git a/QuestPaths/quest-v1.json b/QuestPaths/quest-v1.json index 6f00e483a..d49f48641 100644 --- a/QuestPaths/quest-v1.json +++ b/QuestPaths/quest-v1.json @@ -184,7 +184,8 @@ "ChocoboUnlocked", "AetheryteShortcutIfInSameTerritory", "NotTargetable", - "ItemNotInInventory" + "ItemNotInInventory", + "WakingSandsMainArea" ] } }, diff --git a/Questionable.Model/V1/Converter/SkipConditionConverter.cs b/Questionable.Model/V1/Converter/SkipConditionConverter.cs index 4a31f616c..7e7b780c8 100644 --- a/Questionable.Model/V1/Converter/SkipConditionConverter.cs +++ b/Questionable.Model/V1/Converter/SkipConditionConverter.cs @@ -13,5 +13,6 @@ public sealed class SkipConditionConverter() : EnumConverter(Val { ESkipCondition.AetheryteShortcutIfInSameTerritory, "AetheryteShortcutIfInSameTerritory" }, { ESkipCondition.NotTargetable, "NotTargetable" }, { ESkipCondition.ItemNotInInventory, "ItemNotInInventory" }, + { ESkipCondition.WakingSandsMainArea, "WakingSandsMainArea" }, }; } diff --git a/Questionable.Model/V1/ESkipCondition.cs b/Questionable.Model/V1/ESkipCondition.cs index f5f0e6762..8c766996c 100644 --- a/Questionable.Model/V1/ESkipCondition.cs +++ b/Questionable.Model/V1/ESkipCondition.cs @@ -14,4 +14,7 @@ public enum ESkipCondition AetheryteShortcutIfInSameTerritory, NotTargetable, ItemNotInInventory, + + // TODO: This is an indication the whole skip bit should be optimized/parameterized to some extent + WakingSandsMainArea, } diff --git a/Questionable/Controller/Steps/Shared/SkipCondition.cs b/Questionable/Controller/Steps/Shared/SkipCondition.cs index b509c9c67..256cf702e 100644 --- a/Questionable/Controller/Steps/Shared/SkipCondition.cs +++ b/Questionable/Controller/Steps/Shared/SkipCondition.cs @@ -28,7 +28,9 @@ internal static class SkipCondition step.SkipIf.Where(x => x != ESkipCondition.AetheryteShortcutIfInSameTerritory).ToList(); if (relevantConditions.Count == 0 && step.CompletionQuestVariablesFlags.Count == 0 && - step.RequiredQuestVariables.Count == 0) + step.RequiredQuestVariables.Count == 0 && + step.PickUpQuestId == null && + step.NextQuestId == null) return null; return serviceProvider.GetRequiredService() @@ -143,6 +145,28 @@ internal static class SkipCondition } } + if (Step.SkipIf.Contains(ESkipCondition.WakingSandsMainArea)) + { + var position = clientState.LocalPlayer!.Position; + if (position.X < 24) + { + logger.LogInformation("Skipping step, as we're not in the Solar"); + return true; + } + } + + if (Step.PickUpQuestId != null && gameFunctions.IsQuestAcceptedOrComplete(Step.PickUpQuestId.Value)) + { + logger.LogInformation("Skipping step, as we have already picked up the relevant quest"); + return true; + } + + if (Step.TurnInQuestId != null && gameFunctions.IsQuestComplete(Step.TurnInQuestId.Value)) + { + logger.LogInformation("Skipping step, as we have already completed the relevant quest"); + return true; + } + return false; } diff --git a/Questionable/Controller/Steps/Shared/WaitAtEnd.cs b/Questionable/Controller/Steps/Shared/WaitAtEnd.cs index 947e425f6..6af28d975 100644 --- a/Questionable/Controller/Steps/Shared/WaitAtEnd.cs +++ b/Questionable/Controller/Steps/Shared/WaitAtEnd.cs @@ -108,20 +108,26 @@ internal static class WaitAtEnd ]; case EInteractionType.AcceptQuest: - return - [ - serviceProvider.GetRequiredService() - .With(step.PickUpQuestId ?? quest.QuestId), - serviceProvider.GetRequiredService() - ]; + { + var accept = serviceProvider.GetRequiredService() + .With(step.PickUpQuestId ?? quest.QuestId); + var delay = serviceProvider.GetRequiredService(); + if (step.PickUpQuestId != null) + return [accept, delay, Next(quest, sequence)]; + else + return [accept, delay]; + } case EInteractionType.CompleteQuest: - return - [ - serviceProvider.GetRequiredService() - .With(step.TurnInQuestId ?? quest.QuestId), - serviceProvider.GetRequiredService() - ]; + { + var complete = serviceProvider.GetRequiredService() + .With(step.TurnInQuestId ?? quest.QuestId); + var delay = serviceProvider.GetRequiredService(); + if (step.NextQuestId != null) + return [complete, delay, Next(quest, sequence)]; + else + return [complete, delay]; + } case EInteractionType.Interact: default: