Decompiled source of BoneMurder v2.0.0

Mods/BoneMurder.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ArpaRec;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using PuppetMasta;
using SLZ.Zones;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BoneMurder")]
[assembly: AssemblyDescription("BONELAB enemy remover")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ArpaRec")]
[assembly: AssemblyProduct("BoneMurder")]
[assembly: AssemblyCopyright("© ArpaRec 2024")]
[assembly: AssemblyTrademark("BoneMurder")]
[assembly: MelonInfo(typeof(BoneMurder), "BoneMurder", "2.0.0", "ArpaRec", null)]
[assembly: ComVisible(false)]
[assembly: Guid("cd64f6fb-5872-4df3-8580-57d5481068f2")]
[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 ZombieMurder
{
	public class ZombieMurderer : MelonMod
	{
		public override void OnInitializeMelon()
		{
			try
			{
				((MelonBase)this).HarmonyInstance.Patch((MethodBase)typeof(ZoneSpawner).GetMethod("Awake"), MelonUtils.ToNewHarmonyMethod(typeof(ZombieMurderer).GetMethod("Murderer")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error(ex.ToString());
			}
		}

		public static void Murderer(ZoneSpawner __instance)
		{
			if (((Object)__instance).name.Contains("Ford EarlyExit") && MelonPreferences.GetEntry<bool>("ArpaRecEnemies", "KillZombies").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("[ZombieMurderer] Killed {Zombie}");
			}
			if (((Object)__instance).name.Contains("Ford Early Exit Headset") && MelonPreferences.GetEntry<bool>("ArpaRecEnemies", "KillZombieHeadsets").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("[ZombieMurderer] Killed {Zombie Headset}");
			}
		}

		public static void Disable(BehaviourBase __instance)
		{
			((Component)((Component)__instance).transform.parent.parent).gameObject.SetActive(false);
			Object.Destroy((Object)(object)((Component)((Component)__instance).transform.parent.parent).gameObject);
		}
	}
}
namespace ArpaRecUtilities
{
	public class PrefManager
	{
		private MelonPreferences_Category ArpaCat;

		private MelonPreferences_Entry<bool> ZombieEn;

		private MelonPreferences_Entry<bool> ZombieHeadEn;

		private MelonPreferences_Entry<bool> NullEn;

		private MelonPreferences_Entry<bool> OmniEn;

		public static void CheckCreatePrefs()
		{
			MelonPreferences.CreateCategory("ArpaRecMurderer");
			MelonPreferences.CreateEntry<bool>("ArpaRecEnemies", "KillZombies", true, (string)null, (string)null, false, false, (ValueValidator)null);
			MelonPreferences.CreateEntry<bool>("ArpaRecEnemies", "KillZombieHeadsets", true, (string)null, (string)null, false, false, (ValueValidator)null);
		}
	}
}
namespace NullProject
{
	public class NullMurderer : MelonMod
	{
		public override void OnInitializeMelon()
		{
			try
			{
				((MelonBase)this).HarmonyInstance.Patch((MethodBase)typeof(ZoneSpawner).GetMethod("Awake"), MelonUtils.ToNewHarmonyMethod(typeof(NullMurderer).GetMethod("Murderer")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error(ex.ToString());
			}
		}

		public static void Murderer(ZoneSpawner __instance)
		{
			if (((Object)__instance).name.Contains("Null Body"))
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
			}
		}

		public static void Disable(BehaviourBase __instance)
		{
			((Component)((Component)__instance).transform.parent.parent).gameObject.SetActive(false);
			Object.Destroy((Object)(object)((Component)((Component)__instance).transform.parent.parent).gameObject);
		}
	}
}
namespace OmniProject
{
	public class OmniMurderer : MelonMod
	{
		public override void OnInitializeMelon()
		{
			try
			{
				((MelonBase)this).HarmonyInstance.Patch((MethodBase)typeof(ZoneSpawner).GetMethod("Awake"), MelonUtils.ToNewHarmonyMethod(typeof(OmniMurderer).GetMethod("Murderer")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error(ex.ToString());
			}
		}

		public static void Murderer(ZoneSpawner __instance)
		{
			if (((Object)__instance).name.Contains("Omni Projector"))
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
			}
		}

		public static void Disable(BehaviourBase __instance)
		{
			((Component)((Component)__instance).transform.parent.parent).gameObject.SetActive(false);
			Object.Destroy((Object)(object)((Component)((Component)__instance).transform.parent.parent).gameObject);
		}
	}
}
namespace ArpaRec
{
	public class BoneMurder : MelonMod
	{
		private MelonPreferences_Category ArpaCat;

		private MelonPreferences_Entry<bool> ZombieEn;

		private MelonPreferences_Entry<bool> ZombieHeadEn;

		private MelonPreferences_Entry<bool> NullEn;

		private MelonPreferences_Entry<bool> OmniEn;

		private MelonPreferences_Entry<bool> CrabletEn;

		private MelonPreferences_Entry<bool> TurretEn;

		public override void OnInitializeMelon()
		{
			ArpaCat = MelonPreferences.CreateCategory("BoneMurder");
			ZombieEn = ArpaCat.CreateEntry<bool>("Kill Zombies", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			ZombieHeadEn = ArpaCat.CreateEntry<bool>("Kill Headset Zombies", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			NullEn = ArpaCat.CreateEntry<bool>("Kill Null Bodies", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			OmniEn = ArpaCat.CreateEntry<bool>("Kill Omni Projectors", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			CrabletEn = ArpaCat.CreateEntry<bool>("Kill Crablets", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			TurretEn = ArpaCat.CreateEntry<bool>("Kill Turrets (LABWORKS)", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			MelonLogger.Msg("Initialised Mod");
			try
			{
				((MelonBase)this).HarmonyInstance.Patch((MethodBase)typeof(ZoneSpawner).GetMethod("Awake"), MelonUtils.ToNewHarmonyMethod(typeof(BoneMurder).GetMethod("Murder")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error(ex.ToString());
			}
		}

		public static void Murder(ZoneSpawner __instance)
		{
			if (((Object)__instance).name.Contains("Ford EarlyExit") && MelonPreferences.GetEntry<bool>("BoneMurder", "Kill Zombies").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("Killed (Zombie)");
			}
			if (((Object)__instance).name.Contains("Ford Early Exit Headset") && MelonPreferences.GetEntry<bool>("BoneMurder", "Kill Headset Zombies").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("Killed (Zombie Headset)");
			}
			if (((Object)__instance).name.Contains("Omni Projector") && MelonPreferences.GetEntry<bool>("BoneMurder", "Kill Omni Projectors").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("Killed (Omni Projector)");
			}
			if (((Object)__instance).name.Contains("Null Body") && MelonPreferences.GetEntry<bool>("BoneMurder", "Kill Null Bodies").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("Killed (Null Body)");
			}
			if (((Object)__instance).name.Contains("Crablet") && MelonPreferences.GetEntry<bool>("BoneMurder", "Kill Crablets").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("Killed (Crablet)");
			}
			if (((Object)__instance).name.Contains("Turret v4") && MelonPreferences.GetEntry<bool>("BoneMurder", "Kill Turrets (LABWORKS)").Value)
			{
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				MelonLogger.Msg("Killed (Turret)");
			}
		}
	}
}