forked from aly/qstbak
407 lines
8.8 KiB
C#
407 lines
8.8 KiB
C#
using FFXIVClientStructs.FFXIV.Client.Game;
|
|
|
|
namespace LLib.Gear;
|
|
|
|
public static class EEquipSlotCategoryExtensions
|
|
{
|
|
public static InventoryType? GetArmoryContainer(this EEquipSlotCategory slot)
|
|
{
|
|
int num;
|
|
InventoryType? result = default(InventoryType?);
|
|
switch (slot)
|
|
{
|
|
default:
|
|
num = -2089769317;
|
|
goto IL_0047;
|
|
case EEquipSlotCategory.Ears:
|
|
result = InventoryType.ArmoryEar;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
case EEquipSlotCategory.Shield:
|
|
goto IL_00b7;
|
|
case EEquipSlotCategory.Hands:
|
|
goto IL_00cd;
|
|
case EEquipSlotCategory.Head:
|
|
goto IL_00e3;
|
|
case (EEquipSlotCategory)6u:
|
|
goto IL_00f9;
|
|
case EEquipSlotCategory.Body:
|
|
goto IL_010e;
|
|
case EEquipSlotCategory.Legs:
|
|
goto IL_0131;
|
|
case EEquipSlotCategory.Feet:
|
|
goto IL_0147;
|
|
case EEquipSlotCategory.Wrists:
|
|
goto IL_015d;
|
|
case EEquipSlotCategory.OneHandedMainHand:
|
|
case EEquipSlotCategory.TwoHandedMainHand:
|
|
goto IL_017e;
|
|
case EEquipSlotCategory.Neck:
|
|
goto IL_0194;
|
|
case EEquipSlotCategory.Rings:
|
|
goto IL_01aa;
|
|
IL_0047:
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -2089769328;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 7:
|
|
goto end_IL_0047;
|
|
case 8:
|
|
goto IL_00b7;
|
|
case 10:
|
|
goto IL_00cd;
|
|
case 5:
|
|
goto IL_00e3;
|
|
case 2:
|
|
goto IL_00f9;
|
|
case 9:
|
|
goto IL_010e;
|
|
case 1:
|
|
return result;
|
|
case 0:
|
|
num = -2089769317;
|
|
break;
|
|
case 12:
|
|
goto IL_0131;
|
|
case 6:
|
|
goto IL_0147;
|
|
case 13:
|
|
goto IL_015d;
|
|
case 11:
|
|
num = -2089769326;
|
|
break;
|
|
case 4:
|
|
goto IL_017e;
|
|
case 3:
|
|
goto IL_0194;
|
|
case 14:
|
|
goto IL_01aa;
|
|
}
|
|
continue;
|
|
end_IL_0047:
|
|
break;
|
|
}
|
|
goto case EEquipSlotCategory.Ears;
|
|
IL_01aa:
|
|
result = InventoryType.ArmoryRings;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_0194:
|
|
result = InventoryType.ArmoryNeck;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_017e:
|
|
result = InventoryType.ArmoryMainHand;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_015d:
|
|
result = InventoryType.ArmoryWrist;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_0147:
|
|
result = InventoryType.ArmoryFeets;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_0131:
|
|
result = InventoryType.ArmoryLegs;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_010e:
|
|
result = InventoryType.ArmoryBody;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_00f9:
|
|
result = null;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_00e3:
|
|
result = InventoryType.ArmoryHead;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_00cd:
|
|
result = InventoryType.ArmoryHands;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
IL_00b7:
|
|
result = InventoryType.ArmoryOffHand;
|
|
num = -2089769327;
|
|
goto IL_0047;
|
|
}
|
|
}
|
|
|
|
public unsafe static int? FindFreeSlot(InventoryType container)
|
|
{
|
|
InventoryManager* ptr = InventoryManager.Instance();
|
|
int num = ((ptr != null) ? (-1184837257) : (-1184837263));
|
|
int num5 = default(int);
|
|
InventoryItem* inventorySlot = default(InventoryItem*);
|
|
InventoryContainer* inventoryContainer = default(InventoryContainer*);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1184837262;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 7:
|
|
return null;
|
|
case 0:
|
|
num5 = 0;
|
|
num = -1184837260;
|
|
break;
|
|
case 2:
|
|
{
|
|
int num6 = num5;
|
|
num3 = 1;
|
|
num4 = num6;
|
|
int num7 = num4 ^ num3;
|
|
int num8 = num4 & num3;
|
|
num5 = num7 + (num8 + num8);
|
|
num = -1184837260;
|
|
break;
|
|
}
|
|
case 1:
|
|
return null;
|
|
case 9:
|
|
return num5;
|
|
case 10:
|
|
inventorySlot = inventoryContainer->GetInventorySlot(num5);
|
|
num = ((inventorySlot == null) ? (-1184837264) : (-1184837254));
|
|
break;
|
|
case 3:
|
|
return null;
|
|
case 5:
|
|
inventoryContainer = ptr->GetInventoryContainer(container);
|
|
num = ((inventoryContainer != null) ? (-1184837262) : (-1184837259));
|
|
break;
|
|
case 8:
|
|
num = ((inventorySlot->ItemId != 0) ? (-1184837264) : (-1184837253));
|
|
break;
|
|
case 4:
|
|
num = -1184837263;
|
|
break;
|
|
case 6:
|
|
num = ((num5 < inventoryContainer->Size) ? (-1184837256) : (-1184837261));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public unsafe static bool TryUnequipItem(int equippedSlotIndex)
|
|
{
|
|
int num;
|
|
InventoryType? inventoryType2 = default(InventoryType?);
|
|
InventoryManager* ptr = default(InventoryManager*);
|
|
InventoryType valueOrDefault2 = default(InventoryType);
|
|
int valueOrDefault = default(int);
|
|
InventoryType? inventoryType = default(InventoryType?);
|
|
int? num7 = default(int?);
|
|
InventoryItem* inventorySlot = default(InventoryItem*);
|
|
InventoryContainer* inventoryContainer = default(InventoryContainer*);
|
|
switch (equippedSlotIndex)
|
|
{
|
|
default:
|
|
num = 1686328571;
|
|
goto IL_004a;
|
|
case 6:
|
|
inventoryType2 = InventoryType.ArmoryLegs;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
case 11:
|
|
case 12:
|
|
goto IL_0106;
|
|
case 0:
|
|
goto IL_0147;
|
|
case 7:
|
|
goto IL_018d;
|
|
case 3:
|
|
goto IL_01d1;
|
|
case 1:
|
|
goto IL_022c;
|
|
case 5:
|
|
goto IL_0259;
|
|
case 10:
|
|
goto IL_0271;
|
|
case 13:
|
|
goto IL_029d;
|
|
case 4:
|
|
goto IL_02db;
|
|
case 8:
|
|
goto IL_0301;
|
|
case 2:
|
|
goto IL_0351;
|
|
case 9:
|
|
goto IL_036b;
|
|
IL_004a:
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 1686328567;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 24:
|
|
return false;
|
|
case 14:
|
|
goto end_IL_004a;
|
|
case 8:
|
|
goto IL_0106;
|
|
case 27:
|
|
return false;
|
|
case 31:
|
|
goto IL_0120;
|
|
case 6:
|
|
goto IL_0147;
|
|
case 22:
|
|
goto IL_015f;
|
|
case 30:
|
|
return false;
|
|
case 4:
|
|
goto IL_018d;
|
|
case 11:
|
|
goto IL_01a5;
|
|
case 15:
|
|
goto IL_01d1;
|
|
case 16:
|
|
goto IL_01e9;
|
|
case 20:
|
|
goto IL_0208;
|
|
case 18:
|
|
goto IL_022c;
|
|
case 2:
|
|
ptr->MoveItemSlot(InventoryType.EquippedItems, (ushort)equippedSlotIndex, valueOrDefault2, (ushort)valueOrDefault, a6: true);
|
|
return true;
|
|
case 19:
|
|
goto IL_0259;
|
|
case 3:
|
|
goto IL_0271;
|
|
case 13:
|
|
valueOrDefault2 = inventoryType.GetValueOrDefault();
|
|
num = 1686328557;
|
|
break;
|
|
case 5:
|
|
goto IL_029d;
|
|
case 26:
|
|
goto IL_02b5;
|
|
case 7:
|
|
goto IL_02db;
|
|
case 0:
|
|
num = 1686328571;
|
|
break;
|
|
case 28:
|
|
return false;
|
|
case 1:
|
|
goto IL_0301;
|
|
case 21:
|
|
goto IL_0319;
|
|
case 12:
|
|
num = 1686328548;
|
|
break;
|
|
case 23:
|
|
return false;
|
|
case 25:
|
|
goto IL_0351;
|
|
case 17:
|
|
return false;
|
|
case 29:
|
|
goto IL_036b;
|
|
case 10:
|
|
valueOrDefault = num7.GetValueOrDefault();
|
|
num = 1686328565;
|
|
break;
|
|
case 9:
|
|
goto IL_0398;
|
|
}
|
|
continue;
|
|
IL_0398:
|
|
num = ((inventorySlot->ItemId != 0) ? 1686328545 : 1686328553);
|
|
continue;
|
|
IL_015f:
|
|
num7 = FindFreeSlot(valueOrDefault2);
|
|
num = ((!num7.HasValue) ? 1686328556 : 1686328573);
|
|
continue;
|
|
IL_0208:
|
|
num = ((equippedSlotIndex < inventoryContainer->Size) ? 1686328546 : 1686328555);
|
|
continue;
|
|
IL_0319:
|
|
inventorySlot = inventoryContainer->GetInventorySlot(equippedSlotIndex);
|
|
num = ((inventorySlot == null) ? 1686328553 : 1686328574);
|
|
continue;
|
|
IL_0120:
|
|
inventoryType = inventoryType2;
|
|
num = ((!inventoryType.HasValue) ? 1686328544 : 1686328570);
|
|
continue;
|
|
IL_01a5:
|
|
inventoryContainer = ptr->GetInventoryContainer(InventoryType.EquippedItems);
|
|
num = ((inventoryContainer != null) ? 1686328551 : 1686328559);
|
|
continue;
|
|
IL_02b5:
|
|
ptr = InventoryManager.Instance();
|
|
num = ((ptr != null) ? 1686328572 : 1686328550);
|
|
continue;
|
|
IL_01e9:
|
|
num = ((equippedSlotIndex < 0) ? 1686328555 : 1686328547);
|
|
continue;
|
|
end_IL_004a:
|
|
break;
|
|
}
|
|
goto case 6;
|
|
IL_036b:
|
|
inventoryType2 = InventoryType.ArmoryNeck;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_0351:
|
|
inventoryType2 = InventoryType.ArmoryHead;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_0301:
|
|
inventoryType2 = InventoryType.ArmoryEar;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_02db:
|
|
inventoryType2 = InventoryType.ArmoryHands;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_029d:
|
|
inventoryType2 = InventoryType.ArmorySoulCrystal;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_0271:
|
|
inventoryType2 = InventoryType.ArmoryWrist;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_0259:
|
|
inventoryType2 = null;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_022c:
|
|
inventoryType2 = InventoryType.ArmoryOffHand;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_01d1:
|
|
inventoryType2 = InventoryType.ArmoryBody;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_018d:
|
|
inventoryType2 = InventoryType.ArmoryFeets;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_0147:
|
|
inventoryType2 = InventoryType.ArmoryMainHand;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
IL_0106:
|
|
inventoryType2 = InventoryType.ArmoryRings;
|
|
num = 1686328552;
|
|
goto IL_004a;
|
|
}
|
|
}
|
|
}
|