muffin v6.18
This commit is contained in:
parent
ce02cf3d0e
commit
5bd47e3d16
5 changed files with 457 additions and 427 deletions
|
@ -290,11 +290,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
_safeAnimationEnd = DateTime.Now.AddSeconds(1f + num);
|
||||
}
|
||||
}
|
||||
UpdateCurrentQuest();
|
||||
if (AutomationType == EAutomationType.Manual && !IsRunning && !IsQuestWindowOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
UpdateCurrentQuest();
|
||||
if (!_clientState.IsLoggedIn)
|
||||
{
|
||||
StopAllDueToConditionFailed("Logged out");
|
||||
|
@ -511,20 +511,6 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
_pendingQuest = null;
|
||||
CheckNextTasks("Pending quest accepted");
|
||||
}
|
||||
if (_startedQuest != null && !_questFunctions.IsQuestAccepted(_startedQuest.Quest.Id))
|
||||
{
|
||||
if (_startedQuest.Quest.Info.IsRepeatable)
|
||||
{
|
||||
_logger.LogInformation("Repeatable quest {QuestId} is no longer accepted, clearing started quest", _startedQuest.Quest.Id);
|
||||
}
|
||||
else if (!_questFunctions.IsQuestComplete(_startedQuest.Quest.Id))
|
||||
{
|
||||
_logger.LogInformation("Quest {QuestId} was abandoned, clearing started quest", _startedQuest.Quest.Id);
|
||||
_startedQuest = null;
|
||||
Stop("Quest abandoned");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_simulatedQuest == null && _nextQuest != null && !((!_nextQuest.Quest.Info.IsRepeatable) ? (!_questFunctions.IsQuestAcceptedOrComplete(_nextQuest.Quest.Id)) : (!_questFunctions.IsQuestAccepted(_nextQuest.Quest.Id))))
|
||||
{
|
||||
_logger.LogInformation("Next quest {QuestId} accepted or completed", _nextQuest.Quest.Id);
|
||||
|
@ -533,27 +519,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
_startedQuest = _nextQuest;
|
||||
AutomationType = EAutomationType.SingleQuestB;
|
||||
}
|
||||
else if (_questFunctions.IsQuestAccepted(_nextQuest.Quest.Id))
|
||||
{
|
||||
QuestProgressInfo questProgressInfo = _questFunctions.GetQuestProgressInfo(_nextQuest.Quest.Id);
|
||||
if (questProgressInfo != null)
|
||||
{
|
||||
_startedQuest = new QuestProgress(_nextQuest.Quest, questProgressInfo.Sequence);
|
||||
_logger.LogInformation("Moving accepted next quest to started quest (sequence: {Sequence})", questProgressInfo.Sequence);
|
||||
_nextQuest = null;
|
||||
CheckNextTasks("Next quest already accepted");
|
||||
return;
|
||||
}
|
||||
_logger.LogWarning("Could not get quest progress info for accepted quest {QuestId}", _nextQuest.Quest.Id);
|
||||
}
|
||||
_logger.LogDebug("Started: {StartedQuest}", _startedQuest?.Quest.Id);
|
||||
_nextQuest = null;
|
||||
}
|
||||
byte b;
|
||||
QuestProgress questProgress;
|
||||
ElementId CurrentQuest;
|
||||
byte Sequence;
|
||||
MainScenarioQuestState State;
|
||||
if (_simulatedQuest != null)
|
||||
{
|
||||
b = _simulatedQuest.Sequence;
|
||||
|
@ -577,71 +547,24 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
ExecuteNextStep();
|
||||
}
|
||||
}
|
||||
else if (_startedQuest != null)
|
||||
{
|
||||
questProgress = _startedQuest;
|
||||
b = _startedQuest.Sequence;
|
||||
QuestProgressInfo questProgressInfo2 = _questFunctions.GetQuestProgressInfo(_startedQuest.Quest.Id);
|
||||
if (questProgressInfo2 != null && questProgressInfo2.Sequence != b)
|
||||
{
|
||||
_logger.LogInformation("Updating started quest sequence from {OldSequence} to {NewSequence}", b, questProgressInfo2.Sequence);
|
||||
b = questProgressInfo2.Sequence;
|
||||
}
|
||||
if (AutomationType == EAutomationType.Manual || !IsRunning)
|
||||
{
|
||||
_questFunctions.GetCurrentQuest(AutomationType != EAutomationType.SingleQuestB).Deconstruct(out CurrentQuest, out Sequence, out State);
|
||||
ElementId elementId = CurrentQuest;
|
||||
byte sequence = Sequence;
|
||||
(ElementId, byte)? tuple = (from x in ManualPriorityQuests
|
||||
where _questFunctions.IsReadyToAcceptQuest(x.Id) || _questFunctions.IsQuestAccepted(x.Id)
|
||||
select (Id: x.Id, _questFunctions.GetQuestProgressInfo(x.Id)?.Sequence ?? 0)).FirstOrDefault();
|
||||
if (tuple.HasValue)
|
||||
{
|
||||
(ElementId, byte) valueOrDefault = tuple.GetValueOrDefault();
|
||||
if ((object)valueOrDefault.Item1 != null)
|
||||
{
|
||||
(elementId, sequence) = valueOrDefault;
|
||||
}
|
||||
}
|
||||
if (elementId != null && elementId.Value != 0 && _startedQuest.Quest.Id != elementId)
|
||||
{
|
||||
_logger.LogInformation("Game current quest changed from {OldQuest} to {NewQuest}, updating started quest", _startedQuest.Quest.Id, elementId);
|
||||
if (_questRegistry.TryGetQuest(elementId, out Quest quest))
|
||||
{
|
||||
_logger.LogInformation("Switching to new quest: {QuestName}", quest.Info.Name);
|
||||
_startedQuest = new QuestProgress(quest, sequence);
|
||||
if (_clientState.LocalPlayer != null && _clientState.LocalPlayer.Level < quest.Info.Level)
|
||||
{
|
||||
_logger.LogInformation("Stopping automation, player level ({PlayerLevel}) < quest level ({QuestLevel}", _clientState.LocalPlayer.Level, quest.Info.Level);
|
||||
Stop("Quest level too high");
|
||||
}
|
||||
questProgress = _startedQuest;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("New quest {QuestId} not found in registry", elementId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_questFunctions.GetCurrentQuest(AutomationType != EAutomationType.SingleQuestB).Deconstruct(out CurrentQuest, out Sequence, out State);
|
||||
ElementId elementId2 = CurrentQuest;
|
||||
_questFunctions.GetCurrentQuest(AutomationType != EAutomationType.SingleQuestB).Deconstruct(out ElementId CurrentQuest, out byte Sequence, out MainScenarioQuestState State);
|
||||
ElementId elementId = CurrentQuest;
|
||||
b = Sequence;
|
||||
MainScenarioQuestState mainScenarioQuestState = State;
|
||||
(ElementId, byte)? tuple3 = (from x in ManualPriorityQuests
|
||||
(ElementId, byte)? tuple = (from x in ManualPriorityQuests
|
||||
where _questFunctions.IsReadyToAcceptQuest(x.Id) || _questFunctions.IsQuestAccepted(x.Id)
|
||||
select (Id: x.Id, _questFunctions.GetQuestProgressInfo(x.Id)?.Sequence ?? 0)).FirstOrDefault();
|
||||
if (tuple3.HasValue)
|
||||
if (tuple.HasValue)
|
||||
{
|
||||
(ElementId, byte) valueOrDefault2 = tuple3.GetValueOrDefault();
|
||||
if ((object)valueOrDefault2.Item1 != null)
|
||||
(ElementId, byte) valueOrDefault = tuple.GetValueOrDefault();
|
||||
if ((object)valueOrDefault.Item1 != null)
|
||||
{
|
||||
(elementId2, b) = valueOrDefault2;
|
||||
(elementId, b) = valueOrDefault;
|
||||
}
|
||||
}
|
||||
if (elementId2 == null || elementId2.Value == 0)
|
||||
if (elementId == null || elementId.Value == 0)
|
||||
{
|
||||
if (_startedQuest != null)
|
||||
{
|
||||
|
@ -662,9 +585,9 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_startedQuest == null || _startedQuest.Quest.Id != elementId2)
|
||||
if (_startedQuest == null || _startedQuest.Quest.Id != elementId)
|
||||
{
|
||||
Quest quest2;
|
||||
Quest quest;
|
||||
if (_configuration.Stop.Enabled && _startedQuest != null && _configuration.Stop.QuestsToStopAfter.Contains(_startedQuest.Quest.Id) && _questFunctions.IsQuestComplete(_startedQuest.Quest.Id))
|
||||
{
|
||||
ElementId id = _startedQuest.Quest.Id;
|
||||
|
@ -673,13 +596,13 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
_startedQuest = null;
|
||||
Stop($"Stopping point [{id}] reached");
|
||||
}
|
||||
else if (_questRegistry.TryGetQuest(elementId2, out quest2))
|
||||
else if (_questRegistry.TryGetQuest(elementId, out quest))
|
||||
{
|
||||
_logger.LogInformation("New quest: {QuestName}", quest2.Info.Name);
|
||||
_startedQuest = new QuestProgress(quest2, b);
|
||||
if (_clientState.LocalPlayer != null && _clientState.LocalPlayer.Level < quest2.Info.Level)
|
||||
_logger.LogInformation("New quest: {QuestName}", quest.Info.Name);
|
||||
_startedQuest = new QuestProgress(quest, b);
|
||||
if (_clientState.LocalPlayer != null && _clientState.LocalPlayer.Level < quest.Info.Level)
|
||||
{
|
||||
_logger.LogInformation("Stopping automation, player level ({PlayerLevel}) < quest level ({QuestLevel}", _clientState.LocalPlayer.Level, quest2.Info.Level);
|
||||
_logger.LogInformation("Stopping automation, player level ({PlayerLevel}) < quest level ({QuestLevel}", _clientState.LocalPlayer.Level, quest.Info.Level);
|
||||
Stop("Quest level too high");
|
||||
return;
|
||||
}
|
||||
|
@ -704,10 +627,7 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
if (questProgress == null)
|
||||
{
|
||||
DebugState = "No quest active";
|
||||
if (!IsRunning)
|
||||
{
|
||||
Stop("No quest active");
|
||||
}
|
||||
Stop("No quest active");
|
||||
return;
|
||||
}
|
||||
if (_gameFunctions.IsOccupied() && !_gameFunctions.IsOccupiedWithCustomDeliveryNpc(questProgress.Quest))
|
||||
|
@ -913,13 +833,6 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
|||
}
|
||||
}
|
||||
|
||||
public void SetStartedQuest(Quest quest, byte sequence = 0)
|
||||
{
|
||||
_logger.LogInformation("Setting started quest: {QuestId}", quest.Id);
|
||||
_startedQuest = new QuestProgress(quest, sequence);
|
||||
_nextQuest = null;
|
||||
}
|
||||
|
||||
public void SetGatheringQuest(Quest? quest)
|
||||
{
|
||||
_logger.LogInformation("GatheringQuest: {QuestId}", quest?.Id);
|
||||
|
|
|
@ -41,63 +41,51 @@ internal sealed class AlliedSocietyDailyInfo : IQuestInfo
|
|||
{
|
||||
QuestId = new AlliedSocietyDailyId((byte)beastTribe.RowId, rank);
|
||||
Name = beastTribe.Name.ToString();
|
||||
IReadOnlyList<EClassJob> readOnlyList = null;
|
||||
try
|
||||
List<EClassJob> list2;
|
||||
switch ((EAlliedSociety)(byte)beastTribe.RowId)
|
||||
{
|
||||
List<EClassJob> list2;
|
||||
switch ((EAlliedSociety)(byte)beastTribe.RowId)
|
||||
{
|
||||
case EAlliedSociety.Amaljaa:
|
||||
case EAlliedSociety.Sylphs:
|
||||
case EAlliedSociety.Kobolds:
|
||||
case EAlliedSociety.Sahagin:
|
||||
case EAlliedSociety.VanuVanu:
|
||||
case EAlliedSociety.Vath:
|
||||
case EAlliedSociety.Kojin:
|
||||
case EAlliedSociety.Ananta:
|
||||
case EAlliedSociety.Pixies:
|
||||
case EAlliedSociety.Arkasodara:
|
||||
case EAlliedSociety.Pelupelu:
|
||||
{
|
||||
List<EClassJob> list3 = new List<EClassJob>();
|
||||
list3.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoW, null));
|
||||
list3.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoM, null));
|
||||
list2 = list3;
|
||||
break;
|
||||
}
|
||||
case EAlliedSociety.Ixal:
|
||||
case EAlliedSociety.Moogles:
|
||||
case EAlliedSociety.Dwarves:
|
||||
case EAlliedSociety.Loporrits:
|
||||
case EAlliedSociety.YokHuy:
|
||||
list2 = classJobUtils.AsIndividualJobs(EExtendedClassJob.DoH, null).ToList();
|
||||
break;
|
||||
case EAlliedSociety.Qitari:
|
||||
case EAlliedSociety.Omicrons:
|
||||
case EAlliedSociety.MamoolJa:
|
||||
list2 = classJobUtils.AsIndividualJobs(EExtendedClassJob.DoL, null).ToList();
|
||||
break;
|
||||
case EAlliedSociety.Namazu:
|
||||
{
|
||||
List<EClassJob> list = new List<EClassJob>();
|
||||
list.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoH, null));
|
||||
list.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoL, null));
|
||||
list2 = list;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("beastTribe");
|
||||
}
|
||||
readOnlyList = list2;
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
case EAlliedSociety.Amaljaa:
|
||||
case EAlliedSociety.Sylphs:
|
||||
case EAlliedSociety.Kobolds:
|
||||
case EAlliedSociety.Sahagin:
|
||||
case EAlliedSociety.VanuVanu:
|
||||
case EAlliedSociety.Vath:
|
||||
case EAlliedSociety.Kojin:
|
||||
case EAlliedSociety.Ananta:
|
||||
case EAlliedSociety.Pixies:
|
||||
case EAlliedSociety.Arkasodara:
|
||||
case EAlliedSociety.Pelupelu:
|
||||
{
|
||||
List<EClassJob> list4 = new List<EClassJob>();
|
||||
list4.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoW, null));
|
||||
list4.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoM, null));
|
||||
readOnlyList = new _003C_003Ez__ReadOnlyList<EClassJob>(list4);
|
||||
List<EClassJob> list3 = new List<EClassJob>();
|
||||
list3.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoW, null));
|
||||
list3.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoM, null));
|
||||
list2 = list3;
|
||||
break;
|
||||
}
|
||||
ClassJobs = readOnlyList;
|
||||
case EAlliedSociety.Ixal:
|
||||
case EAlliedSociety.Moogles:
|
||||
case EAlliedSociety.Dwarves:
|
||||
case EAlliedSociety.Loporrits:
|
||||
case EAlliedSociety.YokHuy:
|
||||
list2 = classJobUtils.AsIndividualJobs(EExtendedClassJob.DoH, null).ToList();
|
||||
break;
|
||||
case EAlliedSociety.Qitari:
|
||||
case EAlliedSociety.Omicrons:
|
||||
case EAlliedSociety.MamoolJa:
|
||||
list2 = classJobUtils.AsIndividualJobs(EExtendedClassJob.DoL, null).ToList();
|
||||
break;
|
||||
case EAlliedSociety.Namazu:
|
||||
{
|
||||
List<EClassJob> list = new List<EClassJob>();
|
||||
list.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoH, null));
|
||||
list.AddRange(classJobUtils.AsIndividualJobs(EExtendedClassJob.DoL, null));
|
||||
list2 = list;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("beastTribe");
|
||||
}
|
||||
ClassJobs = list2;
|
||||
Expansion = (EExpansionVersion)beastTribe.Expansion.RowId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -311,6 +311,11 @@ internal sealed class QuestJournalComponent
|
|||
goto IL_0210;
|
||||
IL_0210:
|
||||
ImGui.TableNextColumn();
|
||||
if (_questFunctions.IsQuestAccepted(questInfo.QuestId))
|
||||
{
|
||||
_uiUtils.ChecklistItem("Active", ImGuiColors.DalamudYellow, FontAwesomeIcon.PersonWalkingArrowRight);
|
||||
return;
|
||||
}
|
||||
if (_questFunctions.IsQuestComplete(questInfo.QuestId))
|
||||
{
|
||||
if (questInfo.IsRepeatable && _questFunctions.IsReadyToAcceptQuest(questInfo.QuestId))
|
||||
|
@ -323,11 +328,6 @@ internal sealed class QuestJournalComponent
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (_questFunctions.IsQuestAccepted(questInfo.QuestId))
|
||||
{
|
||||
_uiUtils.ChecklistItem("Active", ImGuiColors.DalamudYellow, FontAwesomeIcon.PersonWalkingArrowRight);
|
||||
return;
|
||||
}
|
||||
bool flag = false;
|
||||
bool flag2 = _questFunctions.IsQuestUnobtainable(questInfo.QuestId);
|
||||
bool flag3 = _questFunctions.IsQuestLocked(questInfo.QuestId);
|
||||
|
|
|
@ -59,28 +59,12 @@ internal sealed class QuestJournalUtils
|
|||
{
|
||||
return;
|
||||
}
|
||||
using (ImRaii.Disabled(!_questFunctions.IsReadyToAcceptQuest(questInfo.QuestId) && !_questFunctions.IsQuestAccepted(questInfo.QuestId)))
|
||||
using (ImRaii.Disabled(!_questFunctions.IsReadyToAcceptQuest(questInfo.QuestId)))
|
||||
{
|
||||
if (ImGui.MenuItem("Start as next quest"))
|
||||
{
|
||||
if (quest == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_questFunctions.IsQuestAccepted(questInfo.QuestId))
|
||||
{
|
||||
QuestProgressInfo questProgressInfo = _questFunctions.GetQuestProgressInfo(questInfo.QuestId);
|
||||
if (questProgressInfo != null)
|
||||
{
|
||||
_questController.SetStartedQuest(quest, questProgressInfo.Sequence);
|
||||
_questController.Start(label);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_questController.SetNextQuest(quest);
|
||||
_questController.Start(label);
|
||||
}
|
||||
_questController.SetNextQuest(quest);
|
||||
_questController.Start(label);
|
||||
}
|
||||
}
|
||||
List<ElementId> incompletePrerequisiteQuests = GetIncompletePrerequisiteQuests(questInfo);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue