Decompiled source of FastKnife v0.0.4

FastKnife.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 HarmonyLib;
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("MyFirstBeplnExMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyFirstBeplnExMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("82d6d362-58ff-4915-a1c0-b66612550264")]
[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 FastKnife
{
	[BepInPlugin("nexor.FastKnife", "FastKnife", "0.0.3")]
	public class FastKnife : BaseUnityPlugin
	{
		private const string modGUID = "nexor.FastKnife";

		private const string modName = "FastKnife";

		private const string modVersion = "0.0.3";

		private readonly Harmony harmony = new Harmony("nexor.FastKnife");

		private static FastKnife Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"FastKnife 0.0.3 loaded.");
		}
	}
}
namespace FastKnife.Patches.Items
{
	[HarmonyPatch(typeof(KnifeItem))]
	[HarmonyPatch("HitKnife")]
	internal class KnifeItem_HitKnife_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(KnifeItem __instance)
		{
			FieldInfo field = typeof(KnifeItem).GetField("timeAtLastDamageDealt", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				field.SetValue(__instance, -1f);
			}
			else
			{
				Debug.LogError((object)"Failed to access timeAtLastDamageDealt field in KnifeItem class!");
			}
		}
	}
}