Decompiled source of FightingTweaks v1.0.0

FightingShuang.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FightingShuang")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FightingShuang")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5ce2c807-8072-4e7f-92cf-50ee266efcad")]
[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 FightingShuang;

[BepInPlugin("LengJing.FightingShuang", "FightingShuang", "1.0.0")]
public class FightingShuang : BaseUnityPlugin
{
	public static ConfigEntry<bool> ConfigNutcrackerGunMod;

	public static ConfigEntry<bool> ConfigSpawnBees;

	public static ConfigEntry<bool> ConfigSpawnKnife;

	public static ConfigEntry<bool> ConfigRemoveCaveDweller;

	public static ConfigEntry<bool> ConfigRemoveHoarderBug;

	public static ConfigEntry<bool> ConfigRemoveSandSpider;

	public static ConfigEntry<bool> ConfigRemoveCrawler;

	public static ConfigEntry<bool> ConfigRemoveCentipede;

	public static ConfigEntry<bool> ConfigRemoveMasked;

	public static ConfigEntry<bool> ConfigRemoveFlowerman;

	public static ConfigEntry<bool> ConfigRemoveForestGiant;

	public static ConfigEntry<bool> ConfigRemoveMouthDog;

	public static ConfigEntry<bool> ConfigRemoveBaboonBird;

	public static ConfigEntry<bool> ConfigRemoveFlowerSnake;

	public static ConfigEntry<bool> ConfigRemoveButler;

	public static ConfigEntry<bool> ConfigButlerBoomRepelled;

	public static ConfigEntry<int> ConfigWebTrapMin;

	public static ConfigEntry<int> ConfigWebTrapMax;

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Expected O, but got Unknown
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Expected O, but got Unknown
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Expected O, but got Unknown
		ConfigNutcrackerGunMod = ((BaseUnityPlugin)this).Config.Bind<bool>("Nutcracker", "EnableNutcrackerGunMod", true, "This is a modification about whether the Nutcracker drops the gun or not (true=yes,false=no)");
		ConfigSpawnBees = ((BaseUnityPlugin)this).Config.Bind<bool>("ButlerEnemy", "SpawnBees", true, "Whether or not bee enemies spawn (true=yes)");
		ConfigSpawnKnife = ((BaseUnityPlugin)this).Config.Bind<bool>("ButlerEnemy", "SpawnKnife", true, "Whether or not to generate knives (true=yes)");
		ConfigButlerBoomRepelled = ((BaseUnityPlugin)this).Config.Bind<bool>("ButlerEnemy", "BoomRepelled", true, "Whether or not an enemy explosion creates knockback (true=yes)");
		ConfigRemoveButler = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "Butler", true, "Whether or not to remove the corpse of Butler when died (true=yes)");
		ConfigRemoveCaveDweller = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "CaveDweller", true, "Whether or not to remove the corpse of CaveDweller when died (true=yes)");
		ConfigRemoveHoarderBug = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "HoarderBug", true, "Whether or not to remove the corpse of HoarderBug when died (true=yes)");
		ConfigRemoveSandSpider = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "SandSpider", true, "Whether or not to remove the corpse and web of SandSpider when died (true=yes)");
		ConfigRemoveCrawler = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "Crawler", true, "Whether or not to remove the corpse of Crawler when died (true=yes)");
		ConfigRemoveCentipede = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "Centipede", true, "Whether or not to remove the corpse of Centipede when died (true=yes)");
		ConfigRemoveMasked = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "Masked", true, "Whether or not to remove the corpse of MaskedEnemy when died (true=yes)");
		ConfigRemoveFlowerman = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "Flowerman", true, "Whether or not to remove the corpse of Flowerman when died (true=yes)");
		ConfigRemoveForestGiant = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "ForestGiant", true, "Whether or not to remove the corpse of ForestGiant when died (true=yes)");
		ConfigRemoveMouthDog = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "MouthDog", true, "Whether or not to remove the corpse of MouthDog when died (true=yes)");
		ConfigRemoveBaboonBird = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "BaboonBird", true, "Whether or not to remove the corpse of BaboonBird when died (true=yes)");
		ConfigRemoveFlowerSnake = ((BaseUnityPlugin)this).Config.Bind<bool>("RemoveCorpse", "FlowerSnake", true, "Whether or not to remove the corpse of FlowerSnake when died (true=yes)");
		ConfigWebTrapMin = ((BaseUnityPlugin)this).Config.Bind<int>("SandSpider", "WebTrapMin", 6, new ConfigDescription("The minimum number of cobweb traps spawned (1-9)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9), Array.Empty<object>()));
		ConfigWebTrapMax = ((BaseUnityPlugin)this).Config.Bind<int>("SandSpider", "WebTrapMax", 9, new ConfigDescription("The maximum number of cobweb traps spawned (1-9)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9), Array.Empty<object>()));
		if (ConfigWebTrapMax.Value < ConfigWebTrapMin.Value)
		{
			ConfigWebTrapMax.Value = ConfigWebTrapMin.Value;
			((BaseUnityPlugin)this).Config.Save();
		}
		ConfigWebTrapMin.SettingChanged += delegate
		{
			EnforceMaxConstraint();
		};
		ConfigWebTrapMax.SettingChanged += delegate
		{
			EnforceMaxConstraint();
		};
		_harmony = new Harmony("aoe.top.plugins.MyFirstBepInExMod");
		_harmony.PatchAll();
	}

	private void EnforceMaxConstraint()
	{
		ConfigWebTrapMax.SettingChanged -= delegate
		{
			EnforceMaxConstraint();
		};
		if (ConfigWebTrapMax.Value < ConfigWebTrapMin.Value)
		{
			ConfigWebTrapMax.Value = ConfigWebTrapMin.Value;
			((BaseUnityPlugin)this).Config.Save();
		}
		ConfigWebTrapMax.SettingChanged += delegate
		{
			EnforceMaxConstraint();
		};
	}

	private void OnDestroy()
	{
		_harmony.UnpatchSelf();
	}
}
[HarmonyPatch(typeof(CaveDwellerAI), "KillEnemy")]
public static class CaveDwellerAI_Patch
{
	private static void Postfix(CaveDwellerAI __instance)
	{
		if (FightingShuang.ConfigRemoveCaveDweller.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(CaveDwellerAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(HoarderBugAI), "KillEnemy")]
public static class HoarderBugAI_Patch
{
	private static void Postfix(HoarderBugAI __instance)
	{
		if (FightingShuang.ConfigRemoveHoarderBug.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(HoarderBugAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(SandSpiderAI), "KillEnemy")]
public static class SandSpiderAI_Patch
{
	private static void Postfix(SandSpiderAI __instance)
	{
		if (!FightingShuang.ConfigRemoveSandSpider.Value)
		{
			return;
		}
		try
		{
			if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer)
			{
				for (int num = __instance.webTraps.Count - 1; num >= 0; num--)
				{
					__instance.BreakWebServerRpc(num, 1);
				}
				Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
				if (value == null)
				{
					Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
					Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
				}
			}
		}
		catch (Exception arg)
		{
			Debug.LogError((object)$"错误: {arg}");
		}
	}

	private static IEnumerator DieAndDestroy(SandSpiderAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(CrawlerAI), "KillEnemy")]
public static class CrawlerAI_Patch
{
	private static void Postfix(CrawlerAI __instance)
	{
		if (FightingShuang.ConfigRemoveCrawler.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(CrawlerAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(CentipedeAI), "KillEnemy")]
public static class CentipedeAI_Patch
{
	private static void Postfix(CentipedeAI __instance)
	{
		if (FightingShuang.ConfigRemoveCentipede.Value)
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if ((((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer) && value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(CentipedeAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(MaskedPlayerEnemy), "KillEnemy")]
public static class MaskedPlayerEnemy_Patch
{
	private static void Postfix(MaskedPlayerEnemy __instance)
	{
		if (FightingShuang.ConfigRemoveMasked.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(MaskedPlayerEnemy instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(FlowermanAI), "KillEnemy")]
public static class FlowermanAI_Patch
{
	private static void Postfix(FlowermanAI __instance)
	{
		if (FightingShuang.ConfigRemoveFlowerman.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(FlowermanAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(ForestGiantAI), "KillEnemy")]
public static class ForestGiantAI_Patch
{
	private static void Postfix(ForestGiantAI __instance)
	{
		if (FightingShuang.ConfigRemoveForestGiant.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(ForestGiantAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(MouthDogAI), "KillEnemy")]
public static class MouthDogAI_Patch
{
	private static void Postfix(MouthDogAI __instance)
	{
		if (FightingShuang.ConfigRemoveMouthDog.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(MouthDogAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(BaboonBirdAI), "KillEnemy")]
public static class BaboonBirdAI_Patch
{
	private static void Postfix(BaboonBirdAI __instance)
	{
		if (FightingShuang.ConfigRemoveBaboonBird.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(BaboonBirdAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(FlowerSnakeEnemy), "KillEnemy")]
public static class FlowerSnakeEnemy_Patch
{
	private static void Postfix(FlowerSnakeEnemy __instance)
	{
		if (FightingShuang.ConfigRemoveFlowerSnake.Value && (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer))
		{
			Coroutine value = Traverse.Create((object)__instance).Field<Coroutine>("deathCoroutine").Value;
			if (value == null)
			{
				Coroutine value2 = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
				Traverse.Create((object)__instance).Field("deathCoroutine").SetValue((object)value2);
			}
		}
	}

	private static IEnumerator DieAndDestroy(FlowerSnakeEnemy instance)
	{
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(NutcrackerEnemyAI), "KillEnemy")]
public static class NutcrackerEnemyAI_Patch
{
	[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(typeof(EnemyAI), "KillEnemy")]
	public static void EnemyAI_KillEnemy(EnemyAI instance, bool destroy)
	{
	}

	private static bool Prefix(NutcrackerEnemyAI __instance, bool destroy = false)
	{
		if (FightingShuang.ConfigNutcrackerGunMod.Value)
		{
			return true;
		}
		try
		{
			EnemyAI_KillEnemy((EnemyAI)(object)__instance, destroy);
			__instance.targetTorsoDegrees = 0;
			__instance.StopInspection();
			Traverse.Create((object)__instance).Method("StopReloading", Array.Empty<object>()).GetValue();
			((EnemyAI)__instance).creatureVoice.Stop();
			__instance.torsoTurnAudio.Stop();
			((EnemyAI)__instance).creatureSFX.Stop();
			((GrabbableObject)__instance.gun).grabbable = true;
			if (((NetworkBehaviour)__instance).IsServer || ((NetworkBehaviour)__instance).IsHost)
			{
				Object.Destroy((Object)(object)((Component)__instance.gun).gameObject);
				Traverse val = Traverse.Create((object)__instance);
				if (val.Field("deathCoroutine").GetValue<Coroutine>() == null)
				{
					Coroutine value = ((MonoBehaviour)__instance).StartCoroutine(DieAndDestroy(__instance));
					val.Field("deathCoroutine").SetValue((object)value);
				}
			}
			return false;
		}
		catch (Exception)
		{
			return false;
		}
	}

	private static IEnumerator DieAndDestroy(NutcrackerEnemyAI instance)
	{
		yield return (object)new WaitForSeconds(5f);
		if ((Object)(object)instance != (Object)null && (Object)(object)((Component)instance).gameObject != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)instance).gameObject);
		}
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(ButlerEnemyAI), "ButlerBlowUpAndPop")]
public static class ButlerEnemyAI_spawn_Patch
{
	private static bool Prefix(ButlerEnemyAI __instance, ref IEnumerator __result)
	{
		__result = ModifiedButlerBlowUpAndPop(__instance);
		return false;
	}

	private static IEnumerator ModifiedButlerBlowUpAndPop(ButlerEnemyAI instance)
	{
		((EnemyAI)instance).creatureAnimator.SetTrigger("Popping");
		((EnemyAI)instance).creatureAnimator.SetLayerWeight(1, 0f);
		instance.popAudio.PlayOneShot(((EnemyAI)instance).enemyType.audioClips[3]);
		yield return (object)new WaitForSeconds(1.1f);
		((EnemyAI)instance).creatureAnimator.SetBool("popFinish", true);
		instance.popAudio.Play();
		instance.popAudioFar.Play();
		instance.popParticle.Play(true);
		float distance = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)instance).transform.position);
		if (distance < 8f)
		{
			if (FightingShuang.ConfigButlerBoomRepelled.Value)
			{
				Landmine.SpawnExplosion(((Component)instance).transform.position + Vector3.up * 0.15f, false, 0f, 2f, 30, 80f, (GameObject)null, false);
			}
			else
			{
				Landmine.SpawnExplosion(((Component)instance).transform.position + Vector3.up * 0.15f, false, 0f, 2f, 30, 0f, (GameObject)null, false);
			}
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			SoundManager.Instance.earsRingingTimer = 0.8f;
		}
		else if (distance < 27f)
		{
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}
		if (!((NetworkBehaviour)instance).IsServer && !((NetworkBehaviour)instance).IsHost)
		{
			yield break;
		}
		if (FightingShuang.ConfigSpawnBees.Value)
		{
			RoundManager.Instance.SpawnEnemyGameObject(((Component)instance).transform.position, 0f, -1, instance.butlerBeesEnemyType);
		}
		if (FightingShuang.ConfigSpawnKnife.Value)
		{
			GameObject knife = Object.Instantiate<GameObject>(instance.knifePrefab, ((Component)instance).transform.position + Vector3.up * 0.5f, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer);
			knife.GetComponent<NetworkObject>().Spawn(false);
		}
		if (FightingShuang.ConfigRemoveButler.Value)
		{
			Coroutine deathCoroutine = Traverse.Create((object)instance).Field<Coroutine>("deathCoroutine").Value;
			if (deathCoroutine == null)
			{
				Coroutine newCoroutine = ((MonoBehaviour)instance).StartCoroutine(DieAndDestroy(instance));
				Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)newCoroutine);
			}
		}
	}

	private static IEnumerator DieAndDestroy(ButlerEnemyAI instance)
	{
		instance.ambience1.Stop();
		instance.ambience1.volume = 0f;
		instance.ambience2.Stop();
		instance.ambience2.volume = 0f;
		yield return (object)new WaitForSeconds(5f);
		Object.Destroy((Object)(object)((Component)instance).gameObject);
		Traverse.Create((object)instance).Field("deathCoroutine").SetValue((object)null);
	}
}
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
public static class RoundManager_Patch
{
	private static void Postfix(RoundManager __instance, bool despawnAllItems)
	{
		if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer)
		{
			EnemyVent[] array = Object.FindObjectsOfType<EnemyVent>();
			for (int i = 0; i < array.Length; i++)
			{
				Object.Destroy((Object)(object)((Component)array[i]).gameObject);
			}
		}
	}
}
[HarmonyPatch(typeof(SandSpiderAI), "Start")]
public static class SandSpiderWeb_Patch
{
	[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPatch(typeof(EnemyAI), "Start")]
	public static void EnemyAI_Start(EnemyAI instance)
	{
	}

	private static bool Prefix(SandSpiderAI __instance)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkBehaviour)__instance).IsServer && !((NetworkBehaviour)__instance).IsHost)
		{
			return true;
		}
		EnemyAI_Start((EnemyAI)(object)__instance);
		__instance.patrolHomeBase.searchWidth = 17f;
		__instance.patrolHomeBase.searchPrecision = 3f;
		__instance.homeNode = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 2);
		Traverse val = Traverse.Create((object)__instance);
		val.Field("meshContainerPosition").SetValue((object)((Component)__instance).transform.position);
		val.Field("meshContainerTarget").SetValue((object)((Component)__instance).transform.position);
		val.Field("navHit").SetValue((object)default(NavMeshHit));
		val.Field("rayHitB").SetValue((object)default(RaycastHit));
		val.Field("meshContainerTargetRotation").SetValue((object)Quaternion.identity);
		int value = FightingShuang.ConfigWebTrapMin.Value;
		int value2 = FightingShuang.ConfigWebTrapMax.Value;
		__instance.maxWebTrapsToPlace = Random.Range(value, value2 + 1);
		return false;
	}
}