From: Liza Carvelli Date: Sun, 2 Mar 2025 22:18:32 +0000 (+0100) Subject: Update Wrath IPC X-Git-Tag: v4.22^0 X-Git-Url: https://git.jacobcasper.com/?a=commitdiff_plain;h=0b001e83c9afdbad23fb94565d35ee6546975e81;p=Questionable.git Update Wrath IPC --- diff --git a/Directory.Build.targets b/Directory.Build.targets index b053a815..0ef99fba 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,5 @@ - 4.21 + 4.22 diff --git a/Questionable/Controller/CombatModules/WrathComboModule.cs b/Questionable/Controller/CombatModules/WrathComboModule.cs index d9563683..175fb109 100644 --- a/Questionable/Controller/CombatModules/WrathComboModule.cs +++ b/Questionable/Controller/CombatModules/WrathComboModule.cs @@ -3,6 +3,7 @@ using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Plugin; using Dalamud.Plugin.Ipc; using Dalamud.Plugin.Ipc.Exceptions; +using JetBrains.Annotations; using Microsoft.Extensions.Logging; using Questionable.Controller.Steps; @@ -17,8 +18,8 @@ internal sealed class WrathComboModule : ICombatModule, IDisposable private readonly ICallGateSubscriber _test; private readonly ICallGateSubscriber _registerForLeaseWithCallback; private readonly ICallGateSubscriber _releaseControl; - private readonly ICallGateSubscriber _setAutoRotationState; - private readonly ICallGateSubscriber _setCurrentJobAutoRotationReady; + private readonly ICallGateSubscriber _setAutoRotationState; + private readonly ICallGateSubscriber _setCurrentJobAutoRotationReady; private readonly ICallGateProvider _callback; private Guid? _lease; @@ -32,9 +33,9 @@ internal sealed class WrathComboModule : ICombatModule, IDisposable _registerForLeaseWithCallback = pluginInterface.GetIpcSubscriber("WrathCombo.RegisterForLeaseWithCallback"); _releaseControl = pluginInterface.GetIpcSubscriber("WrathCombo.ReleaseControl"); - _setAutoRotationState = pluginInterface.GetIpcSubscriber("WrathCombo.SetAutoRotationState"); + _setAutoRotationState = pluginInterface.GetIpcSubscriber("WrathCombo.SetAutoRotationState"); _setCurrentJobAutoRotationReady = - pluginInterface.GetIpcSubscriber("WrathCombo.SetCurrentJobAutoRotationReady"); + pluginInterface.GetIpcSubscriber("WrathCombo.SetCurrentJobAutoRotationReady"); _callback = pluginInterface.GetIpcProvider($"{CallbackPrefix}.WrathComboCallback"); _callback.RegisterAction(Callback); @@ -65,8 +66,22 @@ internal sealed class WrathComboModule : ICombatModule, IDisposable { _logger.LogDebug("Wrath combo lease: {Lease}", _lease.Value); - _setAutoRotationState.InvokeAction(_lease.Value, true); - _setCurrentJobAutoRotationReady.InvokeAction(_lease.Value); + ESetResult autoRotationSet = _setAutoRotationState.InvokeFunc(_lease.Value, true); + if (!autoRotationSet.IsSuccess()) + { + _logger.LogError("Unable to set autorotation state"); + Stop(); + return false; + } + + ESetResult currentJobSetForAutoRotation = _setCurrentJobAutoRotationReady.InvokeFunc(_lease.Value); + if (!currentJobSetForAutoRotation.IsSuccess()) + { + _logger.LogError("Unable to setr current job for autorotation"); + Stop(); + return false; + } + return true; } else @@ -120,4 +135,27 @@ internal sealed class WrathComboModule : ICombatModule, IDisposable Stop(); _callback.UnregisterAction(); } + + [PublicAPI] + public enum ESetResult + { + Okay = 0, + OkayWorking = 1, + + IpcDisabled = 10, + InvalidLease = 11, + BlacklistedLease = 12, + Duplicate = 13, + PlayerNotAvailable = 14, + InvalidConfiguration = 15, + InvalidValue = 16, + } +} + +internal static class WrathResultExtensions +{ + public static bool IsSuccess(this WrathComboModule.ESetResult result) + { + return result is WrathComboModule.ESetResult.Okay or WrathComboModule.ESetResult.OkayWorking; + } }