201 lines
8.4 KiB
C#
201 lines
8.4 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using Dalamud.Game.ClientState.Objects.Types;
|
|
using Dalamud.Plugin;
|
|
using Dalamud.Plugin.Ipc;
|
|
using Dalamud.Plugin.Ipc.Exceptions;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Questionable.Controller.CombatModules;
|
|
|
|
internal sealed class RotationSolverRebornModule : ICombatModule, IDisposable
|
|
{
|
|
private const byte ModeOff = 0;
|
|
|
|
private const byte ModeHenched = 4;
|
|
|
|
private readonly ILogger<RotationSolverRebornModule> _logger;
|
|
|
|
private readonly Configuration _configuration;
|
|
|
|
private readonly ICallGateSubscriber<string, object> _test;
|
|
|
|
private readonly ICallGateSubscriber<byte, object> _changeOperationMode;
|
|
|
|
private readonly ICallGateSubscriber<string, object, object> _setConfig;
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public RotationSolverRebornModule(ILogger<RotationSolverRebornModule> logger, IDalamudPluginInterface pluginInterface, Configuration configuration)
|
|
{
|
|
_logger = logger;
|
|
_configuration = configuration;
|
|
_test = pluginInterface.GetIpcSubscriber<string, object>(global::_003CModule_003E._202D_206D_206A_206E_202C_202B_200C_206C_200E_206A_206D_200E_206A_202A_200C_202E_206E_202C_206F_200B_206D_206F_200C_202C_200B_202B_200F_200B_206A_206F_200F_202E_206B_200E_202B_202A_200F_200B_202A_200E_202E<string>(1411732443));
|
|
_changeOperationMode = pluginInterface.GetIpcSubscriber<byte, object>(global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(1860544423));
|
|
_setConfig = pluginInterface.GetIpcSubscriber<string, object, object>(global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(1066419232));
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public bool IsAvailable()
|
|
{
|
|
int num = ((_configuration.General.CombatModule == Configuration.ECombatModule.RotationSolverReborn) ? 1043338071 : 1043338068);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 1043338070;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
goto IL_0051;
|
|
case 2:
|
|
return false;
|
|
case 1:
|
|
try
|
|
{
|
|
_test.InvokeAction(global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(801710835));
|
|
return true;
|
|
}
|
|
catch (IpcError)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
continue;
|
|
IL_0051:
|
|
num = 1043338068;
|
|
}
|
|
}
|
|
|
|
public bool CanHandleFight(CombatController.CombatData combatData)
|
|
{
|
|
return IsAvailable();
|
|
}
|
|
|
|
bool ICombatModule.CanHandleFight(CombatController.CombatData combatData)
|
|
{
|
|
//ILSpy generated this explicit interface implementation from .override directive in CanHandleFight
|
|
return this.CanHandleFight(combatData);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public bool Start(CombatController.CombatData combatData)
|
|
{
|
|
try
|
|
{
|
|
_changeOperationMode.InvokeAction(4);
|
|
SetConfig(global::_003CModule_003E._202E_206C_200F_206B_206A_202A_202C_206F_200C_206C_202B_206B_206D_206D_206D_202D_206E_202E_206C_206E_206D_202C_206F_200D_202D_202E_206A_206D_202A_206A_202B_200D_200C_206D_202B_200B_200D_200C_206E_206B_202E<string>(1302352989), false);
|
|
SetConfig(global::_003CModule_003E._202E_206C_200F_206B_206A_202A_202C_206F_200C_206C_202B_206B_206D_206D_206D_202D_206E_202E_206C_206E_206D_202C_206F_200D_202D_202E_206A_206D_202A_206A_202B_200D_200C_206D_202B_200B_200D_200C_206E_206B_202E<string>(-21636385), true);
|
|
SetConfig(global::_003CModule_003E._202E_206C_200F_206B_206A_202A_202C_206F_200C_206C_202B_206B_206D_206D_206D_202D_206E_202E_206C_206E_206D_202C_206F_200D_202D_202E_206A_206D_202A_206A_202B_200D_200C_206D_202B_200B_200D_200C_206E_206B_202E<string>(440160262), 1);
|
|
return true;
|
|
}
|
|
catch (IpcError ipcError)
|
|
{
|
|
_206B_200C_200B_202B_202B_206C_202B_200E_202D_202E_200C_206A_206D_202C_200B_202C_202E_200E_200E_200D_200F_206B_202A_206C_206F_202C_206D_206A_200E_202D_202E_200D_200F_202E_200E_200D_200E_200C_200F_202B_202E((ILogger)_logger, (Exception)ipcError, global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(-1187675745), Array.Empty<object>());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool ICombatModule.Start(CombatController.CombatData combatData)
|
|
{
|
|
//ILSpy generated this explicit interface implementation from .override directive in Start
|
|
return this.Start(combatData);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public bool Stop()
|
|
{
|
|
int num = (_202B_200D_202B_206D_206F_202A_206C_206C_200D_200C_202B_202C_202C_202C_200E_206B_202D_202C_202A_206B_206B_206C_202B_202D_200F_206E_200D_206E_206B_206F_206A_206F_206A_200E_206B_200E_206B_206D_202A_206B_202E((ICallGateSubscriber)_changeOperationMode) ? (-427994100) : (-427994099));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -427994100;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 2:
|
|
goto IL_004e;
|
|
case 1:
|
|
return true;
|
|
case 0:
|
|
try
|
|
{
|
|
_changeOperationMode.InvokeAction(0);
|
|
return true;
|
|
}
|
|
catch (IpcError ipcError)
|
|
{
|
|
_206B_200C_200B_202B_202B_206C_202B_200E_202D_202E_200C_206A_206D_202C_200B_202C_202E_200E_200E_200D_200F_206B_202A_206C_206F_202C_206D_206A_200E_202D_202E_200D_200F_202E_200E_200D_200E_200C_200F_202B_202E((ILogger)_logger, (Exception)ipcError, global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(-52047300), Array.Empty<object>());
|
|
return false;
|
|
}
|
|
}
|
|
continue;
|
|
IL_004e:
|
|
num = -427994099;
|
|
}
|
|
}
|
|
|
|
bool ICombatModule.Stop()
|
|
{
|
|
//ILSpy generated this explicit interface implementation from .override directive in Stop
|
|
return this.Stop();
|
|
}
|
|
|
|
public void Update(IGameObject gameObject)
|
|
{
|
|
}
|
|
|
|
void ICombatModule.Update(IGameObject gameObject)
|
|
{
|
|
//ILSpy generated this explicit interface implementation from .override directive in Update
|
|
this.Update(gameObject);
|
|
}
|
|
|
|
public bool CanAttack(IBattleNpc target)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool ICombatModule.CanAttack(IBattleNpc target)
|
|
{
|
|
//ILSpy generated this explicit interface implementation from .override directive in CanAttack
|
|
return this.CanAttack(target);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
void IDisposable.Dispose()
|
|
{
|
|
//ILSpy generated this explicit interface implementation from .override directive in Dispose
|
|
this.Dispose();
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
private void SetConfig(string key, object value)
|
|
{
|
|
try
|
|
{
|
|
_setConfig.InvokeAction(key, value);
|
|
}
|
|
catch (IpcError ipcError)
|
|
{
|
|
_202D_206C_200F_200F_206F_202B_206F_202C_206B_206E_206A_202D_202B_206A_202A_200D_206F_206F_200F_200F_202A_206E_206F_202E_206C_200D_200B_200E_206C_200B_206A_202E_202E_206D_200B_202E_200C_200E_202C_202D_202E((ILogger)_logger, (Exception)ipcError, global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(-1316823844), new object[1] { key });
|
|
}
|
|
}
|
|
|
|
static void _206B_200C_200B_202B_202B_206C_202B_200E_202D_202E_200C_206A_206D_202C_200B_202C_202E_200E_200E_200D_200F_206B_202A_206C_206F_202C_206D_206A_200E_202D_202E_200D_200F_202E_200E_200D_200E_200C_200F_202B_202E(ILogger P_0, Exception P_1, string P_2, object[] P_3)
|
|
{
|
|
P_0.LogWarning(P_1, P_2, P_3);
|
|
}
|
|
|
|
static bool _202B_200D_202B_206D_206F_202A_206C_206C_200D_200C_202B_202C_202C_202C_200E_206B_202D_202C_202A_206B_206B_206C_202B_202D_200F_206E_200D_206E_206B_206F_206A_206F_206A_200E_206B_200E_206B_206D_202A_206B_202E(ICallGateSubscriber P_0)
|
|
{
|
|
return P_0.HasAction;
|
|
}
|
|
|
|
static void _202D_206C_200F_200F_206F_202B_206F_202C_206B_206E_206A_202D_202B_206A_202A_200D_206F_206F_200F_200F_202A_206E_206F_202E_206C_200D_200B_200E_206C_200B_206A_202E_202E_206D_200B_202E_200C_200E_202C_202D_202E(ILogger P_0, Exception P_1, string P_2, object[] P_3)
|
|
{
|
|
P_0.LogDebug(P_1, P_2, P_3);
|
|
}
|
|
}
|