Decompiled source of billy butcher bug v1.0.3

BillyButcherBug.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.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 BillyButcherBug
{
	[BepInPlugin("Mambo.BillyButcherBug", "BillyButcherBug", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static AudioClip chitter1;

		public static AudioClip chitter2;

		public static AudioClip chitter3;

		public static AudioClip chitter4;

		public static AudioClip chitter5;

		public static AudioClip chitter6;

		public static AudioClip fly;

		private void Awake()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BillyButcherBug loaded!");
			string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location);
			chitter1 = LoadClip(Path.Combine(directoryName, "Chitter1.wav"));
			chitter2 = LoadClip(Path.Combine(directoryName, "Chitter2.wav"));
			chitter3 = LoadClip(Path.Combine(directoryName, "Chitter3.wav"));
			chitter4 = LoadClip(Path.Combine(directoryName, "Chitter4.wav"));
			chitter5 = LoadClip(Path.Combine(directoryName, "Chitter5.wav"));
			chitter6 = LoadClip(Path.Combine(directoryName, "Chitter6.wav"));
			fly = LoadClip(Path.Combine(directoryName, "Fly.wav"));
			Harmony val = new Harmony("Mambo.BillyButcherBug");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BillyButcherBug patched!");
		}

		private AudioClip LoadClip(string path)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			WWW val = new WWW("file://" + path);
			while (!val.isDone)
			{
			}
			AudioClip audioClip = val.GetAudioClip(false, false);
			audioClip.LoadAudioData();
			return audioClip;
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI), "Start")]
	public class HoarderBugStartPatch
	{
		private static void Postfix(HoarderBugAI __instance)
		{
			if ((Object)(object)Plugin.chitter1 != (Object)null && (Object)(object)Plugin.chitter2 != (Object)null && (Object)(object)Plugin.chitter3 != (Object)null)
			{
				__instance.chitterSFX = (AudioClip[])(object)new AudioClip[18]
				{
					Plugin.chitter1,
					Plugin.chitter2,
					Plugin.chitter3,
					Plugin.chitter4,
					Plugin.chitter5,
					Plugin.chitter6,
					Plugin.chitter1,
					Plugin.chitter2,
					Plugin.chitter3,
					Plugin.chitter4,
					Plugin.chitter5,
					Plugin.chitter6,
					Plugin.chitter1,
					Plugin.chitter2,
					Plugin.chitter3,
					Plugin.chitter4,
					Plugin.chitter5,
					Plugin.chitter6
				};
			}
			if ((Object)(object)Plugin.fly != (Object)null && __instance.angryScreechSFX != null && __instance.angryScreechSFX.Length != 0)
			{
				__instance.angryScreechSFX[0] = Plugin.fly;
			}
		}
	}
}