muffin v7.38

This commit is contained in:
alydev 2025-11-17 11:31:27 +10:00
parent 411c0bbe76
commit e5b98b3d57
35 changed files with 10700 additions and 7610 deletions

View file

@ -33,6 +33,8 @@ internal sealed class AutoDutyIpc
private readonly ICallGateSubscriber<object> _stop;
private bool _loggedContentHasPathQueryWarning;
public AutoDutyIpc(IDalamudPluginInterface pluginInterface, Configuration configuration, TerritoryData territoryData, ILogger<AutoDutyIpc> logger)
{
_configuration = configuration;
@ -43,6 +45,7 @@ internal sealed class AutoDutyIpc
_run = pluginInterface.GetIpcSubscriber<uint, int, bool, object>("AutoDuty.Run");
_isStopped = pluginInterface.GetIpcSubscriber<bool>("AutoDuty.IsStopped");
_stop = pluginInterface.GetIpcSubscriber<object>("AutoDuty.Stop");
_loggedContentHasPathQueryWarning = false;
}
public bool IsConfiguredToRunContent(DutyOptions? dutyOptions)
@ -82,7 +85,11 @@ internal sealed class AutoDutyIpc
}
catch (IpcError ipcError)
{
_logger.LogWarning("Unable to query AutoDuty for path in territory {TerritoryType}: {Message}", contentFinderConditionData.TerritoryId, ipcError.Message);
if (!_loggedContentHasPathQueryWarning)
{
_logger.LogWarning("Unable to query AutoDuty for path in territory {TerritoryType}: {Message}", contentFinderConditionData.TerritoryId, ipcError.Message);
_loggedContentHasPathQueryWarning = true;
}
return false;
}
}

View file

@ -5,6 +5,7 @@ using System.Numerics;
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
using Questionable.Controller;
using Questionable.Controller.Steps;
using Questionable.Functions;
using Questionable.Model;
using Questionable.Model.Questing;
@ -30,12 +31,21 @@ internal sealed class QuestionableIpc : IDisposable
public required ushort TerritoryId { get; init; }
}
public sealed class TaskData
{
public required string TaskName { get; init; }
public required int RemainingTaskCount { get; init; }
}
private const string IpcIsRunning = "Questionable.IsRunning";
private const string IpcGetCurrentQuestId = "Questionable.GetCurrentQuestId";
private const string IpcGetCurrentStepData = "Questionable.GetCurrentStepData";
private const string IpcGetCurrentTask = "Questionable.GetCurrentTask";
private const string IpcGetCurrentlyActiveEventQuests = "Questionable.GetCurrentlyActiveEventQuests";
private const string IpcStartQuest = "Questionable.StartQuest";
@ -44,9 +54,9 @@ internal sealed class QuestionableIpc : IDisposable
private const string IpcIsQuestLocked = "Questionable.IsQuestLocked";
private const string IpcIsQuestCompleted = "Questionable.IsQuestCompleted";
private const string IpcIsQuestComplete = "Questionable.IsQuestComplete";
private const string IpcIsQuestAvailable = "Questionable.IsQuestAvailable";
private const string IpcIsReadyToAcceptQuest = "Questionable.IsReadyToAcceptQuest";
private const string IpcIsQuestAccepted = "Questionable.IsQuestAccepted";
@ -76,6 +86,8 @@ internal sealed class QuestionableIpc : IDisposable
private readonly ICallGateProvider<StepData?> _getCurrentStepData;
private readonly ICallGateProvider<TaskData?> _getCurrentTask;
private readonly ICallGateProvider<List<string>> _getCurrentlyActiveEventQuests;
private readonly ICallGateProvider<string, bool> _startQuest;
@ -84,9 +96,9 @@ internal sealed class QuestionableIpc : IDisposable
private readonly ICallGateProvider<string, bool> _isQuestLocked;
private readonly ICallGateProvider<string, bool> _isQuestCompleted;
private readonly ICallGateProvider<string, bool> _IsQuestComplete;
private readonly ICallGateProvider<string, bool> _isQuestAvailable;
private readonly ICallGateProvider<string, bool> _IsReadyToAcceptQuest;
private readonly ICallGateProvider<string, bool> _isQuestAccepted;
@ -115,6 +127,8 @@ internal sealed class QuestionableIpc : IDisposable
_getCurrentQuestId.RegisterFunc(() => questController.CurrentQuest?.Quest.Id.ToString());
_getCurrentStepData = pluginInterface.GetIpcProvider<StepData>("Questionable.GetCurrentStepData");
_getCurrentStepData.RegisterFunc(GetStepData);
_getCurrentTask = pluginInterface.GetIpcProvider<TaskData>("Questionable.GetCurrentTask");
_getCurrentTask.RegisterFunc(GetCurrentTask);
_getCurrentlyActiveEventQuests = pluginInterface.GetIpcProvider<List<string>>("Questionable.GetCurrentlyActiveEventQuests");
_getCurrentlyActiveEventQuests.RegisterFunc(() => (from q in eventInfoComponent.GetCurrentlyActiveEventQuests()
select q.ToString()).ToList());
@ -124,10 +138,10 @@ internal sealed class QuestionableIpc : IDisposable
_startSingleQuest.RegisterFunc((string questId) => questionableIpc.StartQuest(questId, single: true));
_isQuestLocked = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsQuestLocked");
_isQuestLocked.RegisterFunc(IsQuestLocked);
_isQuestCompleted = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsQuestCompleted");
_isQuestCompleted.RegisterFunc(IsQuestCompleted);
_isQuestAvailable = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsQuestAvailable");
_isQuestAvailable.RegisterFunc(IsQuestAvailable);
_IsQuestComplete = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsQuestComplete");
_IsQuestComplete.RegisterFunc(IsQuestComplete);
_IsReadyToAcceptQuest = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsReadyToAcceptQuest");
_IsReadyToAcceptQuest.RegisterFunc(IsReadyToAcceptQuest);
_isQuestAccepted = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsQuestAccepted");
_isQuestAccepted.RegisterFunc(IsQuestAccepted);
_isQuestUnobtainable = pluginInterface.GetIpcProvider<string, bool>("Questionable.IsQuestUnobtainable");
@ -190,6 +204,22 @@ internal sealed class QuestionableIpc : IDisposable
};
}
private TaskData? GetCurrentTask()
{
ITask task = _questController.TaskQueue.CurrentTaskExecutor?.CurrentTask;
if (task == null)
{
return null;
}
int remainingTaskCount = _questController.TaskQueue.RemainingTasks.Count();
string taskName = task.ToString() ?? "Unknown";
return new TaskData
{
TaskName = taskName,
RemainingTaskCount = remainingTaskCount
};
}
private bool IsQuestLocked(string questId)
{
if (ElementId.TryFromString(questId, out ElementId elementId) && elementId != null && _questRegistry.TryGetQuest(elementId, out Quest _))
@ -199,7 +229,7 @@ internal sealed class QuestionableIpc : IDisposable
return true;
}
private bool IsQuestCompleted(string questId)
private bool IsQuestComplete(string questId)
{
if (ElementId.TryFromString(questId, out ElementId elementId) && elementId != null)
{
@ -208,7 +238,7 @@ internal sealed class QuestionableIpc : IDisposable
return false;
}
private bool IsQuestAvailable(string questId)
private bool IsReadyToAcceptQuest(string questId)
{
if (ElementId.TryFromString(questId, out ElementId elementId) && elementId != null)
{
@ -275,12 +305,13 @@ internal sealed class QuestionableIpc : IDisposable
_importQuestPriority.UnregisterFunc();
_isQuestUnobtainable.UnregisterFunc();
_isQuestAccepted.UnregisterFunc();
_isQuestAvailable.UnregisterFunc();
_isQuestCompleted.UnregisterFunc();
_IsReadyToAcceptQuest.UnregisterFunc();
_IsQuestComplete.UnregisterFunc();
_isQuestLocked.UnregisterFunc();
_startSingleQuest.UnregisterFunc();
_startQuest.UnregisterFunc();
_getCurrentlyActiveEventQuests.UnregisterFunc();
_getCurrentTask.UnregisterFunc();
_getCurrentStepData.UnregisterFunc();
_getCurrentQuestId.UnregisterFunc();
_isRunning.UnregisterFunc();