Decompiled source of LootBugAnimeVoices v0.0.1

LootBugAnimeVoices.dll

Decompiled 9 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LootBugAnimeVoices")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LootBugAnimeVoices")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E86D6BEB-85B9-4433-A3F4-68BB5E190698")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LootBugAnimeVoices;

[BepInPlugin("NotAtAll-LootBugAnimeVoices", "Loot Bug Anime Voices", "0.0.1")]
public class LootBugAnimeVoices : BaseUnityPlugin
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	public static class HoarderBugAI_Path
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start_Patch(ref AudioClip[] ___chitterSFX, ref AudioClip ___angryVoiceSFX, ref AudioClip ___hitPlayerSFX, int ___thisEnemyIndex)
		{
			int num = ___thisEnemyIndex % 5;
			int num2 = ___thisEnemyIndex % 3 + 5;
			int num3 = ___thisEnemyIndex % 3 + 8;
			___chitterSFX = (AudioClip[])(object)new AudioClip[1] { _AudioSFX[num] };
			___angryVoiceSFX = _AudioSFX[num2];
			___hitPlayerSFX = _AudioSFX[num3];
		}
	}

	private const string ID = "NotAtAll-LootBugAnimeVoices";

	private const string NAME = "Loot Bug Anime Voices";

	private const string VERSION = "0.0.1";

	private static ManualLogSource _L;

	private static Harmony _H;

	private static AssetBundle _A;

	private static AudioClip[] _AudioSFX;

	private void Awake()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		string text = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) + "\\assets";
		_L = ((BaseUnityPlugin)this).Logger;
		_H = new Harmony("NotAtAll-LootBugAnimeVoices");
		_A = AssetBundle.LoadFromFile(text);
		_AudioSFX = (AudioClip[])(object)new AudioClip[11]
		{
			_A.LoadAsset<AudioClip>("Assets/Voice_0.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Voice_1.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Voice_2.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Voice_3.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Voice_4.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Angry_0.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Angry_1.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Angry_2.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Punch_0.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Punch_1.mp3"),
			_A.LoadAsset<AudioClip>("Assets/Punch_2.mp3")
		};
		_H.PatchAll();
		_L.LogInfo((object)"The plugin was initialized!");
	}
}