Decompiled source of KillCommand v1.0.5

FirstMod.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using FirstMod.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FirstMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FirstMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9fc3bc7e-cad1-4f72-a9bb-5fee38e0b09a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FirstMod
{
	[BepInPlugin("Nono.FirstNonoMod", "First Mod", "1.0.0.1")]
	public class ClassTest : BaseUnityPlugin
	{
		private const string modGUID = "Nono.FirstNonoMod";

		private const string modName = "First Mod";

		private const string modVersion = "1.0.0.1";

		private readonly Harmony harmony = new Harmony("Nono.FirstNonoMod");

		private static ClassTest Instance;

		internal static ManualLogSource Logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Do not press = hehe ;)");
			harmony.PatchAll(typeof(ClassTest));
			harmony.PatchAll(typeof(LcInputStuff));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace FirstMod.Patches
{
	internal class LcInputStuff : LcInputActions
	{
		public static LcInputStuff Instance = new LcInputStuff();

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction DeathKey { get; set; }
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static LcInputStuff lcInputStuff = LcInputStuff.Instance;

		private static Random randomDeath = new Random();

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void killButton(PlayerControllerB __instance, bool ___isTypingChat, bool ___inTerminalMenu)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			int[] array = new int[3] { 0, 1, 2 };
			int num = randomDeath.Next(array.Length);
			if (___isTypingChat || ___inTerminalMenu)
			{
				lcInputStuff.DeathKey.Disable();
				return;
			}
			lcInputStuff.DeathKey.Enable();
			if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController && lcInputStuff.DeathKey.triggered)
			{
				__instance.KillPlayer(Vector3.zero, true, (CauseOfDeath)4, array[num], default(Vector3));
			}
		}
	}
}