Decompiled source of BuddyHollyForCerbJumpscare v1.1.0

plugins/BuddyHollyP2/buddyholly.dll

Decompiled 9 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("buddyholly")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Replaces the deep droning in P-2 with Buddy Holly by weezer")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("buddyholly")]
[assembly: AssemblyTitle("buddyholly")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace BuddyHolly;

[BepInPlugin("ImNotSimon.BuddyHollyP-2", "Buddy Holly for P-2", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(StockMapInfo), "Awake")]
	internal class Patch01
	{
		private static void Postfix(StockMapInfo __instance)
		{
			AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>();
			foreach (AudioSource val in array)
			{
				if (Object.op_Implicit((Object)(object)val.clip) && val.clip.GetName() == "Deep Drone 5B")
				{
					Debug.Log((object)"Replacing cerb room music");
					val.clip = BuddyHollyAssetBundle.LoadAsset<AudioClip>("buddyholly.wav");
				}
			}
		}
	}

	private static Harmony harmony;

	internal static AssetBundle BuddyHollyAssetBundle;

	private void Awake()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		Debug.Log((object)"weezer room starting");
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		string path = "buddyholly";
		BuddyHollyAssetBundle = AssetBundle.LoadFromFile(Path.Combine(ModPath(), path));
		harmony = new Harmony("imnotsimon.BuddyHolly");
		harmony.PatchAll();
	}

	public static string ModPath()
	{
		return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar));
	}
}