Decompiled source of Arachnophobia v1.0.1

plugins/Arachnophobia/ArachMod.dll

Decompiled 6 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using ArachMod.Patches;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ArachMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Prevents spider spawns entirely")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArachMod")]
[assembly: AssemblyTitle("ArachMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ArachMod
{
	[BepInPlugin("ArachMod", "ArachMod", "1.0.0")]
	public class ArachPlugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("ArachMod");

		private static ArachPlugin Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ArachMod is loaded!");
			harmony.PatchAll(typeof(ArachPlugin));
			harmony.PatchAll(typeof(RoundManagerAPPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ArachMod";

		public const string PLUGIN_NAME = "ArachMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ArachMod.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerAPPatch
	{
		public static string SPIDER_NAME = "Bunker Spider";

		internal static ManualLogSource logs = Logger.CreateLogSource("ArachMod");

		[HarmonyPatch("GenerateNewFloor")]
		[HarmonyPostfix]
		private static void RemoveSpidersFromSpawnTable(ref SelectableLevel ___currentLevel)
		{
			List<SpawnableEnemyWithRarity> enemies = ___currentLevel.Enemies;
			int num = -1;
			for (int i = 0; i < enemies.Count; i++)
			{
				if (enemies[i].enemyType.enemyName == SPIDER_NAME)
				{
					num = i;
					break;
				}
			}
			if (num > -1)
			{
				logs.LogInfo((object)$"Removing the spider at index {num}");
				enemies.RemoveAt(num);
			}
		}
	}
}