muffin v7.4.16

This commit is contained in:
alydev 2026-03-01 13:55:33 +10:00
parent 0b1b2d38c7
commit e21aa9ca07
4 changed files with 1067 additions and 993 deletions

View file

@ -27,10 +27,14 @@ internal sealed class PandorasBoxIpc : IDisposable
private readonly QuestController _questController;
private readonly FateController _fateController;
private readonly TerritoryData _territoryData;
private readonly IClientState _clientState;
private readonly IFramework _framework;
private readonly ILogger<PandorasBoxIpc> _logger;
private readonly ICallGateSubscriber<string, bool?> _getFeatureEnabled;
@ -39,16 +43,21 @@ internal sealed class PandorasBoxIpc : IDisposable
private HashSet<string>? _pausedFeatures;
public PandorasBoxIpc(Configuration configuration, IDalamudPluginInterface pluginInterface, QuestController questController, TerritoryData territoryData, IClientState clientState, ILogger<PandorasBoxIpc> logger)
private bool _wasFateRunning;
public PandorasBoxIpc(Configuration configuration, IDalamudPluginInterface pluginInterface, QuestController questController, FateController fateController, TerritoryData territoryData, IClientState clientState, IFramework framework, ILogger<PandorasBoxIpc> logger)
{
_configuration = configuration;
_questController = questController;
_fateController = fateController;
_territoryData = territoryData;
_clientState = clientState;
_framework = framework;
_logger = logger;
_getFeatureEnabled = pluginInterface.GetIpcSubscriber<string, bool?>("PandorasBox.GetFeatureEnabled");
_setFeatureEnabled = pluginInterface.GetIpcSubscriber<string, bool, object>("PandorasBox.SetFeatureEnabled");
_questController.AutomationTypeChanged += OnAutomationTypeChanged;
_framework.Update += OnFrameworkUpdate;
}
private void OnAutomationTypeChanged(object sender, QuestController.EAutomationType automationType)
@ -57,14 +66,32 @@ internal sealed class PandorasBoxIpc : IDisposable
{
Task.Run((Action)DisableConflictingFeatures);
}
else
else if (!_fateController.IsRunning)
{
Task.Run((Action)RestoreConflictingFeatures);
}
}
private void OnFrameworkUpdate(IFramework framework)
{
bool isRunning = _fateController.IsRunning;
if (isRunning != _wasFateRunning)
{
_wasFateRunning = isRunning;
if (isRunning && !_territoryData.IsDutyInstance(_clientState.TerritoryType))
{
Task.Run((Action)DisableConflictingFeatures);
}
else if (_questController.AutomationType == QuestController.EAutomationType.Manual)
{
Task.Run((Action)RestoreConflictingFeatures);
}
}
}
public void Dispose()
{
_framework.Update -= OnFrameworkUpdate;
_questController.AutomationTypeChanged -= OnAutomationTypeChanged;
RestoreConflictingFeatures();
}