private readonly Configuration _configuration;
private readonly TerritoryData _territoryData;
private readonly ILogger<AutoDutyIpc> _logger;
- private readonly ICallGateSubscriber<uint,bool> _contentHasPath;
- private readonly ICallGateSubscriber<uint,int,bool,object> _run;
+ private readonly ICallGateSubscriber<uint, bool> _contentHasPath;
+ private readonly ICallGateSubscriber<string, string, object> _setConfig;
+ private readonly ICallGateSubscriber<uint, int, bool, object> _run;
private readonly ICallGateSubscriber<bool> _isStopped;
+ private readonly ICallGateSubscriber<object> _stop;
- public AutoDutyIpc(IDalamudPluginInterface pluginInterface, Configuration configuration, TerritoryData territoryData, ILogger<AutoDutyIpc> logger)
+ public AutoDutyIpc(IDalamudPluginInterface pluginInterface, Configuration configuration,
+ TerritoryData territoryData, ILogger<AutoDutyIpc> logger)
{
_configuration = configuration;
_territoryData = territoryData;
_logger = logger;
_contentHasPath = pluginInterface.GetIpcSubscriber<uint, bool>("AutoDuty.ContentHasPath");
+ _setConfig = pluginInterface.GetIpcSubscriber<string, string, object>("AutoDuty.SetConfig");
_run = pluginInterface.GetIpcSubscriber<uint, int, bool, object>("AutoDuty.Run");
_isStopped = pluginInterface.GetIpcSubscriber<bool>("AutoDuty.IsStopped");
+ _stop = pluginInterface.GetIpcSubscriber<object>("AutoDuty.Stop");
}
public bool IsConfiguredToRunContent(uint? cfcId, bool autoDutyEnabled)
}
catch (IpcError e)
{
- _logger.LogWarning("Unable to query AutoDuty for path in territory {TerritoryType}: {Message}", cfcData.TerritoryId, e.Message);
+ _logger.LogWarning("Unable to query AutoDuty for path in territory {TerritoryType}: {Message}",
+ cfcData.TerritoryId, e.Message);
return false;
}
}
try
{
+ _setConfig.InvokeAction("dutyModeEnum", "Support");
_run.InvokeAction(cfcData.TerritoryId, 1, true);
}
catch (IpcError e)
return true;
}
}
+
+ public void Stop()
+ {
+ try
+ {
+ _logger.LogInformation("Calling AutoDuty.Stop");
+ _stop.InvokeAction();
+ }
+ catch (IpcError e)
+ {
+ throw new TaskException($"Unable to stop AutoDuty: {e.Message}", e);
+ }
+ }
}