Decompiled source of MaskHaiyaaSFX v1.0.5

MaskHaiyaa.dll

Decompiled 7 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 MaskHaiyaa.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("MaskHaiyaa")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MaskHaiyaa")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("92b84f4e-9efe-4b0f-b5d5-259ff4a7ab7c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MaskHaiyaa
{
	[BepInPlugin("Ex.MaskHaiyaa", "Ex Mask Haiyaa SFX Mod", "1.0.0")]
	public class MaskHaiyaaBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.MaskHaiyaa";

		private const string modName = "Ex Mask Haiyaa SFX Mod";

		private const string modVersion = "1.0.0";

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

		private static MaskHaiyaaBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newHaiyaaSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.MaskHaiyaa");
			mls.LogInfo((object)"Mask Haiyaa SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "MaskHaiyaa.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "HaiyaaSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newHaiyaaSFX = val.LoadAsset<AudioClip>("Assets/Haiyaa.mp3");
			harmony.PatchAll(typeof(MaskHaiyaaBase));
			harmony.PatchAll(typeof(HaiyaaPatch));
			mls.LogInfo((object)"Uncle Roger would be proud.");
		}
	}
}
namespace MaskHaiyaa.Patches
{
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	internal class HaiyaaPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void HaiyaaSFXPatch(MaskedPlayerEnemy __instance)
		{
			((EnemyAI)__instance).creatureSFX.PlayOneShot(MaskHaiyaaBase.newHaiyaaSFX);
		}
	}
}