Decompiled source of LCBaboonGulls v1.0.2

BepInEx/plugins/LCBaboongulls.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
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.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LCBaboongulls")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LCBaboongulls")]
[assembly: AssemblyTitle("LCBaboongulls")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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 LCBaboongulls
{
	[BepInPlugin("org.bepinex.plugins.lethalcompany.baboongulls", "LCBaboonGulls", "1.0.2")]
	[BepInProcess("Lethal Company.exe")]
	public class LCModMain : BaseUnityPlugin
	{
		private readonly string assetBundlePath = "\\Crypto_Neo-LCBaboonGulls\\baboongullsfx.data";

		public static AudioClip sfxMine = AudioClip.Create("null", 1024, 1, 12000, false);

		private GameObject sfxTester = new GameObject();

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			string text = Paths.PluginPath + assetBundlePath;
			try
			{
				sfxMine = (AudioClip)AssetBundle.LoadFromFile(text).LoadAsset("Assets/mine.mp3");
				Baboonhawk_Patches.seagullsMine = sfxMine;
				Baboonhawk_Patches.seagullTester = sfxTester;
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Encountered an exception loading the asset bundle");
				((BaseUnityPlugin)this).Logger.LogError((object)ex.Message);
			}
			Harmony val = new Harmony("org.bepinex.plugins.lethalcompany.baboongulls");
			MethodInfo methodInfo = AccessTools.Method(typeof(BaboonBirdAI), "GrabScrap", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Baboonhawk_Patches), "GrabScrapPatch", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public class Baboonhawk_Patches
	{
		public static GameObject seagullTester = new GameObject();

		public static AudioClip seagullsMine = AudioClip.Create("null", 1024, 1, 12000, false);

		[HarmonyPatch(typeof(BaboonBirdAI), "GrabScrapPatch")]
		[HarmonyPostfix]
		public static void GrabScrapPatch(BaboonBirdAI __instance)
		{
			if ((Object)(object)seagullsMine != (Object)null)
			{
				RoundManager.PlayRandomClip(((EnemyAI)__instance).creatureVoice, (AudioClip[])(object)new AudioClip[1] { seagullsMine }, true, 1f, 1105);
			}
			else
			{
				Console.Write("[LC Baboongulls] ERROR - Sound effect not present");
			}
		}
	}
}