Decompiled source of Pop Goes the Freddy v1.0.0

PopGoesFreddy/FunnyJackNoise.dll

Decompiled 2 years 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 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("FunnyJackNoise")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FunnyJackNoise")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("354AD31D-DF26-4663-A7C8-F7DA80375B99")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FunnyJackNoise;

[BepInPlugin("com.porta137.funnyjacknoise", "FunnyJackNoise", "1.0.0")]
public class ModBase : BaseUnityPlugin
{
	private const string GUID = "com.porta137.funnyjacknoise";

	private const string NAME = "FunnyJackNoise";

	private const string VERSION = "1.0.0";

	private Harmony harmony = new Harmony("com.porta137.funnyjacknoise");

	private static ModBase Instance;

	internal ManualLogSource MLS;

	private string AssetBundlePath;

	public static AudioClip[] newSfx;

	private void Awake()
	{
		if (!Object.op_Implicit((Object)(object)Instance))
		{
			Instance = this;
		}
		MLS = Logger.CreateLogSource("com.porta137.funnyjacknoise");
		MLS.LogInfo((object)"Loading FunnyJackNoise");
		AssetBundlePath = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("FunnyJackNoise.dll".ToCharArray()) + "bundle";
		MLS.LogInfo((object)("Using AssetBundlePath: " + AssetBundlePath));
		AssetBundle val = AssetBundle.LoadFromFile(AssetBundlePath);
		if ((Object)(object)val == (Object)null)
		{
			MLS.LogError((object)"Failed to load AssetBundle, mod loading aborted.");
			return;
		}
		newSfx = val.LoadAssetWithSubAssets<AudioClip>("Assets/death.mp3");
		MLS.LogInfo((object)"Bundle loaded, patching...");
		harmony.PatchAll();
		MLS.LogInfo((object)"Mod loading Complete!");
	}
}
[HarmonyPatch(typeof(JesterAI))]
public class JesterPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPrefix]
	public static void Prefix(ref AudioClip ___popGoesTheWeaselTheme)
	{
		AudioClip[] newSfx = ModBase.newSfx;
		if (newSfx != null && newSfx.Length != 0)
		{
			AudioClip val = newSfx[0];
			___popGoesTheWeaselTheme = val;
		}
	}
}