Decompiled source of LethalJimmy v1.0.1

LethalJimmy.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalJimmy.Patches;
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("LethalJimmy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalJimmy")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b6146e9f-179f-4eba-bdf6-d17334e0d74d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalJimmy
{
	[BepInPlugin("jimmyboy.LethalJimmy", "Lethal Jimmy", "1.0.1")]
	public class JimmyModBase : BaseUnityPlugin
	{
		private const string modGUID = "jimmyboy.LethalJimmy";

		private const string modName = "Lethal Jimmy";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("jimmyboy.LethalJimmy");

		private static JimmyModBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newChitterSFX;

		internal static AudioClip newAngrySFX;

		internal static AudioClip[] pickupSFX;

		internal static AudioClip[] screechSFX;

		private string filePath;

		private void Awake()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("jimmyboy.LethalJimmy");
			mls.LogInfo((object)"Lethal Jimmy has awakened :D");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "LethalJimmy.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "lethaljimmy";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			int num = 9;
			newChitterSFX = (AudioClip[])(object)new AudioClip[num];
			for (int i = 0; i < num; i++)
			{
				newChitterSFX[i] = val.LoadAsset<AudioClip>("Assets/LethalJimmy/chitter/" + (i + 1) + ".wav");
			}
			int num2 = 3;
			pickupSFX = (AudioClip[])(object)new AudioClip[num2];
			for (int j = 0; j < num2; j++)
			{
				pickupSFX[j] = val.LoadAsset<AudioClip>("Assets/LethalJimmy/pickup/" + (j + 1) + ".wav");
			}
			int num3 = 3;
			screechSFX = (AudioClip[])(object)new AudioClip[num3];
			for (int k = 0; k < num3; k++)
			{
				screechSFX[k] = val.LoadAsset<AudioClip>("Assets/LethalJimmy/screech/" + (k + 1) + ".wav");
			}
			newAngrySFX = val.LoadAsset<AudioClip>("Assets/LethalJimmy/angry1.wav");
			harmony.PatchAll(typeof(JimmyModBase));
			harmony.PatchAll(typeof(HoarderBugPatch));
			mls.LogInfo((object)"jimmyboy.LethalJimmy is loaded. Yahoo!!!");
		}
	}
}
namespace LethalJimmy.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX, ref AudioClip ___angryVoiceSFX)
		{
			AudioClip[] newChitterSFX = JimmyModBase.newChitterSFX;
			___chitterSFX = newChitterSFX;
			AudioClip newAngrySFX = JimmyModBase.newAngrySFX;
			___angryVoiceSFX = newAngrySFX;
		}

		[HarmonyPatch("GrabItem")]
		[HarmonyPostfix]
		public static void hoarderBugOnPickupPatch(ref AudioSource ___creatureVoice)
		{
			RoundManager.PlayRandomClip(___creatureVoice, JimmyModBase.pickupSFX, true, 1f, 0);
		}
	}
}