Decompiled source of FreeJester v1.0.3

FreeJester/FreeJester.dll

Decompiled a year 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 FreeJester.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("FreeJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FreeJester")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cb752f14-68ca-44e9-836b-f8a323fbbf36")]
[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 FreeJester
{
	[BepInPlugin("atg.FreeJester", "Free Jester", "1.0.3")]
	public class FreeJesterBase : BaseUnityPlugin
	{
		private const string modGUID = "atg.FreeJester";

		private const string modName = "Free Jester";

		private const string modVersion = "1.0.3";

		private Harmony harmony = new Harmony("atg.FreeJester");

		private static FreeJesterBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newSFX;

		private void Awake()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("atg.FreeJester");
			mls.LogInfo((object)"Starting Free Jester :D");
			mls.LogInfo((object)(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("FreeJester.dll".ToCharArray()) + "freebird"));
			AssetBundle val = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("FreeJester.dll".ToCharArray()) + "freebird");
			if ((Object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/freebird.mp3");
			harmony.PatchAll(typeof(JesterAIPatch));
			mls.LogInfo((object)"Free Jester is loaded");
			harmony.PatchAll(typeof(FreeJesterBase));
		}
	}
}
namespace FreeJester.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void FreeJesterPatch(ref AudioClip ___popGoesTheWeaselTheme)
		{
			AudioClip[] newSFX = FreeJesterBase.newSFX;
			if (newSFX != null && newSFX.Length != 0)
			{
				AudioClip val = newSFX[0];
				___popGoesTheWeaselTheme = val;
			}
		}
	}
}