Decompiled source of MyChemicalJester v1.0.0

MyChemicalJester/MyChemicalJester.dll

Decompiled 2 years 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 MyChemicalJester.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("MyChemicalJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyChemicalJester")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("78ffbec7-4586-411c-a0a8-d7fa3df0a339")]
[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 MyChemicalJester
{
	[BepInPlugin("Kiwizkat.MyChemicalJester", "My Chemical Jester", "1.0.0.0")]
	public class MyChemicalJesterBase : BaseUnityPlugin
	{
		private const string modGUID = "Kiwizkat.MyChemicalJester";

		private const string modName = "My Chemical Jester";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Kiwizkat.MyChemicalJester");

		private static MyChemicalJesterBase Instane;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instane == (Object)null)
			{
				Instane = this;
			}
			mls = Logger.CreateLogSource("Kiwizkat.MyChemicalJester");
			mls.LogInfo((object)"Have you heard the news that you're dead?");
			harmony.PatchAll(typeof(MyChemicalJesterBase));
			harmony.PatchAll(typeof(JesterAIPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instane).Info.Location;
			location = location.TrimEnd("MyChemicalJester.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "jester");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace MyChemicalJester.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = MyChemicalJesterBase.SoundFX[0];
			__instance.popUpSFX = null;
			__instance.screamingSFX = MyChemicalJesterBase.SoundFX[1];
		}
	}
}