Decompiled source of ExBoinkSFX v1.0.4

ExBoinkSFX.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 ExBoinkSFX.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("ExBoinkSFX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExBoinkSFX")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81daeabb-7ad5-4398-9696-28e5d93dddaf")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ExBoinkSFX
{
	[BepInPlugin("Ex.BoinkSFXMod", "Ex Boink SFX Mod", "0.1.1.0")]
	public class ExBoinkSFXBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.BoinkSFXMod";

		private const string modName = "Ex Boink SFX Mod";

		private const string modVersion = "0.1.1.0";

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

		private static ExBoinkSFXBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newHitSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.BoinkSFXMod");
			mls.LogInfo((object)"ExBoink has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "ExBoinkSFX.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "ExBoinkSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newHitSFX = val.LoadAssetWithSubAssets<AudioClip>("Assets/BoinkScout.mp3");
			harmony.PatchAll(typeof(ExBoinkSFXBase));
			harmony.PatchAll(typeof(hitSFXBPatch));
			mls.LogInfo((object)"BoinkSFX has loaded.");
		}
	}
}
namespace ExBoinkSFX.Patches
{
	[HarmonyPatch(typeof(Shovel))]
	internal class hitSFXBPatch
	{
		[HarmonyPatch("HitShovelClientRpc")]
		[HarmonyPatch("HitShovel")]
		[HarmonyPrefix]
		public static void hitSFXPatch(ref AudioClip[] ___hitSFX)
		{
			___hitSFX = ExBoinkSFXBase.newHitSFX;
		}
	}
}