forked from aly/qstbak
463 lines
12 KiB
C#
463 lines
12 KiB
C#
using System.Runtime.CompilerServices;
|
|
using Dalamud.Plugin.Services;
|
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
|
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
|
using LLib.GameUI;
|
|
using Lumina.Excel.Sheets;
|
|
|
|
namespace LLib.Gear;
|
|
|
|
public static class DesynthActions
|
|
{
|
|
public const uint DesynthUnlockQuestId = 65688u;
|
|
|
|
public unsafe static bool TryOpenDesynthWindow()
|
|
{
|
|
AgentSalvage* ptr = AgentSalvage.Instance();
|
|
int num = ((ptr != null) ? 423836342 : 423836341);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 423836343;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 1:
|
|
ptr->AgentInterface.Show();
|
|
return true;
|
|
case 2:
|
|
return false;
|
|
case 0:
|
|
goto IL_005a;
|
|
}
|
|
continue;
|
|
IL_005a:
|
|
num = 423836341;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool IsDesynthAddonReady(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
return 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>(-866883789), out addonPtr);
|
|
}
|
|
|
|
public unsafe static void SetCategory(AgentSalvage.SalvageItemCategory category)
|
|
{
|
|
AgentSalvage* ptr = AgentSalvage.Instance();
|
|
int num = ((ptr == null) ? (-1642327650) : (-1642327651));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1642327649;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
num = -1642327651;
|
|
break;
|
|
case 1:
|
|
return;
|
|
case 2:
|
|
ptr->SelectedCategory = category;
|
|
num = -1642327650;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public unsafe static AgentSalvage.SalvageItemCategory GetCategory()
|
|
{
|
|
AgentSalvage* ptr = AgentSalvage.Instance();
|
|
int num = ((ptr != null) ? 1275547526 : 1275547525);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 1275547527;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 0:
|
|
goto IL_004b;
|
|
case 2:
|
|
return AgentSalvage.SalvageItemCategory.InventoryEquipment;
|
|
case 1:
|
|
return ptr->SelectedCategory;
|
|
}
|
|
continue;
|
|
IL_004b:
|
|
num = 1275547525;
|
|
}
|
|
}
|
|
|
|
public unsafe static void RefreshItemList()
|
|
{
|
|
AgentSalvage* ptr = AgentSalvage.Instance();
|
|
int num = ((ptr == null) ? 213710031 : 213710028);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 213710029;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 0:
|
|
num = 213710028;
|
|
break;
|
|
case 2:
|
|
return;
|
|
case 1:
|
|
ptr->ItemListRefresh(isSalvageResultAddonOpen: true);
|
|
num = 213710031;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public unsafe static int GetItemCount()
|
|
{
|
|
AgentSalvage* ptr = AgentSalvage.Instance();
|
|
int num = ((ptr != null) ? (-832139057) : (-832139060));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -832139059;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 2:
|
|
return (int)ptr->ItemCount;
|
|
case 1:
|
|
return 0;
|
|
case 0:
|
|
goto IL_0052;
|
|
}
|
|
continue;
|
|
IL_0052:
|
|
num = -832139060;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TrySelectItem(IGameGui gameGui, int itemIndex)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (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>(1627601716), out addonPtr) ? (-770746818) : (-770746819));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -770746817;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 0:
|
|
goto IL_0054;
|
|
case 2:
|
|
return false;
|
|
case 1:
|
|
AddonCallback.FireWithUpdate(addonPtr, 12, itemIndex);
|
|
return true;
|
|
}
|
|
continue;
|
|
IL_0054:
|
|
num = -770746819;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool IsConfirmDialogReady(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
return gameGui.TryGetReadyAddon<AtkUnitBase>(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>(-1828930182), out addonPtr);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TryConfirmDesynth(IGameGui gameGui, bool nqOnly = false)
|
|
{
|
|
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>(221638269), out addonPtr) ? (-763680542) : (-763680543));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -763680541;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
goto IL_0052;
|
|
case 1:
|
|
AddonCallback.FireWithUpdate(addonPtr, 15, nqOnly ? 1 : 0);
|
|
AddonCallback.FireWithUpdate(addonPtr, default(int), default(int));
|
|
return true;
|
|
case 2:
|
|
return false;
|
|
}
|
|
continue;
|
|
IL_0052:
|
|
num = -763680543;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool IsResultDialogReady(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
return gameGui.TryGetReadyAddon<AtkUnitBase>(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>(-132278347), out addonPtr);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TryCloseResultDialog(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (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>(937498069), out addonPtr) ? (-1405203810) : (-1405203811));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1405203809;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 1:
|
|
addonPtr->Close(fireCallback: true);
|
|
return true;
|
|
case 2:
|
|
return false;
|
|
case 0:
|
|
goto IL_0060;
|
|
}
|
|
continue;
|
|
IL_0060:
|
|
num = -1405203811;
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public unsafe static bool TryCloseDesynthWindow(IGameGui gameGui)
|
|
{
|
|
AtkUnitBase* addonPtr;
|
|
int num = (gameGui.TryGetReadyAddon<AtkUnitBase>(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>(-2023860148), out addonPtr) ? 176704598 : 176704597);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 176704599;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
goto IL_0052;
|
|
case 2:
|
|
return false;
|
|
case 1:
|
|
addonPtr->Close(fireCallback: true);
|
|
return true;
|
|
}
|
|
continue;
|
|
IL_0052:
|
|
num = 176704597;
|
|
}
|
|
}
|
|
|
|
public unsafe static AgentSalvage.SalvageListItem? GetItemAtIndex(int index)
|
|
{
|
|
AgentSalvage* ptr = AgentSalvage.Instance();
|
|
int num = ((ptr == null) ? 1959558310 : 1959558311);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 1959558309;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 0:
|
|
num = 1959558311;
|
|
break;
|
|
case 2:
|
|
num = ((ptr->ItemList == null) ? 1959558310 : 1959558305);
|
|
break;
|
|
case 1:
|
|
return ptr->ItemList[index];
|
|
case 4:
|
|
num = ((index < 0) ? 1959558310 : 1959558304);
|
|
break;
|
|
case 5:
|
|
num = ((index < ptr->ItemCount) ? 1959558308 : 1959558310);
|
|
break;
|
|
case 3:
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public unsafe static bool TryDesynthDirect(InventoryItem* item)
|
|
{
|
|
int num = ((item == null) ? (-1819563004) : (-1819563003));
|
|
AgentSalvage* ptr = default(AgentSalvage*);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1819563004;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 2:
|
|
num = -1819563003;
|
|
break;
|
|
case 1:
|
|
num = ((item->ItemId != 0) ? (-1819563007) : (-1819563004));
|
|
break;
|
|
case 5:
|
|
ptr = AgentSalvage.Instance();
|
|
num = ((ptr != null) ? (-1819563001) : (-1819563008));
|
|
break;
|
|
case 4:
|
|
return false;
|
|
case 3:
|
|
{
|
|
ptr->SalvageItem(item, 0, 0);
|
|
AtkValue* returnValue = stackalloc AtkValue[1];
|
|
AtkValue* ptr2 = stackalloc AtkValue[2];
|
|
ptr2->Type = AtkValueType.Int;
|
|
ptr2->Int = 0;
|
|
ptr2[1].Type = AtkValueType.Bool;
|
|
ptr2[1].Byte = 1;
|
|
ptr->AgentInterface.ReceiveEvent(returnValue, ptr2, 2u, 1uL);
|
|
return true;
|
|
}
|
|
case 0:
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static bool IsDesynthUnlocked()
|
|
{
|
|
return GearFeatures.IsDesynthUnlocked();
|
|
}
|
|
|
|
public static bool IsItemDesynthable(IDataManager dataManager, uint itemId)
|
|
{
|
|
Item row;
|
|
int num = (dataManager.GetExcelSheet<Item>().TryGetRow(itemId, out row) ? (-1608454273) : (-1608454276));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1608454274;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 1:
|
|
return row.Desynth > 0;
|
|
case 2:
|
|
return false;
|
|
case 0:
|
|
goto IL_0068;
|
|
}
|
|
continue;
|
|
IL_0068:
|
|
num = -1608454276;
|
|
}
|
|
}
|
|
|
|
public unsafe static bool CanPlayerDesynthItem(IDataManager dataManager, uint itemId)
|
|
{
|
|
Item row;
|
|
int num = (dataManager.GetExcelSheet<Item>().TryGetRow(itemId, out row) ? (-1179010991) : (-1179010980));
|
|
PlayerState* ptr = default(PlayerState*);
|
|
ClassJob? valueNullable = default(ClassJob?);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1179010983;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 4:
|
|
num = -1179010980;
|
|
break;
|
|
case 6:
|
|
return false;
|
|
case 1:
|
|
return false;
|
|
case 7:
|
|
return false;
|
|
case 5:
|
|
return false;
|
|
case 3:
|
|
ptr = PlayerState.Instance();
|
|
num = ((ptr != null) ? (-1179010981) : (-1179010984));
|
|
break;
|
|
case 2:
|
|
return ptr->ClassJobLevels[valueNullable.Value.ExpArrayIndex] >= 30;
|
|
case 8:
|
|
num = ((row.Desynth > 0) ? (-1179010983) : (-1179010978));
|
|
break;
|
|
case 0:
|
|
valueNullable = row.ClassJobRepair.ValueNullable;
|
|
num = (valueNullable.HasValue ? (-1179010982) : (-1179010977));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public unsafe static float GetDesynthLevel(uint classJobId)
|
|
{
|
|
PlayerState* ptr = PlayerState.Instance();
|
|
bool flag = ptr == null;
|
|
int num = (flag ? 659072519 : 659072518);
|
|
bool flag2 = default(bool);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 659072516;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 7:
|
|
return ptr->GetDesynthesisLevel(classJobId);
|
|
case 8:
|
|
num = ((classJobId <= 15) ? 659072513 : 659072516);
|
|
break;
|
|
case 2:
|
|
num = ((classJobId < 8) ? 659072516 : 659072524);
|
|
break;
|
|
case 5:
|
|
flag2 = false;
|
|
num = 659072517;
|
|
break;
|
|
case 3:
|
|
num = ((!flag) ? 659072515 : 659072512);
|
|
break;
|
|
case 1:
|
|
flag = flag2;
|
|
num = 659072519;
|
|
break;
|
|
case 0:
|
|
flag2 = true;
|
|
num = 659072517;
|
|
break;
|
|
case 4:
|
|
return 0f;
|
|
case 6:
|
|
num = 659072518;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|