Decompiled source of HoarderJasper v1.1.1

HoarderJasper.dll

Decompiled 6 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 HoarderJasper.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("HoarderJasper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HoarderJasper")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c9c159bd-e372-4aad-9153-b332d6625ac3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HoarderJasper
{
	[BepInPlugin("Kotlin.HoarderJasper", "HoarderJasper", "1.1.0")]
	public class HoarderJasperBase : BaseUnityPlugin
	{
		private const string modGUID = "Kotlin.HoarderJasper";

		private const string modName = "HoarderJasper";

		private const string modVersion = "1.1.0";

		private readonly Harmony harmony = new Harmony("Kotlin.HoarderJasper");

		private static HoarderJasperBase Instance;

		internal static AudioClip[] newChitterSFX;

		internal static AudioClip newAngry;

		internal ManualLogSource mls;

		internal static AssetBundle Bundle;

		internal static AssetBundle Bundle2;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kotlin.HoarderJasper");
			mls.LogInfo((object)"HoarderJasper is loading...");
			harmony.PatchAll(typeof(HoarderBugAngryPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "HoarderJasper.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "newChitterSFX";
			string text4 = text2 + "jasperSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			AssetBundle val2 = AssetBundle.LoadFromFile(text4);
			if ((Object)(object)val != (Object)null)
			{
				newChitterSFX = val.LoadAllAssets<AudioClip>();
				harmony.PatchAll(typeof(HoarderBugPatch));
				newAngry = val2.LoadAsset<AudioClip>("Assets/newAngry.wav");
				mls.LogInfo((object)"Succesfully load asset bundle");
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace HoarderJasper.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAngryPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void HoardedBugAngryAudioPatch(ref AudioClip ___angryVoiceSFX)
		{
			___angryVoiceSFX = HoarderJasperBase.newAngry;
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void HoardedBugAudioPatch(ref AudioClip[] ___chitterSFX)
		{
			AudioClip[] newChitterSFX = HoarderJasperBase.newChitterSFX;
			___chitterSFX = newChitterSFX;
		}
	}
}