forked from aly/qstbak
150 lines
4.5 KiB
C#
150 lines
4.5 KiB
C#
using System.Runtime.CompilerServices;
|
|
using Dalamud.Plugin.Services;
|
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
|
using LLib.GameUI;
|
|
|
|
namespace LLib.Buddy;
|
|
|
|
public static class BuddyEquipActions
|
|
{
|
|
private const uint CompanionWindowActionId = 26u;
|
|
|
|
public unsafe static bool TryOpenBuddyAddon()
|
|
{
|
|
ActionManager* ptr = ActionManager.Instance();
|
|
int num = ((ptr != null) ? 1019459524 : 1019459527);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 1019459526;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 0:
|
|
goto IL_004b;
|
|
case 2:
|
|
return ptr->UseAction(ActionType.GeneralAction, 26u, 3758096384uL, 0u, ActionManager.UseActionMode.None, 0u, null);
|
|
case 1:
|
|
return false;
|
|
}
|
|
continue;
|
|
IL_004b:
|
|
num = 1019459527;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool IsBuddyAddonReady(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
return gameGui.TryGetReadyAddon<AtkUnitBase>(global::_003CModule_003E._202E_202C_206D_206B_202B_202D_206D_202E_206F_202E_202A_206A_206A_202B_206A_202D_202C_206C_206B_202C_206E_202B_200E_206E_206A_206C_200D_200D_200F_200B_202C_200B_200E_206F_202C_200F_202D_202A_206E_202B_202E<string>(583695867), out addonPtr);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TrySelectBardingSlot(IGameGui gameGui, int slot)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (gameGui.TryGetReadyAddon<AtkUnitBase>(global::_003CModule_003E._206E_202B_206C_202A_202A_200E_202B_202B_206D_200B_200C_206B_200B_206D_202E_202D_206C_202B_200B_206A_202D_206C_202A_200F_202D_200C_200B_200B_200B_200D_202C_206E_206D_202E_200C_206B_206A_206D_202D_202C_202E<string>(-70251581), out addonPtr) ? (-765945705) : (-765945708));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -765945707;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
goto IL_0052;
|
|
case 2:
|
|
AddonCallback.Fire(addonPtr, 0, 2);
|
|
AddonCallback.Fire(addonPtr, 1, slot);
|
|
return true;
|
|
case 1:
|
|
return false;
|
|
}
|
|
continue;
|
|
IL_0052:
|
|
num = -765945708;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TryEquipBarding(IGameGui gameGui, int bardingIndex)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (gameGui.TryGetReadyAddon<AtkUnitBase>(global::_003CModule_003E._200E_206F_206C_206C_200E_202A_206D_206B_200B_202D_202B_200F_200F_206B_206C_206F_202D_206F_206A_202D_206A_200B_200B_202B_202D_202C_200F_200D_202E_200E_200D_202A_202B_206F_202E_200E_200B_206B_200E_202E_202E<string>(1272603864), out addonPtr) ? (-427454791) : (-427454790));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -427454792;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
goto IL_0052;
|
|
case 2:
|
|
return false;
|
|
case 1:
|
|
AddonCallback.Fire(addonPtr, 2, bardingIndex);
|
|
return true;
|
|
}
|
|
continue;
|
|
IL_0052:
|
|
num = -427454790;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TryUnequipBarding(IGameGui gameGui, int slot)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (gameGui.TryGetReadyAddon<AtkUnitBase>(global::_003CModule_003E._200E_206F_206C_206C_200E_202A_206D_206B_200B_202D_202B_200F_200F_206B_206C_206F_202D_206F_206A_202D_206A_200B_200B_202B_202D_202C_200F_200D_202E_200E_200D_202A_202B_206F_202E_200E_200B_206B_200E_202E_202E<string>(1272603864), out addonPtr) ? 170791386 : 170791385);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 170791387;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
goto IL_0052;
|
|
case 1:
|
|
AddonCallback.Fire(addonPtr, 3, slot);
|
|
return true;
|
|
case 2:
|
|
return false;
|
|
}
|
|
continue;
|
|
IL_0052:
|
|
num = 170791385;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TryCloseBuddyAddon(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (gameGui.TryGetAddonByName<AtkUnitBase>(global::_003CModule_003E._202E_202C_206D_206B_202B_202D_206D_202E_206F_202E_202A_206A_206A_202B_206A_202D_202C_206C_206B_202C_206E_202B_200E_206E_206A_206C_200D_200D_200F_200B_202C_200B_200E_206F_202C_200F_202D_202A_206E_202B_202E<string>(583695867), out addonPtr) ? (-1191072356) : (-1191072353));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1191072355;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 1:
|
|
AddonCallback.Fire(addonPtr, -1);
|
|
return true;
|
|
case 2:
|
|
return false;
|
|
case 0:
|
|
goto IL_0066;
|
|
}
|
|
continue;
|
|
IL_0066:
|
|
num = -1191072353;
|
|
}
|
|
}
|
|
}
|