using Dalamud.Plugin; using Dalamud.Plugin.Ipc; using Dalamud.Plugin.Ipc.Exceptions; using Microsoft.Extensions.Logging; namespace Questionable.External; internal sealed class AutomatonIpc { private readonly ILogger _logger; private readonly ICallGateSubscriber _isTweakEnabled; private bool _loggedIpcError; public bool IsAutoSnipeEnabled { get { try { return _isTweakEnabled.InvokeFunc("AutoSnipeQuests"); } catch (IpcError exception) { if (!_loggedIpcError) { _loggedIpcError = true; _logger.LogWarning(exception, "Could not query automaton for tweak status, probably not installed"); } return false; } } } public AutomatonIpc(IDalamudPluginInterface pluginInterface, ILogger logger) { _logger = logger; _isTweakEnabled = pluginInterface.GetIpcSubscriber("Automaton.IsTweakEnabled"); logger.LogInformation("Automaton auto-snipe enabled: {IsTweakEnabled}", IsAutoSnipeEnabled); } }