Decompiled source of CroissantMod v0.0.1

CroissantMod.dll

Decompiled 9 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 CroissantMod.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("CroissantMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CroissantMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("73f0565e-2270-4649-964a-2b446386a76a")]
[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 CroissantMod
{
	[BepInPlugin("DeadlyBusiness.CroissantMod", "Croissant Mod", "0.0.1.0")]
	public class CroissantModBase : BaseUnityPlugin
	{
		private const string modGUID = "DeadlyBusiness.CroissantMod";

		private const string modName = "Croissant Mod";

		private const string modVersion = "0.0.1.0";

		private readonly Harmony harmony = new Harmony("DeadlyBusiness.CroissantMod");

		private static CroissantModBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("DeadlyBusiness.CroissantMod");
			mls.LogInfo((object)"DeadlyBusiness.CroissantMod is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "CroissantMod.dll";
			location = location.TrimEnd(text.ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "croissant");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Croissants are locked and loaded");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load croissants");
			}
			harmony.PatchAll(typeof(HoarderBugPatch));
			mls.LogInfo((object)"DeadlyBusiness.CroissantMod is loaded.");
		}
	}
}
namespace CroissantMod.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX)
		{
			AudioClip[] array = CroissantModBase.SoundFX.ToArray();
			___chitterSFX = array;
		}
	}
}