muffin v6.20
This commit is contained in:
parent
0000d73aff
commit
daafb42d2d
6 changed files with 958 additions and 1031 deletions
File diff suppressed because it is too large
Load diff
|
@ -142,8 +142,6 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
||||||
|
|
||||||
private DateTime _lastAutoRefresh = DateTime.MinValue;
|
private DateTime _lastAutoRefresh = DateTime.MinValue;
|
||||||
|
|
||||||
private readonly AlliedSocietyData _alliedSocietyData = new AlliedSocietyData();
|
|
||||||
|
|
||||||
private const char ClipboardSeparator = ';';
|
private const char ClipboardSeparator = ';';
|
||||||
|
|
||||||
public EAutomationType AutomationType
|
public EAutomationType AutomationType
|
||||||
|
@ -945,18 +943,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
||||||
_combatController.Stop("Execute next step");
|
_combatController.Stop("Execute next step");
|
||||||
_gatheringController.Stop("Execute next step");
|
_gatheringController.Stop("Execute next step");
|
||||||
try
|
try
|
||||||
{
|
|
||||||
if (CurrentQuest.Sequence == byte.MaxValue && CurrentQuest.Quest.Info.AlliedSociety != EAlliedSociety.None && _configuration.General.BatchAlliedSocietyTurnIns)
|
|
||||||
{
|
|
||||||
EnqueueBatchedAlliedSocietyTurnIns(questSequence, step);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
foreach (ITask item in _taskCreator.CreateTasks(CurrentQuest.Quest, CurrentQuest.Sequence, questSequence, step))
|
foreach (ITask item in _taskCreator.CreateTasks(CurrentQuest.Quest, CurrentQuest.Sequence, questSequence, step))
|
||||||
{
|
{
|
||||||
_taskQueue.Enqueue(item);
|
_taskQueue.Enqueue(item);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ResetAutoRefreshState();
|
ResetAutoRefreshState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -975,86 +966,6 @@ internal sealed class QuestController : MiniTaskController<QuestController>
|
||||||
goto IL_01e8;
|
goto IL_01e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnqueueBatchedAlliedSocietyTurnIns(QuestSequence seq, QuestStep? step)
|
|
||||||
{
|
|
||||||
QuestProgress currentQuest = CurrentQuest;
|
|
||||||
if (currentQuest == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EAlliedSociety alliedSociety = currentQuest.Quest.Info.AlliedSociety;
|
|
||||||
if (alliedSociety == EAlliedSociety.None)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<(QuestId, byte, int)> list = new List<(QuestId, byte, int)>();
|
|
||||||
foreach (Quest allQuest in _questRegistry.AllQuests)
|
|
||||||
{
|
|
||||||
if (allQuest == null || allQuest.Info.AlliedSociety != alliedSociety || !_questFunctions.IsQuestAccepted(allQuest.Id))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QuestProgressInfo questProgressInfo = _questFunctions.GetQuestProgressInfo(allQuest.Id);
|
|
||||||
if (questProgressInfo != null)
|
|
||||||
{
|
|
||||||
int item = 0;
|
|
||||||
if (allQuest.Id is QuestId item2)
|
|
||||||
{
|
|
||||||
list.Add((item2, questProgressInfo.Sequence, item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (list.Count == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foreach (var (questId, b, num) in list.Where<(QuestId, byte, int)>(((QuestId Id, byte Sequence, int StepIndex) x) => x.Sequence < byte.MaxValue))
|
|
||||||
{
|
|
||||||
if (!_questRegistry.TryGetQuest(questId, out Quest quest))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QuestSequence questSequence = quest.FindSequence(b);
|
|
||||||
if (questSequence == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QuestStep step2 = null;
|
|
||||||
if (num >= 0 && num < questSequence.Steps.Count)
|
|
||||||
{
|
|
||||||
step2 = questSequence.FindStep(num);
|
|
||||||
}
|
|
||||||
foreach (ITask item3 in _taskCreator.CreateTasks(quest, b, questSequence, step2))
|
|
||||||
{
|
|
||||||
_taskQueue.Enqueue(item3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<uint, List<QuestId>> item4 in _alliedSocietyData.GroupQuestsByTurnInIssuer(list.Select<(QuestId, byte, int), QuestId>(((QuestId Id, byte Sequence, int StepIndex) x) => x.Id)))
|
|
||||||
{
|
|
||||||
_ = item4.Key;
|
|
||||||
List<QuestId> value = item4.Value;
|
|
||||||
if (value.Count == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QuestId questId2 = value[0];
|
|
||||||
if (!_questRegistry.TryGetQuest(questId2, out Quest quest2))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QuestSequence questSequence2 = quest2.FindSequence(byte.MaxValue);
|
|
||||||
if (questSequence2 == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QuestStep step3 = questSequence2.FindStep(0);
|
|
||||||
foreach (ITask item5 in _taskCreator.CreateTasks(quest2, byte.MaxValue, questSequence2, step3))
|
|
||||||
{
|
|
||||||
_taskQueue.Enqueue(item5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ToStatString()
|
public string ToStatString()
|
||||||
{
|
{
|
||||||
ITask task = _taskQueue.CurrentTaskExecutor?.CurrentTask;
|
ITask task = _taskQueue.CurrentTaskExecutor?.CurrentTask;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using Questionable.Model;
|
using Questionable.Model;
|
||||||
using Questionable.Model.Common;
|
using Questionable.Model.Common;
|
||||||
using Questionable.Model.Questing;
|
using Questionable.Model.Questing;
|
||||||
|
@ -261,53 +260,4 @@ internal sealed class AlliedSocietyData
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetTurnInIssuers(ElementId elementId, out uint[] issuerDataIds)
|
|
||||||
{
|
|
||||||
EAlliedSociety commonAlliedSocietyTurnIn = GetCommonAlliedSocietyTurnIn(elementId);
|
|
||||||
if (commonAlliedSocietyTurnIn == EAlliedSociety.None)
|
|
||||||
{
|
|
||||||
issuerDataIds = Array.Empty<uint>();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
GetCommonAlliedSocietyNpcs(commonAlliedSocietyTurnIn, out uint[] normalNpcs, out uint[] mountNpcs);
|
|
||||||
if (normalNpcs.Length != 0)
|
|
||||||
{
|
|
||||||
issuerDataIds = normalNpcs;
|
|
||||||
}
|
|
||||||
else if (mountNpcs.Length != 0)
|
|
||||||
{
|
|
||||||
issuerDataIds = mountNpcs;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
issuerDataIds = Array.Empty<uint>();
|
|
||||||
}
|
|
||||||
return issuerDataIds.Length != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<uint, List<QuestId>> GroupQuestsByTurnInIssuer(IEnumerable<QuestId> quests)
|
|
||||||
{
|
|
||||||
Dictionary<uint, List<QuestId>> dictionary = new Dictionary<uint, List<QuestId>>();
|
|
||||||
foreach (QuestId quest in quests)
|
|
||||||
{
|
|
||||||
if (TryGetTurnInIssuers(quest, out uint[] issuerDataIds) && issuerDataIds.Length != 0)
|
|
||||||
{
|
|
||||||
uint key = issuerDataIds[0];
|
|
||||||
if (dictionary.TryGetValue(key, out var value))
|
|
||||||
{
|
|
||||||
value.Add(quest);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int num = 1;
|
|
||||||
List<QuestId> list = new List<QuestId>(num);
|
|
||||||
CollectionsMarshal.SetCount(list, num);
|
|
||||||
Span<QuestId> span = CollectionsMarshal.AsSpan(list);
|
|
||||||
int index = 0;
|
|
||||||
span[index] = quest;
|
|
||||||
dictionary[key] = list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dictionary;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,26 +212,6 @@ internal sealed class GeneralConfigComponent : ConfigComponent
|
||||||
ImGui.TextColored(in col, text);
|
ImGui.TextColored(in col, text);
|
||||||
ImGui.Unindent();
|
ImGui.Unindent();
|
||||||
}
|
}
|
||||||
bool v9 = base.Configuration.General.BatchAlliedSocietyTurnIns;
|
|
||||||
if (ImGui.Checkbox("Batch allied society turn-ins", ref v9))
|
|
||||||
{
|
|
||||||
base.Configuration.General.BatchAlliedSocietyTurnIns = v9;
|
|
||||||
Save();
|
|
||||||
}
|
|
||||||
ImGui.SameLine();
|
|
||||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
|
||||||
{
|
|
||||||
ImGui.TextDisabled(FontAwesomeIcon.InfoCircle.ToIconString());
|
|
||||||
}
|
|
||||||
if (ImGui.IsItemHovered())
|
|
||||||
{
|
|
||||||
using (ImRaii.Tooltip())
|
|
||||||
{
|
|
||||||
ImGui.TextUnformatted("When enabled, allied society quests that share the same NPC will be turned in in a single conversation (batched).");
|
|
||||||
ImGui.TextUnformatted("If disabled, each allied society quest will be turned in individually.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,14 +107,20 @@ internal sealed class QuestJournalUtils
|
||||||
HashSet<ElementId> visited = new HashSet<ElementId>();
|
HashSet<ElementId> visited = new HashSet<ElementId>();
|
||||||
CollectPrerequisitesRecursive(questInfo, list, visited);
|
CollectPrerequisitesRecursive(questInfo, list, visited);
|
||||||
list.Reverse();
|
list.Reverse();
|
||||||
List<ElementId> list2 = (from qId in list
|
List<ElementId> list2 = (from qId in list.Where(delegate(ElementId qId)
|
||||||
where !_questFunctions.IsQuestComplete(qId)
|
{
|
||||||
|
if (!_questData.TryGetQuestInfo(qId, out IQuestInfo questInfo2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return questInfo2.IsRepeatable || !_questFunctions.IsQuestComplete(qId);
|
||||||
|
})
|
||||||
where !_questFunctions.IsQuestUnobtainable(qId)
|
where !_questFunctions.IsQuestUnobtainable(qId)
|
||||||
where _questRegistry.IsKnownQuest(qId)
|
where _questRegistry.IsKnownQuest(qId)
|
||||||
where !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(qId))
|
where !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(qId))
|
||||||
select qId).ToList();
|
select qId).ToList();
|
||||||
list2.Reverse();
|
list2.Reverse();
|
||||||
if (!_questFunctions.IsQuestComplete(questInfo.QuestId) && !_questFunctions.IsQuestUnobtainable(questInfo.QuestId) && _questRegistry.IsKnownQuest(questInfo.QuestId) && !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questInfo.QuestId)))
|
if ((questInfo.IsRepeatable || !_questFunctions.IsQuestComplete(questInfo.QuestId)) && !_questFunctions.IsQuestUnobtainable(questInfo.QuestId) && _questRegistry.IsKnownQuest(questInfo.QuestId) && !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questInfo.QuestId)))
|
||||||
{
|
{
|
||||||
list2.Add(questInfo.QuestId);
|
list2.Add(questInfo.QuestId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,6 @@ internal sealed class Configuration : IPluginConfiguration
|
||||||
public int AutoStepRefreshDelaySeconds { get; set; } = 10;
|
public int AutoStepRefreshDelaySeconds { get; set; } = 10;
|
||||||
|
|
||||||
public bool HideSeasonalEventsFromJournalProgress { get; set; }
|
public bool HideSeasonalEventsFromJournalProgress { get; set; }
|
||||||
|
|
||||||
public bool BatchAlliedSocietyTurnIns { get; set; } = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class StopConfiguration
|
internal sealed class StopConfiguration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue