Decompiled source of RemadeJesterMusic v1.0.2

RemadeJesterMusic.dll

Decompiled 4 months ago
using System.Collections.Generic;
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.Logging;
using HarmonyLib;
using RemadeJesterMusic.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("RemadeJesterMusic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RemadeJesterMusic")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("534a96a8-b6d7-4596-ae61-35995b38c7a1")]
[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 RemadeJesterMusic
{
	[BepInPlugin("DxL.RemadeJesterMusic", "Remade Jester Music (Music by Piano Vampire)", "1.0.2")]
	public class RemadeJesterMusicBase : BaseUnityPlugin
	{
		private const string ModGUID = "DxL.RemadeJesterMusic";

		private const string ModName = "Remade Jester Music (Music by Piano Vampire)";

		private const string ModVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("DxL.RemadeJesterMusic");

		private static RemadeJesterMusicBase Instance;

		internal ManualLogSource MLS;

		internal static List<AudioClip> JesterMusic;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			MLS = Logger.CreateLogSource("DxL.RemadeJesterMusic");
			MLS.LogInfo((object)"Remade Jester Music (Music by Piano Vampire) has awaken");
			MLS = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll(typeof(RemadeJesterMusicBase));
			harmony.PatchAll(typeof(JesterAIPatch));
			JesterMusic = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("RemadeJesterMusic.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "remadejestermusic");
			if ((Object)(object)Bundle != (Object)null)
			{
				MLS.LogInfo((object)"Loaded asset bundle");
				JesterMusic = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				MLS.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace RemadeJesterMusic.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideJesterMusic(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = RemadeJesterMusicBase.JesterMusic[0];
		}
	}
}