muffin v7.4.7

This commit is contained in:
alydev 2025-12-28 12:35:39 +10:00
parent 1cc65e495d
commit 63f975ff4f
16 changed files with 1659 additions and 939 deletions

View file

@ -15,6 +15,7 @@ using Dalamud.Plugin.Services;
using Microsoft.Extensions.Logging;
using Questionable.Controller;
using Questionable.Controller.Steps.Shared;
using Questionable.External;
using Questionable.Functions;
using Questionable.Model;
using Questionable.Model.Questing;
@ -49,6 +50,8 @@ internal sealed class ActiveQuestComponent
private readonly IChatGui _chatGui;
private readonly AutoDutyIpc _autoDutyIpc;
private readonly ILogger<ActiveQuestComponent> _logger;
public event EventHandler? Reload;
@ -60,7 +63,7 @@ internal sealed class ActiveQuestComponent
return _003CRegexGenerator_g_003EFBB8301322196CF81C64F1652C2FA6E1D6BF3907141F781E9D97ABED51BF056C4__MultipleWhitespaceRegex_0.Instance;
}
public ActiveQuestComponent(QuestController questController, MovementController movementController, CombatController combatController, GatheringController gatheringController, QuestFunctions questFunctions, ICommandManager commandManager, Configuration configuration, QuestRegistry questRegistry, PriorityWindow priorityWindow, UiUtils uiUtils, IObjectTable objectTable, IClientState clientState, IChatGui chatGui, ILogger<ActiveQuestComponent> logger)
public ActiveQuestComponent(QuestController questController, MovementController movementController, CombatController combatController, GatheringController gatheringController, QuestFunctions questFunctions, ICommandManager commandManager, Configuration configuration, QuestRegistry questRegistry, PriorityWindow priorityWindow, UiUtils uiUtils, IObjectTable objectTable, IClientState clientState, IChatGui chatGui, AutoDutyIpc autoDutyIpc, ILogger<ActiveQuestComponent> logger)
{
_questController = questController;
_movementController = movementController;
@ -75,6 +78,7 @@ internal sealed class ActiveQuestComponent
_objectTable = objectTable;
_clientState = clientState;
_chatGui = chatGui;
_autoDutyIpc = autoDutyIpc;
_logger = logger;
}
@ -146,30 +150,97 @@ internal sealed class ActiveQuestComponent
_logger.LogError(ex, "Could not handle active quest buttons");
}
DrawSimulationControls();
return;
}
(bool isLevelLocked, int levelsNeeded, int requiredLevel, string? questName) msqLevelLockInfo = _questFunctions.GetMsqLevelLockInfo();
bool item = msqLevelLockInfo.isLevelLocked;
int item2 = msqLevelLockInfo.levelsNeeded;
int item3 = msqLevelLockInfo.requiredLevel;
string item4 = msqLevelLockInfo.questName;
int currentPlayerLevel = _objectTable.LocalPlayer?.Level ?? 0;
if (item && _autoDutyIpc.IsConfiguredToRunLevelingMode(currentPlayerLevel) && item4 != null)
{
Vector4 col = ImGuiColors.DalamudYellow;
ImU8String text = new ImU8String(22, 2);
text.AppendLiteral("MSQ '");
text.AppendFormatted(item4);
text.AppendLiteral("' requires level ");
text.AppendFormatted(item3);
ImGui.TextColored(in col, text);
col = ImGuiColors.DalamudGrey;
ImU8String text2 = new ImU8String(61, 2);
text2.AppendLiteral("You need ");
text2.AppendFormatted(item2);
text2.AppendLiteral(" more level");
text2.AppendFormatted((item2 == 1) ? string.Empty : "s");
text2.AppendLiteral(" - Leveling mode will start automatically");
ImGui.TextColored(in col, text2);
using (ImRaii.Disabled(_questController.IsRunning || !_autoDutyIpc.IsStopped()))
{
if (ImGuiComponents.IconButton(FontAwesomeIcon.Play))
{
_logger.LogInformation("Start button clicked with MSQ level-locked. Starting AutoDuty leveling mode.");
if (_autoDutyIpc.StartLevelingMode())
{
_chatGui.Print($"Starting AutoDuty Leveling mode to reach level {item3} for MSQ '{item4}'.", "Questionable", 576);
}
else
{
_chatGui.PrintError("Failed to start AutoDuty Leveling mode. Please check that AutoDuty is installed and configured.", "Questionable", 576);
}
}
}
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
{
if (!_autoDutyIpc.IsStopped())
{
ImGui.SetTooltip("AutoDuty is currently running.");
}
else
{
ImU8String tooltip = new ImU8String(53, 1);
tooltip.AppendLiteral("Start AutoDuty Leveling mode to reach level ");
tooltip.AppendFormatted(item3);
tooltip.AppendLiteral(" for MSQ.");
ImGui.SetTooltip(tooltip);
}
}
}
else
{
ImGui.Text("No active quest");
if (!isMinimized)
}
if (!isMinimized)
{
Vector4 col = ImGuiColors.DalamudGrey;
ImU8String text3 = new ImU8String(14, 1);
text3.AppendFormatted(_questRegistry.Count);
text3.AppendLiteral(" quests loaded");
ImGui.TextColored(in col, text3);
}
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.Stop))
{
_movementController.Stop();
_questController.Stop("Manual (no active quest)");
_gatheringController.Stop("Manual (no active quest)");
if (!_autoDutyIpc.IsStopped())
{
Vector4 col = ImGuiColors.DalamudGrey;
ImU8String text = new ImU8String(14, 1);
text.AppendFormatted(_questRegistry.Count);
text.AppendLiteral(" quests loaded");
ImGui.TextColored(in col, text);
}
if (ImGuiComponents.IconButton(FontAwesomeIcon.Stop))
{
_movementController.Stop();
_questController.Stop("Manual (no active quest)");
_gatheringController.Stop("Manual (no active quest)");
}
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.SortAmountDown))
{
_priorityWindow.ToggleOrUncollapse();
try
{
_autoDutyIpc.Stop();
}
catch (Exception exception)
{
_logger.LogWarning(exception, "Failed to stop AutoDuty");
}
}
}
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.SortAmountDown))
{
_priorityWindow.ToggleOrUncollapse();
}
}
private void DrawQuestNames(QuestController.QuestProgress currentQuest, QuestController.ECurrentQuestType? currentQuestType)
@ -237,9 +308,9 @@ internal sealed class ActiveQuestComponent
ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DalamudRed, "Disabled");
}
bool flag = _configuration.Stop.Enabled && _configuration.Stop.LevelToStopAfter;
bool flag = _configuration.Stop.Enabled && _configuration.Stop.LevelStopMode != Configuration.EStopConditionMode.Off;
bool flag2 = _configuration.Stop.Enabled && _configuration.Stop.QuestsToStopAfter.Any((ElementId x) => !_questFunctions.IsQuestComplete(x) && !_questFunctions.IsQuestUnobtainable(x));
bool flag3 = _configuration.Stop.Enabled && _configuration.Stop.SequenceToStopAfter;
bool flag3 = _configuration.Stop.Enabled && _configuration.Stop.SequenceStopMode != Configuration.EStopConditionMode.Off;
if (flag || flag2 || flag3)
{
ImGui.SameLine();

View file

@ -253,12 +253,9 @@ internal sealed class EventInfoComponent
}
if (_questFunctions.IsQuestUnobtainable(questInfo.QuestId))
{
if (_alreadyLoggedActiveSeasonalSkip.Add(questInfo.QuestId.Value))
{
_logger.LogDebug("Skipping quest {QuestId} '{Name}': marked unobtainable", questInfo.QuestId, questInfo.Name);
}
continue;
}
else if (questInfo is UnlockLinkQuestInfo { QuestExpiry: var questExpiry })
if (questInfo is UnlockLinkQuestInfo { QuestExpiry: var questExpiry })
{
if (questExpiry.HasValue)
{
@ -287,15 +284,10 @@ internal sealed class EventInfoComponent
if (seasonalQuestExpiry.HasValue)
{
DateTime valueOrDefault2 = seasonalQuestExpiry.GetValueOrDefault();
DateTime dateTime2 = NormalizeExpiry(valueOrDefault2);
if (dateTime2 > DateTime.UtcNow)
if (NormalizeExpiry(valueOrDefault2) > DateTime.UtcNow)
{
yield return questInfo;
}
else if (_alreadyLoggedActiveSeasonalSkip.Add(questInfo.QuestId.Value))
{
_logger.LogDebug("Skipping quest {QuestId} '{Name}': seasonal expiry {Expiry:o} UTC is not in the future", questInfo.QuestId, questInfo.Name, dateTime2);
}
}
else if (questInfo2.IsSeasonalQuest && !questInfo2.SeasonalQuestExpiry.HasValue)
{

View file

@ -103,10 +103,12 @@ internal sealed class PresetBuilderComponent
ImGui.SetTooltip("No preset quests are currently in the priority list.");
return;
}
ImU8String tooltip = new ImU8String(59, 1);
ImU8String tooltip = new ImU8String(51, 2);
tooltip.AppendLiteral("Remove all ");
tooltip.AppendFormatted(list.Count);
tooltip.AppendLiteral(" preset-related quest(s) from the priority list.");
tooltip.AppendLiteral(" preset-related ");
tooltip.AppendFormatted((list.Count == 1) ? "quest" : "quests");
tooltip.AppendLiteral(" from the priority list.");
ImGui.SetTooltip(tooltip);
}
}