Decompiled source of Tron Kevin Flynn Yeah Bugs v1.0.0

FlynnYeahBug.dll

Decompiled 3 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FlynnYeahBug")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FlynnYeahBug")]
[assembly: AssemblyTitle("FlynnYeahBug")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace FlynnYeahBug
{
	[HarmonyPatch(typeof(HoarderBugAI), "Start")]
	internal static class HoarderBugAIPatch
	{
		private static void Postfix(HoarderBugAI __instance)
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(HoarderBugAI), "chitterSFX");
			if (fieldInfo == null)
			{
				Plugin.Log.LogError((object)"Could not find HoarderBugAI.chitterSFX!");
				return;
			}
			if (!(fieldInfo.GetValue(__instance) is AudioClip[] array) || array.Length == 0)
			{
				Plugin.Log.LogWarning((object)"Hoarder Bug has no chitter sounds!");
				return;
			}
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = ((i % 2 == 0) ? Plugin.SoundA : Plugin.SoundB);
			}
			fieldInfo.SetValue(__instance, array);
		}
	}
	[BepInPlugin("com.flynnyeahbug", "FlynnYeahBug", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		internal static AssetBundle Bundle;

		internal static AudioClip SoundA;

		internal static AudioClip SoundB;

		private Harmony harmony;

		private void Awake()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "flynnyeahbug");
			Bundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)Bundle == (Object)null)
			{
				Log.LogError((object)"Failed to load the FlynnYeahBug AssetBundle!");
				return;
			}
			SoundA = Bundle.LoadAsset<AudioClip>("flynn_chitter_1");
			SoundB = Bundle.LoadAsset<AudioClip>("flynn_chitter_2");
			if ((Object)(object)SoundA == (Object)null || (Object)(object)SoundB == (Object)null)
			{
				Log.LogError((object)"Failed to load one or both FlynnYeahBug audio clips!");
				return;
			}
			harmony = new Harmony("com.flynnyeahbug");
			harmony.PatchAll();
			Log.LogInfo((object)"FlynnYeahBug loaded successfully!");
		}
	}
}