Decompiled source of OnlyHoardBugs v1.0.1

OnlyHoardBugs.dll

Decompiled 11 months 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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_OnlyHoardingBugs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_OnlyHoardingBugs")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0361d3b2-735a-46d9-b776-3cda347de9f4")]
[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 OnlyHoardBugs;

[BepInPlugin("AngelMadeline.OnlyHoardBugs", "Only Hoard Bugs", "1.0.1")]
public class OnlyHoardBugs : BaseUnityPlugin
{
	public static bool loaded;

	private const string modGUID = "AngelMadeline.OnlyHoardBugs";

	private const string modName = "Only Hoard Bugs";

	private const string modVersion = "1.0.1";

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

	private static OnlyHoardBugs Instance;

	public static ManualLogSource mls;

	private void Awake()
	{
		mls = Logger.CreateLogSource("Only Hoard Bugs");
		mls.LogInfo((object)"Loaded Only Hoard Bugs and applying patches.");
		harmony.PatchAll(typeof(OnlyHoardBugs));
	}

	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	[HarmonyPrefix]
	private static bool OnlyHoardBugsSpawn(ref SelectableLevel newLevel)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
		{
			enemy.rarity = 0;
			if ((Object)enemy.enemyType.enemyPrefab.GetComponent<HoarderBugAI>() != (Object)null)
			{
				enemy.rarity = 999;
			}
		}
		mls.LogDebug((object)"Only Hoard Bugs: Removed Other Enemies");
		return true;
	}
}