Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Toggle Enemies v1.0.7
ToggleEnemies.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EnemyToggle.Patches; 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("ToggleEnemies")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ToggleEnemies")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("fc359b6f-0904-41c8-ac4f-7db934547a95")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace EnemyToggle { [BepInPlugin("SpiralMods.EnemyToggle", "EnemyToggle", "1.0.6")] public class EnemyToggleBase : BaseUnityPlugin { public const string modGUID = "SpiralMods.EnemyToggle"; private const string modName = "EnemyToggle"; private const string modVersion = "1.0.6"; private readonly Harmony harmony = new Harmony("SpiralMods.EnemyToggle"); private static EnemyToggleBase Instance; internal ManualLogSource mls; public static ConfigEntry<bool> RemoveSnareFlea; public static ConfigEntry<bool> RemoveBunkerSpider; public static ConfigEntry<bool> RemoveLootBug; public static ConfigEntry<bool> RemoveBracken; public static ConfigEntry<bool> RemoveThumper; public static ConfigEntry<bool> RemoveSlime; public static ConfigEntry<bool> RemoveDressGirl; public static ConfigEntry<bool> RemovePuffer; public static ConfigEntry<bool> RemoveNutcracker; public static ConfigEntry<bool> RemoveCoilHead; public static ConfigEntry<bool> RemoveJester; public static ConfigEntry<bool> RemoveMasked; public static ConfigEntry<bool> RemoveMouthDog; public static ConfigEntry<bool> RemoveGiant; public static ConfigEntry<bool> RemoveWorm; public static ConfigEntry<bool> RemoveBaboonHawk; public static ConfigEntry<bool> RemoveOldBird; public static ConfigEntry<bool> RemoveButler; public static ConfigEntry<bool> RemoveFlowerSnake; public static ConfigEntry<bool> RemoveBarber; public static ConfigEntry<bool> RemoveFox; public static ConfigEntry<bool> RemoveLasso; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("SpiralMods.EnemyToggle"); mls.LogInfo((object)"EnemyToggle has loaded (ModVersion: 1.0.6, ModGUID: SpiralMods.EnemyToggle)!"); SetBindings(); harmony.PatchAll(typeof(Variables)); harmony.PatchAll(typeof(FlowermanPatch)); harmony.PatchAll(typeof(CentipedePatch)); harmony.PatchAll(typeof(HoardingBugPatch)); harmony.PatchAll(typeof(SandSpiderPatch)); harmony.PatchAll(typeof(CrawlerPatch)); harmony.PatchAll(typeof(BlobPatch)); harmony.PatchAll(typeof(DressGirlPatch)); harmony.PatchAll(typeof(PufferPatch)); harmony.PatchAll(typeof(NutcrackerEnemyPatch)); harmony.PatchAll(typeof(JesterPatch)); harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); harmony.PatchAll(typeof(MouthDogPatch)); harmony.PatchAll(typeof(ForestGiantPatch)); harmony.PatchAll(typeof(SandWormPatch)); harmony.PatchAll(typeof(BaboonBirdPatch)); harmony.PatchAll(typeof(SpringManPatch)); harmony.PatchAll(typeof(FlowerSnakePatch)); harmony.PatchAll(typeof(LassoManPatch)); harmony.PatchAll(typeof(BushWolfPatch)); harmony.PatchAll(typeof(ClaySurgeonPatch)); } private void SetBindings() { RemoveSnareFlea = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Snare Fleas", false, "If true, snare fleas will never spawn!"); RemoveBunkerSpider = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Bunker Spiders", false, "If true, bunker spiders will never spawn!"); RemoveLootBug = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Loot Bugs", false, "If true, loot bugs will never spawn!"); RemoveBracken = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Brackens", false, "If true, brackens will never spawn!"); RemoveThumper = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Thumpers", false, "If true, thumpers will never spawn!"); RemoveSlime = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Slimes", false, "If true, slimes will never spawn!"); RemoveDressGirl = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Ghost Girls", false, "If true, the ghost girl will never spawn!"); RemovePuffer = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Spore Lizards", false, "If true, spore lizards will never spawn!"); RemoveNutcracker = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Nutcrackers", false, "If true, nutcrackers will never spawn!"); RemoveCoilHead = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Coil Heads", false, "If true, coil heads will never spawn!"); RemoveJester = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Jesters", false, "If true, jesters will never spawn!"); RemoveMasked = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Masked Players", false, "If true, masked players will never spawn!"); RemoveMouthDog = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Eyeless Dogs", false, "If true, eyeless dogs will never spawn!"); RemoveGiant = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Giants", false, "If true, giants will never spawn!"); RemoveWorm = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Worms", false, "If true, worms will never spawn!"); RemoveBaboonHawk = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Baboon Hawks", false, "If true, baboon hawks will never spawn!"); RemoveButler = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Butlers", false, "If true, butlers will never spawn!"); RemoveOldBird = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Old Birds", false, "If true, old birds will never spawn!"); RemoveFlowerSnake = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Flower Snakes", false, "If true, flower snakes will never spawn!"); RemoveBarber = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Barbers", false, "If true, barbers will never spawn!"); RemoveFox = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Kidnapper Foxes", false, "If true, foxes will never spawn!"); RemoveLasso = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings (Restart Required)", "Disable Lasso Man", false, "If true, lasso Man won't spawn during modded!"); } } } namespace EnemyToggle.Patches { internal class Variables { public static void BroadcastString(string str) { ManualLogSource val = Logger.CreateLogSource("SpiralMods.EnemyToggle"); val.LogInfo((object)str); } } [HarmonyPatch(typeof(ClaySurgeonAI))] internal class ClaySurgeonPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveBarber.Value && GameNetworkManager.Instance.isHostingGame) { ClaySurgeonAI val = Object.FindObjectOfType<ClaySurgeonAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A clay surgeon (barber) has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(ButlerBeesEnemyAI))] internal class ButlerBeesPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveButler.Value && GameNetworkManager.Instance.isHostingGame) { ButlerBeesEnemyAI val = Object.FindObjectOfType<ButlerBeesEnemyAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A pack of butler bees has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(BushWolfEnemy))] internal class BushWolfPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveFox.Value && GameNetworkManager.Instance.isHostingGame) { BushWolfEnemy val = Object.FindObjectOfType<BushWolfEnemy>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A kidnapping fox has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(LassoManAI))] internal class LassoManPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveLasso.Value && GameNetworkManager.Instance.isHostingGame) { LassoManAI val = Object.FindObjectOfType<LassoManAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A lasso man has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(RadMechAI))] internal class OldBirdPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveOldBird.Value && GameNetworkManager.Instance.isHostingGame) { RadMechAI val = Object.FindObjectOfType<RadMechAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("An old bird has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(ButlerEnemyAI))] internal class ButlerPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveButler.Value && GameNetworkManager.Instance.isHostingGame) { ButlerEnemyAI val = Object.FindObjectOfType<ButlerEnemyAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A butler has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(CentipedeAI))] internal class CentipedePatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveSnareFlea.Value && GameNetworkManager.Instance.isHostingGame) { CentipedeAI val = Object.FindObjectOfType<CentipedeAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A snare flea has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(CrawlerAI))] internal class CrawlerPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveThumper.Value && GameNetworkManager.Instance.isHostingGame) { CrawlerAI val = Object.FindObjectOfType<CrawlerAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A thumper has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(BlobAI))] internal class BlobPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveSlime.Value && GameNetworkManager.Instance.isHostingGame) { BlobAI val = Object.FindObjectOfType<BlobAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A slime has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(DressGirlAI))] internal class DressGirlPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveDressGirl.Value && GameNetworkManager.Instance.isHostingGame) { DressGirlAI val = Object.FindObjectOfType<DressGirlAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A ghost girl has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedPlayerEnemyPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveMasked.Value && GameNetworkManager.Instance.isHostingGame) { MaskedPlayerEnemy val = Object.FindObjectOfType<MaskedPlayerEnemy>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("An masked player has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(PufferAI))] internal class PufferPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemovePuffer.Value && GameNetworkManager.Instance.isHostingGame) { PufferAI val = Object.FindObjectOfType<PufferAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A spore lizard has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class NutcrackerEnemyPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveNutcracker.Value && GameNetworkManager.Instance.isHostingGame) { NutcrackerEnemyAI val = Object.FindObjectOfType<NutcrackerEnemyAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A nutcracker has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(JesterAI))] internal class JesterPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveJester.Value && GameNetworkManager.Instance.isHostingGame) { JesterAI val = Object.FindObjectOfType<JesterAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A jester has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(MouthDogAI))] internal class MouthDogPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveMouthDog.Value && GameNetworkManager.Instance.isHostingGame) { MouthDogAI val = Object.FindObjectOfType<MouthDogAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("An eyeless dog has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(ForestGiantAI))] internal class ForestGiantPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveGiant.Value && GameNetworkManager.Instance.isHostingGame) { ForestGiantAI val = Object.FindObjectOfType<ForestGiantAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A giant has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(SandWormAI))] internal class SandWormPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveWorm.Value && GameNetworkManager.Instance.isHostingGame) { SandWormAI val = Object.FindObjectOfType<SandWormAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A sand worm has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(BaboonBirdAI))] internal class BaboonBirdPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveBaboonHawk.Value && GameNetworkManager.Instance.isHostingGame) { BaboonBirdAI val = Object.FindObjectOfType<BaboonBirdAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Variables.BroadcastString("A baboon hawk has been deleted."); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(FlowerSnakeEnemy))] internal class FlowerSnakePatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveFlowerSnake.Value && GameNetworkManager.Instance.isHostingGame) { FlowerSnakeEnemy val = Object.FindObjectOfType<FlowerSnakeEnemy>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A flower snake has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(SpringManAI))] internal class SpringManPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveCoilHead.Value && GameNetworkManager.Instance.isHostingGame) { SpringManAI val = Object.FindObjectOfType<SpringManAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A spring man has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); SpringJoint val2 = Object.FindObjectOfType<SpringJoint>(); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val2); Object.DestroyImmediate((Object)(object)val2); } } } [HarmonyPatch(typeof(SandSpiderAI))] internal class SandSpiderPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveBunkerSpider.Value && GameNetworkManager.Instance.isHostingGame) { SandSpiderAI val = Object.FindObjectOfType<SandSpiderAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A bunker spider has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(HoarderBugAI))] internal class HoardingBugPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveLootBug.Value && GameNetworkManager.Instance.isHostingGame) { HoarderBugAI val = Object.FindObjectOfType<HoarderBugAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A hoarding bug has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } [HarmonyPatch(typeof(FlowermanAI))] internal class FlowermanPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (EnemyToggleBase.RemoveBracken.Value && GameNetworkManager.Instance.isHostingGame) { FlowermanAI val = Object.FindObjectOfType<FlowermanAI>(); ((EnemyAI)val).serverPosition = new Vector3(1000f, -1000f, 1000f); ((EnemyAI)val).SyncPositionToClients(); ((EnemyAI)val).enemyType.canDie = true; Variables.BroadcastString("A flowerman has been deleted."); ((EnemyAI)val).KillEnemyClientRpc(true); ((EnemyAI)val).KillEnemyOnOwnerClient(true); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)val); } } } }