using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using UpgradeSolver.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("UpgradeSolver")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2+dd2b7e9b0503cb25c189600ad7bf3722a88aef34")]
[assembly: AssemblyProduct("UpgradeSolver")]
[assembly: AssemblyTitle("UpgradeSolver")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 UpgradeSolver
{
[MycoMod(/*Could not decode attribute arguments.*/)]
[BepInPlugin("UpgradeSolver", "UpgradeSolver", "0.1.2")]
public class Plugin : BaseUnityPlugin
{
public Coroutine? SolverCoroutine;
internal static Plugin Instance;
internal static ManualLogSource Logger;
private static Harmony _harmony;
internal SolverUI SolverUI = new SolverUI(null);
private void Awake()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
_harmony = new Harmony("UpgradeSolverPatches");
_harmony.PatchAll(typeof(GearDetailsWindowPatch));
Logger.LogInfo((object)"Plugin UpgradeSolver is loaded!");
}
private void OnDestroy()
{
_harmony.UnpatchSelf();
}
internal void OnGearDetailsWindowOpen(GearDetailsWindow window)
{
SolverUI.GearDetailsWindow = window;
SolverUI.PatchUpgradeClick();
SolverUI.AddSolveButton();
}
internal void OnGearDetailsWindowClosed()
{
SolverUI.Close();
}
}
public class Offset
{
public readonly int OffsetX;
public readonly int OffsetY;
public Offset(int offsetX, int offsetY)
{
OffsetX = offsetX;
OffsetY = offsetY;
base..ctor();
}
}
public class Solver
{
[CompilerGenerated]
private sealed class <SolveAndNotify>d__11 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Solver <>4__this;
public Action<bool> onComplete;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SolveAndNotify>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
Solver solver = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = solver.SolveDfs(0);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
onComplete(solver._foundSolution);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SolveDfs>d__10 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public int index;
public Solver <>4__this;
private UpgradeInstance <upgrade>5__2;
private int <y>5__3;
private int <x>5__4;
private int <rotation>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SolveDfs>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<upgrade>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
Solver solver = <>4__this;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
if (solver._foundSolution)
{
return false;
}
solver.<gearDetailsWindow>P.equipSlots.Unequip(solver._gear, <upgrade>5__2);
goto IL_013e;
}
<>1__state = -1;
if (index >= solver.<upgrades>P.Count)
{
solver._foundSolution = true;
return false;
}
<upgrade>5__2 = solver.<upgrades>P[index];
<y>5__3 = 0;
goto IL_019b;
IL_0150:
if (<rotation>5__5 < solver._maxRotations)
{
UpgradeEquipCell cell = solver.<gearDetailsWindow>P.equipSlots.GetCell(<x>5__4, <y>5__3);
if (cell != null && ((HoverInfoUpgrade)cell).Upgrade == null)
{
Offset offsetsCached = solver.GetOffsetsCached(<upgrade>5__2, <rotation>5__5, cell);
int offsetX = offsetsCached.OffsetX;
int offsetY = offsetsCached.OffsetY;
int num2 = offsetX;
if (solver.<gearDetailsWindow>P.equipSlots.EquipModule(solver._gear, <upgrade>5__2, num2, offsetY, (byte)<rotation>5__5))
{
<>2__current = solver.SolveDfs(index + 1);
<>1__state = 1;
return true;
}
}
goto IL_013e;
}
<x>5__4++;
goto IL_0173;
IL_013e:
<rotation>5__5++;
goto IL_0150;
IL_0173:
if (<x>5__4 < solver._hexMap.Width)
{
<rotation>5__5 = 0;
goto IL_0150;
}
<y>5__3++;
goto IL_019b;
IL_019b:
if (<y>5__3 < solver._hexMap.Height)
{
<x>5__4 = 0;
goto IL_0173;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private GearDetailsWindow <gearDetailsWindow>P;
[CompilerGenerated]
private List<UpgradeInstance> <upgrades>P;
private readonly IUpgradable _gear;
private readonly HexMap _hexMap;
private readonly int _maxRotations;
private readonly Dictionary<Tuple<UpgradeInstance, int>, Offset> _offsetCache;
private bool _foundSolution;
public Solver(GearDetailsWindow gearDetailsWindow, List<UpgradeInstance> upgrades)
{
<gearDetailsWindow>P = gearDetailsWindow;
<upgrades>P = upgrades;
_gear = <gearDetailsWindow>P.UpgradablePrefab;
_hexMap = <gearDetailsWindow>P.equipSlots.HexMap;
_maxRotations = ((PlayerData.GetPlayerLevel() < 30) ? 1 : 6);
_offsetCache = new Dictionary<Tuple<UpgradeInstance, int>, Offset>();
base..ctor();
}
private Offset GetOffsetsCached(UpgradeInstance upgrade, int rotation, UpgradeEquipCell cell)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
Tuple<UpgradeInstance, int> key = new Tuple<UpgradeInstance, int>(upgrade, rotation);
if (_offsetCache.TryGetValue(key, out Offset value))
{
return new Offset(cell.X + value.OffsetX, cell.Y + value.OffsetY);
}
HexMap modifiedMap = upgrade.Pattern.GetModifiedMap(rotation, (HexMap)null);
int num = modifiedMap.width / 2;
int num2 = 0;
int num3 = 0;
for (int i = 0; i < modifiedMap.height; i++)
{
if (modifiedMap[num, i].enabled)
{
num2 += i;
num3++;
}
}
int num4 = -((num3 > 0) ? (num2 / num3) : 0);
if (num % 2 == 1)
{
num4--;
}
value = new Offset(-num, num4);
_offsetCache[key] = value;
return new Offset(cell.X + value.OffsetX, cell.Y + value.OffsetY);
}
private void ClearSlots()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Invalid comparison between Unknown and I4
IUpgradable upgradablePrefab = <gearDetailsWindow>P.UpgradablePrefab;
List<UpgradeInfo> allUpgrades = PlayerData.GetAllUpgrades(upgradablePrefab);
List<UpgradeInfo> second = new List<UpgradeInfo>();
if ((int)upgradablePrefab.GearType == 5)
{
second = PlayerData.GetAllUpgrades((IUpgradable)(object)Global.Instance);
}
foreach (UpgradeInfo item in from u in allUpgrades.Concat(second)
where u != null
select u)
{
if (item.Instances == null)
{
continue;
}
foreach (UpgradeInstance item2 in item.Instances.OfType<UpgradeInstance>())
{
<gearDetailsWindow>P.equipSlots.Unequip(upgradablePrefab, item2);
}
}
}
[IteratorStateMachine(typeof(<SolveDfs>d__10))]
private IEnumerator SolveDfs(int index)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SolveDfs>d__10(0)
{
<>4__this = this,
index = index
};
}
[IteratorStateMachine(typeof(<SolveAndNotify>d__11))]
private IEnumerator SolveAndNotify(Action<bool> onComplete)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SolveAndNotify>d__11(0)
{
<>4__this = this,
onComplete = onComplete
};
}
public void TrySolve(Action<bool> onComplete)
{
_foundSolution = false;
ClearSlots();
if (!CanFitAll())
{
onComplete(obj: false);
}
else
{
Plugin.Instance.SolverCoroutine = ((MonoBehaviour)Plugin.Instance).StartCoroutine(SolveAndNotify(onComplete));
}
}
public bool CanFitAll()
{
int num = _hexMap.Height * _hexMap.Width;
return <upgrades>P.Select((UpgradeInstance u) => u.Pattern.GetCellCount()).Sum() <= num;
}
}
public class SolverUI
{
private readonly Color _defaultSecondaryColor = new Color(0.9434f, 0.9434f, 0.9434f, 1f);
private readonly Color _grayedOutColor = new Color(0.9434f, 0.9434f, 0.9434f, 0.1484f);
internal GearDetailsWindow? GearDetailsWindow;
private readonly Dictionary<int, UnityEvent> _originalOnHoverEnters = new Dictionary<int, UnityEvent>();
private Dictionary<int, GearUpgradeUI> _selectedUpgrades = new Dictionary<int, GearUpgradeUI>();
private GearUpgradeUI? _hoveredUpgrade;
private DefaultButton? _solveButton;
private readonly InputActionMap _solverControls;
private readonly InputAction _addForSolve;
public SolverUI(GearDetailsWindow? gearDetailsWindow)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
GearDetailsWindow = gearDetailsWindow;
_solverControls = new InputActionMap("SolverControls");
_addForSolve = InputActionSetupExtensions.AddAction(_solverControls, "AddForSolve", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
InputActionSetupExtensions.AddBinding(_addForSolve, "<Keyboard>/n", (string)null, (string)null, (string)null);
_addForSolve.performed += delegate
{
SelectUpgrade();
};
}
private void SelectUpgrade()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Invalid comparison between Unknown and I4
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_hoveredUpgrade == (Object)null || !((HoverInfoUpgrade)_hoveredUpgrade).Upgrade.IsUnlocked)
{
return;
}
UpgradeInstance upgrade = ((HoverInfoUpgrade)_hoveredUpgrade).Upgrade;
RarityData val = Global.Instance.Rarities[upgrade.Upgrade.Rarity];
if (_selectedUpgrades.TryGetValue(upgrade.InstanceID, out GearUpgradeUI value))
{
Plugin.Logger.LogInfo((object)("Deselecting " + upgrade.Upgrade.Name));
value.button.SetDefaultColor(val.backgroundColor);
_selectedUpgrades.Remove(upgrade.InstanceID);
SetSolveButtonInteractable(_selectedUpgrades.Count > 0);
return;
}
if (!upgrade.Upgrade.CanStack || (int)upgrade.Upgrade.UpgradeType == 1)
{
GearUpgradeUI val2 = ((IEnumerable<GearUpgradeUI>)_selectedUpgrades.Values).FirstOrDefault((Func<GearUpgradeUI, bool>)((GearUpgradeUI u) => (!upgrade.Upgrade.CanStack && ((HoverInfoUpgrade)u).Upgrade.upgradeID == upgrade.upgradeID) || ((int)upgrade.Upgrade.UpgradeType == 1 && (int)((HoverInfoUpgrade)u).Upgrade.Upgrade.UpgradeType == 1)));
if ((Object)(object)val2 != (Object)null)
{
Plugin.Logger.LogInfo((object)("Replacing " + ((HoverInfoUpgrade)val2).Upgrade.Upgrade.Name + " with " + upgrade.Upgrade.Name));
Color backgroundColor = Global.Instance.Rarities[((HoverInfoUpgrade)val2).Upgrade.Upgrade.Rarity].backgroundColor;
val2.button.SetDefaultColor(backgroundColor);
_selectedUpgrades.Remove(((HoverInfoUpgrade)val2).Upgrade.InstanceID);
}
}
Plugin.Logger.LogInfo((object)("Selecting " + upgrade.Upgrade.Name));
_hoveredUpgrade.button.SetDefaultColor(_hoveredUpgrade.button.hoverColor);
_selectedUpgrades[upgrade.InstanceID] = _hoveredUpgrade;
SetSolveButtonInteractable(interactable: true);
}
internal void RebuildSelectedUpgrades()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
Plugin.Logger.LogInfo((object)"Rebuilding _selectedUpgrades");
_selectedUpgrades = GearDetailsWindow.upgradeUIs.Where((GearUpgradeUI ui) => _selectedUpgrades.ContainsKey(((HoverInfoUpgrade)ui).Upgrade.InstanceID)).ToDictionary((GearUpgradeUI ui) => ((HoverInfoUpgrade)ui).Upgrade.InstanceID);
foreach (KeyValuePair<int, GearUpgradeUI> selectedUpgrade in _selectedUpgrades)
{
selectedUpgrade.Value.button.SetDefaultColor(selectedUpgrade.Value.button.hoverColor);
}
SetSolveButtonInteractable(_selectedUpgrades.Count > 0);
}
internal void Close()
{
_solverControls.Disable();
_originalOnHoverEnters.Clear();
_selectedUpgrades.Clear();
Coroutine solverCoroutine = Plugin.Instance.SolverCoroutine;
if (solverCoroutine != null)
{
((MonoBehaviour)Plugin.Instance).StopCoroutine(solverCoroutine);
}
}
private void SetSolveButtonInteractable(bool interactable)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
if (_solveButton != null)
{
Color val = (interactable ? _defaultSecondaryColor : _grayedOutColor);
((Button)_solveButton).IgnoreEvents = !interactable;
_solveButton.SetSecondaryColor(val);
((Graphic)((Component)_solveButton).gameObject.GetComponent<Rect>()).color = val;
}
}
internal void AddSolveButton()
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: 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_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Expected O, but got Unknown
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
if (GearDetailsWindow == null)
{
return;
}
if ((Object)(object)_solveButton != (Object)null)
{
SetSolveButtonInteractable(_selectedUpgrades.Count > 0);
return;
}
GameObject val = GameObject.Find("Gear Details/UpgradeList");
GameObject val2 = GameObject.Find("Gear Details/UpgradeList/OpenSort");
GameObject val3 = GameObject.Find("Gear Details/UpgradeList/Search");
GameObject val4 = GameObject.Find("Gear Details/UpgradeList/Count");
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null)
{
return;
}
RectTransform component = val2.GetComponent<RectTransform>();
RectTransform component2 = val3.GetComponent<RectTransform>();
RectTransform component3 = val4.GetComponent<RectTransform>();
GameObject obj = Object.Instantiate<GameObject>(val2, val.transform);
((Object)obj).name = "Solve";
RectTransform component4 = obj.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(0f, 1f);
component4.anchorMax = new Vector2(0f, 1f);
component4.pivot = new Vector2(0f, 0f);
component4.sizeDelta = new Vector2(125f, 42f);
component4.anchoredPosition = new Vector2(component.offsetMax.x + 10f, component.anchoredPosition.y);
component2.anchoredPosition = new Vector2(component4.offsetMax.x + 10f, component4.anchoredPosition.y);
component2.sizeDelta = new Vector2(400f, component2.sizeDelta.y);
component3.anchoredPosition = new Vector2(component2.offsetMax.x + 10f, component2.offsetMin.y);
Transform obj2 = obj.transform.Find("Text");
TextMeshProUGUI val5 = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshProUGUI>() : null);
if ((Object)(object)val5 != (Object)null)
{
((TMP_Text)val5).text = "Solve";
}
DefaultButton component5 = obj.GetComponent<DefaultButton>();
((Button)component5).OnClickDown = new UnityEvent();
((Button)component5).OnClickUp = new UnityEvent();
DefaultButton val6 = component5;
if (((Button)val6).OnClickUp == null)
{
((Button)val6).OnClickUp = new UnityEvent();
}
((Button)component5).OnClickUp.AddListener((UnityAction)delegate
{
Plugin.Logger.LogInfo((object)$"Selected upgrades ({_selectedUpgrades.Count}):");
foreach (GearUpgradeUI value in _selectedUpgrades.Values)
{
Plugin.Logger.LogInfo((object)("\t • " + FormatUpgrade(value)));
}
List<UpgradeInstance> upgrades = (from u in _selectedUpgrades
select ((HoverInfoUpgrade)u.Value).Upgrade into u
orderby u.Upgrade.Pattern.GetCellCount() descending
select u).ToList();
Solver solver = new Solver(GearDetailsWindow, upgrades);
Plugin.Logger.LogInfo((object)$"Can fit in theory?: {solver.CanFitAll()}");
solver.TrySolve(delegate(bool success)
{
Plugin.Logger.LogInfo((object)(success ? "Found a solution" : "No solution"));
});
});
_solveButton = component5;
SetSolveButtonInteractable(interactable: false);
}
private static string FormatUpgrade(GearUpgradeUI upgrade)
{
UpgradeInstance upgrade2 = ((HoverInfoUpgrade)upgrade).Upgrade;
return $"[{upgrade2.Upgrade.RarityName}] {upgrade2.Upgrade.Name} ({upgrade2.InstanceID})";
}
internal void PatchUpgradeClick()
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
_solverControls.Enable();
foreach (GearUpgradeUI upgradeUI in GearDetailsWindow.upgradeUIs)
{
int instanceID = ((HoverInfoUpgrade)upgradeUI).Upgrade.InstanceID;
if (!_originalOnHoverEnters.ContainsKey(instanceID))
{
UnityEvent onHoverEnter = ((Button)upgradeUI.button).OnHoverEnter;
_originalOnHoverEnters[instanceID] = onHoverEnter;
((Button)upgradeUI.button).OnHoverExit.AddListener((UnityAction)delegate
{
_hoveredUpgrade = null;
});
((Button)upgradeUI.button).OnHoverEnter.AddListener((UnityAction)delegate
{
_hoveredUpgrade = upgradeUI;
});
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "UpgradeSolver";
public const string PLUGIN_NAME = "UpgradeSolver";
public const string PLUGIN_VERSION = "0.1.2";
}
}
namespace UpgradeSolver.Patches
{
[HarmonyPatch(typeof(GearDetailsWindow))]
public class GearDetailsWindowPatch
{
[HarmonyPostfix]
[HarmonyPatch("OnOpen")]
private static void OnOpen(GearDetailsWindow __instance)
{
Plugin.Instance.OnGearDetailsWindowOpen(__instance);
}
[HarmonyPostfix]
[HarmonyPatch("OnCloseCallback")]
private static void OnCloseCallback(GearDetailsWindow __instance)
{
Plugin.Instance.OnGearDetailsWindowClosed();
}
[HarmonyPostfix]
[HarmonyPatch("SwitchUpgradeView")]
private static void SwitchUpgradeView(GearDetailsWindow __instance)
{
Plugin.Instance.SolverUI.RebuildSelectedUpgrades();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}