Decompiled source of EpilepsyPatch v1.0.22

EpilepsyPatch.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EpilepsyPatch.patches;
using EpilepsyPatch.tools;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EpilepsyPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EpilepsyPatch")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("448af8f1-1e7e-4222-9304-828f2daea2bb")]
[assembly: AssemblyFileVersion("1.0.22.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.22.0")]
namespace EpilepsyPatch
{
	[BepInPlugin("LongParsnip.EpilepsyPatch", "EpilepsyPatch", "1.0.22.0")]
	public class EpilepsyPatchBase : BaseUnityPlugin
	{
		private const string modGUID = "LongParsnip.EpilepsyPatch";

		private const string modName = "EpilepsyPatch";

		private const string modVersion = "1.0.22.0";

		public const bool LogDebugMessages = false;

		private readonly Harmony harmony = new Harmony("LongParsnip.EpilepsyPatch");

		private static EpilepsyPatchBase Instance;

		private ManualLogSource mls;

		public static string StunGrenadeExplosionDisabledKey = "Disable stun grenade explosion";

		public static string StunGrenadeFilterDisabledKey = "Disable stun grenade flashed effect";

		public static string ScanBlueFlashDisabledKey = "Disable scan blue flash effect";

		public static string GettingFiredLightDisabledKey = "Getting fired red flashing light disabled";

		public static string DisableGlobalNotificationsKey = "Disable global notifications";

		public static string DisableRadiationWarningKey = "Disable radiation warning";

		public static string ReplaceWarningWithHintKey = "Replace warning with hint";

		public static string ForceShipLightsOnKey = "Force ship lights on";

		public static string HideLightningStrikesKey = "Hide lightning strikes";

		public static string HideLightningExplosionsKey = "Hide lightning explosions";

		public static string DisableFearScreenFilterKey = "Disable fear screen filter";

		public static string DisableBeeZapsKey = "Disable bee zaps";

		public static string DisableBeamUpParticlesKey = "Disable beam up particles";

		public static string PreventFlashlightSpamKey = "Prevent flashlight spam";

		public static string FlashlightSpamCooldownKey = "Flashlight spam cooldown";

		public static string DisablePlayerMonitorBlinkKey = "Disable player monitor blink";

		public static string DisableStartRoomFanKey = "Disable the fan in the start room";

		public static string HideTerminalCaretKey = "Hide terminal caret";

		public static string DisableChargerAnimationKey = "Disable charger animation";

		public static string TryToHideTurretBulletsKey = "Try to hide turret bullets";

		public static string DisableRadarBoosterAnimationKey = "Disable radar booster animation";

		public static string DisableRadarBoosterFlashKey = "Disable radar booster flash";

		public static string DisableLandminesKey = "Disable landmines";

		public static string DisableFogKey = "Disable fog";

		public static string DisableVolumetricFogKey = "Disable volumetric fog";

		public static string DisableFogMovementKey = "Disable Fog Movement";

		public static string DisableFoggyModifierKey = "Disable foggy modifier";

		public static string DisableFPVHelmetKey = "Disable FPV helmet";

		public static string DisableFPVHelmetGlassKey = "Disable helmet glass";

		public static string DisableCriticalHealthMessageKey = "Disable critical health message";

		public static string DisableCustomShaderKey = "Disable custom pass shader";

		public static string DisableMiscReflectionsKey = "Disable misc reflections";

		public static string TryToStopTooltipFlashKey = "Try to stop tooltips flashing";

		public static string DisableTZPinhalentFilterKey = "Disble TZP filter";

		public static ConfigEntry<bool> StunGrenadeExplosionDisabled;

		public static ConfigEntry<bool> StunGrenadeFilterDisabled;

		public static ConfigEntry<bool> ScanBlueFlashDisabled;

		public static ConfigEntry<bool> GettingFiredLightDisabled;

		public static ConfigEntry<bool> DisableGlobalNotifications;

		public static ConfigEntry<bool> DisableRadiationWarning;

		public static ConfigEntry<bool> ReplaceWarningWithHint;

		public static ConfigEntry<bool> ForceShipLightsOn;

		public static ConfigEntry<bool> HideLightningStrikes;

		public static ConfigEntry<bool> HideLightningExplosions;

		public static ConfigEntry<bool> DisableFearScreenFilter;

		public static ConfigEntry<bool> DisableBeeZaps;

		public static ConfigEntry<bool> DisableBeamUpParticles;

		public static ConfigEntry<bool> PreventFlashlightSpam;

		public static ConfigEntry<float> FlashlightSpamCooldown;

		public static ConfigEntry<bool> DisablePlayerMonitorBlink;

		public static ConfigEntry<bool> DisableStartRoomFan;

		public static ConfigEntry<bool> HideTerminalCaret;

		public static ConfigEntry<bool> DisableChargerAnimation;

		public static ConfigEntry<bool> TryToHideTurretBullets;

		public static ConfigEntry<bool> DisableRadarBoosterAnimation;

		public static ConfigEntry<bool> DisableRadarBoosterFlash;

		public static ConfigEntry<bool> DisableLandmines;

		public static ConfigEntry<bool> DisableFog;

		public static ConfigEntry<bool> DisableFPVHelmet;

		public static ConfigEntry<bool> DisableFPVHelmetGlass;

		public static ConfigEntry<bool> DisableVolumetricFog;

		public static ConfigEntry<bool> DisableCriticalHealthMessage;

		public static ConfigEntry<bool> DisableFogMovement;

		public static ConfigEntry<bool> DisableCustomShader;

		public static ConfigEntry<bool> DisableMiscReflections;

		public static ConfigEntry<bool> TryToStopTooltipFlash;

		public static ConfigEntry<bool> DisableFoggyModifier;

		public static ConfigEntry<bool> DisableTZPinhalentFilter;

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Expected O, but got Unknown
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Expected O, but got Unknown
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Expected O, but got Unknown
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Expected O, but got Unknown
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Expected O, but got Unknown
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Expected O, but got Unknown
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Expected O, but got Unknown
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Expected O, but got Unknown
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Expected O, but got Unknown
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Expected O, but got Unknown
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Expected O, but got Unknown
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Expected O, but got Unknown
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Expected O, but got Unknown
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Expected O, but got Unknown
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Expected O, but got Unknown
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Expected O, but got Unknown
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Expected O, but got Unknown
			StunGrenadeExplosionDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", StunGrenadeExplosionDisabledKey, true, new ConfigDescription("Should the stun grenade explosion animation be disabled.", (AcceptableValueBase)null, Array.Empty<object>()));
			StunGrenadeFilterDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", StunGrenadeFilterDisabledKey, true, new ConfigDescription("Should the stun grenade stunned filter be disabled.", (AcceptableValueBase)null, Array.Empty<object>()));
			ScanBlueFlashDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", ScanBlueFlashDisabledKey, true, new ConfigDescription("Should the blue flash when scanning be disabled.", (AcceptableValueBase)null, Array.Empty<object>()));
			GettingFiredLightDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", GettingFiredLightDisabledKey, true, new ConfigDescription("Should the red light when getting fired be disabled", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableGlobalNotifications = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableGlobalNotificationsKey, false, new ConfigDescription("Should global notifications be disabled", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableRadiationWarning = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableRadiationWarningKey, true, new ConfigDescription("Should the radiation warning be disabled", (AcceptableValueBase)null, Array.Empty<object>()));
			ReplaceWarningWithHint = ((BaseUnityPlugin)this).Config.Bind<bool>("General", ReplaceWarningWithHintKey, true, new ConfigDescription("Should warnings be replaced with hints", (AcceptableValueBase)null, Array.Empty<object>()));
			ForceShipLightsOn = ((BaseUnityPlugin)this).Config.Bind<bool>("General", ForceShipLightsOnKey, true, new ConfigDescription("Should ship lights always be forced to be on", (AcceptableValueBase)null, Array.Empty<object>()));
			HideLightningStrikes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", HideLightningStrikesKey, true, new ConfigDescription("Should lightning strikes be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			HideLightningExplosions = ((BaseUnityPlugin)this).Config.Bind<bool>("General", HideLightningExplosionsKey, true, new ConfigDescription("Should explosions from lightning strikes be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableFearScreenFilter = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableFearScreenFilterKey, true, new ConfigDescription("Should the fear effect screen filter be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableBeeZaps = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableBeeZapsKey, true, new ConfigDescription("Should the bee zap effect be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableBeamUpParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableBeamUpParticlesKey, true, new ConfigDescription("Should the particle effect when being beamed up be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			PreventFlashlightSpam = ((BaseUnityPlugin)this).Config.Bind<bool>("General", PreventFlashlightSpamKey, true, new ConfigDescription("Prevent the flashlight from being spammed on and off", (AcceptableValueBase)null, Array.Empty<object>()));
			FlashlightSpamCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", FlashlightSpamCooldownKey, 2f, new ConfigDescription("Time in seconds for network players flashlight to be on cooldown for, this is to prevent spamming. Note: this may cause the state to not be synchronised.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			DisablePlayerMonitorBlink = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisablePlayerMonitorBlinkKey, true, new ConfigDescription("Should the screen blink when switching players on the monitor animation be removed", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableStartRoomFan = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableStartRoomFanKey, true, new ConfigDescription("Should the fan in the enterance of the facility be stopped from spinning", (AcceptableValueBase)null, Array.Empty<object>()));
			HideTerminalCaret = ((BaseUnityPlugin)this).Config.Bind<bool>("General", HideTerminalCaretKey, true, new ConfigDescription("Should the blinking caret on the terminal be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableChargerAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableChargerAnimationKey, true, new ConfigDescription("Should the Charger sparks animation be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			TryToHideTurretBullets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", TryToHideTurretBulletsKey, true, new ConfigDescription("Attemps to hide the bullets from the turret, hit detection may be affected", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableRadarBoosterAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableRadarBoosterAnimationKey, true, new ConfigDescription("Should the spinning animation on the radar booster be hidden", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableRadarBoosterFlash = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableRadarBoosterFlashKey, true, new ConfigDescription("Prevents the radar booster from flashing, unfortunately this means it wont work... sorry.", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableLandmines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableLandminesKey, false, new ConfigDescription("Stops landmines exploding... also means they wont kill you.", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableFogKey, true, new ConfigDescription("Disables all fog in the rendering gameobject.", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableVolumetricFog = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableVolumetricFogKey, true, new ConfigDescription("Disables volumetric fog (3D fog) only", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableFogMovement = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableFogMovementKey, true, new ConfigDescription("Stops the movement of the outdoors volumetric fog which can cause strobing near light sources. Note for this to work the other fog settings need to be set to false", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableFPVHelmet = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableFPVHelmetKey, true, new ConfigDescription("Disables the first person helmet 3D model, in the rendering gamebobject, because light can reflect off the glass and flash.", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableFPVHelmetGlass = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableFPVHelmetGlassKey, true, new ConfigDescription("Disables only the glass on the FPV helmet", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableCriticalHealthMessage = ((BaseUnityPlugin)this).Config.Bind<bool>("General", DisableCriticalHealthMessageKey, true, new ConfigDescription("Disables the warning message when health is critical", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableCustomShader = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", DisableCustomShaderKey, true, new ConfigDescription("Disables the custom shader that does the outlining and produces the harsh colour gradients", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableMiscReflections = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", DisableMiscReflectionsKey, true, new ConfigDescription("Disables misc reflections that can cause flickering", (AcceptableValueBase)null, Array.Empty<object>()));
			TryToStopTooltipFlash = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", TryToStopTooltipFlashKey, true, new ConfigDescription("Attempts to prevent the animator from making the tooltip messages from flashing", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableFoggyModifier = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", DisableFoggyModifierKey, true, new ConfigDescription("Disables the foggy weather modifier, incase the fog is too intense for some players", (AcceptableValueBase)null, Array.Empty<object>()));
			DisableTZPinhalentFilter = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", DisableTZPinhalentFilterKey, true, new ConfigDescription("Disables the drunk effect when taking TZP inhalent", (AcceptableValueBase)null, Array.Empty<object>()));
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("LongParsnip.EpilepsyPatch");
			mls.LogInfo((object)"EpilepsyPatch is awake and needs coffee.");
			harmony.PatchAll(typeof(StunGrenadePatch));
			harmony.PatchAll(typeof(StunGrenadeExplosionPatch));
			harmony.PatchAll(typeof(PingScan_performedPatch));
			harmony.PatchAll(typeof(DisplayGlobalNotification_Patch));
			harmony.PatchAll(typeof(RadiationWarningHUD_Patch));
			harmony.PatchAll(typeof(DisplayTip_Patch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(LightningPatch));
			harmony.PatchAll(typeof(insanityFilterPatch));
			harmony.PatchAll(typeof(BeeZapPatch));
			harmony.PatchAll(typeof(SwitchFlashlightSpamPatch));
			harmony.PatchAll(typeof(ManualCameraRendererPatch));
			harmony.PatchAll(typeof(Tools_ListAllGameObjects));
			harmony.PatchAll(typeof(StopEntryRoomFan));
			harmony.PatchAll(typeof(TerminalPatch));
			harmony.PatchAll(typeof(ItemChargerPatch));
			harmony.PatchAll(typeof(StopTurretAnimator));
			harmony.PatchAll(typeof(StopLandmine));
			harmony.PatchAll(typeof(RadarBoosterPatch));
			harmony.PatchAll(typeof(RadarBoosterPatch2));
			harmony.PatchAll(typeof(ToolTipFlashPatch));
		}

		public static bool IsRandomRangeCall(CodeInstruction instruction)
		{
			return instruction.opcode == OpCodes.Call && instruction.operand is MethodInfo methodInfo && methodInfo.DeclaringType == typeof(Random) && methodInfo.Name == "Range";
		}

		public static void LogDebuggingMessages(CodeInstruction instruction, int i)
		{
			Debug.Log((object)$"Opcode at index {i}: {instruction.opcode}");
			if (instruction.operand is FieldInfo fieldInfo)
			{
				Debug.Log((object)$"Field Name: {fieldInfo.Name}, Declaring Type: {fieldInfo.DeclaringType}");
			}
			if (IsRandomRangeCall(instruction))
			{
				Debug.Log((object)$"Found the call to UnityEngine.Random.Range at index {i}");
			}
		}
	}
}
namespace EpilepsyPatch.tools
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class Tools_ListAllGameObjects
	{
		private static bool hasTriggered1;

		private static bool hasTriggered2;

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Postfix(Tools_ListAllGameObjects __instance)
		{
			if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f10Key).wasPressedThisFrame && !hasTriggered1)
			{
				hasTriggered1 = true;
			}
			if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f11Key).wasPressedThisFrame && !hasTriggered2)
			{
				LogGOinformation(__instance, "VolumeMain");
				hasTriggered2 = true;
			}
		}

		private static void ListGameObjects(Tools_ListAllGameObjects toolsInstance)
		{
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			Debug.Log((object)"List of GameObjects:");
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				Debug.Log((object)((Object)val).name);
			}
		}

		private static void ListRenderingGameObjects(Tools_ListAllGameObjects toolsInstance)
		{
			GameObject val = GameObject.Find("Plane");
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)"List of Child GameObjects under 'Rendering':");
				for (int i = 0; i < val.transform.childCount; i++)
				{
					Transform child = val.transform.GetChild(i);
					Debug.Log((object)((Object)((Component)child).gameObject).name);
				}
			}
			else
			{
				Debug.LogError((object)"No 'Rendering' GameObject found in the scene");
			}
		}

		private static void LogGOinformation(Tools_ListAllGameObjects toolsInstance, string gObject)
		{
			GameObject val = GameObject.Find(gObject);
			if ((Object)(object)val != (Object)null)
			{
				Component[] components = val.GetComponents<Component>();
				Component[] array = components;
				foreach (Component val2 in array)
				{
					Debug.Log((object)("Parameters of " + ((object)val2).GetType().Name + " on " + gObject + " GameObject:"));
					Type type = ((object)val2).GetType();
					FieldInfo[] fields = type.GetFields();
					PropertyInfo[] properties = type.GetProperties();
					FieldInfo[] array2 = fields;
					foreach (FieldInfo fieldInfo in array2)
					{
						Debug.Log((object)$"{fieldInfo.Name}: {fieldInfo.GetValue(val2)}");
					}
					PropertyInfo[] array3 = properties;
					foreach (PropertyInfo propertyInfo in array3)
					{
						Debug.Log((object)$"{propertyInfo.Name}: {propertyInfo.GetValue(val2)}");
					}
				}
			}
			else
			{
				Debug.LogError((object)("No " + gObject + " GameObject found in the scene"));
			}
		}
	}
}
namespace EpilepsyPatch.patches
{
	[HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")]
	public static class FlashlightSpamPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = 0;
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.PreventFlashlightSpam.Value && list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo fieldInfo && fieldInfo.Name == "flashlightBulb")
				{
					if (num == 1)
					{
						list[i - 1].opcode = OpCodes.Nop;
						list[i].opcode = OpCodes.Nop;
						list[i + 1].opcode = OpCodes.Nop;
						list[i + 2].opcode = OpCodes.Nop;
						Debug.Log((object)"Flashlight bulb replaced with NOP");
					}
					else
					{
						num++;
					}
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(FlashlightItem), "Update")]
	public static class SwitchFlashlightPatch
	{
		[HarmonyPrefix]
		public static void Prefix(FlashlightItem __instance)
		{
			((GrabbableObject)__instance).useCooldown = 0.5f;
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	[HarmonyPatch("PingScan_performed")]
	public static class PingScan_performedPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (EpilepsyPatchBase.ScanBlueFlashDisabled.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "scan")
				{
					list[i - 2].opcode = OpCodes.Nop;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					Debug.Log((object)"Scan animation replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	[HarmonyPatch("DisplayGlobalNotification")]
	public static class DisplayGlobalNotification_Patch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (EpilepsyPatchBase.DisableGlobalNotifications.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "TriggerNotif")
				{
					list[i - 2].opcode = OpCodes.Nop;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					Debug.Log((object)"Notification animation replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	[HarmonyPatch("RadiationWarningHUD")]
	public static class RadiationWarningHUD_Patch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (EpilepsyPatchBase.DisableRadiationWarning.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "RadiationWarning")
				{
					list[i - 2].opcode = OpCodes.Nop;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					Debug.Log((object)"Radiation warning replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	[HarmonyPatch("DisplayTip")]
	public static class DisplayTip_Patch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (EpilepsyPatchBase.ReplaceWarningWithHint.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "TriggerWarning")
				{
					list[i].operand = "TriggerHint";
					Debug.Log((object)"TriggerWarning replaced with TriggerHint");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class insanityFilterPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void shipLightsPatch(HUDManager __instance)
		{
			if (EpilepsyPatchBase.DisableFearScreenFilter.Value)
			{
				__instance.insanityScreenFilter.weight = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class ToolTipFlashPatch
	{
		[HarmonyPatch("DisplayTip")]
		[HarmonyPostfix]
		private static void PostFix()
		{
			if (EpilepsyPatchBase.TryToStopTooltipFlash.Value)
			{
				HUDManager.Instance.tipsPanelAnimator.speed = 0.1f;
				((MonoBehaviour)HUDManager.Instance).StartCoroutine(PauseAnimation());
				((MonoBehaviour)HUDManager.Instance).StartCoroutine(FastForwardAnimation());
			}
		}

		private static IEnumerator PauseAnimation()
		{
			yield return (object)new WaitForSeconds(0.9f);
			HUDManager.Instance.tipsPanelAnimator.speed = 0f;
		}

		private static IEnumerator FastForwardAnimation()
		{
			yield return (object)new WaitForSeconds(6f);
			HUDManager.Instance.tipsPanelAnimator.speed = 10000f;
		}
	}
	[HarmonyPatch]
	public static class ItemChargerPatch
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.DisableChargerAnimation.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "zap")
				{
					list[i - 2].opcode = OpCodes.Nop;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					Debug.Log((object)"Item Charger animation replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(Landmine), "SetOffMineAnimation")]
	public static class ExplosionPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.HideLightningExplosions.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "detonate")
				{
					list[i - 2].opcode = OpCodes.Nop;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					Debug.Log((object)"Landmine detonation animation trigger replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(ManualCameraRenderer))]
	internal class ManualCameraRendererPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Postfix(ManualCameraRenderer __instance)
		{
			Animator mapCameraAnimator = __instance.mapCameraAnimator;
			if ((Object)(object)mapCameraAnimator != (Object)null && EpilepsyPatchBase.DisablePlayerMonitorBlink.Value)
			{
				((Behaviour)mapCameraAnimator).enabled = false;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class HideTheSunDontPraiseIt
	{
		private static bool hasTriggered;

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Postfix(Tools_ListAllGameObjects __instance)
		{
			if (!hasTriggered)
			{
				ReplaceSunMaterial();
			}
		}

		private static void ReplaceSunMaterial()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("SunTexture");
			if ((Object)(object)val != (Object)null)
			{
				Renderer component = val.GetComponent<Renderer>();
				if ((Object)(object)component != (Object)null)
				{
					Material val2 = new Material(Shader.Find("Standard"));
					val2.color = Color.gray;
					component.material = val2;
					Debug.Log((object)"Material of Sun object replaced with a gray material.");
				}
				else
				{
					Debug.LogWarning((object)"Renderer component not found on Sun object.");
				}
			}
			else
			{
				Debug.LogWarning((object)"Sun object not found.");
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void shipLightsPatch()
		{
			if (EpilepsyPatchBase.GettingFiredLightDisabled.Value)
			{
				((Component)StartOfRound.Instance.shipAnimatorObject).gameObject.GetComponent<Animator>().SetBool("AlarmRinging", false);
			}
			if (EpilepsyPatchBase.ForceShipLightsOn.Value)
			{
				((Component)StartOfRound.Instance.shipRoomLights).gameObject.GetComponent<ShipLights>().areLightsOn = false;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void TeleporterBeamUpPatch(ref PlayerControllerB __instance)
		{
			if (EpilepsyPatchBase.DisableBeamUpParticles.Value)
			{
				__instance.beamUpParticle.Stop();
				__instance.beamOutParticle.Stop();
				__instance.beamOutBuildupParticle.Stop();
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void MakeFogStill()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (!EpilepsyPatchBase.DisableFogMovement.Value)
			{
				return;
			}
			GameObject val = GameObject.Find("BrightDay");
			if ((Object)(object)val != (Object)null)
			{
				LocalVolumetricFog componentInChildren = val.GetComponentInChildren<LocalVolumetricFog>();
				if ((Object)(object)componentInChildren == (Object)null)
				{
					componentInChildren = val.GetComponentInChildren<LocalVolumetricFog>(true);
				}
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.parameters.textureScrollingSpeed = Vector3.zero;
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void DustStorm()
		{
			if (!EpilepsyPatchBase.DisableFogMovement.Value)
			{
				return;
			}
			GameObject val = GameObject.Find("TimeAndWeather");
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			Transform obj = val.transform.Find("DustStorm");
			GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val2 != (Object)null)
			{
				LocalVolumetricFog component = val2.GetComponent<LocalVolumetricFog>();
				if ((Object)(object)component != (Object)null)
				{
					((Behaviour)component).enabled = false;
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void DisableFoggy()
		{
			if (!EpilepsyPatchBase.DisableFoggyModifier.Value)
			{
				return;
			}
			GameObject val = GameObject.Find("TimeAndWeather");
			if ((Object)(object)val != (Object)null)
			{
				Transform obj = val.transform.Find("Foggy");
				GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
				if ((Object)(object)val2 != (Object)null)
				{
					val2.SetActive(false);
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void KillInsanityFilter()
		{
			if (EpilepsyPatchBase.DisableFearScreenFilter.Value)
			{
				GameObject val = GameObject.Find("InsanityFilter");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void KillFlashFilter()
		{
			if (EpilepsyPatchBase.StunGrenadeFilterDisabled.Value)
			{
				GameObject val = GameObject.Find("FlashbangFilter");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB), "ChangeHelmetLight")]
	public static class SwitchFlashlightSpamPatch
	{
		private static bool canTurnOnFlashlight = true;

		[HarmonyPrefix]
		public static bool FLSpamPrefix(PlayerControllerB __instance)
		{
			if (!canTurnOnFlashlight && EpilepsyPatchBase.PreventFlashlightSpam.Value)
			{
				return false;
			}
			((MonoBehaviour)__instance).StartCoroutine(FlashlightCooldown());
			return true;
		}

		private static IEnumerator FlashlightCooldown()
		{
			canTurnOnFlashlight = false;
			yield return (object)new WaitForSeconds(EpilepsyPatchBase.FlashlightSpamCooldown.Value);
			canTurnOnFlashlight = true;
		}
	}
	[HarmonyPatch]
	public static class RadarBoosterPatch
	{
		[HarmonyPatch(typeof(RadarBoosterItem), "EnableRadarBooster")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.DisableRadarBoosterAnimation.Value && list[i].opcode == OpCodes.Ldstr && (string)list[i].operand == "on")
				{
					list[i].operand = "off";
					Debug.Log((object)"Radar booster on animation replaced with off");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(RadarBoosterItem), "Flash")]
	public static class RadarBoosterPatch2
	{
		[HarmonyPrefix]
		private static bool RemoveFlash()
		{
			if (EpilepsyPatchBase.DisableRadarBoosterFlash.Value)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(RedLocustBees), "BeesZap")]
	public static class BeeZapPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.DisableBeeZaps.Value && list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo fieldInfo && fieldInfo.Name == "lightningComponent")
				{
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					list[i + 2].opcode = OpCodes.Nop;
					Debug.Log((object)"Replaced bee lightning call with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch]
	public static class ShipTeleporterPatch
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction instruction = list[i];
				EpilepsyPatchBase.LogDebuggingMessages(instruction, i);
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StopEntryRoomFan
	{
		private static bool fanStopped;

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static void Postfix(Tools_ListAllGameObjects __instance)
		{
			if (!fanStopped)
			{
				DisableIndustrialFanAnimator();
			}
			RemoveHelmet();
			RemoveHelmet2();
			RemoveFog();
			RemoveCustomPass();
			RemoveMiscReflections();
			RemoveCriticalHealthWarning();
			RemoveDrunkFilter();
		}

		private static void DisableIndustrialFanAnimator()
		{
			GameObject val = GameObject.Find("IndustrialFan");
			if ((Object)(object)val != (Object)null)
			{
				Animator component = val.GetComponent<Animator>();
				if ((Object)(object)component != (Object)null)
				{
					((Behaviour)component).enabled = false;
					fanStopped = true;
					Debug.Log((object)"Industrial fan found and has been stopped");
				}
			}
		}

		private static void RemoveCriticalHealthWarning()
		{
			if (EpilepsyPatchBase.DisableCriticalHealthMessage.Value)
			{
				GameObject val = GameObject.Find("CriticalInjury");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
			}
		}

		private static void RemoveHelmet()
		{
			if (EpilepsyPatchBase.DisableFPVHelmet.Value)
			{
				GameObject val = GameObject.Find("ScavengerHelmet");
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
			}
		}

		public static void RemoveHelmet2()
		{
			if (!EpilepsyPatchBase.DisableFPVHelmetGlass.Value)
			{
				return;
			}
			GameObject val = GameObject.Find("ScavengerHelmet");
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			MeshRenderer component = val.GetComponent<MeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				Material[] materials = ((Renderer)component).materials;
				if (materials.Length >= 3)
				{
					Material[] array = (Material[])(object)new Material[materials.Length - 1];
					Array.Copy(materials, array, 2);
					Array.Copy(materials, 3, array, 2, materials.Length - 3);
					((Renderer)component).materials = array;
					Object.Destroy((Object)(object)materials[2]);
				}
			}
		}

		private static void RemoveFog()
		{
			GameObject val = GameObject.Find("VolumeMain");
			if ((Object)(object)val != (Object)null)
			{
				if (EpilepsyPatchBase.DisableFog.Value)
				{
					val.SetActive(false);
				}
				if (EpilepsyPatchBase.DisableVolumetricFog.Value)
				{
					Volume component = val.GetComponent<Volume>();
					Fog val2 = default(Fog);
					component.sharedProfile.TryGet<Fog>(ref val2);
					((VolumeParameter<bool>)(object)val2.enableVolumetricFog).value = false;
				}
			}
		}

		private static void RemoveDrunkFilter()
		{
			GameObject val = GameObject.Find("DrunknessFilter");
			if ((Object)(object)val != (Object)null && EpilepsyPatchBase.DisableTZPinhalentFilter.Value)
			{
				val.SetActive(false);
				((Behaviour)HUDManager.Instance.gasHelmetAnimator).enabled = false;
				HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
			}
		}

		private static void RemoveCustomPass()
		{
			GameObject val = GameObject.Find("CustomPass");
			if ((Object)(object)val != (Object)null && EpilepsyPatchBase.DisableCustomShader.Value)
			{
				val.SetActive(false);
			}
		}

		private static void RemoveMiscReflections()
		{
			GameObject val = GameObject.Find("Puddles");
			if ((Object)(object)val != (Object)null && EpilepsyPatchBase.DisableMiscReflections.Value)
			{
				val.SetActive(false);
			}
		}

		private static VolumeProfile FindVolumeProfile(string profileName)
		{
			VolumeProfile[] array = Object.FindObjectsOfType<VolumeProfile>();
			VolumeProfile[] array2 = array;
			foreach (VolumeProfile val in array2)
			{
				if (((Object)val).name == profileName)
				{
					return val;
				}
			}
			return null;
		}

		[HarmonyPrefix]
		[HarmonyPatch("AutoSaveShipData")]
		private static void resetFanDisabled()
		{
			fanStopped = false;
			Debug.Log((object)"Resetting fan stopped trigger.");
		}

		[HarmonyPatch(typeof(RoundManager))]
		[HarmonyPrefix]
		[HarmonyPatch("LoadNewLevel")]
		private static void resetFanDisabled2()
		{
			fanStopped = false;
			Debug.Log((object)"Resetting fan stopped trigger.");
		}
	}
	[HarmonyPatch(typeof(StormyWeather), "LightningStrike")]
	public static class LightningPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = 0;
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.HideLightningStrikes.Value && list[i].opcode == OpCodes.Stfld && list[i].operand is FieldInfo fieldInfo && fieldInfo.Name == "AutomaticModeSeconds")
				{
					list[i - 2].opcode = OpCodes.Nop;
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					Debug.Log((object)"Lightning script replaced with NOP");
				}
				if (EpilepsyPatchBase.HideLightningExplosions.Value && list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo fieldInfo2 && fieldInfo2.Name == "explosionEffectParticle")
				{
					if (num == 1)
					{
						list[i - 1].opcode = OpCodes.Nop;
						list[i].opcode = OpCodes.Nop;
						list[i + 1].opcode = OpCodes.Nop;
						Debug.Log((object)"Lightning explosion trigger replaced with NOP");
					}
					else
					{
						num++;
					}
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(StunGrenadeItem))]
	[HarmonyPatch("ExplodeStunGrenade")]
	public static class StunGrenadeExplosionPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				bool flag = false;
				if (EpilepsyPatchBase.StunGrenadeExplosionDisabled.Value && list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo fieldInfo && fieldInfo.Name == "stunGrenadeExplosion")
				{
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					list[i + 2].opcode = OpCodes.Nop;
					list[i + 3].opcode = OpCodes.Nop;
					list[i + 4].opcode = OpCodes.Nop;
					list[i + 5].opcode = OpCodes.Nop;
					list[i + 6].opcode = OpCodes.Nop;
					list[i + 7].opcode = OpCodes.Nop;
					Debug.Log((object)"Flashbang Explosion replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(StunGrenadeItem))]
	[HarmonyPatch("StunExplosion")]
	public static class StunGrenadePatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (EpilepsyPatchBase.StunGrenadeFilterDisabled.Value && list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo fieldInfo && fieldInfo.Name == "flashbangScreenFilter")
				{
					list[i - 1].opcode = OpCodes.Nop;
					list[i].opcode = OpCodes.Nop;
					list[i + 1].opcode = OpCodes.Nop;
					list[i + 2].opcode = OpCodes.Nop;
					Debug.Log((object)"Flashbang filter replaced with NOP");
				}
			}
			return list.AsEnumerable();
		}
	}
	[HarmonyPatch(typeof(Terminal), "Update")]
	public static class TerminalPatch
	{
		[HarmonyPrefix]
		public static void TerminalCaretPatch(Terminal __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (EpilepsyPatchBase.HideTerminalCaret.Value)
			{
				__instance.screenText.caretColor = Color.clear;
			}
		}
	}
	[HarmonyPatch(typeof(Turret))]
	internal class StopTurretAnimator
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void TurretAnimatorPatch(Turret __instance)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			if (EpilepsyPatchBase.TryToHideTurretBullets.Value)
			{
				EmissionModule emission = __instance.bulletParticles.emission;
				MainModule main = __instance.bulletParticles.main;
				((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.1f);
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color.clear);
				((EmissionModule)(ref emission)).enabled = false;
			}
		}
	}
	[HarmonyPatch(typeof(Landmine), "SetOffMineAnimation")]
	public static class StopLandmine
	{
		[HarmonyPrefix]
		private static bool StopMine(Landmine __instance)
		{
			if (EpilepsyPatchBase.DisableLandmines.Value)
			{
				__instance.mineAudio.PlayOneShot(__instance.mineTrigger, 1f);
				return false;
			}
			return true;
		}
	}
}