Decompiled source of FreeBirdTotemRemixJester v1.0.1

FreeBirdTotemRemixJester/FreeBirdTotemRemixJester.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 FreeBirdTotemRemixJester.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("FreeBirdTotemRemixJester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FreeBirdTotemRemixJester")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c8e7b974-251d-4ed2-9692-91fd06040951")]
[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 FreeBirdTotemRemixJester
{
	[BepInPlugin("TopraksuK.FBTRJ", "Free Bird Totem Remix for Jester Mod", "1.0.1")]
	public class LethalBruhModBase : BaseUnityPlugin
	{
		private const string modGUID = "TopraksuK.FBTRJ";

		private const string modName = "Free Bird Totem Remix for Jester Mod";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("TopraksuK.FBTRJ");

		private static LethalBruhModBase Instance;

		internal ManualLogSource MLS;

		internal static AudioClip[] windingSFX;

		internal static AudioClip[] screamSFX;

		private void Awake()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			MLS = Logger.CreateLogSource("TopraksuK.FBTRJ");
			MLS.LogInfo((object)"Loading Free Bird TOTEM Remix for Jester.");
			AssetBundle val = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("FreeBirdTotemRemixJester.dll".ToCharArray()) + "jestersfx");
			if ((Object)val == (Object)null || (Object)val == (Object)null)
			{
				MLS.LogError((object)"Failed to load audio asset for Jester Free Bird TOTEM Remix Theme!");
				return;
			}
			windingSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/freebird1.mp3");
			screamSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/freebird2.mp3");
			harmony.PatchAll(typeof(JesterAIPatch));
			MLS.LogInfo((object)"Free Bird Totem Remix for Jester Mod. Press ESC if the game is frozen occasionally.");
			harmony.PatchAll(typeof(LethalBruhModBase));
		}
	}
}
namespace FreeBirdTotemRemixJester.Patches
{
	[HarmonyPatch(typeof(JesterAI))]
	internal class JesterAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void JesterAIPopUpSFXPatch(ref AudioClip ___popGoesTheWeaselTheme)
		{
			AudioClip[] windingSFX = LethalBruhModBase.windingSFX;
			if (windingSFX != null && windingSFX.Length != 0)
			{
				AudioClip val = windingSFX[0];
				___popGoesTheWeaselTheme = val;
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void JesterAIScreamSFXPatch(ref AudioClip ___screamingSFX)
		{
			AudioClip[] screamSFX = LethalBruhModBase.screamSFX;
			if (screamSFX != null && screamSFX.Length != 0)
			{
				AudioClip val = screamSFX[0];
				___screamingSFX = val;
			}
		}

		[HarmonyPatch("SetJesterInitialValues")]
		[HarmonyPostfix]
		public static void JestAIInitialPatch(ref float ___popUpTimer)
		{
			___popUpTimer = 35f;
		}
	}
}