using System;
using System.Diagnostics;
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 Unity.Collections;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Sparroh")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmployeeInfuserFix")]
[assembly: AssemblyTitle("EmployeeInfuserFix")]
[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;
}
}
}
[HarmonyPatch(typeof(PatternInfuserWindow))]
internal static class PatternInfuserWindowPatch
{
private static readonly FieldRef<PatternInfuserWindow, UpgradeSelectButton> InfuseFromButton = AccessTools.FieldRefAccess<PatternInfuserWindow, UpgradeSelectButton>("infuseFromButton");
private static readonly FieldRef<PatternInfuserWindow, UpgradeSelectButton> InfuseIntoButton = AccessTools.FieldRefAccess<PatternInfuserWindow, UpgradeSelectButton>("infuseIntoButton");
private static readonly FieldRef<PatternInfuserWindow, HoverInfoHold> InfuseButton = AccessTools.FieldRefAccess<PatternInfuserWindow, HoverInfoHold>("infuseButton");
private static readonly FieldRef<PatternInfuserWindow, Action<UpgradeInstance>> OnFromSelected = AccessTools.FieldRefAccess<PatternInfuserWindow, Action<UpgradeInstance>>("onFromSelected");
private static readonly FieldRef<PatternInfuserWindow, Action<UpgradeInstance>> OnToSelected = AccessTools.FieldRefAccess<PatternInfuserWindow, Action<UpgradeInstance>>("onToSelected");
private static readonly MethodInfo ClearInfuseLinesMethod = AccessTools.Method(typeof(PatternInfuserWindow), "ClearInfuseLines", (Type[])null, (Type[])null);
private static readonly MethodInfo SetupInfuseButtonMethod = AccessTools.Method(typeof(PatternInfuserWindow), "SetupInfuseButton", (Type[])null, (Type[])null);
[HarmonyPrefix]
[HarmonyPatch("OnUpgradeButtonPressed")]
private static bool OnUpgradeButtonPressedPrefix(PatternInfuserWindow __instance, UpgradeSelectButton button)
{
//IL_001c: 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_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
UpgradeSelectButton val = InfuseFromButton.Invoke(__instance);
UpgradeSelectButton val2 = InfuseIntoButton.Invoke(__instance);
Filter val3 = new Filter
{
rarities = (RarityFlags)223
};
if ((Object)(object)button == (Object)(object)val)
{
UpgradeInstance upgrade = val2.Upgrade;
if (upgrade != null)
{
val3.rarities = (RarityFlags)(byte)(1 << (int)upgrade.Upgrade.Rarity);
val3.gear = BuildGearFilter(upgrade);
}
}
val3.ignoreUpgrade = (((Object)(object)button == (Object)(object)val) ? val2.Upgrade : val.Upgrade);
UpgradeSelectPopup.Show(((Object)(object)button == (Object)(object)val) ? OnFromSelected.Invoke(__instance) : OnToSelected.Invoke(__instance), ((Component)__instance).transform, val3, true, false);
return false;
}
[HarmonyPrefix]
[HarmonyPatch("OnToSelected")]
private static bool OnToSelectedPrefix(PatternInfuserWindow __instance, UpgradeInstance upgrade)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
UpgradeSelectButton val = InfuseFromButton.Invoke(__instance);
UpgradeSelectButton obj = InfuseIntoButton.Invoke(__instance);
HoverInfoHold val2 = InfuseButton.Invoke(__instance);
obj.SetUpgrade(upgrade);
val.AllowInteraction(true);
UpgradeInstance upgrade2 = val.Upgrade;
if (upgrade2 != null && upgrade != null && (upgrade2.Upgrade.Rarity != upgrade.Upgrade.Rarity || !AreCompatibleGears(upgrade2.Gear, upgrade.Gear)))
{
val.SetUpgrade((UpgradeInstance)null);
ClearInfuseLinesMethod.Invoke(__instance, null);
}
if (val.Upgrade == null)
{
NavigationManager.SelectIfInNavMode(((Component)val).GetComponent<INavSelectable>());
}
else if (upgrade != null)
{
NavigationManager.SelectIfInNavMode(((Component)val2).GetComponent<INavSelectable>());
}
SetupInfuseButtonMethod.Invoke(__instance, null);
return false;
}
private static NativeArray<int> BuildGearFilter(UpgradeInstance into)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if (into.Gear is Character)
{
Character[] characters = Global.Instance.Characters;
NativeArray<int> result = default(NativeArray<int>);
result..ctor(characters.Length, (Allocator)2, (NativeArrayOptions)1);
for (int i = 0; i < characters.Length; i++)
{
result[i] = ((Dude)characters[i]).Info.ID;
}
return result;
}
NativeArray<int> result2 = default(NativeArray<int>);
result2..ctor(1, (Allocator)2, (NativeArrayOptions)1);
result2[0] = into.Gear.Info.ID;
return result2;
}
private static bool AreCompatibleGears(IUpgradable a, IUpgradable b)
{
if (a == b)
{
return true;
}
if (a is Character)
{
return b is Character;
}
return false;
}
}
[BepInPlugin("sparroh.employeeinfuserfix", "EmployeeInfuserFix", "1.0.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class EmployeeInfuserFixPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.employeeinfuserfix";
public const string PluginName = "EmployeeInfuserFix";
public const string PluginVersion = "1.0.0";
internal static ManualLogSource Log;
private Harmony _harmony;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
_harmony = new Harmony("sparroh.employeeinfuserfix");
try
{
_harmony.PatchAll(typeof(PatternInfuserWindowPatch));
Log.LogInfo((object)"EmployeeInfuserFix v1.0.0 loaded — cross-employee pattern infusion enabled.");
}
catch (Exception arg)
{
Log.LogError((object)$"Error applying patches: {arg}");
}
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
namespace EmployeeInfuserFix
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "EmployeeInfuserFix";
public const string PLUGIN_NAME = "EmployeeInfuserFix";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}