Decompiled source of KillKey v1.1.0

KillKey.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
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("KillKey")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KillKey")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c8a55143-ff4c-4e51-966f-51ef5090c725")]
[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 KillKey
{
	[BepInPlugin("KillKey", "KillKey", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Base : BaseUnityPlugin
	{
		public const string modGUID = "KillKey";

		public const string modName = "KillKey";

		public const string modVersion = "1.1.0";

		private readonly Harmony harmony = new Harmony("KillKey");

		internal ManualLogSource mls;

		internal static InputBindings bindingInstance = new InputBindings();

		private static Base Instance;

		public static ConfigEntry<int> _config;

		private void Awake()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00a2: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("KillKey");
			mls.LogInfo((object)"KillKey successfully ran");
			ConfigEntry<int> obj = (_config = ((BaseUnityPlugin)this).Config.Bind<int>("Values", "HurtAmount", 10, "Amount of health that depletes from pressing the hurt key."));
			IntSliderOptions val = new IntSliderOptions
			{
				Name = "Hurt Amount",
				Description = "Amount of health that depletes from pressing the hurt key.",
				Section = "Values",
				RequiresRestart = false
			};
			((BaseRangeOptions<int>)val).Min = 1;
			((BaseRangeOptions<int>)val).Max = 100;
			IntSliderConfigItem val2 = new IntSliderConfigItem(obj, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.SetModDescription("A mod that adds hotkeys to hurt and kill yourself.Use it to prank friends.Jokes on you, you dont have friends.");
			harmony.PatchAll();
		}
	}
	public class InputBindings : LcInputActions
	{
		public static InputBindings Instance = new InputBindings();

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction Kill_Key { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction Hurt_Key { get; set; }
	}
}
namespace KillKey.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class MainPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void Awake(PlayerControllerB __instance)
		{
			InputBindings.Instance.Kill_Key.performed += delegate(CallbackContext context)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				if (((CallbackContext)(ref context)).performed)
				{
					__instance.KillPlayer(new Vector3(0f, 0f, 0f), true, (CauseOfDeath)0, 0);
				}
			};
			InputBindings.Instance.Hurt_Key.performed += delegate(CallbackContext context)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (((CallbackContext)(ref context)).performed)
				{
					__instance.DamagePlayer(Base._config.Value, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			};
		}
	}
}