Decompiled source of Loudbug v1.0.0

lnbug.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LCHoarderLN.Patches;
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: IgnoresAccessChecksTo("0Harmony")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("BepInEx")]
[assembly: AssemblyCompany("lnbug")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("e")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("lnbug")]
[assembly: AssemblyTitle("lnbug")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[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 lnbug
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "lnbug";

		public const string PLUGIN_NAME = "lnbug";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace LCHoarderLN
{
	[BepInPlugin("badmodsinc-loudbug", "Loudbug", "1.0.0")]
	public class hoarderln : BaseUnityPlugin
	{
		private const string mod_guid = "badmodsinc-loudbug";

		private const string mod_name = "Loudbug";

		private const string mod_version = "1.0.0";

		internal static hoarderln instance;

		internal static ManualLogSource modlog;

		public static AssetBundle new_sounds;

		internal static AudioClip[] ln_asset;

		private readonly Harmony harmony = new Harmony("badmodsinc-loudbug");

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			modlog = Logger.CreateLogSource("hoarderln");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			new_sounds = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lnhoarder"));
			if ((Object)(object)new_sounds == (Object)null)
			{
				modlog.LogError((object)"Failed to load AssetBundle.");
				return;
			}
			ln_asset = new_sounds.LoadAssetWithSubAssets<AudioClip>("assets\\audio\\ln.wav");
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			modlog.LogInfo((object)"Plugin badmodsinc-loudbug is loaded!");
		}
	}
}
namespace LCHoarderLN.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugAIPatch
	{
		internal static ManualLogSource modlog = hoarderln.modlog;

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void AudioPatch(ref AudioClip[] ___chitterSFX, ref AudioClip[] ___angryScreechSFX, ref AudioClip ___angryVoiceSFX, ref AudioClip ___bugFlySFX, ref AudioClip ___hitPlayerSFX)
		{
			AudioClip[] ln_asset = hoarderln.ln_asset;
			if (ln_asset != null && ln_asset.Length != 0)
			{
				AudioClip val = ln_asset[0];
				___chitterSFX = ln_asset;
				___angryScreechSFX = ln_asset;
				___angryVoiceSFX = val;
				___bugFlySFX = val;
				___hitPlayerSFX = val;
			}
			else
			{
				modlog.LogError((object)"Failed to load replacement audio data from extracted assets.");
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}