Decompiled source of OSHA Certified Jetpacks v1.0.0

OSHA_Certified_Jetpacks.dll

Decompiled a year ago
using System;
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 System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("OSHA_Certified_Jetpacks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Non-exploding Jetpacks")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OSHA_Certified_Jetpacks")]
[assembly: AssemblyTitle("OSHA_Certified_Jetpacks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace OSHA_Certified_Jetpacks
{
	[BepInPlugin("LC.OSHAJetpacks", "OSHA Certified Jetpacks", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static readonly Harmony harmony = new Harmony("LC.OSHAJetpacks");

		private void Awake()
		{
			harmony.PatchAll(typeof(JetpackPatch));
			ModdedServer.SetServerModdedOnly();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"OSHA Certified Jetpacks has loaded");
		}
	}
	[HarmonyPatch]
	public class JetpackPatch
	{
		[HarmonyPatch(typeof(JetpackItem), "Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> JetpackOSHA(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			int num = -1;
			int num2 = -1;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (num >= 0 && list[i].opcode == OpCodes.Callvirt)
				{
					num2 = i;
					break;
				}
				if (list[i].opcode == OpCodes.Bge_Un || list[i].opcode == OpCodes.Bge_Un_S)
				{
					num = i + 1;
				}
			}
			if (num > -1 && num2 > -1)
			{
				list[num] = new CodeInstruction(OpCodes.Nop, (object)null);
				list.RemoveRange(num + 1, num2 - num);
			}
			return list.AsEnumerable();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "OSHA_Certified_Jetpacks";

		public const string PLUGIN_NAME = "OSHA_Certified_Jetpacks";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}