BepInEx/plugins/caca/caca.dll

Decompiled 2 months ago
using System;
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 Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8DEA218D-624C-42D7-9515-42280BAC4460")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("caca")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("caca")]
[assembly: AssemblyTitle("caca")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace caca
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	public class PatchClass
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void hoarderBugPatch(HoarderBugAI __instance, ref AudioClip[] ___chitterSFX)
		{
			AudioClip[] newSFX = Plugin.newSFX;
			if ((Object)(object)__instance == (Object)null)
			{
				Logger.CreateLogSource("caca").LogError((object)"Instance is null!");
			}
			else if (newSFX == null || newSFX.Length == 0)
			{
				Logger.CreateLogSource("caca").LogError((object)"Failed to load audio assets! 2");
			}
			else if (___chitterSFX == null)
			{
				Logger.CreateLogSource("caca").LogError((object)"___chitterSFX is null!");
			}
			else
			{
				___chitterSFX = newSFX;
			}
		}
	}
	[BepInPlugin("com.sau6son.cacaPlugin", "caca hehe", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private static Plugin Instance;

		internal static AudioClip[] newSFX;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			if ((Object)Instance == (Object)null)
			{
				Instance = this;
			}
			_harmony = new Harmony("com.sau6son.cacaPlugin");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"sau6son.caca is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "caca.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "caca-bundle";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/caca.mp3");
			if (newSFX == null || newSFX.Length == 0)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load audio assets! 1");
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded audio assets " + ((Object)newSFX[0]).name));
			_harmony.PatchAll(typeof(PatchClass));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"caca plugin loaded !");
		}
	}
}