Decompiled source of AntiphobiaMod v1.0.8

Antiphobia.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AntiphobiaMod.Patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LCSoundTool;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Antiphobia")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Chdata's Antiphobia Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cde6c3e17a638a53bcbb4e0054ff954a0b134a8b")]
[assembly: AssemblyProduct("Antiphobia")]
[assembly: AssemblyTitle("Antiphobia")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AntiphobiaMod
{
	[BepInPlugin("Antiphobia", "Antiphobia", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Antiphobia");

		internal static ManualLogSource Logger;

		public static ConfigEntry<bool> configHoplophobiaTurretMode;

		public static ConfigEntry<bool> configHoplophobiaShotgunMode;

		public static ConfigEntry<int> configTrypophobiaMode;

		public static ConfigEntry<bool> configEpilepsyMode;

		public static ConfigEntry<bool> configBasscannonParticles;

		public static AssetBundle antiphobiaAssetBundle;

		public static GameObject shotgunTrumpetHorn;

		public static GameObject shotgunTrumpetBarrel;

		private static AudioClip soundTrumpetBlast;

		private static AudioClip soundTrumpetBlast2;

		private static AudioClip soundTrumpetBlastFail;

		public static GameObject turretBasscannon;

		private static AudioClip soundCannonBass;

		private static AudioClip soundCannonMuffle;

		private static AudioClip soundCannonWall;

		public static Material beeHiveMaterial;

		public static GameObject beeHivePopcorn;

		public static readonly Dictionary<ulong, TurretMode> turretModeLastFrameDict = new Dictionary<ulong, TurretMode>();

		public static readonly Dictionary<ulong, float> turretBerserkTimerDict = new Dictionary<ulong, float>();

		public static readonly Dictionary<ulong, bool> turretEnteringBerserkModeDict = new Dictionary<ulong, bool>();

		public static readonly Dictionary<ulong, ParticleSystem> basscannonParticleDict = new Dictionary<ulong, ParticleSystem>();

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin Antiphobia is loaded, huzzah!");
			configHoplophobiaTurretMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Hoplophobia Mode Turret", true, "If true, replaces Turret with Basscannon");
			configHoplophobiaShotgunMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Hoplophobia Mode Shotgun", true, "If true, replaces Shotgun with Trumpet.");
			configTrypophobiaMode = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Trypophobia Mode", 2, "0 = Disabled, 1 = replace texture, 2 = popcorn. Replaces the Circuit Bee Hive.");
			configEpilepsyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Epilepsy Mode", false, "If true, stops the fan from spinning in the Bunker Facility Start Room.");
			configBasscannonParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Basscannon Particles", true, "If false, it disables the Basscannon particle effects in Hoplophobia Mode.");
			LoadAssets();
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(BunkerSpiderPatch));
			harmony.PatchAll(typeof(CircuitBeesPatch));
			harmony.PatchAll(typeof(ShotgunPatch));
			harmony.PatchAll(typeof(TurretPatch));
		}

		private void LoadAssets()
		{
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "antiphobia.assetbundle");
			Logger.LogInfo((object)text);
			antiphobiaAssetBundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)antiphobiaAssetBundle == (Object)null)
			{
				Logger.LogError((object)"Could not find Antiphobia Asset Bundle! File \"antiphobia.assetbundle\" needs to be moved to the same folder as the .dll");
			}
			beeHiveMaterial = antiphobiaAssetBundle.LoadAsset<Material>("Assets/Import/Antiphobia/mat_redlocusthive.mat");
			if ((Object)(object)beeHiveMaterial == (Object)null)
			{
				Logger.LogError((object)"Beehive material failed to load!");
			}
			beeHivePopcorn = antiphobiaAssetBundle.LoadAsset<GameObject>("Assets/Import/Antiphobia/popcorn.prefab");
			if ((Object)(object)beeHivePopcorn == (Object)null)
			{
				Logger.LogError((object)"Beehive popcorn failed to load!");
			}
			turretBasscannon = antiphobiaAssetBundle.LoadAsset<GameObject>("Assets/Import/Antiphobia/Basscannon.prefab");
			if ((Object)(object)turretBasscannon == (Object)null)
			{
				Logger.LogError((object)"Basscannon failed to load!");
			}
			shotgunTrumpetHorn = antiphobiaAssetBundle.LoadAsset<GameObject>("Assets/Import/Antiphobia/TrumpetHorn.prefab");
			if ((Object)(object)shotgunTrumpetHorn == (Object)null)
			{
				Logger.LogError((object)"Trumpet Horn failed to load!");
			}
			shotgunTrumpetBarrel = antiphobiaAssetBundle.LoadAsset<GameObject>("Assets/Import/Antiphobia/TrumpetBarrel.prefab");
			if ((Object)(object)shotgunTrumpetBarrel == (Object)null)
			{
				Logger.LogError((object)"Trumpet Barrel failed to load!");
			}
			Logger.LogInfo((object)"Finished loading assets!");
		}

		private void Start()
		{
			Logger.LogInfo((object)"--=== START ===--");
			if ((Object)(object)antiphobiaAssetBundle == (Object)null)
			{
				Logger.LogError((object)"Could not find Antiphobia Asset Bundle! File \"antiphobia.assetbundle\" needs to be moved to the same folder as the .dll");
			}
			if (configHoplophobiaShotgunMode.Value)
			{
				soundTrumpetBlast = antiphobiaAssetBundle.LoadAsset<AudioClip>("Assets/Import/Antiphobia/sfx/TrumpetBlast.wav");
				soundTrumpetBlast2 = antiphobiaAssetBundle.LoadAsset<AudioClip>("Assets/Import/Antiphobia/sfx/TrumpetBlast2.wav");
				soundTrumpetBlastFail = antiphobiaAssetBundle.LoadAsset<AudioClip>("Assets/Import/Antiphobia/sfx/TrumpetBlastFail.wav");
				if ((Object)(object)soundTrumpetBlastFail == (Object)null)
				{
					Logger.LogError((object)"Failed to load Trumpet sounds! File \"antiphobia.assetbundle\" needs to be moved to the same folder as the .dll");
				}
				SoundTool.ReplaceAudioClip("ShotgunBlast", soundTrumpetBlast);
				SoundTool.ReplaceAudioClip("ShotgunBlast2", soundTrumpetBlast2);
				SoundTool.ReplaceAudioClip("ShotgunBlastFail", soundTrumpetBlastFail);
			}
			if (configHoplophobiaTurretMode.Value)
			{
				soundCannonBass = antiphobiaAssetBundle.LoadAsset<AudioClip>("Assets/Import/Antiphobia/sfx/CannonBass.wav");
				soundCannonMuffle = antiphobiaAssetBundle.LoadAsset<AudioClip>("Assets/Import/Antiphobia/sfx/CannonMuffle.wav");
				soundCannonWall = antiphobiaAssetBundle.LoadAsset<AudioClip>("Assets/Import/Antiphobia/sfx/CannonWall.wav");
				if ((Object)(object)soundCannonWall == (Object)null)
				{
					Logger.LogError((object)"Failed to load Basscannon sounds! File \"antiphobia.assetbundle\" needs to be moved to the same folder as the .dll");
				}
				SoundTool.ReplaceAudioClip("TurretFire", soundCannonBass);
				SoundTool.ReplaceAudioClip("TurretFireDistance", soundCannonMuffle);
				SoundTool.ReplaceAudioClip("TurretWallHits", soundCannonWall);
			}
			Logger.LogInfo((object)"--=== All sounds are loaded! ===--");
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPostfix]
		private static void OnLoadNewLevel()
		{
			Logger.LogInfo((object)("Client is host: " + ((NetworkBehaviour)RoundManager.Instance).IsHost));
			turretModeLastFrameDict.Clear();
			turretBerserkTimerDict.Clear();
			turretEnteringBerserkModeDict.Clear();
			basscannonParticleDict.Clear();
			((MonoBehaviour)RoundManager.Instance).StartCoroutine(BunkerInterior.PatchStartRoom());
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Antiphobia";

		public const string PLUGIN_NAME = "Antiphobia";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace AntiphobiaMod.Patches
{
	internal class BunkerInterior
	{
		public static IEnumerator PatchStartRoom()
		{
			yield return (object)new WaitForSeconds(5f);
			if (!Plugin.configEpilepsyMode.Value)
			{
				yield break;
			}
			Plugin.Logger.LogInfo((object)"Searching for Industrial Fan");
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val in array)
			{
				if (((Object)val).name.StartsWith("IndustrialFan"))
				{
					Plugin.Logger.LogInfo((object)"Found Industrial Fan and turned it off!");
					Animator component = val.GetComponent<Animator>();
					if ((Object)(object)component != (Object)null)
					{
						((Behaviour)component).enabled = false;
					}
				}
			}
		}
	}
	internal class BunkerSpiderPatch
	{
		[HarmonyPatch(typeof(SandSpiderAI), "Start")]
		[HarmonyPostfix]
		public static void OnBunkerSpiderStart(SandSpiderAI __instance)
		{
			Plugin.Logger.LogInfo((object)"--=== Bunker Spider Summoned ===--");
			Plugin.Logger.LogInfo((object)"--=== Fixing Bunker Spider... ===--");
			Transform obj = ((Component)__instance).transform.Find("MeshContainer");
			if ((Object)(object)obj == (Object)null)
			{
				Plugin.Logger.LogError((object)"--=== NOT FOUND ===--");
			}
			else
			{
				Plugin.Logger.LogInfo((object)"--=== FOUND ===--");
			}
			((Renderer)((Component)obj.Find("AnimContainer").Find("Armature").Find("Head")
				.Find("RightFang")).gameObject.GetComponent<MeshRenderer>()).enabled = false;
			((Renderer)((Component)obj.Find("AnimContainer").Find("Armature").Find("Head")
				.Find("LeftFang")).gameObject.GetComponent<MeshRenderer>()).enabled = false;
		}
	}
	internal class CircuitBeesPatch
	{
		[HarmonyPatch(typeof(RedLocustBees), "Start")]
		[HarmonyPostfix]
		public static void OnRedLocustBeesStart(RedLocustBees __instance)
		{
			Plugin.Logger.LogInfo((object)"--=== Circuit Bees Summoned ===--");
			Plugin.Logger.LogInfo((object)"--=== Fixing Circuit Bee Hive... ===--");
			switch (Plugin.configTrypophobiaMode.Value)
			{
			case 1:
				((Renderer)((Component)__instance.hive).gameObject.GetComponent<MeshRenderer>()).material = Plugin.beeHiveMaterial;
				Plugin.Logger.LogInfo((object)"--=== Changed to Wood! ===--");
				break;
			case 2:
				CreatePopcornAndParentTo(((Component)__instance.hive).transform);
				((Renderer)((Component)((Component)__instance.hive).gameObject.transform).GetComponent<MeshRenderer>()).enabled = false;
				Plugin.Logger.LogInfo((object)"--=== Changed to Popcorn! ===--");
				break;
			}
		}

		private static void CreatePopcornAndParentTo(Transform parentModel)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(Plugin.beeHivePopcorn);
			obj.transform.SetParent(parentModel);
			obj.transform.localPosition = Vector3.zero;
			obj.transform.localRotation = Quaternion.identity;
		}

		[HarmonyPatch(typeof(GrabbableObject), "EquipItem")]
		[HarmonyPostfix]
		public static void OnBeehiveEquipItem(GrabbableObject __instance)
		{
			HideBeehiveGraphics(__instance);
		}

		[HarmonyPatch(typeof(GrabbableObject), "DiscardItem")]
		[HarmonyPostfix]
		public static void OnBeehiveDiscardItem(GrabbableObject __instance)
		{
			HideBeehiveGraphics(__instance);
		}

		private static void HideBeehiveGraphics(GrabbableObject theHive)
		{
			if (!(theHive.itemProperties.itemName != "Hive"))
			{
				((Renderer)((Component)((Component)theHive).gameObject.transform).GetComponent<MeshRenderer>()).enabled = false;
			}
		}
	}
	internal class ShotgunPatch
	{
		[HarmonyPatch(typeof(ShotgunItem), "Start")]
		[HarmonyPostfix]
		public static void OnShotgunItemStart(ShotgunItem __instance)
		{
			Plugin.Logger.LogInfo((object)"--=== Shotgun Summoned ===--");
			if (Plugin.configHoplophobiaShotgunMode.Value)
			{
				Plugin.Logger.LogInfo((object)"--=== Fixing Shotgun... ===--");
				Transform parentModel = ((Component)__instance).gameObject.transform.Find("GunBarrel");
				Transform parentModel2 = ((Component)__instance).gameObject.transform.Find("GunHandleLOD1");
				HideShotgunGraphics(__instance);
				CreateTrumpetHornAndParentTo(parentModel);
				CreateTrumpetBarrelAndParentTo(parentModel2);
			}
		}

		[HarmonyPatch(typeof(ShotgunItem), "EquipItem")]
		[HarmonyPostfix]
		public static void OnShotgunEquipItem(ShotgunItem __instance)
		{
			HideShotgunGraphics(__instance);
		}

		[HarmonyPatch(typeof(ShotgunItem), "DiscardItem")]
		[HarmonyPostfix]
		public static void OnShotgunDiscardItem(ShotgunItem __instance)
		{
			HideShotgunGraphics(__instance);
		}

		private static void HideShotgunGraphics(ShotgunItem theShotgun)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = ((Component)theShotgun).gameObject.transform.Find("GunBarrel");
			Transform val = ((Component)theShotgun).gameObject.transform.Find("GunHandleLOD1");
			((Renderer)((Component)((Component)theShotgun).gameObject.transform).GetComponent<MeshRenderer>()).enabled = false;
			((Renderer)((Component)obj).GetComponent<MeshRenderer>()).enabled = false;
			((Renderer)((Component)obj.Find("GunBarrelLOD1")).GetComponent<MeshRenderer>()).enabled = false;
			((Renderer)((Component)val).GetComponent<MeshRenderer>()).enabled = false;
			TrailModule trails = ((Component)obj.Find("GunShootRayPoint").Find("BulletParticle")).GetComponent<ParticleSystem>().trails;
			((TrailModule)(ref trails)).enabled = false;
			SizeOverLifetimeModule sizeOverLifetime = ((Component)obj.Find("GunShootRayPoint").Find("BulletParticle").Find("BulletParticleFlare")).GetComponent<ParticleSystem>().sizeOverLifetime;
			AnimationCurve val2 = new AnimationCurve();
			val2.AddKey(0f, 0f);
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(0f, val2);
		}

		private static void CreateTrumpetHornAndParentTo(Transform parentModel)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(Plugin.shotgunTrumpetHorn);
			obj.transform.SetParent(parentModel);
			obj.transform.localPosition = Vector3.zero;
			obj.transform.localRotation = Quaternion.Euler(-90f, 40f, 0f);
		}

		private static void CreateTrumpetBarrelAndParentTo(Transform parentModel)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(Plugin.shotgunTrumpetBarrel);
			obj.transform.SetParent(parentModel);
			obj.transform.localPosition = new Vector3(-0.075f, 0f, 0f);
			obj.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
		}
	}
	internal class TurretPatch
	{
		[HarmonyPatch(typeof(Turret), "Start")]
		[HarmonyPostfix]
		public static void OnTurretStart(Turret __instance)
		{
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Logger.LogInfo((object)"--=== Turret Summoned ===--");
			if (Plugin.configHoplophobiaTurretMode.Value)
			{
				Plugin.turretModeLastFrameDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, (TurretMode)0);
				Plugin.turretBerserkTimerDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, 0f);
				Plugin.turretEnteringBerserkModeDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, value: false);
				Transform val = ((Component)__instance).gameObject.transform.parent.Find("MeshContainer").Find("RotatingRodContainer").Find("Rod")
					.Find("GunBody");
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Logger.LogInfo((object)"--=== Failed Turret... ===--");
				}
				((Renderer)((Component)val).GetComponent<MeshRenderer>()).enabled = false;
				((Renderer)((Component)val.Find("Magazine")).GetComponent<MeshRenderer>()).enabled = false;
				ParticleSystem component = ((Component)val.Find("GunBarrelPos").Find("BulletParticle")).GetComponent<ParticleSystem>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Logger.LogInfo((object)"--=== Failed Turret Particles... ===--");
				}
				TrailModule trails = component.trails;
				((TrailModule)(ref trails)).enabled = false;
				ParticleSystem component2 = ((Component)val.Find("GunBarrelPos").Find("BulletParticle").Find("BulletParticleFlare")).GetComponent<ParticleSystem>();
				if ((Object)(object)component2 == (Object)null)
				{
					Plugin.Logger.LogInfo((object)"--=== Failed Flared Particles... ===--");
				}
				SizeOverLifetimeModule sizeOverLifetime = component2.sizeOverLifetime;
				AnimationCurve val2 = new AnimationCurve();
				val2.AddKey(0f, 0f);
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(0f, val2);
				CreateBasscannonAndParentTo(__instance, val);
				Plugin.Logger.LogInfo((object)"--=== Reformed Turret... ===--");
			}
		}

		private static void CreateBasscannonAndParentTo(Turret __instance, Transform parentModel)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(Plugin.turretBasscannon);
			val.transform.SetParent(parentModel);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.Euler(-90f, -90f, 0f);
			((Component)val.transform.Find("roar")).transform.localRotation = Quaternion.Euler(0f, -3.75f, 0f);
			Plugin.basscannonParticleDict.Add(((NetworkBehaviour)__instance).NetworkObjectId, ((Component)val.transform.Find("roar")).GetComponent<ParticleSystem>());
			((Component)Plugin.basscannonParticleDict[((NetworkBehaviour)__instance).NetworkObjectId]).transform.SetParent(parentModel.parent, true);
		}

		[HarmonyPatch(typeof(Turret), "Update")]
		[HarmonyPostfix]
		public static void OnTurretUpdate(Turret __instance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected I4, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Invalid comparison between Unknown and I4
			if (!Plugin.configHoplophobiaTurretMode.Value || !Plugin.configBasscannonParticles.Value || !__instance.turretActive)
			{
				return;
			}
			TurretMode turretMode = __instance.turretMode;
			switch ((int)turretMode)
			{
			case 0:
				if ((int)Plugin.turretModeLastFrameDict[((NetworkBehaviour)__instance).NetworkObjectId] != 0)
				{
					Plugin.turretModeLastFrameDict[((NetworkBehaviour)__instance).NetworkObjectId] = (TurretMode)0;
					((Component)GetCustomParticleSystem(__instance)).gameObject.SetActive(false);
				}
				break;
			case 2:
				if ((int)Plugin.turretModeLastFrameDict[((NetworkBehaviour)__instance).NetworkObjectId] != 2)
				{
					Plugin.turretModeLastFrameDict[((NetworkBehaviour)__instance).NetworkObjectId] = (TurretMode)2;
					((Component)GetCustomParticleSystem(__instance)).gameObject.SetActive(true);
				}
				break;
			case 3:
				if ((int)Plugin.turretModeLastFrameDict[((NetworkBehaviour)__instance).NetworkObjectId] != 3)
				{
					Plugin.turretModeLastFrameDict[((NetworkBehaviour)__instance).NetworkObjectId] = (TurretMode)3;
					Plugin.turretBerserkTimerDict[((NetworkBehaviour)__instance).NetworkObjectId] = 1.3f;
					Plugin.turretEnteringBerserkModeDict[((NetworkBehaviour)__instance).NetworkObjectId] = true;
				}
				if (Plugin.turretEnteringBerserkModeDict[((NetworkBehaviour)__instance).NetworkObjectId])
				{
					Plugin.turretBerserkTimerDict[((NetworkBehaviour)__instance).NetworkObjectId] -= Time.deltaTime;
					Plugin.turretBerserkTimerDict[((NetworkBehaviour)__instance).NetworkObjectId] -= Time.deltaTime;
					if (Plugin.turretBerserkTimerDict[((NetworkBehaviour)__instance).NetworkObjectId] <= 0f)
					{
						Plugin.turretEnteringBerserkModeDict[((NetworkBehaviour)__instance).NetworkObjectId] = false;
						Plugin.turretBerserkTimerDict[((NetworkBehaviour)__instance).NetworkObjectId] = 9f;
						((Component)GetCustomParticleSystem(__instance)).gameObject.SetActive(true);
					}
				}
				else if (((NetworkBehaviour)__instance).IsServer)
				{
					Plugin.turretBerserkTimerDict[((NetworkBehaviour)__instance).NetworkObjectId] -= Time.deltaTime;
				}
				break;
			case 1:
				break;
			}
		}

		public static ParticleSystem GetCustomParticleSystem(Turret theTurret)
		{
			return Plugin.basscannonParticleDict[((NetworkBehaviour)theTurret).NetworkObjectId];
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}