Decompiled source of VoidJumpKeybind v0.0.0

VoidJumpKeybind.dll

Decompiled a week 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 BepInEx.Configuration;
using BepInEx.Logging;
using CG.Client.Ship.Interactions;
using CG.Game;
using CG.Ship.Modules;
using CG.Space;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;

[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("VoidJumpKeybind")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VoidJumpKeybind")]
[assembly: AssemblyTitle("VoidJumpKeybind")]
[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 VoidJumpKeybind
{
	internal static class MyPluginInfo
	{
		internal const string PLUGIN_GUID = "id107.voidjumpkeybind";

		internal const string PLUGIN_NAME = "VoidJumpKeybind";

		internal const string PLUGIN_VERSION = "0.0.0";
	}
	[BepInPlugin("id107.voidjumpkeybind", "VoidJumpKeybind", "0.0.0")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "id107.voidjumpkeybind");
			Configs.Load(this);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin id107.voidjumpkeybind is loaded!");
		}
	}
	internal class Configs
	{
		internal const KeyCode LeverPullDefaultKey = 121;

		internal static ConfigEntry<KeyCode> LeverPullConfig;

		internal static void Load(BepinPlugin plugin)
		{
			LeverPullConfig = ((BaseUnityPlugin)plugin).Config.Bind<KeyCode>("VoidJumpKeybind", "PullLever", (KeyCode)121, "");
		}
	}
	internal class GUI : ModSettingsMenu
	{
		public override string Name()
		{
			return "Void Jump Keybind";
		}

		public override void Draw()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			KeyCode value = Configs.LeverPullConfig.Value;
			if (GUITools.DrawChangeKeybindButton("Change Void Jump Keybind", ref value))
			{
				Configs.LeverPullConfig.Value = value;
			}
		}
	}
	[HarmonyPatch(typeof(VoidDriveModule))]
	internal class VoidDriveModulePatch
	{
		private static bool isKeyPressed;

		[HarmonyPostfix]
		[HarmonyPatch("FixedUpdate")]
		private static void FixedUpdate(VoidDriveModule __instance)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			AbstractPlayerControlledShip playerShip = ClientGame.Current.PlayerShip;
			object obj;
			if (playerShip == null)
			{
				obj = null;
			}
			else
			{
				Helm module = playerShip.GetModule<Helm>();
				obj = ((module != null) ? module.Chair : null);
			}
			TakeoverChair val = (TakeoverChair)((obj is TakeoverChair) ? obj : null);
			if ((Object)(object)val == (Object)null || val.IsAvailable || PhotonNetwork.LocalPlayer != ((MonoBehaviourPun)val).photonView.Owner)
			{
				if (isKeyPressed)
				{
					isKeyPressed = false;
					((ClickerInteractable)__instance.VoidJumpLever).EndClick();
				}
			}
			else if ((int)Configs.LeverPullConfig.Value != 0 && isKeyPressed != UnityInput.Current.GetKey(Configs.LeverPullConfig.Value))
			{
				isKeyPressed = !isKeyPressed;
				if (isKeyPressed)
				{
					((ClickerInteractable)__instance.VoidJumpLever).StartClick();
				}
				else
				{
					((ClickerInteractable)__instance.VoidJumpLever).EndClick();
				}
			}
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)3;

		public override string Author => "18107";

		public override string Description => "Adds a keybind for the pilot to activate the void jump lever";
	}
}