Decompiled source of FastKillPlugin v2.1.0

FastKillPlugin.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FastKillPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FastKillPlugin")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("FastKillPlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.1.0.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.fastkill", "Fast Kill Plug-In", "2.1.0.0")]
public sealed class FastKillPlugin : BaseUnityPlugin
{
	public const string Name = "Fast Kill Plug-In";

	public const string Guid = "org.lordashes.plugins.fastkill";

	public const string Version = "2.1.0.0";

	private ConfigEntry<KeyboardShortcut> trigger;

	private void Awake()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("Fast Kill Plugin: " + ((object)this).GetType().AssemblyQualifiedName + " Active."));
		trigger = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Delete Asset", new KeyboardShortcut((KeyCode)127, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null);
	}

	private void Update()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		if (StrictKeyCheck(trigger.Value))
		{
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
			if ((Object)(object)val != (Object)null)
			{
				val.RequestDelete();
			}
		}
	}

	public bool StrictKeyCheck(KeyboardShortcut check)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		if (!((KeyboardShortcut)(ref check)).IsUp())
		{
			return false;
		}
		KeyCode[] array = new KeyCode[6];
		RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
		KeyCode[] array2 = (KeyCode[])(object)array;
		foreach (KeyCode val in array2)
		{
			if (Input.GetKey(val) != ((KeyboardShortcut)(ref check)).Modifiers.Contains(val))
			{
				return false;
			}
		}
		return true;
	}
}