Decompiled source of RobinJester v1.0.3

RobinJester.dll

Decompiled 2 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 RobinJester.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("RobinJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RobinJester")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8117d053-8312-4427-8157-9415ef728a3f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RobinJester
{
	[BepInPlugin("ta-xao.robinjester", "Robin Jester", "1.0.3")]
	public class RobinJester : BaseUnityPlugin
	{
		private const string modGUID = "ta-xao.robinjester";

		private const string modName = "Robin Jester";

		private const string modVersion = "1.0.3";

		private readonly Harmony harmony = new Harmony("ta-xao.robinjester");

		private static RobinJester Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("ta-xao.robinjester");
			mls.LogInfo((object)"[Robin Jester] 1.0.3 is loaded!");
			harmony.PatchAll(typeof(JesterAIPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("RobinJester.dll".ToCharArray());
			mls.LogInfo((object)("[Robin Jester] Trying to load " + location + "robinjesterassetbundle."));
			Bundle = AssetBundle.LoadFromFile(location + "robinjesterassetbundle");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"[Robin Jester] Asset bundle loaded successfully.");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"[Robin Jester] Failed to load asset bundle.");
			}
		}
	}
}
namespace RobinJester.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void OverrideAudio(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = RobinJester.SoundFX[0];
			__instance.screamingSFX = RobinJester.SoundFX[1];
		}
	}
}