1
0
Fork 0
forked from aly/qstbak

muffin v7.5.5

This commit is contained in:
alydev 2026-08-17 20:25:32 +10:00
parent a8f2c1df37
commit 6266f9e6b7
110 changed files with 14907 additions and 6073 deletions

View file

@ -317,6 +317,7 @@ internal sealed class InteractionUiController : IDisposable
private unsafe int? HandleListChoice(string? actualPrompt, List<string?> answers, bool checkAllSteps)
{
List<DialogueChoiceInfo> list = new List<DialogueChoiceInfo>();
List<int> list2 = new List<int>();
QuestController.QuestProgress questProgress = _questController.SimulatedQuest ?? _questController.GatheringQuest ?? _questController.StartedQuest;
if (questProgress != null)
{
@ -347,6 +348,15 @@ internal sealed class InteractionUiController : IDisposable
{
questStep = quest.FindSequence(questProgress.Sequence)?.FindStep(questProgress.Step);
}
if (questStep == null && questProgress.Step == 255)
{
QuestSequence questSequence2 = quest.FindSequence(questProgress.Sequence);
if (questSequence2 != null && questSequence2.Steps.Count > 0)
{
List<QuestStep> steps = questSequence2.Steps;
questStep = steps[steps.Count - 1];
}
}
if (questStep == null)
{
_logger.LogDebug("Ignoring current quest dialogue choices, no active step");
@ -371,10 +381,10 @@ internal sealed class InteractionUiController : IDisposable
{
EAetheryteLocation valueOrDefault = aetheryte.GetValueOrDefault();
int num = 1;
List<EAetheryteLocation> list2 = new List<EAetheryteLocation>(num);
CollectionsMarshal.SetCount(list2, num);
CollectionsMarshal.AsSpan(list2)[0] = valueOrDefault;
source = list2;
List<EAetheryteLocation> list3 = new List<EAetheryteLocation>(num);
CollectionsMarshal.SetCount(list3, num);
CollectionsMarshal.AsSpan(list3)[0] = valueOrDefault;
source = list3;
}
}
flag = questStep.InteractionType == EInteractionType.UnlockTaxiStand;
@ -451,30 +461,30 @@ internal sealed class InteractionUiController : IDisposable
{
continue;
}
List<DialogueChoice> list3 = knownQuest.FindSequence(0)?.Steps.SelectMany((QuestStep x) => x.DialogueChoices).ToList();
if (list3 != null && list3.Count > 0)
List<DialogueChoice> list4 = knownQuest.FindSequence(0)?.Steps.SelectMany((QuestStep x) => x.DialogueChoices).ToList();
if (list4 != null && list4.Count > 0)
{
_logger.LogInformation("Adding {Count} dialogue choices from not accepted quest {QuestName}", list3.Count, item.Name);
list.AddRange(list3.Select((DialogueChoice x) => new DialogueChoiceInfo(knownQuest, x)));
_logger.LogInformation("Adding {Count} dialogue choices from not accepted quest {QuestName}", list4.Count, item.Name);
list.AddRange(list4.Select((DialogueChoice x) => new DialogueChoiceInfo(knownQuest, x)));
}
}
}
if (_fateController.IsRunning)
{
List<DialogueChoice> list4 = _fateController.CurrentFate?.TransformDialogueChoices;
if (list4 != null)
List<DialogueChoice> list5 = _fateController.CurrentFate?.TransformDialogueChoices;
if (list5 != null)
{
_logger.LogInformation("Adding {Count} dialogue choices from active FATE", list4.Count);
list.AddRange(list4.Select((DialogueChoice x) => new DialogueChoiceInfo(null, x)));
_logger.LogInformation("Adding {Count} dialogue choices from active FATE", list5.Count);
list.AddRange(list5.Select((DialogueChoice x) => new DialogueChoiceInfo(null, x)));
}
}
if (_seasonalDutyController.IsRunning)
{
List<DialogueChoice> list5 = _seasonalDutyController.CurrentDuty?.DialogueChoices;
if (list5 != null && list5.Count > 0)
List<DialogueChoice> list6 = _seasonalDutyController.CurrentDuty?.DialogueChoices;
if (list6 != null && list6.Count > 0)
{
_logger.LogInformation("Adding {Count} dialogue choices from active seasonal duty", list5.Count);
list.AddRange(list5.Select((DialogueChoice x) => new DialogueChoiceInfo(null, x)));
_logger.LogInformation("Adding {Count} dialogue choices from active seasonal duty", list6.Count);
list.AddRange(list6.Select((DialogueChoice x) => new DialogueChoiceInfo(null, x)));
}
}
if (list.Count == 0)
@ -522,19 +532,24 @@ internal sealed class InteractionUiController : IDisposable
_logger.LogInformation("Unexpected excelPrompt: {ExcelPrompt}", stringOrRegex);
continue;
}
if (actualPrompt != null && (stringOrRegex == null || !IsMatch(actualPrompt, stringOrRegex)))
if (actualPrompt != null && stringOrRegex != null && !IsMatch(actualPrompt, stringOrRegex))
{
_logger.LogInformation("Unexpected excelPrompt: {ExcelPrompt}, actualPrompt: {ActualPrompt}", stringOrRegex, actualPrompt);
int? num3 = TryFindAnswerMatchIndex(answers, stringOrRegex2, dialogueChoice2.AnswerIsRegularExpression, quest3, dialogueChoice2);
if (num3.HasValue)
{
list2.Add(num3.Value);
}
continue;
}
if (dialogueChoice2.AnswerIsRegularExpression && stringOrRegex2 != null)
{
int? num3 = FindBestRegexMatch(answers, stringOrRegex2, quest3, dialogueChoice2);
if (!num3.HasValue)
int? num4 = FindBestRegexMatch(answers, stringOrRegex2, quest3, dialogueChoice2);
if (!num4.HasValue)
{
continue;
}
_logger.LogInformation("Returning {Index}: '{Answer}' for '{Prompt}' (best regex match)", num3.Value, answers[num3.Value], actualPrompt);
_logger.LogInformation("Returning {Index}: '{Answer}' for '{Prompt}' (best regex match)", num4.Value, answers[num4.Value], actualPrompt);
if (quest3?.Id is SatisfactionSupplyNpcId)
{
if (_questController.GatheringQuest == null || _questController.GatheringQuest.Sequence == byte.MaxValue)
@ -544,16 +559,16 @@ internal sealed class InteractionUiController : IDisposable
_questController.GatheringQuest.SetSequence(1);
_questController.StartGatheringQuest("SatisfactionSupply turn in");
}
return num3.Value;
return num4.Value;
}
for (int num4 = 0; num4 < answers.Count; num4++)
for (int num5 = 0; num5 < answers.Count; num5++)
{
_logger.LogTrace("Checking if {ActualAnswer} == {ExpectedAnswer}", answers[num4], stringOrRegex2);
if (!IsMatch(answers[num4], stringOrRegex2))
_logger.LogTrace("Checking if {ActualAnswer} == {ExpectedAnswer}", answers[num5], stringOrRegex2);
if (!IsMatch(answers[num5], stringOrRegex2))
{
continue;
}
_logger.LogInformation("Returning {Index}: '{Answer}' for '{Prompt}'", num4, answers[num4], actualPrompt);
_logger.LogInformation("Returning {Index}: '{Answer}' for '{Prompt}'", num5, answers[num5], actualPrompt);
if (quest3?.Id is SatisfactionSupplyNpcId)
{
if (_questController.GatheringQuest == null || _questController.GatheringQuest.Sequence == byte.MaxValue)
@ -563,13 +578,39 @@ internal sealed class InteractionUiController : IDisposable
_questController.GatheringQuest.SetSequence(1);
_questController.StartGatheringQuest("SatisfactionSupply turn in");
}
return num4;
return num5;
}
}
int[] array = list2.Distinct().ToArray();
if (array.Length == 1)
{
_logger.LogWarning("Using answer-only fallback for prompt '{Prompt}'. Selected index {Index}: '{Answer}'", actualPrompt, array[0], answers[array[0]]);
return array[0];
}
_logger.LogInformation("No matching answer found for {Prompt}.", actualPrompt);
return null;
}
private static int? TryFindAnswerMatchIndex(List<string?> answers, StringOrRegex? excelAnswer, bool answerIsRegularExpression, Questionable.Model.Quest? quest, DialogueChoice dialogueChoice)
{
if (excelAnswer == null)
{
return null;
}
if (answerIsRegularExpression)
{
return FindBestRegexMatch(answers, excelAnswer, quest, dialogueChoice);
}
for (int i = 0; i < answers.Count; i++)
{
if (IsMatch(answers[i], excelAnswer))
{
return i;
}
}
return null;
}
private static int? FindBestRegexMatch(List<string?> answers, StringOrRegex expectedAnswer, Questionable.Model.Quest? quest, DialogueChoice dialogueChoice)
{
List<int> list = (from x in answers.Select((string answer, int index) => new { answer, index })
@ -731,6 +772,15 @@ internal sealed class InteractionUiController : IDisposable
else
{
QuestStep questStep = quest.FindSequence(currentQuest.Sequence)?.FindStep(currentQuest.Step);
if (questStep == null && currentQuest.Step == 255)
{
QuestSequence questSequence2 = quest.FindSequence(currentQuest.Sequence);
if (questSequence2 != null && questSequence2.Steps.Count > 0)
{
List<QuestStep> steps = questSequence2.Steps;
questStep = steps[steps.Count - 1];
}
}
if (questStep != null && HandleDefaultYesNo(addonSelectYesno, quest, questStep, questStep.DialogueChoices, actualPrompt))
{
return true;