Decompiled source of BridgeFallSFX v1.0.0

BridgeFall.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 BridgeFall.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("BridgeFall")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BridgeFall")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("83cc99cc-5c97-46c5-a504-ae5ad547b133")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BridgeFall
{
	[BepInPlugin("Ex.BridgeFall", "Ex Bridge Fall SFX Mod", "1.0.0")]
	public class BridgeFallBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.BridgeFall";

		private const string modName = "Ex Bridge Fall SFX Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Ex.BridgeFall");

		private static BridgeFallBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newBridgeFallSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.BridgeFall");
			mls.LogInfo((object)"BridgeFall has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "BridgeFall.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "BridgeFallSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newBridgeFallSFX = val.LoadAsset<AudioClip>("Assets/EDamage.mp3");
			harmony.PatchAll(typeof(BridgeFallBase));
			harmony.PatchAll(typeof(BridgeFallPatch));
			mls.LogInfo((object)"The Bridge Is Collapsing.");
		}
	}
}
namespace BridgeFall.Patches
{
	[HarmonyPatch(typeof(BridgeTrigger))]
	internal class BridgeFallPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPatch("BridgeFallClientRpc")]
		[HarmonyPrefix]
		public static void BridgeFallSFXPatch(ref AudioClip ___bridgeFallSFX)
		{
			___bridgeFallSFX = BridgeFallBase.newBridgeFallSFX;
		}
	}
}