Decompiled source of TestMod v1.0.3

TestMod.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TestMod.Patches;
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("TestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("55891cdd-9ad3-427b-83f9-768f47ca711e")]
[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 TestMod
{
	[BepInPlugin("TestiModi23457239845", "Test Mod", "1.0.0.0")]
	public class TestBase : BaseUnityPlugin
	{
		private const string modGUID = "TestiModi23457239845";

		private const string modName = "Test Mod";

		private const string modVersion = "1.0.0.0";

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

		public static TestBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("TestiModi23457239845");
			mls.LogInfo((object)"Test start");
			harmony.PatchAll(typeof(TestBase));
			harmony.PatchAll(typeof(HauntedMaskItemPatch));
		}
	}
}
namespace TestMod.Patches
{
	[HarmonyPatch(typeof(HauntedMaskItem))]
	internal class HauntedMaskItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static void PatchItemActivate(HauntedMaskItem __instance, bool used, ref bool buttonDown)
		{
			TestBase.Instance.mls.LogInfo((object)("used: " + used));
			TestBase.Instance.mls.LogInfo((object)("buttonDown: " + buttonDown));
			buttonDown = used;
		}

		[HarmonyPatch("BeginAttachment")]
		[HarmonyPrefix]
		private static bool PatchBeginAttachment()
		{
			TestBase.Instance.mls.LogInfo((object)"Attachment called, cancelling.");
			return false;
		}
	}
}