Decompiled source of Remote Operated Drones Can Interact v1.0.0

DronesCanPickup.dll

Decompiled 3 weeks ago
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 HG.Reflection;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RoR2;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DronesCanPickup")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DronesCanPickup")]
[assembly: AssemblyTitle("DronesCanPickup")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 DronesCanPickup
{
	[Serializable]
	[BepInPlugin("com.brynzananas.dronescanpickup", "Drones Can Pickup", "1.0.0")]
	public class DronesCanPickupPlugin : BaseUnityPlugin
	{
		public const string ModGuid = "com.brynzananas.dronescanpickup";

		public const string ModName = "Drones Can Pickup";

		public const string ModVer = "1.0.0";

		private bool _hooksSet;

		public void Awake()
		{
			SetHooks();
		}

		public void OnDestroy()
		{
			UnsetHooks();
		}

		public void SetHooks()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			if (!_hooksSet)
			{
				_hooksSet = true;
				CharacterBody.Start += new Manipulator(CharacterBody_Start);
			}
		}

		public void UnsetHooks()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (_hooksSet)
			{
				_hooksSet = false;
				CharacterBody.Start -= new Manipulator(CharacterBody_Start);
			}
		}

		private void CharacterBody_Start(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int locID = 1;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locID),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCall<CharacterBody>(x, "get_isRemoteOp"),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Interactor>(x, "isRemoteOp")
			}))
			{
				val.Emit(OpCodes.Ldloc, locID);
				val.Emit(OpCodes.Ldc_I4_0);
				val.Emit(OpCodes.Stfld, AccessTools.Field(typeof(Interactor), "isRemoteOp"));
			}
		}
	}
}