1
0
Fork 0
forked from aly/qstbak
qstbak/LLib/LLib.GameUI/LAddon.cs
2026-08-17 20:27:25 +10:00

182 lines
5.9 KiB
C#

using System;
using System.Runtime.CompilerServices;
using Dalamud.Game.NativeWrapper;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Component.GUI;
namespace LLib.GameUI;
public static class LAddon
{
private const int UnitListCount = 18;
public unsafe static AtkUnitBase* GetAddonById(uint id)
{
AtkUnitList* ptr = &AtkStage.Instance()->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList;
int num = 0;
int num2 = 2129774169;
AtkUnitBase* value = default(AtkUnitBase*);
AtkUnitList* ptr2 = default(AtkUnitList*);
int num10 = default(int);
int num7 = default(int);
while (true)
{
int num3 = num2;
int num4 = 2129774174;
int num5 = num3;
switch ((num5 | num4) - (num5 & num4))
{
case 9:
num2 = 2129774169;
break;
case 5:
{
int num11 = num;
num4 = 1;
num5 = num11;
num = (num5 | num4) + (num5 & num4);
num2 = 2129774169;
break;
}
case 8:
num2 = ((value->Id != id) ? 2129774174 : 2129774175);
break;
case 7:
num2 = ((num < 18) ? 2129774170 : 2129774172);
break;
case 1:
return value;
case 4:
ptr2 = ptr + num;
num10 = _200F_202C_206F_202D_200F_202D_206D_200E_200D_206E_200B_200B_202A_202B_200F_202A_200C_200B_206C_206F_200B_202A_200E_202C_202E_206A_202D_206D_200F_200E_202C_206A_206A_206F_202D_206B_200B_200C_206C_202A_202E((int)ptr2->Count, ptr2->Entries.Length);
num7 = 0;
num2 = 2129774168;
break;
case 3:
value = ptr2->Entries[num7].Value;
num2 = ((value == null) ? 2129774174 : 2129774166);
break;
case 6:
num2 = ((num7 < num10) ? 2129774173 : 2129774171);
break;
case 0:
{
int num6 = num7;
num4 = 1;
num5 = num6;
int num8 = num5 ^ num4;
int num9 = num5 & num4;
num7 = num8 + (num9 + num9);
num2 = 2129774168;
break;
}
case 2:
return null;
}
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public unsafe static bool TryGetAddonByName<T>(this IGameGui gameGui, string addonName, out T* addonPtr) where T : unmanaged
{
_206F_202D_200B_200D_206C_206D_200D_202D_202B_200C_206D_206C_206E_200D_200F_206E_200B_202E_200F_206F_200E_200F_206A_202B_202C_202B_206F_206A_206C_206F_200E_202E_200F_200E_202C_202D_200F_206F_200C_206D_202E((object)gameGui, global::_003CModule_003E._206A_206D_202C_206E_206D_206E_202A_200F_200D_206A_200F_206C_202C_202D_206D_206A_200D_200F_206A_206C_202C_206D_206E_200F_200F_200C_206B_200B_206B_206E_202B_206B_200E_200E_200B_206F_200F_202E_200C_200C_202E<string>(1115223157));
_206D_200C_206B_206E_200E_202E_202B_206D_206F_202B_200D_200D_206A_202D_202E_202B_202D_206E_206F_206E_206A_202E_202C_202A_206E_200B_206B_206F_200E_202E_202A_200F_202E_206A_206E_206A_206D_206F_206B_206F_202E(addonName, global::_003CModule_003E._206A_202C_200C_206F_202A_200C_200F_206F_202B_202B_200D_206F_206D_200E_206A_206B_202A_200F_200B_206C_202B_202A_202B_206C_200F_206C_202C_202C_200C_206C_206F_200C_200B_202D_200E_202A_202A_206B_206B_200F_202E<string>(-709864046));
AtkUnitBasePtr atkUnitBasePtr = _200F_202D_202D_200E_200F_200C_200E_202D_202E_200B_202A_206B_202A_206A_206A_206F_206D_202A_206D_206C_200E_202D_202C_206A_200D_202E_202D_206E_200C_206A_206B_200F_206C_200E_202D_202C_200B_202D_200E_200F_202E(gameGui, addonName, 1);
int num = (atkUnitBasePtr.IsNull ? (-1471855993) : (-1471855994));
while (true)
{
int num2 = num;
int num3 = -1471855993;
int num4 = num2;
int num5 = num4 + num3;
int num6 = num4 & num3;
switch (num5 - (num6 + num6))
{
case 2:
goto IL_0072;
case 0:
addonPtr = null;
return false;
case 1:
addonPtr = (T*)atkUnitBasePtr.Address;
return true;
}
continue;
IL_0072:
num = -1471855994;
}
}
public unsafe static bool IsAddonReady(AtkUnitBase* addon)
{
int num = ((addon == null) ? 1974833566 : 1974833564);
while (true)
{
int num2 = num;
int num3 = 1974833565;
int num4 = num2;
int num5 = num4 + num3;
int num6 = num4 & num3;
switch (num5 - (num6 + num6))
{
case 0:
return addon->UldManager.LoadedState == AtkLoadState.Loaded;
case 1:
num = ((!addon->IsVisible) ? 1974833566 : 1974833565);
break;
case 3:
return false;
case 2:
num = 1974833564;
break;
}
}
}
public unsafe static bool TryGetReadyAddon<T>(this IGameGui gameGui, string addonName, out T* addonPtr) where T : unmanaged
{
int num = ((!gameGui.TryGetAddonByName<T>(addonName, out addonPtr)) ? 1276632889 : 1276632891);
while (true)
{
int num2 = num;
int num3 = 1276632890;
int num4 = num2;
int num5 = num4 + num3;
int num6 = num4 & num3;
switch (num5 - (num6 + num6))
{
case 2:
return true;
case 1:
num = ((!IsAddonReady((AtkUnitBase*)addonPtr)) ? 1276632889 : 1276632888);
break;
case 3:
addonPtr = null;
return false;
case 0:
num = 1276632891;
break;
}
}
}
static int _200F_202C_206F_202D_200F_202D_206D_200E_200D_206E_200B_200B_202A_202B_200F_202A_200C_200B_206C_206F_200B_202A_200E_202C_202E_206A_202D_206D_200F_200E_202C_206A_206A_206F_202D_206B_200B_200C_206C_202A_202E(int P_0, int P_1)
{
return Math.Min(P_0, P_1);
}
static void _206F_202D_200B_200D_206C_206D_200D_202D_202B_200C_206D_206C_206E_200D_200F_206E_200B_202E_200F_206F_200E_200F_206A_202B_202C_202B_206F_206A_206C_206F_200E_202E_200F_200E_202C_202D_200F_206F_200C_206D_202E(object P_0, string P_1)
{
ArgumentNullException.ThrowIfNull(P_0, P_1);
}
static void _206D_200C_206B_206E_200E_202E_202B_206D_206F_202B_200D_200D_206A_202D_202E_202B_202D_206E_206F_206E_206A_202E_202C_202A_206E_200B_206B_206F_200E_202E_202A_200F_202E_206A_206E_206A_206D_206F_206B_206F_202E(string P_0, string P_1)
{
ArgumentException.ThrowIfNullOrEmpty(P_0, P_1);
}
static AtkUnitBasePtr _200F_202D_202D_200E_200F_200C_200E_202D_202E_200B_202A_206B_202A_206A_206A_206F_206D_202A_206D_206C_200E_202D_202C_206A_200D_202E_202D_206E_200C_206A_206B_200F_206C_200E_202D_202C_200B_202D_200E_200F_202E(IGameGui P_0, string P_1, int P_2)
{
return P_0.GetAddonByName(P_1, P_2);
}
}