Decompiled source of NoMonsters v1.0.0

NoMonsters.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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NoMonsters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoMonsters")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4a0dd3d5-26c4-4590-bdcf-a818b87989ee")]
[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 NoMonsters;

[BepInPlugin("AngelMadeline.NoMonsters", "No Monsters", "1.0.0")]
public class NoMonsters : BaseUnityPlugin
{
	public static bool loaded;

	private const string modGUID = "AngelMadeline.NoMonsters";

	private const string modName = "No Monsters";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("AngelMadeline.NoMonsters");

	private static NoMonsters Instance;

	public static ManualLogSource mls;

	private void Awake()
	{
		mls = Logger.CreateLogSource("No Monsters");
		mls.LogInfo((object)"Loaded No Monsters.");
		harmony.PatchAll(typeof(NoMonsters));
	}

	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	[HarmonyPrefix]
	private static bool NoMonstersSpawn(ref SelectableLevel newLevel)
	{
		foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
		{
			enemy.rarity = 0;
		}
		foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies)
		{
			outsideEnemy.rarity = 0;
		}
		mls.LogDebug((object)"No Monsters: Removed All Enemies");
		return true;
	}
}