Decompiled source of ShowUserspaceSpawnButton v1.0.2

plugins/ShowUserspaceSpawnButton.dll

Decompiled 2 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using FrooxEngine;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("eia485")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+f70fc12908ac61462181362741fb632025add971")]
[assembly: AssemblyProduct("ShowUserspaceSpawnButton")]
[assembly: AssemblyTitle("ShowUserspaceSpawnButton")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/EIA485/NeosShowUserspaceSpawnButton")]
[assembly: AssemblyVersion("1.0.2.0")]
[module: RefSafetyRules(11)]
namespace ShowUserspaceSpawnButton;

[ResonitePlugin("net.eia485.ShowUserspaceSpawnButton", "ShowUserspaceSpawnButton", "1.0.2", "eia485", "https://github.com/EIA485/NeosShowUserspaceSpawnButton")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ShowUserspaceSpawnButton : BasePlugin
{
	[HarmonyPatch(typeof(InventoryBrowser), "OnItemSelected")]
	private class ShowUserspaceSpawnButtonPatch
	{
		private static global::System.Collections.Generic.IEnumerable<CodeInstruction> Transpiler(global::System.Collections.Generic.IEnumerable<CodeInstruction> instructions)
		{
			//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_002f: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006c: Expected O, but got Unknown
			List<CodeInstruction> val = Enumerable.ToList<CodeInstruction>(instructions);
			for (int i = 0; i < val.Count; i++)
			{
				if (val[i].opcode == OpCodes.Ldloc_1 && val[i + 1].opcode == OpCodes.Ldc_I4_5 && val[i + 5].opcode == OpCodes.Brfalse)
				{
					val[i] = new CodeInstruction(OpCodes.Ldloc_0, (object)null);
					val[i + 1] = val[i + 5];
					val.RemoveRange(i + 2, 4);
					break;
				}
			}
			return Enumerable.AsEnumerable<CodeInstruction>((global::System.Collections.Generic.IEnumerable<CodeInstruction>)val);
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnAttach")]
		private static void OnAttachPostFixSync(Sync<SpecialItemType> ____lastSpecialItemType)
		{
			((SyncField<SpecialItemType>)(object)____lastSpecialItemType).Value = (SpecialItemType)(-1);
		}
	}

	public override void Load()
	{
		((BasePlugin)this).HarmonyInstance.PatchAll();
	}
}
public static class PluginMetadata
{
	public const string GUID = "net.eia485.ShowUserspaceSpawnButton";

	public const string NAME = "ShowUserspaceSpawnButton";

	public const string VERSION = "1.0.2";

	public const string AUTHORS = "eia485";

	public const string REPOSITORY_URL = "https://github.com/EIA485/NeosShowUserspaceSpawnButton";
}