Decompiled source of DATMJCoil v1.0.0

BepInEx/plugins/DAT/DATMJCoil/DATMJCoil.dll

Decompiled 7 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DATMJCoil.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("DATMJCoil")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DATMJCoil")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5c2084d7-19b6-44e8-b02d-d5de18876dc9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DATMJCoil
{
	[BepInPlugin("DAT.MJCoil", "DAT MJ Coil-Head", "1.0.0.0")]
	public class DATMJCoilModBase : BaseUnityPlugin
	{
		private const string modGUID = "DAT.MJCoil";

		private const string modName = "DAT MJ Coil-Head";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("DAT.MJCoil");

		private static DATMJCoilModBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll(typeof(DATMJCoilModBase));
			mls = Logger.CreateLogSource("DAT.MJCoil");
			harmony.PatchAll(typeof(SpringManAIPatch));
			SoundFX = new List<AudioClip>();
			string text = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("DATMJCoil.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(text + "datmjcoil");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Loaded MJ Coil assets succesfully");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle for DATMJCoil");
			}
		}
	}
}
namespace DATMJCoil.Patches
{
	[HarmonyPatch(typeof(SpringManAI))]
	internal class SpringManAIPatch
	{
		[HarmonyPatch("__initializeVariables")]
		[HarmonyPostfix]
		private static void OverrideAudio(SpringManAI __instance)
		{
			__instance.springNoises = DATMJCoilModBase.SoundFX.ToArray();
		}
	}
}