using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("dotoo.lessannoyinginventory")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("dotoo.lessannoyinginventory")]
[assembly: AssemblyTitle("dotoo.lessannoyinginventory")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace GearUITweaks
{
internal enum AnchorModeType
{
Attach,
Manual
}
internal enum PopupSideType
{
Auto,
Left,
Right
}
[MycoMod(/*Could not decode attribute arguments.*/)]
[BepInPlugin("dotoo.lessannoyinginventory", "Dotoo Less Annoying Inventory", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string Guid = "dotoo.lessannoyinginventory";
public const string Name = "Dotoo Less Annoying Inventory";
public const string Version = "1.0.0";
internal const float MarginMax = 4000f;
internal const float OffsetMax = 2000f;
internal static Plugin Instance;
internal static ManualLogSource Log;
internal static ConfigEntry<bool> RestoreOnCancel;
internal static ConfigEntry<bool> ShowEquipOrder;
internal static ConfigEntry<bool> ShowDetailedStats;
internal static ConfigEntry<bool> KeepPlacedOnConflict;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<bool> PinStatUpgrades;
internal static ConfigEntry<bool> PinSkinUpgrades;
internal static ConfigEntry<bool> OnlyListItems;
internal static ConfigEntry<AnchorModeType> AnchorMode;
internal static ConfigEntry<PopupSideType> PopupSide;
internal static ConfigEntry<float> ManualMarginX;
internal static ConfigEntry<float> ManualMarginY;
internal static ConfigEntry<float> AttachOffsetX;
internal static ConfigEntry<float> AttachOffsetY;
private void Awake()
{
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Expected O, but got Unknown
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Expected O, but got Unknown
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Expected O, but got Unknown
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
RestoreOnCancel = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "RestoreOnCancel", true, "Restore the grid when you let go of an upgrade without placing it. Needs a game restart to apply.");
ShowEquipOrder = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "ShowEquipOrder", true, "Always show the equip order numbers on the grid (Ctrl hides them). Needs a game restart to apply.");
ShowDetailedStats = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "ShowDetailedStats", true, "Always show detailed stats (E shows the simple view). Needs a game restart to apply.");
KeepPlacedOnConflict = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "KeepPlacedOnConflict", true, "When an upgrade conflicts with one on the grid, keep the placed one and do not place the new one. Needs a game restart to apply.");
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch for the tooltip pinning (feature 4).");
PinStatUpgrades = ((BaseUnityPlugin)this).Config.Bind<bool>("Targets", "PinStatUpgrades", true, "Reposition tooltips of stat upgrades (non-skin upgrades).");
PinSkinUpgrades = ((BaseUnityPlugin)this).Config.Bind<bool>("Targets", "PinSkinUpgrades", true, "Reposition tooltips of skin upgrades.");
OnlyListItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Targets", "OnlyListItems", false, "true: only upgrade list items are affected. false: every tooltip that belongs to an upgrade, including equipped slots.");
AnchorMode = ((BaseUnityPlugin)this).Config.Bind<AnchorModeType>("Position", "AnchorMode", AnchorModeType.Attach, "Attach: attach the tooltip to the top-left corner of the upgrade window (ManualMargin is ignored). Manual: place it relative to the top-right corner of the screen, regardless of the window (AttachOffset is ignored).");
PopupSide = ((BaseUnityPlugin)this).Config.Bind<PopupSideType>("Position", "PopupSide", PopupSideType.Auto, "Side on which keyword pop-ups open. Auto picks the side with more room.");
AcceptableValueRange<float> val = new AcceptableValueRange<float>(0f, 4000f);
AcceptableValueRange<float> val2 = new AcceptableValueRange<float>(-2000f, 2000f);
ManualMarginX = ((BaseUnityPlugin)this).Config.Bind<float>("Manual", "ManualMarginX", 65f, new ConfigDescription("Manual mode: distance from the right edge of the screen (UI units, reference height 1080). The tooltip is always clamped to stay on screen, so large values are safe.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
ManualMarginY = ((BaseUnityPlugin)this).Config.Bind<float>("Manual", "ManualMarginY", 65f, new ConfigDescription("Manual mode: distance from the top edge of the screen (UI units, reference height 1080). The tooltip is always clamped to stay on screen, so large values are safe.", (AcceptableValueBase)(object)val, Array.Empty<object>()));
AttachOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Attach", "AttachOffsetX", 0f, new ConfigDescription("Attach mode: horizontal adjustment (positive moves right).", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
AttachOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Attach", "AttachOffsetY", 12f, new ConfigDescription("Attach mode: vertical adjustment (positive moves up). This is the gap between the bottom of the tooltip and the top of the window.", (AcceptableValueBase)(object)val2, Array.Empty<object>()));
new Harmony("dotoo.lessannoyinginventory").PatchAll();
Log.LogInfo((object)"Dotoo Less Annoying Inventory 1.0.0 loaded");
}
internal static void SaveConfig()
{
if ((Object)(object)Instance != (Object)null)
{
((BaseUnityPlugin)Instance).Config.Save();
}
}
}
internal static class BoardSnapshot
{
private struct Entry
{
public UpgradeInstance Upgrade;
public sbyte X;
public sbyte Y;
public byte Rotation;
}
private static readonly List<Entry> Entries = new List<Entry>();
private static UpgradeInstance held;
private static IUpgradable target;
private static bool justTaken;
internal static void Clear()
{
justTaken = false;
Entries.Clear();
held = null;
target = null;
}
internal static void ForgetIfHeld(UpgradeInstance upgrade)
{
if (held == upgrade)
{
Clear();
}
}
internal static void Take(IUpgradable gear, UpgradeInstance picked)
{
Clear();
target = gear;
held = picked;
EquippedUpgradeEnumerator val = default(EquippedUpgradeEnumerator);
((EquippedUpgradeEnumerator)(ref val))..ctor(gear, true);
sbyte x = default(sbyte);
sbyte y = default(sbyte);
byte rotation = default(byte);
while (((EquippedUpgradeEnumerator)(ref val)).MoveNext())
{
UpgradeInstance upgrade = ((EquippedUpgradeEnumerator)(ref val)).GetUpgrade(ref x, ref y, ref rotation);
Entries.Add(new Entry
{
Upgrade = upgrade,
X = x,
Y = y,
Rotation = rotation
});
}
justTaken = true;
}
internal static void HealAfterPickup(GearDetailsWindow window, ModuleEquipSlots slots)
{
if (!justTaken)
{
return;
}
justTaken = false;
if (held == null || target != window.UpgradablePrefab)
{
return;
}
IUpgradable val = target;
int num = CountCasualties(val);
if (num == 0)
{
return;
}
for (int i = 0; i < 8; i++)
{
slots.Setup(val, false, (IUpgradeWindow)(object)window);
int num2 = CountCasualties(val);
if (num2 == num)
{
break;
}
num = num2;
}
}
private static int CountCasualties(IUpgradable gear)
{
int num = 0;
foreach (Entry entry in Entries)
{
if (entry.Upgrade != held && !entry.Upgrade.IsEquipped(gear))
{
num++;
}
}
return num;
}
internal static void Resolve(GearDetailsWindow window, ModuleEquipSlots slots)
{
if (held == null)
{
return;
}
IUpgradable val = target;
UpgradeInstance val2 = held;
List<Entry> list = new List<Entry>(Entries);
Clear();
if (val != window.UpgradablePrefab)
{
return;
}
bool flag = false;
if (!val2.IsEquipped(val))
{
foreach (Entry item in list)
{
if (!item.Upgrade.IsEquipped(val))
{
item.Upgrade.Equip(val, item.X, item.Y, item.Rotation, false, false);
flag = true;
}
}
}
else
{
bool flag2 = true;
while (flag2)
{
flag2 = false;
foreach (Entry item2 in list)
{
if (item2.Upgrade != val2 && !item2.Upgrade.IsEquipped(val) && slots.EquipModule(val, item2.Upgrade, (int)item2.X, (int)item2.Y, item2.Rotation, true, false))
{
flag2 = true;
flag = true;
}
}
}
}
if (flag)
{
slots.Setup(val, false, (IUpgradeWindow)(object)window);
}
}
}
[HarmonyPatch(typeof(GearDetailsWindow), "SelectUpgrade", new Type[] { typeof(GearUpgradeUI) })]
internal static class SelectUpgradePatch
{
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.RestoreOnCancel.Value;
}
private static void Prefix(GearDetailsWindow __instance, GearUpgradeUI upgrade, bool ___inSkinMode, ModuleEquipSlots ___equipSlots)
{
if ((Object)(object)GearDetailsWindow.SelectedUpgrade == (Object)(object)upgrade || ((Object)(object)upgrade != (Object)null && (((HoverInfoUpgrade)upgrade).Upgrade == null || !((HoverInfoUpgrade)upgrade).Upgrade.IsUnlocked)))
{
return;
}
if (___inSkinMode)
{
BoardSnapshot.Clear();
return;
}
UpgradeInstance val = (((Object)(object)upgrade != (Object)null) ? ((HoverInfoUpgrade)upgrade).Upgrade : null);
BoardSnapshot.Resolve(__instance, ___equipSlots);
if (val != null && val.IsEquipped(__instance.UpgradablePrefab))
{
BoardSnapshot.Take(__instance.UpgradablePrefab, val);
}
}
private static void Postfix(GearDetailsWindow __instance, ModuleEquipSlots ___equipSlots)
{
BoardSnapshot.HealAfterPickup(__instance, ___equipSlots);
}
}
[HarmonyPatch(typeof(GearDetailsWindow), "AddUpgradeToTempStorage")]
internal static class TempStoragePatch
{
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.RestoreOnCancel.Value;
}
private static void Postfix(UpgradeInstance upgrade, bool __result)
{
if (__result)
{
BoardSnapshot.ForgetIfHeld(upgrade);
}
}
}
internal static class StackingState
{
internal static bool InManualEquip;
}
[HarmonyPatch(typeof(ModuleEquipSlots), "EquipModule")]
internal static class EquipModuleScopePatch
{
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.KeepPlacedOnConflict.Value;
}
private static void Prefix(bool equippedManually, out bool __state)
{
__state = StackingState.InManualEquip;
StackingState.InManualEquip = equippedManually;
}
private static void Finalizer(bool __state)
{
StackingState.InManualEquip = __state;
}
}
[HarmonyPatch(typeof(ModuleEquipSlots), "Unequip", new Type[]
{
typeof(IUpgradable),
typeof(UpgradeInstance)
})]
internal static class StackingUnequipPatch
{
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.KeepPlacedOnConflict.Value;
}
private static bool Prefix(ref bool __result)
{
if (!StackingState.InManualEquip)
{
return true;
}
__result = false;
return false;
}
}
internal static class TooltipPin
{
private static readonly FieldInfo PatternField = AccessTools.Field(typeof(HoverInfoDisplay), "patternDisplay");
private static readonly FieldInfo HangField = AccessTools.Field(typeof(HoverInfoDisplay), "offset");
private static readonly FieldInfo UpgradeListField = AccessTools.Field(typeof(GearDetailsWindow), "upgradeList");
private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4];
private static bool errorLogged;
private const float AttachClampMargin = 20f;
internal static bool TryGetTarget(HoverInfoDisplay display, out Vector2 pos)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
pos = default(Vector2);
if (!Plugin.Enabled.Value)
{
return false;
}
RectTransform val = (RectTransform)((Component)display).transform;
Transform parent = ((Transform)val).parent;
RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
if ((Object)(object)val2 == (Object)null || (Object)(object)Menu.Instance == (Object)null || (Object)(object)val2 != (Object)(object)((Component)Menu.Instance).transform)
{
return false;
}
if (!IsTargetUpgrade(display))
{
return false;
}
Rect rect = val2.rect;
Vector2 size = ((Rect)(ref rect)).size;
Vector2 sizeDelta = val.sizeDelta;
float num = sizeDelta.y * 0.5f + PatternExtra(display);
float num2 = sizeDelta.y * 0.5f + Hang(display);
float x;
float y;
if (Plugin.AnchorMode.Value == AnchorModeType.Attach && TryGetWindowTopLeft(val2, out var topLeft))
{
x = topLeft.x + sizeDelta.x * 0.5f + Plugin.AttachOffsetX.Value;
y = topLeft.y + Plugin.AttachOffsetY.Value + num2;
ClampToScreen(ref x, ref y, size, sizeDelta, num, num2, 20f);
}
else
{
x = size.x * 0.5f - Plugin.ManualMarginX.Value - sizeDelta.x * 0.5f;
y = size.y * 0.5f - Plugin.ManualMarginY.Value - num;
ClampToScreen(ref x, ref y, size, sizeDelta, num, num2, 0f);
}
pos = new Vector2(x, y);
return true;
}
private static void ClampToScreen(ref float x, ref float y, Vector2 bounds, Vector2 size, float top, float bottom, float margin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
float num = (0f - bounds.x) * 0.5f + margin + size.x * 0.5f;
float num2 = bounds.x * 0.5f - margin - size.x * 0.5f;
float num3 = (0f - bounds.y) * 0.5f + margin + bottom;
float num4 = bounds.y * 0.5f - margin - top;
x = Mathf.Min(Mathf.Max(x, num), num2);
y = Mathf.Min(Mathf.Max(y, num3), num4);
}
internal static bool? WantsLeftPopup(Vector2 tooltipPos)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
return Plugin.PopupSide.Value switch
{
PopupSideType.Left => true,
PopupSideType.Right => false,
_ => tooltipPos.x > 0f,
};
}
private static bool IsTargetUpgrade(HoverInfoDisplay display)
{
try
{
HoverInfo selectedInfo = display.SelectedInfo;
if ((Object)(object)selectedInfo == (Object)null)
{
return false;
}
if (Plugin.OnlyListItems.Value && !(selectedInfo is GearUpgradeUI))
{
return false;
}
Upgrade val = default(Upgrade);
int num = default(int);
UpgradeInstance val2 = default(UpgradeInstance);
bool flag = default(bool);
selectedInfo.GetUpgrade(ref val, ref num, ref val2, ref flag);
if ((Object)(object)val == (Object)null)
{
return false;
}
return val.IsSkin() ? Plugin.PinSkinUpgrades.Value : Plugin.PinStatUpgrades.Value;
}
catch (Exception ex)
{
if (!errorLogged)
{
errorLogged = true;
Plugin.Log.LogError((object)ex);
}
return false;
}
}
private static bool TryGetWindowTopLeft(RectTransform parent, out Vector2 topLeft)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
topLeft = default(Vector2);
try
{
if ((Object)(object)Menu.Instance == (Object)null || UpgradeListField == null)
{
return false;
}
WindowSystem windowSystem = Menu.Instance.WindowSystem;
if ((Object)(object)windowSystem == (Object)null)
{
return false;
}
Window top = windowSystem.GetTop();
GearDetailsWindow val = (GearDetailsWindow)(object)((top is GearDetailsWindow) ? top : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
object? value = UpgradeListField.GetValue(val);
GameObject val2 = (GameObject)((value is GameObject) ? value : null);
if ((Object)(object)val2 == (Object)null || !val2.activeInHierarchy)
{
return false;
}
Transform transform = val2.transform;
RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
if ((Object)(object)val3 == (Object)null)
{
return false;
}
val3.GetWorldCorners(Corners);
Vector3 val4 = ((Transform)parent).InverseTransformPoint(Corners[1]);
Vector2 val5 = new Vector2(val4.x, val4.y);
Rect rect = parent.rect;
topLeft = val5 - ((Rect)(ref rect)).center;
return true;
}
catch (Exception ex)
{
if (!errorLogged)
{
errorLogged = true;
Plugin.Log.LogError((object)ex);
}
return false;
}
}
private static float PatternExtra(HoverInfoDisplay display)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (PatternField == null)
{
return 0f;
}
object? value = PatternField.GetValue(display);
Component val = (Component)((value is Component) ? value : null);
if ((Object)(object)val == (Object)null || !val.gameObject.activeSelf)
{
return 0f;
}
return ((RectTransform)val.transform).anchoredPosition.y + 31f;
}
private static float Hang(HoverInfoDisplay display)
{
if (HangField == null)
{
return 0f;
}
return (HangField.GetValue(display) is float num) ? num : 0f;
}
}
[HarmonyPatch(typeof(HoverInfoDisplay), "UpdatePosition")]
internal static class HoverInfoDisplay_UpdatePosition_Patch
{
private static void Postfix(HoverInfoDisplay __instance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (TooltipPin.TryGetTarget(__instance, out var pos))
{
((RectTransform)((Component)__instance).transform).anchoredPosition = pos;
}
}
}
[HarmonyPatch(typeof(PopupInfo), "Activate")]
internal static class PopupInfo_Activate_Patch
{
private static readonly HashSet<PopupInfo> LeftPopups = new HashSet<PopupInfo>();
private static void Prefix(PopupInfo __instance, object content, ref Vector2 pivot, ref Vector2 offset)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
HoverInfoDisplay val = (HoverInfoDisplay)((content is HoverInfoDisplay) ? content : null);
if (val != null)
{
if (TooltipPin.TryGetTarget(val, out var pos))
{
bool? flag2 = TooltipPin.WantsLeftPopup(pos);
if (flag2 == true)
{
pivot.x = 1f;
offset.x = 0f - Mathf.Abs(offset.x);
flag = true;
}
else if (flag2 == false)
{
pivot.x = 0f;
offset.x = Mathf.Abs(offset.x);
}
}
}
else
{
PopupInfo val2 = (PopupInfo)((content is PopupInfo) ? content : null);
if (val2 != null && LeftPopups.Contains(val2))
{
pivot.x = 1f;
offset.x = 0f - (val2.RectTransform.sizeDelta.x + 15f);
flag = true;
}
}
if (flag)
{
LeftPopups.Add(__instance);
}
else
{
LeftPopups.Remove(__instance);
}
}
}
[HarmonyPatch(typeof(ModuleEquipSlots), "Update")]
internal static class EquipOrderPatch
{
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.ShowEquipOrder.Value;
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
foreach (CodeInstruction code in instructions)
{
yield return code;
object operand = code.operand;
if (operand is MethodInfo m && m.Name == "IsPressed")
{
yield return new CodeInstruction(OpCodes.Ldc_I4_0, (object)null);
yield return new CodeInstruction(OpCodes.Ceq, (object)null);
}
}
}
}
[HarmonyPatch(typeof(HoverInfo), "ShowExtraInfo")]
internal static class ExtraInfoPatch
{
internal static int PatternDepth;
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.ShowDetailedStats.Value;
}
private static void Postfix(ref bool __result)
{
if (PatternDepth == 0)
{
__result = !__result;
}
}
}
[HarmonyPatch(typeof(UpgradeProperty_Pattern), "ModifyPattern")]
internal static class PatternPreviewPatch
{
[HarmonyPrepare]
private static bool Prepare()
{
return Plugin.ShowDetailedStats.Value;
}
private static void Prefix()
{
ExtraInfoPatch.PatternDepth++;
}
private static void Finalizer()
{
ExtraInfoPatch.PatternDepth--;
}
}
}