Decompiled source of VikingLoudHornSFX v1.0.0

VikingLoudHorn.dll

Decompiled 10 months 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;
using VikingLoudHorn.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("VikingLoudHorn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VikingLoudHorn")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c475d116-40dd-401b-ba42-3ec5a0ded1f5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VikingLoudHorn
{
	[BepInPlugin("Ex.VikingLoudHornMod", "Ex Viking Loud Horn SFX Mod", "1.0.0")]
	public class LoudHornBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.VikingLoudHornMod";

		private const string modName = "Ex Viking Loud Horn SFX Mod";

		private const string modVersion = "1.0.0";

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

		private static LoudHornBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newLoudHornSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.VikingLoudHornMod");
			mls.LogInfo((object)"Viking Loud Horn SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "VikingLoudHorn.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "VikingHorn";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newLoudHornSFX = val.LoadAsset<AudioClip>("Assets/Viking.mp3");
			harmony.PatchAll(typeof(LoudHornBase));
			harmony.PatchAll(typeof(LoudHornPatch));
			mls.LogInfo((object)"The Vikings Are Coming!");
		}
	}
}
namespace VikingLoudHorn.Patches
{
	[HarmonyPatch(typeof(ShipAlarmCord))]
	internal class LoudHornPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void JawsSFXPatch(ref AudioClip ___cordPullSFX)
		{
			___cordPullSFX = LoudHornBase.newLoudHornSFX;
		}
	}
}