Decompiled source of LolikamiJester v1.0.3

Lethal_Jester_LolikamiRequiem.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LCSoundTool;
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("Lethal_Jester_LolikamiRequiem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal_Jester_LolikamiRequiem")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("75B86339-2183-46AE-9F9C-C0E30A451EB8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Lethal_Jester_LolikamiRequiem;

[BepInPlugin("K13A.LCLolikami", "Lolikami Requiem", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Lolikami : BaseUnityPlugin
{
	private const string modGUID = "K13A.LCLolikami";

	private const string modName = "Lolikami Requiem";

	private const string modVersion = "1.0.1";

	private readonly Harmony _harmony = new Harmony("K13A.LCLolikami");

	public static BaseUnityPlugin Instance;

	internal static ManualLogSource mls;

	public static AudioClip audio;

	public static EnemyType[] Enemies;

	public ConfigEntry<int> Volume { get; private set; }

	private void Awake()
	{
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Expected O, but got Unknown
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Expected O, but got Unknown
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		mls = Logger.CreateLogSource("K13A.LCLolikami");
		if (!Object.op_Implicit((Object)(object)Instance))
		{
			Instance = (BaseUnityPlugin)(object)this;
		}
		mls.LogInfo((object)"Initialized Lolikami Requiem plugin");
		mls.LogInfo((object)("Loading audio " + Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) + "/lolikami.wav"));
		if (!Object.op_Implicit((Object)(object)SoundTool.Instance))
		{
			SoundTool.Instance = new SoundTool();
		}
		audio = SoundTool.GetAudioClip(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lolikami.wav");
		mls.LogInfo((object)("Load Success " + ((Object)audio).name));
		Volume = ((BaseUnityPlugin)this).Config.Bind<int>("Sound", "IntroVolume", 100, new ConfigDescription("Sets the volume of the cranking intro (in %)", (AcceptableValueBase)new AcceptableValueRange<int>(0, 200), Array.Empty<object>()));
		_harmony.PatchAll(typeof(Lolikami));
		_harmony.PatchAll(typeof(JesterAIPatch));
	}
}
[HarmonyPatch(typeof(JesterAI))]
internal class JesterAIPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void Postfix(ref AudioClip ___popGoesTheWeaselTheme, ref AudioSource ___farAudio)
	{
		Lolikami.mls.LogInfo((object)(" Replace Audio " + ((Object)___popGoesTheWeaselTheme).name + " to " + ((Object)Lolikami.audio).name));
		___popGoesTheWeaselTheme = Lolikami.audio;
		___farAudio.volume = (float)((Lolikami)(object)Lolikami.Instance).Volume.Value / 100f;
	}
}