Only auto-accept leves

This commit is contained in:
Liza 2024-08-08 23:58:29 +02:00
parent 3a27fc1211
commit c9d9cfb787
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 16 additions and 11 deletions

View File

@ -784,7 +784,7 @@ internal sealed class GameUiController : IDisposable
AddonJournalResult* addon = (AddonJournalResult*)args.Addon;
string questName = addon->AtkTextNode250->NodeText.ToString();
if (_questController.CurrentQuest != null &&
if (_questController.CurrentQuest is { Quest.Id: LeveId } &&
GameFunctions.GameStringEquals(_questController.CurrentQuest.Quest.Info.Name, questName))
addon->FireCallbackInt(0);
else

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using FFXIVClientStructs.FFXIV.Common.Math;
using LLib.GameData;
@ -24,7 +25,9 @@ internal sealed class LeveData
public void AddQuestSteps(LeveInfo leveInfo, QuestRoot questRoot)
{
LeveStepData leveStepData = Leves.Single(x => x.IssuerDataId == leveInfo.IssuerDataId);
LeveStepData leveStepData = Leves.SingleOrDefault(x => x.IssuerDataId == leveInfo.IssuerDataId)
?? throw new InvalidOperationException(
$"No leve location for issuer data id {leveInfo.IssuerDataId} found");
QuestSequence? startSequence = questRoot.QuestSequence.FirstOrDefault(x => x.Sequence == 0);
if (startSequence == null)

View File

@ -12,9 +12,10 @@ internal sealed class UniqueStartStopValidator : IQuestValidator
if (quest.Id is SatisfactionSupplyNpcId)
yield break;
var questAccepts = FindQuestStepsWithInteractionType(quest, EInteractionType.AcceptQuest)
.Where(x => x.Step.PickUpQuestId == null)
.ToList();
var questAccepts =
FindQuestStepsWithInteractionType(quest, [EInteractionType.AcceptQuest, EInteractionType.AcceptLeve])
.Where(x => x.Step.PickUpQuestId == null)
.ToList();
foreach (var accept in questAccepts)
{
if (accept.Sequence.Sequence != 0 || accept.StepId != quest.FindSequence(0)!.Steps.Count - 1)
@ -44,9 +45,10 @@ internal sealed class UniqueStartStopValidator : IQuestValidator
};
}
var questCompletes = FindQuestStepsWithInteractionType(quest, EInteractionType.CompleteQuest)
.Where(x => x.Step.TurnInQuestId == null)
.ToList();
var questCompletes =
FindQuestStepsWithInteractionType(quest, [EInteractionType.CompleteQuest, EInteractionType.CompleteLeve])
.Where(x => x.Step.TurnInQuestId == null)
.ToList();
foreach (var complete in questCompletes)
{
if (complete.Sequence.Sequence != 255 || complete.StepId != quest.FindSequence(255)!.Steps.Count - 1)
@ -78,6 +80,6 @@ internal sealed class UniqueStartStopValidator : IQuestValidator
}
private static IEnumerable<(QuestSequence Sequence, int StepId, QuestStep Step)> FindQuestStepsWithInteractionType(
Quest quest, EInteractionType interactionType)
=> quest.AllSteps().Where(x => x.Step.InteractionType == interactionType);
Quest quest, List<EInteractionType> interactionType)
=> quest.AllSteps().Where(x => interactionType.Contains(x.Step.InteractionType));
}