Decompiled source of Maneater HallOates v1.0.1

Maneater_HallOates.dll

Decompiled 3 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 HarmonyLib;
using Maneater_HallOates.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("Maneater_HallOates")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Maneater_HallOates")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2da40f77-2575-43de-b972-10318e11e526")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Maneater_HallOates
{
	[BepInPlugin("dukeofbiscuits.ManeaterHallOates", "Maneater Hall and Oates", "1.0.0")]
	public class ManeaterHallOatesBase : BaseUnityPlugin
	{
		private const string modGUID = "dukeofbiscuits.ManeaterHallOates";

		private const string modName = "Maneater Hall and Oates";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("dukeofbiscuits.ManeaterHallOates");

		private static ManeaterHallOatesBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> newCryingSound;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("dukeofbiscuits.ManeaterHallOates");
			mls.LogInfo((object)"Whoa. Here she comes. dukeofbiscuits.ManeaterHallOates is loaded.");
			mls.LogInfo((object)"Hall and Oates incoming");
			harmony.PatchAll(typeof(CaveDwellerAIPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			newCryingSound = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("Maneater_HallOates.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "cryingaudio");
			mls.LogInfo((object)("Folder: " + location));
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle");
				newCryingSound = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to Load asset");
			}
		}
	}
}
namespace Maneater_HallOates.Patches
{
	[HarmonyPatch(typeof(CaveDwellerAI))]
	internal class CaveDwellerAIPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void OverrideBabyCryingAudio(CaveDwellerAI __instance)
		{
			if (__instance.babyCrying && (Object)(object)__instance.babyCryingAudio.clip != (Object)(object)ManeaterHallOatesBase.newCryingSound[0])
			{
				Debug.Log((object)"Setting Baby Crying to the Dulcet tones of Hall and Oates");
				__instance.babyCryingAudio.Stop();
				__instance.babyCryingAudio.clip = ManeaterHallOatesBase.newCryingSound[0];
				__instance.babyCryingAudio.Play();
			}
			if (__instance.babyCrying && (Object)(object)__instance.babyCryingAudio.clip != (Object)(object)ManeaterHallOatesBase.newCryingSound[0])
			{
				Debug.Log((object)"Clip not set");
			}
			__instance.fakeCrySFX = ManeaterHallOatesBase.newCryingSound.ToArray();
		}
	}
}