Decompiled source of Treys Enemy Nuker v1.1.0

TreysEnemyNuker.dll

Decompiled a year 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;

[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("TreysEnemyNuker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod for removing enemies from Lethal Company")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("TreysEnemyNuker")]
[assembly: AssemblyTitle("TreysEnemyNuker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace TreysEnemyNuker;

[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
public static class EnemyManagerPatch
{
	public static void Postfix(RoundManager __instance, int randomSeed, SelectableLevel newLevel)
	{
		List<SpawnableEnemyWithRarity> outsideEnemies = __instance.currentLevel.OutsideEnemies;
		List<SpawnableEnemyWithRarity> enemies = __instance.currentLevel.Enemies;
		List<SpawnableEnemyWithRarity> daytimeEnemies = __instance.currentLevel.DaytimeEnemies;
		if (outsideEnemies != null)
		{
			if (Plugin.RemoveMouthDog.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing MouthDogs");
				outsideEnemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "MouthDog");
			}
			if (Plugin.RemoveForestGiant.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing ForestGiants");
				outsideEnemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "ForestGiant");
			}
			if (Plugin.RemoveEarthLeviathan.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing EarthLeviathans");
				outsideEnemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Earth Leviathan");
			}
			if (Plugin.RemoveBaboonHawk.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing BaboonHawks");
				outsideEnemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Baboon hawk");
			}
		}
		if (enemies != null)
		{
			if (Plugin.RemoveCentipede.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing Centipedes");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Centipede");
			}
			if (Plugin.RemoveBunkerSpider.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing BunkerSpiders");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Bunker Spider");
			}
			if (Plugin.RemoveHoardingBug.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing HoardingBugs");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Hoarding bug");
			}
			if (Plugin.RemoveFlowerMan.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing FlowerMen");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Flowerman");
			}
			if (Plugin.RemoveCrawler.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing Crawlers");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Crawler");
			}
			if (Plugin.RemoveBlob.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing Blobs");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Blob");
			}
			if (Plugin.RemoveSpring.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing Springs");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Spring");
			}
			if (Plugin.RemovePuffer.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing Puffers");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Puffer");
			}
			if (Plugin.RemoveNutcracker.Value)
			{
				Plugin.PluginLogger.LogInfo((object)"Tried removing Nutcrackers");
				enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Nutcracker");
			}
		}
		if (daytimeEnemies != null && Plugin.RemoveManticoil.Value)
		{
			Plugin.PluginLogger.LogInfo((object)"Tried removing Manticoils");
			daytimeEnemies.RemoveAll((SpawnableEnemyWithRarity enemy) => enemy.enemyType.enemyName == "Manticoil");
		}
	}
}
[BepInPlugin("TreysEnemyNuker", "TreysEnemyNuker", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigEntry<bool> RemoveMouthDog;

	public static ConfigEntry<bool> RemoveForestGiant;

	public static ConfigEntry<bool> RemoveEarthLeviathan;

	public static ConfigEntry<bool> RemoveBaboonHawk;

	public static ConfigEntry<bool> RemoveCentipede;

	public static ConfigEntry<bool> RemoveBunkerSpider;

	public static ConfigEntry<bool> RemoveHoardingBug;

	public static ConfigEntry<bool> RemoveFlowerMan;

	public static ConfigEntry<bool> RemoveCrawler;

	public static ConfigEntry<bool> RemoveBlob;

	public static ConfigEntry<bool> RemoveSpring;

	public static ConfigEntry<bool> RemovePuffer;

	public static ConfigEntry<bool> RemoveNutcracker;

	public static ConfigEntry<bool> RemoveManticoil;

	internal static ManualLogSource PluginLogger;

	private void Awake()
	{
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Expected O, but got Unknown
		RemoveMouthDog = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "MouthDog", true, "Set to true to remove Mouth Dogs from the game.");
		RemoveForestGiant = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "ForestGiant", true, "Set to true to remove Forest Giants from the game.");
		RemoveEarthLeviathan = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "EarthLeviathan", true, "Set to true to remove Earth Leviathans from the game.");
		RemoveBaboonHawk = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "BaboonHawk", true, "Set to true to remove Baboon Hawks from the game.");
		RemoveCentipede = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Centipede", true, "Set to true to remove Centipedes from the game.");
		RemoveBunkerSpider = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "BunkerSpider", true, "Set to true to remove Bunker Spiders from the game.");
		RemoveHoardingBug = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "HoardingBug", true, "Set to true to remove Hoarding Bugs from the game.");
		RemoveFlowerMan = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "FlowerMan", true, "Set to true to remove Flower Man from the game.");
		RemoveCrawler = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Crawler", true, "Set to true to remove Crawlers from the game.");
		RemoveBlob = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Blob", true, "Set to true to remove Blobs from the game.");
		RemoveSpring = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Spring", true, "Set to true to remove Springs from the game.");
		RemovePuffer = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Puffer", true, "Set to true to remove Puffers from the game.");
		RemoveNutcracker = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Nutcracker", true, "Set to true to remove Nutcrackers from the game.");
		RemoveManticoil = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Removal", "Manticoil", true, "Set to true to remove Manticoils from the game.");
		PluginLogger = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TreysEnemyNuker is loaded!");
		Harmony val = new Harmony("TreysEnemyNuker");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied.");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "TreysEnemyNuker";

	public const string PLUGIN_NAME = "TreysEnemyNuker";

	public const string PLUGIN_VERSION = "1.1.0";
}