Decompiled source of NowhereKingJester v0.2.2

BepInEx/plugins/Auron-NowhereKingJester/NowhereKingJester.dll

Decompiled a month 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 NowhereKingJester.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NowhereKingJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NowhereKingJester")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("859d8e13-2b83-4e1f-8614-36d60073491f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NowhereKingJester
{
	public enum Jest
	{
		WindUp,
		Pop,
		Chase
	}
	[BepInPlugin("Auron.NowhereKing", "Nowhere King - Jester", "1.0.0")]
	public class NowhereKingBase : BaseUnityPlugin
	{
		private const string modGUID = "Auron.NowhereKing";

		private const string modName = "Nowhere King - Jester";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Auron.NowhereKing");

		private static NowhereKingBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] NowhereKingFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Auron.NowhereKing");
			mls.LogInfo((object)"The Nowhere King has Awoken!");
			harmony.PatchAll(typeof(JesterAIPatch));
			Bundle = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("NowhereKingJester.dll".ToCharArray()) + "nowhereking");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully resurrected the Nowhere King!");
				NowhereKingFX = (AudioClip[])(object)new AudioClip[3];
				NowhereKingFX[0] = Bundle.LoadAsset<AudioClip>("Jester-NowhereKing");
				NowhereKingFX[1] = Bundle.LoadAsset<AudioClip>("Jester-Pop");
				NowhereKingFX[2] = Bundle.LoadAsset<AudioClip>("Jester-Chase");
			}
			else
			{
				mls.LogError((object)"Failed to bring the king!");
			}
		}
	}
}
namespace NowhereKingJester.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = NowhereKingBase.NowhereKingFX[0];
			__instance.popUpSFX = NowhereKingBase.NowhereKingFX[1];
			__instance.screamingSFX = NowhereKingBase.NowhereKingFX[2];
		}
	}
}