Decompiled source of SandwormJawsSFX v1.0.0

SandwormJaws.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 HarmonyLib;
using SandwormJaws.Patches;
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("SandwormJaws")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SandwormJaws")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e4400d82-c5b7-4ecd-9366-6af6fa73b982")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SandwormJaws
{
	[BepInPlugin("Ex.SandwormJawsMod", "Ex Sandworm Jaws SFX Mod", "1.0.0")]
	public class SandwormJawsBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.SandwormJawsMod";

		private const string modName = "Ex Sandworm Jaws SFX Mod";

		private const string modVersion = "1.0.0";

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

		private static SandwormJawsBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newEmergeSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.SandwormJawsMod");
			mls.LogInfo((object)"Sandworm Jaws SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "SandwormJaws.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "JawsSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newEmergeSFX = val.LoadAsset<AudioClip>("Assets/Jaws.mp3");
			harmony.PatchAll(typeof(SandwormJawsBase));
			harmony.PatchAll(typeof(SandwormPatch));
			mls.LogInfo((object)"Sandworm Jaws is hunting.");
		}
	}
}
namespace SandwormJaws.Patches
{
	[HarmonyPatch(typeof(SandWormAI))]
	internal class SandwormPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void JawsSFXPatch(ref AudioClip ___emergeFromGroundSFX)
		{
			___emergeFromGroundSFX = SandwormJawsBase.newEmergeSFX;
		}
	}
}