forked from liza/Questionable
Only auto-accept leves
This commit is contained in:
parent
3a27fc1211
commit
c9d9cfb787
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -12,9 +12,10 @@ 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 =
|
||||||
.Where(x => x.Step.PickUpQuestId == null)
|
FindQuestStepsWithInteractionType(quest, [EInteractionType.AcceptQuest, EInteractionType.AcceptLeve])
|
||||||
.ToList();
|
.Where(x => x.Step.PickUpQuestId == null)
|
||||||
|
.ToList();
|
||||||
foreach (var accept in questAccepts)
|
foreach (var accept in questAccepts)
|
||||||
{
|
{
|
||||||
if (accept.Sequence.Sequence != 0 || accept.StepId != quest.FindSequence(0)!.Steps.Count - 1)
|
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)
|
var questCompletes =
|
||||||
.Where(x => x.Step.TurnInQuestId == null)
|
FindQuestStepsWithInteractionType(quest, [EInteractionType.CompleteQuest, EInteractionType.CompleteLeve])
|
||||||
.ToList();
|
.Where(x => x.Step.TurnInQuestId == null)
|
||||||
|
.ToList();
|
||||||
foreach (var complete in questCompletes)
|
foreach (var complete in questCompletes)
|
||||||
{
|
{
|
||||||
if (complete.Sequence.Sequence != 255 || complete.StepId != quest.FindSequence(255)!.Steps.Count - 1)
|
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(
|
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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user