Make AcceptQuest/CompleteQuest skippable if their relevant quest has been accepted/completed

cacahuetes-minorupdate1
Liza 2024-07-21 10:40:39 +02:00
parent e6a9c21c0f
commit 07b4765478
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 49 additions and 14 deletions

View File

@ -184,7 +184,8 @@
"ChocoboUnlocked",
"AetheryteShortcutIfInSameTerritory",
"NotTargetable",
"ItemNotInInventory"
"ItemNotInInventory",
"WakingSandsMainArea"
]
}
},

View File

@ -13,5 +13,6 @@ public sealed class SkipConditionConverter() : EnumConverter<ESkipCondition>(Val
{ ESkipCondition.AetheryteShortcutIfInSameTerritory, "AetheryteShortcutIfInSameTerritory" },
{ ESkipCondition.NotTargetable, "NotTargetable" },
{ ESkipCondition.ItemNotInInventory, "ItemNotInInventory" },
{ ESkipCondition.WakingSandsMainArea, "WakingSandsMainArea" },
};
}

View File

@ -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,
}

View File

@ -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<CheckTask>()
@ -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;
}

View File

@ -108,20 +108,26 @@ internal static class WaitAtEnd
];
case EInteractionType.AcceptQuest:
return
[
serviceProvider.GetRequiredService<WaitQuestAccepted>()
.With(step.PickUpQuestId ?? quest.QuestId),
serviceProvider.GetRequiredService<WaitDelay>()
];
{
var accept = serviceProvider.GetRequiredService<WaitQuestAccepted>()
.With(step.PickUpQuestId ?? quest.QuestId);
var delay = serviceProvider.GetRequiredService<WaitDelay>();
if (step.PickUpQuestId != null)
return [accept, delay, Next(quest, sequence)];
else
return [accept, delay];
}
case EInteractionType.CompleteQuest:
return
[
serviceProvider.GetRequiredService<WaitQuestCompleted>()
.With(step.TurnInQuestId ?? quest.QuestId),
serviceProvider.GetRequiredService<WaitDelay>()
];
{
var complete = serviceProvider.GetRequiredService<WaitQuestCompleted>()
.With(step.TurnInQuestId ?? quest.QuestId);
var delay = serviceProvider.GetRequiredService<WaitDelay>();
if (step.NextQuestId != null)
return [complete, delay, Next(quest, sequence)];
else
return [complete, delay];
}
case EInteractionType.Interact:
default: