Decompiled source of NoBugs v1.0.0

BepInEx/plugins/BugsBGone.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LC_API.BundleAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Video;

[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("Exterminators")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Our first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BugsBGone")]
[assembly: AssemblyTitle("BugsBGone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 Scarybugs
{
	[BepInPlugin("com.xeranok.BugsBGone", "BugsBGone", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public Harmony harmonymain;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmonymain = new Harmony("com.xeranok.BugsBGone");
			harmonymain.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"consider the bugs gone.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BugsBGone";

		public const string PLUGIN_NAME = "BugsBGone";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Scarybugs.Patches
{
	[HarmonyPatch]
	internal class Bees
	{
		[HarmonyPatch(typeof(RedLocustBees), "Start")]
		[HarmonyPostfix]
		public static void Buzz(RedLocustBees __instance)
		{
			__instance.beesAngry.clip = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/beesAngry.wav");
			__instance.beesDefensive.clip = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/beesDefensive.wav");
			__instance.beesIdle.clip = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/beesIdle.wav");
			__instance.beeZapAudio.clip = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/beeZapAudio.wav");
		}
	}
	[HarmonyPatch]
	internal class Centipede
	{
		[HarmonyPatch(typeof(CentipedeAI), "Start")]
		[HarmonyPostfix]
		public static void SummonBug(CentipedeAI __instance)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			__instance.hitCentipede = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/bugDie.wav");
			__instance.fallShriek = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/beesAngry.wav");
			Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("CentipedeModel").Find("LOD1")).gameObject.GetComponent<SkinnedMeshRenderer>());
			Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("CentipedeModel").Find("LOD2")).gameObject.GetComponent<SkinnedMeshRenderer>());
			GameObject val = Object.Instantiate<GameObject>(BundleLoader.GetLoadedAsset<GameObject>("Assets/Stored Asset Bundles/centipedeReplacement.prefab"), ((Component)__instance).gameObject.transform);
			if (Object.FindObjectsOfType<CentipedeAI>().Any((CentipedeAI centipede) => (Object)(object)centipede.clingingToPlayer != (Object)null))
			{
				val.transform.localPosition = new Vector3(0f, 0f, 0f);
			}
			else
			{
				val.transform.localPosition = new Vector3(0f, 0.8f, 0f);
			}
		}
	}
	[HarmonyPatch]
	internal class Hoarder
	{
		[HarmonyPatch(typeof(HoarderBugAI), "Start")]
		[HarmonyPostfix]
		public static void SummonBug(HoarderBugAI __instance)
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string> { "Assets/Stored Asset Bundles/hoarderBugSpottedA.wav", "Assets/Stored Asset Bundles/hoarderBugSpottedB.wav", "Assets/Stored Asset Bundles/hoarderBugSpottedC.wav" };
			int num = 0;
			AudioClip[] chitterSFX = __instance.chitterSFX;
			foreach (AudioClip val in chitterSFX)
			{
				int index = Random.Range(0, 2);
				string text = list[index];
				__instance.chitterSFX[num] = BundleLoader.GetLoadedAsset<AudioClip>(text);
				num++;
			}
			__instance.angryScreechSFX[0] = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/angryScreech.wav");
			__instance.angryScreechSFX[1] = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/angryScreech2.wav");
			__instance.angryVoiceSFX = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/fly.wav");
			__instance.bugFlySFX = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/haorderBugCry.wav");
			Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("HoarderBugModel").Find("Cube")).gameObject.GetComponent<SkinnedMeshRenderer>());
			Object.Destroy((Object)(object)((Component)((Component)__instance).gameObject.transform.Find("HoarderBugModel").Find("Cube.001")).gameObject.GetComponent<SkinnedMeshRenderer>());
			GameObject val2 = Object.Instantiate<GameObject>(BundleLoader.GetLoadedAsset<GameObject>("Assets/Stored Asset Bundles/hoarderReplacement.prefab"), ((Component)__instance).gameObject.transform);
			val2.transform.localPosition = new Vector3(0f, 2.5f, 0f);
		}
	}
	[HarmonyPatch]
	internal class SandSpider
	{
		[HarmonyPatch(typeof(SandSpiderAI), "Start")]
		[HarmonyPostfix]
		public static void SummonBug(SandSpiderAI __instance)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			AudioClip[] footstepSFX = __instance.footstepSFX;
			foreach (AudioClip val in footstepSFX)
			{
				__instance.footstepSFX[num] = BundleLoader.GetLoadedAsset<AudioClip>("Assets/Stored Asset Bundles/spiderStep.wav");
				num++;
			}
			Transform val2 = ((Component)__instance).gameObject.transform.Find("MeshContainer/AnimContainer/Armature/Abdomen");
			((Renderer)((Component)((Component)__instance).gameObject.transform.Find("MeshContainer/MeshRenderer")).gameObject.GetComponent<SkinnedMeshRenderer>()).enabled = false;
			GameObject val3 = Object.Instantiate<GameObject>(BundleLoader.GetLoadedAsset<GameObject>("Assets/Stored Asset Bundles/spiderReplacement.prefab"), val2);
			Transform transform = ((Component)((Component)__instance).gameObject.transform.Find("MeshContainer/AnimContainer/Armature/Abdomen/spiderReplacement(Clone)")).transform;
			val3.transform.localPosition = new Vector3(0f, 1f, 0f);
			Vector3 localEulerAngles = val3.transform.localEulerAngles;
			transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, 90f);
		}
	}
	[HarmonyPatch]
	internal class ArachnophobiaTerminalPatch
	{
		[HarmonyPatch(typeof(Terminal), "Awake")]
		[HarmonyPostfix]
		public static void EditTerminal(Terminal __instance)
		{
			__instance.enemyFiles[12].displayVideo = BundleLoader.GetLoadedAsset<VideoClip>("assets/Gok.m4v");
		}
	}
}