1
0
forked from liza/Questionable

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; AddonJournalResult* addon = (AddonJournalResult*)args.Addon;
string questName = addon->AtkTextNode250->NodeText.ToString(); 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)) GameFunctions.GameStringEquals(_questController.CurrentQuest.Quest.Info.Name, questName))
addon->FireCallbackInt(0); addon->FireCallbackInt(0);
else else

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using FFXIVClientStructs.FFXIV.Common.Math; using FFXIVClientStructs.FFXIV.Common.Math;
using LLib.GameData; using LLib.GameData;
@ -24,7 +25,9 @@ internal sealed class LeveData
public void AddQuestSteps(LeveInfo leveInfo, QuestRoot questRoot) 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); QuestSequence? startSequence = questRoot.QuestSequence.FirstOrDefault(x => x.Sequence == 0);
if (startSequence == null) if (startSequence == null)

View File

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