Decompiled source of GasGasGasJester v1.1.0

BepInEx/plugins/GasGasGasJester/GasGasGasJester.dll

Decompiled a year 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 GasGasGasJester.Patches;
using HarmonyLib;
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("GasGasGasJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GasGasGasJester")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d10fec6-ce15-4ba4-b909-4c1d78532496")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GasGasGasJester
{
	[BepInPlugin("BeepBoop.GasGasGasJester", "GasGasGasJester", "1.0.0")]
	public class GasGasGasModBase : BaseUnityPlugin
	{
		private const string modGUID = "BeepBoop.GasGasGasJester";

		private const string modName = "GasGasGasJester";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("BeepBoop.GasGasGasJester");

		private static GasGasGasModBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static List<AudioClip> SoundFX2;

		internal static AssetBundle Bundle;

		internal static AssetBundle Bundle2;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("BeepBoop.GasGasGasJester");
			mls.LogInfo((object)"GasGasGasJester has awaken");
			harmony.PatchAll(typeof(GasGasGasModBase));
			harmony.PatchAll(typeof(JesterPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			SoundFX2 = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("GasGasGasJester.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "start");
			Bundle2 = AssetBundle.LoadFromFile(location + "attack");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Sucessfully loaded asset bundle (start)");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle (start)");
			}
			if ((Object)(object)Bundle2 != (Object)null)
			{
				mls.LogInfo((object)"Sucessfully loaded asset bundle (attack)");
				SoundFX2 = Bundle2.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle (attack)");
			}
		}
	}
}
namespace GasGasGasJester.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudioJester(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = GasGasGasModBase.SoundFX[0];
			__instance.screamingSFX = GasGasGasModBase.SoundFX2[0];
		}
	}
}