Decompiled source of AlwaysPickup v1.2.0

BepInEx/plugins/AlwaysPickup.dll

Decompiled a year ago
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 BepInEx;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AlwaysPickup")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AlwaysPickup")]
[assembly: AssemblyTitle("AlwaysPickup")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AlwaysPickup;

[BepInPlugin("NutNutty.AlwaysPickup", "Always Pickup", "1.0.0")]
public class AlwaysPickup : BaseUnityPlugin
{
	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("AlwaysPickup").PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Always Pickup plugin loaded!");
	}
}
[HarmonyPatch(typeof(GrabbableObject))]
public class GrabbableObjectPatch
{
	[HarmonyTranspiler]
	[HarmonyPatch("Start")]
	private static IEnumerable<CodeInstruction> TranspileGrabbableObject(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, Array.Empty<CodeMatch>()).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4]
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(GrabbableObject), "itemProperties")),
			new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(Item), "canBeGrabbedBeforeGameStart"))
		}).InstructionEnumeration();
	}
}