Decompiled source of LocalFlashlight v1.5.1

LocalFlashlight.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCSoundTool;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LocalFlashlight.Compatibilities;
using LocalFlashlight.NetcodePatcher;
using LocalFlashlight.Networking;
using Microsoft.CodeAnalysis;
using ReservedItemSlotCore;
using ReservedItemSlotCore.Data;
using TMPro;
using TerminalApi;
using TerminalApi.Classes;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LocalFlashlight")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e4af701fad887504e62470bfc5322a62b68b41cb")]
[assembly: AssemblyProduct("LocalFlashlight")]
[assembly: AssemblyTitle("LocalFlashlight")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
public enum BatteryDisplayOptions
{
	Disabled,
	Bar,
	Text,
	VerticalBar,
	CircularBar,
	All
}
public enum TextDisplayOptions
{
	Percent,
	AccuratePercent,
	Time,
	All
}
public enum SoundOptions
{
	InGameFlashlight,
	CustomSounds
}
public enum RechargeOptions
{
	Time,
	Shake,
	Dynamo,
	FacilityPowered
}
public enum GlobalFlashlightOptions
{
	CrewUpgrade,
	Unrestricted
}
namespace LocalFlashlight
{
	internal class LightScript : MonoBehaviour
	{
		private PlayerControllerB player_controller;

		public ulong clientId;

		private GameObject player;

		private GameObject cameraObject;

		private GameObject dynamoLightObj;

		public static GameObject lightObject;

		public static AudioClip[] flashlightClips = (AudioClip[])(object)new AudioClip[25];

		public static int[] activeClips = new int[20];

		private static AudioSource flashSource;

		private static AudioSource dynamoAudioSource;

		private Light localLight;

		private bool flashState;

		private bool posState;

		public static bool publicFlashState;

		private bool canToggle = true;

		private static SoundOptions selectedSoundOption;

		private RechargeOptions selectedRechargeOption;

		private float playerMovementSpeed;

		public static float UIHideTime;

		public static float maxBatteryTime;

		public static float BatteryPercent;

		public static float truePercentBattery;

		public static float BatteryClamped;

		public static float batteryTime = maxBatteryTime;

		private float batteryRegen;

		private float regenCool;

		private float batteryCooldown;

		private float burnOutCooldown;

		private float shakeCool;

		private float soundCool;

		private float lastShakeTime = 0f;

		private bool rechargeKeyHeld = false;

		private float targetVolume = 0f;

		private float targetPitch = 0f;

		private float windRechargeMult = 0f;

		public static Color flashColor;

		private int toggleAmount = 0;

		private float flashOnTime = 0f;

		private int timesUsedCommand = 0;

		public bool canUse = true;

		private void Start()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			Plugin.mls.LogDebug((object)"localflashlight script started, setting mod values and creating light...");
			FindLocalPlayer();
			if (((Object)(object)player == (Object)null) | ((Object)(object)cameraObject == (Object)null))
			{
				Plugin.mls.LogError((object)"either the player is null, or the camera object is null, so the mod won't work at all since it needs those two things");
				return;
			}
			SetModValues();
			SetFlashlightSounds();
			MakeLocalLight();
			if (Plugin.enableNetworking.Value)
			{
				LFNetworkHandler.Instance?.RequestAllLightsUpdateServerRpc();
			}
			((Behaviour)localLight).enabled = false;
			TerminalApi.AddCommand("LocalFlashlight", new CommandInfo
			{
				Category = "other",
				Description = (Plugin.enableNetworking.Value ? "Displays statistics about the flashlight's usage" : "Displays statistics about the flashlight's usage"),
				DisplayTextSupplier = onCommandParse
			}, (string)null, true);
		}

		public void Update()
		{
			if (((Object)(object)player == (Object)null) | ((Object)(object)player_controller == (Object)null) | ((Object)(object)cameraObject == (Object)null) | ((Object)(object)lightObject == (Object)null))
			{
				return;
			}
			try
			{
				UpdateModValues();
				UpdateBatteryValues();
				if (flashState)
				{
					batteryTime -= Time.deltaTime;
					flashOnTime += Time.deltaTime;
					if (batteryTime < 0f)
					{
						if (Plugin.flickerOnBatteryBurn.Value)
						{
							((MonoBehaviour)this).StartCoroutine(FlickerAndStop());
						}
						else
						{
							Toggle();
						}
					}
				}
				if (((double)BatteryPercent <= 99.8) | flashState)
				{
					UIHideTime = Plugin.HideUIDelay.Value;
				}
				else if ((double)BatteryPercent > 99.8 && !flashState)
				{
					UIHideTime -= Time.deltaTime;
				}
				if (Plugin.rechargeInShip.Value && !flashState && player_controller.isInHangarShipRoom && (double)batteryTime < (double)maxBatteryTime - 0.01)
				{
					batteryTime += Time.deltaTime * 3f;
				}
				if (Plugin.flashlightToggleInstance.toggleKey.triggered)
				{
					if (player_controller.quickMenuManager.isMenuOpen | player_controller.isPlayerDead | player_controller.inTerminalMenu | player_controller.isTypingChat | player_controller.inSpecialInteractAnimation | ((Object)(object)localLight == (Object)null))
					{
						return;
					}
					if (batteryTime > 0f)
					{
						if (flashState)
						{
							Toggle();
						}
						else if (!flashState && canToggle)
						{
							Toggle();
						}
						else if (Patches.isFlashlightHeld)
						{
							PlayNoise(activeClips[8], 0.3f);
						}
					}
					else
					{
						PlayNoise(activeClips[8], 0.7f);
					}
				}
				if (Plugin.flashlightToggleInstance.switchLightPosKey.triggered && !(player_controller.quickMenuManager.isMenuOpen | player_controller.isPlayerDead | player_controller.inTerminalMenu | player_controller.isTypingChat | player_controller.inSpecialInteractAnimation | ((Object)(object)localLight == (Object)null)))
				{
					ChangeLightPosition();
				}
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"something went wrong in the update script!! might be either from battery update, mod value update, or whatever else there is in this script:\n{arg}");
			}
		}

		private void Toggle()
		{
			if ((Object)(object)player == (Object)null || (Object)(object)cameraObject == (Object)null)
			{
				return;
			}
			flashState = !flashState;
			publicFlashState = flashState;
			((Behaviour)localLight).enabled = flashState;
			if (Plugin.enableNetworking.Value)
			{
				LFNetworkHandler.Instance?.ToggleLightServerRpc(player_controller.playerClientId, flashState);
			}
			if (flashState)
			{
				PlayNoise(activeClips[0], 0.3f, playForWorld: true);
				toggleAmount++;
			}
			else if (!flashState)
			{
				if (batteryTime <= 0f && Plugin.BatteryBurnOut.Value)
				{
					regenCool = burnOutCooldown;
				}
				else
				{
					regenCool = batteryCooldown;
					toggleAmount++;
				}
				if (batteryTime <= 0f)
				{
					PlayNoise(activeClips[2], 0.5f, playForWorld: true);
				}
				else
				{
					PlayNoise(activeClips[1], 0.6f, playForWorld: true);
				}
			}
		}

		private void ChangeLightPosition()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			posState = !posState;
			lightObject.transform.localPosition = new Vector3(posState ? Plugin.lightPosX2.Value : Plugin.lightPosX1.Value, posState ? Plugin.lightPosY2.Value : Plugin.lightPosY1.Value, posState ? Plugin.lightPosZ2.Value : Plugin.lightPosZ1.Value);
			lightObject.transform.localRotation = Quaternion.Euler(posState ? Plugin.lightRotX2.Value : Plugin.lightRotX1.Value, posState ? Plugin.lightRotY2.Value : Plugin.lightRotY1.Value, posState ? Plugin.lightRotZ2.Value : Plugin.lightRotZ1.Value);
			PlayNoise(activeClips[7], 0.3f);
		}

		public static void PlayNoise(int clipIndex, float volume, bool playForWorld = false)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			AudioSource obj = flashSource;
			if (obj != null)
			{
				obj.PlayOneShot(flashlightClips[clipIndex]);
			}
			if (playForWorld)
			{
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(lightObject.transform.position, 8f, volume, 0, StartOfRound.Instance.localPlayerController.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
				if (Plugin.enableNetworking.Value)
				{
					LFNetworkHandler.Instance?.PlayNetworkedSoundServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, (selectedSoundOption == SoundOptions.CustomSounds) ? (clipIndex - 1) : clipIndex);
				}
			}
		}

		private void holdCallback(CallbackContext context)
		{
			if ((selectedRechargeOption != RechargeOptions.Dynamo) | player_controller.quickMenuManager.isMenuOpen | player_controller.isPlayerDead | player_controller.inTerminalMenu | player_controller.isTypingChat)
			{
				return;
			}
			targetVolume = (float)Plugin.FlashVolume.Value / 200f;
			targetPitch = 1f;
			rechargeKeyHeld = true;
			if ((Object)(object)dynamoAudioSource != (Object)null)
			{
				dynamoAudioSource.loop = true;
				dynamoAudioSource.clip = flashlightClips[activeClips[5]];
				dynamoAudioSource.Play();
				if (Plugin.enableNetworking.Value)
				{
					LFNetworkHandler.Instance.PlayDynamoAudioServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, activeClips[5]);
				}
			}
		}

		private void releaseCallback(CallbackContext context)
		{
			if (selectedRechargeOption != RechargeOptions.Dynamo)
			{
				return;
			}
			targetVolume = 0f;
			targetPitch = 0f;
			soundCool = 0.25f;
			rechargeKeyHeld = false;
			if ((Object)(object)dynamoAudioSource != (Object)null)
			{
				dynamoAudioSource.loop = false;
				if (Plugin.enableNetworking.Value)
				{
					LFNetworkHandler.Instance.StopDynamoAudioServerRpc(StartOfRound.Instance.localPlayerController.playerClientId);
				}
			}
		}

		private void SetFlashlightSounds()
		{
			try
			{
				selectedSoundOption = Plugin.soundOption.Value;
				flashlightClips[0] = Plugin.bundle.LoadAsset<AudioClip>("lighton2");
				flashlightClips[2] = Plugin.bundle.LoadAsset<AudioClip>("lighton2");
				flashlightClips[4] = Plugin.bundle.LoadAsset<AudioClip>("lowtoggle1");
				flashlightClips[6] = Plugin.bundle.LoadAsset<AudioClip>("recharged1");
				flashlightClips[8] = Plugin.bundle.LoadAsset<AudioClip>("reloadlight");
				flashlightClips[10] = Plugin.bundle.LoadAsset<AudioClip>("dynamo");
				flashlightClips[12] = Plugin.bundle.LoadAsset<AudioClip>("flashDown2");
				flashlightClips[14] = Plugin.bundle.LoadAsset<AudioClip>("changepos.ogg");
				flashlightClips[16] = Plugin.bundle.LoadAsset<AudioClip>("denytoggle");
				if (Plugin.hasLCSoundTool)
				{
					flashlightClips[1] = LCSoundToolCompatibility.LoadCustomSound("lighton_custom");
					flashlightClips[3] = LCSoundToolCompatibility.LoadCustomSound("lightoff_custom");
					flashlightClips[5] = LCSoundToolCompatibility.LoadCustomSound("lowtoggle_custom");
					flashlightClips[7] = LCSoundToolCompatibility.LoadCustomSound("recharged_custom");
					flashlightClips[9] = LCSoundToolCompatibility.LoadCustomSound("reloadlight_custom");
					flashlightClips[11] = LCSoundToolCompatibility.LoadCustomSound("dynamo_custom");
					flashlightClips[13] = LCSoundToolCompatibility.LoadCustomSound("flashDown_custom");
					flashlightClips[15] = LCSoundToolCompatibility.LoadCustomSound("changepos_custom");
					flashlightClips[17] = LCSoundToolCompatibility.LoadCustomSound("denytoggle_custom");
				}
				else
				{
					Plugin.mls.LogWarning((object)"LCSoundTool not installed/enabled, this will lead to an error if you're using custom sounds for the flashlight.");
					activeClips[0] = 0;
					activeClips[1] = 2;
					activeClips[2] = 4;
					activeClips[3] = 6;
					activeClips[4] = 8;
					activeClips[5] = 10;
					activeClips[6] = 12;
					activeClips[7] = 14;
					activeClips[8] = 16;
				}
				Plugin.mls.LogDebug((object)"loaded sound assets...");
				switch (selectedSoundOption)
				{
				case SoundOptions.InGameFlashlight:
					activeClips[0] = 0;
					activeClips[1] = 2;
					activeClips[2] = 4;
					activeClips[3] = 6;
					activeClips[4] = 8;
					activeClips[5] = 10;
					activeClips[6] = 12;
					activeClips[7] = 14;
					activeClips[8] = 16;
					break;
				case SoundOptions.CustomSounds:
					activeClips[0] = 1;
					activeClips[1] = 3;
					activeClips[2] = 5;
					activeClips[3] = 7;
					activeClips[4] = 9;
					activeClips[5] = 11;
					activeClips[6] = 13;
					activeClips[7] = 15;
					activeClips[8] = 17;
					break;
				}
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while setting localflashlight mod sounds:\n{arg}");
			}
		}

		private void SetModValues()
		{
			try
			{
				flashState = false;
				posState = false;
				canToggle = true;
				rechargeKeyHeld = false;
				maxBatteryTime = Plugin.BatteryLife.Value;
				batteryTime = maxBatteryTime;
				batteryRegen = Plugin.RechargeMult.Value;
				burnOutCooldown = Plugin.BurnOutCool.Value;
				batteryCooldown = Plugin.BatteryCool.Value;
				UIHideTime = 2f + Plugin.HideUIDelay.Value;
				selectedRechargeOption = Plugin.rechargeOption.Value;
				shakeCool = Plugin.shakeActionCooldown.Value;
				playerMovementSpeed = player_controller.movementSpeed;
				ColorUtility.TryParseHtmlString(Plugin.flashlightColorHex.Value, ref flashColor);
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while setting initial localflashlight mod values:\n{arg}");
			}
		}

		private void FindLocalPlayer()
		{
			if ((Object)(object)player != (Object)null)
			{
				return;
			}
			try
			{
				Plugin.mls.LogDebug((object)"finding local player controller");
				player = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject;
				if ((Object)(object)player != (Object)null)
				{
					player_controller = player.GetComponent<PlayerControllerB>();
					cameraObject = ((Component)player_controller.gameplayCamera).gameObject;
					clientId = GameNetworkManager.Instance.localPlayerController.playerClientId;
				}
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while finding the local player controller, it may be null or the mod just can't find it\n{arg}");
			}
		}

		private void MakeLocalLight()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Expected O, but got Unknown
			if ((Object)(object)player == (Object)null)
			{
				Plugin.mls.LogError((object)"no player to attach the light to (somehow)");
				return;
			}
			try
			{
				AudioMixerGroup outputAudioMixerGroup = ((Component)GameNetworkManager.Instance.localPlayerController.itemAudio).GetComponent<AudioSource>().outputAudioMixerGroup;
				lightObject = new GameObject();
				lightObject.transform.SetParent(cameraObject.transform, false);
				((Object)lightObject).name = "lightObject (LOCAL)";
				localLight = lightObject.AddComponent<Light>();
				localLight.type = (LightType)0;
				localLight.shape = (LightShape)0;
				localLight.color = flashColor;
				localLight.intensity = Plugin.lightIntensity.Value;
				localLight.range = Plugin.lightRange.Value;
				localLight.shadows = (LightShadows)1;
				localLight.spotAngle = Plugin.lightAngle.Value;
				flashSource = lightObject.AddComponent<AudioSource>();
				flashSource.loop = false;
				flashSource.playOnAwake = false;
				flashSource.volume = (float)Plugin.FlashVolume.Value / 100f;
				flashSource.priority = 0;
				flashSource.spatialize = true;
				flashSource.outputAudioMixerGroup = outputAudioMixerGroup;
				lightObject.transform.localPosition = new Vector3(Plugin.lightPosX1.Value, Plugin.lightPosY1.Value, Plugin.lightPosZ1.Value);
				lightObject.transform.Rotate(new Vector3(Plugin.lightRotX1.Value, Plugin.lightRotY1.Value, Plugin.lightRotZ1.Value));
				if (selectedRechargeOption == RechargeOptions.Dynamo)
				{
					dynamoLightObj = new GameObject("DynamoAudioSource (ONLY USED FOR DYNAMO RECHARGE)");
					dynamoLightObj.transform.SetParent(lightObject.transform, false);
					dynamoAudioSource = dynamoLightObj.AddComponent<AudioSource>();
					((Object)dynamoAudioSource).name = "dynamo audio source";
					dynamoAudioSource.loop = true;
					dynamoAudioSource.priority = 0;
					dynamoAudioSource.spatialize = true;
					dynamoAudioSource.outputAudioMixerGroup = outputAudioMixerGroup;
				}
				if (Plugin.ShadowsEnabled.Value)
				{
					HDAdditionalLightData val = lightObject.AddComponent<HDAdditionalLightData>();
					val.EnableShadows(true);
					val.SetShadowNearPlane(0.35f);
				}
				lightObject.SetActive(true);
				Plugin.mls.LogInfo((object)"created local light object!");
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while creating the light object:\n{arg}");
			}
		}

		private void UpdateModValues()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			regenCool -= Time.deltaTime;
			BatteryPercent = (int)Math.Ceiling(batteryTime / maxBatteryTime * 100f);
			BatteryClamped = batteryTime / maxBatteryTime;
			truePercentBattery = BatteryClamped * 100f;
			ColorUtility.TryParseHtmlString(Plugin.flashlightColorHex.Value, ref flashColor);
			localLight.color = flashColor;
			localLight.range = Plugin.lightRange.Value;
			localLight.spotAngle = Plugin.lightAngle.Value;
			flashSource.volume = (float)Plugin.FlashVolume.Value / 100f;
			if (selectedRechargeOption == RechargeOptions.Dynamo && (Object)(object)dynamoAudioSource != (Object)null)
			{
				dynamoAudioSource.volume = Mathf.Lerp(dynamoAudioSource.volume, targetVolume, Time.deltaTime * 6f);
				dynamoAudioSource.pitch = Mathf.Lerp(dynamoAudioSource.pitch, targetPitch, Time.deltaTime * 6f);
			}
			canToggle = !Plugin.flashlightToggleModSynergyquestionmark.Value || (!((Behaviour)player_controller.allHelmetLights[0]).enabled && !((Behaviour)player_controller.allHelmetLights[1]).enabled && !Patches.isFlashlightPocketed && !Patches.isFlashlightHeld && !ReservedItemSlotCompatibility.flashlightInReservedSlot);
			if (player_controller.isPlayerDead)
			{
				flashState = false;
				((Behaviour)localLight).enabled = false;
				batteryTime = maxBatteryTime;
				regenCool = 0f;
				canToggle = true;
				rechargeKeyHeld = false;
			}
			float val = Mathf.Lerp(0f, 1f, BatteryClamped);
			val = Math.Max(val, (float)Plugin.flashlightStopDimBatteryValue.Value / 100f);
			if (FlashlightItem.globalFlashlightInterferenceLevel >= 1)
			{
				localLight.intensity = Plugin.lightIntensity.Value * ((selectedRechargeOption == RechargeOptions.FacilityPowered) ? Plugin.apparaticeFlashlightIntensityMult.Value : 1f) * Patches.randomLightInterferenceMultiplier;
			}
			else
			{
				localLight.intensity = (Plugin.dimEnabled.Value ? (Plugin.lightIntensity.Value * val) : Plugin.lightIntensity.Value);
			}
		}

		private void UpdateBatteryValues()
		{
			switch (selectedRechargeOption)
			{
			case RechargeOptions.Time:
				if (!flashState && (double)batteryTime <= (double)maxBatteryTime - 0.001 && regenCool < 0f)
				{
					batteryTime += batteryRegen * Time.deltaTime;
				}
				if (batteryTime > maxBatteryTime)
				{
					batteryTime = maxBatteryTime;
					if (selectedRechargeOption == RechargeOptions.Time && Plugin.soundOnRecharge.Value)
					{
						PlayNoise(activeClips[3], 0.7f, playForWorld: true);
					}
				}
				break;
			case RechargeOptions.Shake:
				if (Plugin.flashlightToggleInstance.rechargeKey.triggered && Time.time - lastShakeTime > shakeCool && !player_controller.quickMenuManager.isMenuOpen && !player_controller.isPlayerDead && !player_controller.inTerminalMenu && !player_controller.isTypingChat)
				{
					if (player_controller.sprintMeter > 0.25f)
					{
						batteryTime += maxBatteryTime * 0.07f * batteryRegen;
						PlayNoise(activeClips[4], 0.6f, playForWorld: true);
						PlayerControllerB obj = player_controller;
						obj.sprintMeter -= (float)Plugin.shakeStaminaConsume.Value / 100f;
						lastShakeTime = Time.time;
					}
					else
					{
						PlayNoise(activeClips[8], 0.7f);
					}
				}
				break;
			case RechargeOptions.Dynamo:
				if (!player_controller.quickMenuManager.isMenuOpen || !player_controller.isPlayerDead || !player_controller.isTypingChat || !player_controller.inSpecialInteractAnimation)
				{
					Plugin.flashlightToggleInstance.rechargeKey.performed += holdCallback;
					Plugin.flashlightToggleInstance.rechargeKey.canceled += releaseCallback;
				}
				else
				{
					Plugin.flashlightToggleInstance.rechargeKey.performed -= holdCallback;
				}
				if (rechargeKeyHeld)
				{
					WindUpFlashlight();
					windRechargeMult += Time.deltaTime * 3f;
				}
				else if (windRechargeMult > 0f)
				{
					windRechargeMult -= Time.deltaTime * 5f;
				}
				batteryTime += Time.deltaTime * batteryRegen * windRechargeMult;
				windRechargeMult = Mathf.Clamp(windRechargeMult, 0f, 1.5f);
				player_controller.movementSpeed = (rechargeKeyHeld ? (playerMovementSpeed * Plugin.dynamoUseMoveMult.Value) : playerMovementSpeed);
				break;
			case RechargeOptions.FacilityPowered:
				if (Patches.isFacilityPowered)
				{
					batteryTime = maxBatteryTime;
				}
				break;
			}
		}

		private void WindUpFlashlight()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (selectedRechargeOption == RechargeOptions.Dynamo)
			{
				PlayerControllerB obj = player_controller;
				obj.sprintMeter -= Time.deltaTime * 0.03f;
				if (soundCool < 0f)
				{
					Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)player_controller).transform.position, 8f, 0.5f, 0, player_controller.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
					soundCool = 0.4f;
				}
				soundCool -= Time.deltaTime;
			}
		}

		public static void FullyChargeBattery()
		{
			batteryTime = maxBatteryTime;
		}

		private IEnumerator FlickerAndStop()
		{
			regenCool = 0.3f + (Plugin.BatteryBurnOut.Value ? burnOutCooldown : batteryCooldown);
			flashState = false;
			publicFlashState = flashState;
			PlayNoise(activeClips[2], 0.6f, playForWorld: true);
			if (Plugin.enableNetworking.Value)
			{
				LFNetworkHandler.Instance?.FlickerOutServerRpc(player_controller.playerClientId);
			}
			((Behaviour)localLight).enabled = false;
			yield return (object)new WaitForSeconds(0.1f);
			((Behaviour)localLight).enabled = true;
			yield return (object)new WaitForSeconds(0.1f);
			((Behaviour)localLight).enabled = false;
		}

		private string onCommandParse()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			string text = null;
			text += "the command isn't fully implemented, nor is the upgrade system, so here's some stats from your entire game session up to this point\n\n";
			text = text + "Flashlight toggle count: " + toggleAmount + "\n";
			text = text + "Time spent using the light: " + $"{flashOnTime:.00}" + " seconds\n";
			text = text + "Flashlight recharge method: " + selectedRechargeOption.ToString() + "\n";
			timesUsedCommand++;
			text = text + "Times you used this command: " + timesUsedCommand + "\n";
			if (timesUsedCommand <= 1)
			{
				text += "\nthese stats are ONLY for this play session, so they will get reset if you close the game\n";
			}
			if (Plugin.enableNetworking.Value)
			{
				TerminalApi.AddCommand("Localflashlight sayhi", new CommandInfo
				{
					DisplayTextSupplier = terminalSayHi
				}, (string)null, true);
			}
			return text;
		}

		private string terminalSayHi()
		{
			LFNetworkHandler.Instance?.SayHiServerRpc(player_controller.playerClientId);
			return "Said hello to all the people in the server!\n\nhow'd you find this anyway?\n";
		}
	}
	internal class Patches : MonoBehaviour
	{
		private static GameObject UIContainer;

		private static GameObject frameObj;

		private static GameObject meterObj;

		private static GameObject textObj;

		private static GameObject warningObj;

		private static TextMeshProUGUI textmesh;

		private static Image frameImage;

		private static Image meterImage;

		private static Image warningImage;

		private static Sprite frame;

		private static Sprite meter;

		private static readonly Sprite warning = Plugin.bundle.LoadAsset<Sprite>("warning");

		public static Color UIColorHex;

		private static bool warningEnabled = Plugin.UIDisabledLowBatteryWarning.Value;

		private static float warningPercent = Plugin.LowBatteryWarningPercentage.Value;

		private static BatteryDisplayOptions selectedStyle;

		private static TextDisplayOptions selectedText;

		private static RechargeOptions selectedRecharge;

		private static float elemScale;

		public static bool isFlashlightHeld = false;

		public static bool isFlashlightPocketed = false;

		public static bool isFacilityPowered = true;

		public static float randomLightInterferenceMultiplier;

		private static float targetAlpha;

		private static readonly float soundCd = 3f;

		private static float lastSoundTime = 0f;

		public static LightScript? semiInstance { get; private set; }

		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		[HarmonyPostfix]
		internal static void MakeLightController()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			semiInstance = null;
			GameObject val = new GameObject("LightController");
			val.transform.SetParent(((Component)StartOfRound.Instance.localPlayerController).transform, false);
			semiInstance = val.AddComponent<LightScript>();
			isFlashlightHeld = false;
			isFlashlightPocketed = false;
			StartOfRound.Instance.localPlayerController.nightVision.intensity = StartOfRound.Instance.localPlayerController.nightVision.intensity * ((float)Plugin.DarkVisionMult.Value / 100f);
		}

		[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
		[HarmonyPostfix]
		internal static void DestroyLightController()
		{
			semiInstance = null;
			GameObject val = GameObject.Find("LightController");
			if ((Object)(object)val != (Object)null)
			{
				Object.Destroy((Object)(object)val);
			}
			TerminalApi.DeleteKeyword("LocalFlashlight");
			try
			{
				Plugin.mls.LogInfo((object)"Attempting to despawn all light objects!!");
				IEnumerable<GameObject> enumerable = from x in Object.FindObjectsOfType<GameObject>()
					where ((Object)x).name.Contains("lightObject")
					select x;
				if (enumerable.Count() == 0)
				{
					Plugin.mls.LogInfo((object)"no light objects to despawn");
				}
				foreach (GameObject item in enumerable)
				{
					Object.Destroy((Object)(object)item);
				}
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while despawning light objects\n{arg}");
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPostfix]
		internal static void GetBatteryUI(ref HUDManager __instance)
		{
			selectedStyle = Plugin.BatteryDisplay.Value;
			selectedText = Plugin.TextDisplay.Value;
			warningEnabled = Plugin.UIDisabledLowBatteryWarning.Value;
			warningPercent = Plugin.LowBatteryWarningPercentage.Value;
			elemScale = Plugin.UIScale.Value;
			selectedRecharge = Plugin.rechargeOption.Value;
			isFacilityPowered = true;
			ColorUtility.TryParseHtmlString(Plugin.HUDColorHex.Value, ref UIColorHex);
			MakeIndicator(__instance);
		}

		[HarmonyPatch(typeof(HUDManager), "Update")]
		[HarmonyPostfix]
		internal static void UpdateBatteryInfo(ref HUDManager __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)UIContainer == (Object)null)
			{
				MakeIndicator(__instance);
				return;
			}
			try
			{
				float batteryTime = LightScript.batteryTime;
				float timeMinutes = Mathf.FloorToInt(batteryTime / 60f);
				float timeSeconds = Mathf.FloorToInt(batteryTime % 60f);
				elemScale = Plugin.UIScale.Value;
				UIContainer.transform.localScale = new Vector3(elemScale, elemScale, elemScale);
				UIContainer.transform.localPosition = Vector2.op_Implicit(new Vector2(Plugin.UIPositionX.Value, Plugin.UIPositionY.Value));
				UIContainer.GetComponent<CanvasGroup>().alpha = Mathf.Lerp(UIContainer.GetComponent<CanvasGroup>().alpha, targetAlpha, Time.deltaTime * 6f);
				if (selectedStyle != 0)
				{
					targetAlpha = ((!Plugin.HideUI.Value) ? 1f : ((LightScript.UIHideTime < 0f) ? Plugin.UIHiddenAlpha.Value : 1f));
					if (selectedStyle != BatteryDisplayOptions.Text)
					{
						meterImage.fillAmount = LightScript.BatteryClamped;
					}
				}
				else
				{
					targetAlpha = 1f;
					UIContainer.SetActive(warningEnabled && LightScript.truePercentBattery <= warningPercent);
				}
				ColorUtility.TryParseHtmlString(Plugin.HUDColorHex.Value, ref UIColorHex);
				if ((Object)(object)frameObj != (Object)null && selectedStyle == BatteryDisplayOptions.Bar)
				{
					((Graphic)frameImage).color = UIColorHex;
				}
				if ((Object)(object)meterObj != (Object)null)
				{
					((Graphic)meterImage).color = UIColorHex;
				}
				if ((Object)(object)warningObj != (Object)null)
				{
					((Graphic)warningImage).color = UIColorHex;
					warningPercent = Plugin.LowBatteryWarningPercentage.Value;
					warningEnabled = Plugin.UIDisabledLowBatteryWarning.Value;
				}
				if ((Object)(object)textObj != (Object)null)
				{
					((Graphic)textmesh).color = UIColorHex;
				}
				if ((selectedStyle == BatteryDisplayOptions.All) | (selectedStyle == BatteryDisplayOptions.Text))
				{
					UpdateHUDText(timeMinutes, timeSeconds);
				}
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while updating hud!! is the light script even there?? is the hud even there????\n{arg}");
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")]
		[HarmonyPostfix]
		internal static void DisableHUDAgain()
		{
			if (selectedRecharge == RechargeOptions.FacilityPowered)
			{
				UIContainer.SetActive(false);
			}
			isFacilityPowered = true;
			if (StartOfRound.Instance.localPlayerController.isPlayerDead)
			{
				StartOfRound.Instance.localPlayerController.pocketedFlashlight = null;
			}
			if (Plugin.rechargeInOrbit.Value)
			{
				LightScript.FullyChargeBattery();
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "openingDoorsSequence")]
		[HarmonyPostfix]
		internal static void FixValues()
		{
			isFlashlightHeld = false;
			isFlashlightPocketed = false;
			randomLightInterferenceMultiplier = Random.Range(0.1f, 0.4f);
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyPostfix]
		internal static void PocketedFlashlightChecks()
		{
			try
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				if ((!((NetworkBehaviour)localPlayerController).IsOwner || !localPlayerController.isPlayerControlled || (((NetworkBehaviour)localPlayerController).IsServer && !localPlayerController.isHostPlayerObject)) && !localPlayerController.isTestingPlayer)
				{
					return;
				}
				if (!localPlayerController.isPlayerDead)
				{
					if (Plugin.hasReservedSlots)
					{
						ReservedItemSlotCompatibility.CheckForFlashlightInSlots();
						isFlashlightPocketed = false;
						isFlashlightHeld = false;
					}
					if (ReservedItemSlotCompatibility.flashlightInReservedSlot)
					{
						return;
					}
					if (localPlayerController.currentlyHeldObjectServer is FlashlightItem && (Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)(object)localPlayerController.pocketedFlashlight)
					{
						localPlayerController.pocketedFlashlight = localPlayerController.currentlyHeldObjectServer;
					}
					if ((Object)(object)localPlayerController.pocketedFlashlight == (Object)null)
					{
						return;
					}
					if (localPlayerController.currentlyHeldObjectServer is FlashlightItem && localPlayerController.isHoldingObject && !localPlayerController.pocketedFlashlight.insertedBattery.empty)
					{
						GrabbableObject currentlyHeldObjectServer = localPlayerController.currentlyHeldObjectServer;
						FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
						if ((Object)(object)val != (Object)null && val.flashlightTypeID != 2)
						{
							isFlashlightHeld = true;
						}
					}
					else
					{
						isFlashlightHeld = false;
					}
					if (localPlayerController.pocketedFlashlight is FlashlightItem && localPlayerController.pocketedFlashlight.isHeld && !localPlayerController.pocketedFlashlight.insertedBattery.empty)
					{
						GrabbableObject pocketedFlashlight = localPlayerController.pocketedFlashlight;
						FlashlightItem val2 = (FlashlightItem)(object)((pocketedFlashlight is FlashlightItem) ? pocketedFlashlight : null);
						if ((Object)(object)val2 != (Object)null && val2.flashlightTypeID != 2)
						{
							isFlashlightPocketed = true;
						}
					}
					else
					{
						isFlashlightPocketed = false;
					}
				}
				else
				{
					localPlayerController.pocketedFlashlight = null;
					isFlashlightHeld = false;
					isFlashlightPocketed = false;
				}
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
		[HarmonyPostfix]
		internal static void ClearLightA(ref PlayerControllerB __instance)
		{
			if (StartOfRound.Instance.localPlayerController.isPlayerDead)
			{
				__instance.pocketedFlashlight = null;
				isFlashlightHeld = false;
				isFlashlightPocketed = false;
				if (Plugin.enableNetworking.Value)
				{
					LFNetworkHandler.Instance?.ToggleLightServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, enabled: false);
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager), "PowerSwitchOnClientRpc")]
		[HarmonyPostfix]
		private static void TurnOnFlashlightPower()
		{
			isFacilityPowered = true;
			if (selectedRecharge == RechargeOptions.FacilityPowered)
			{
				UIContainer.SetActive(!isFacilityPowered);
			}
			lastSoundTime = Time.time;
		}

		[HarmonyPatch(typeof(RoundManager), "PowerSwitchOffClientRpc")]
		[HarmonyPostfix]
		private static void TurnOffFlashlightPower()
		{
			isFacilityPowered = false;
			if (selectedRecharge == RechargeOptions.FacilityPowered)
			{
				UIContainer.SetActive(!isFacilityPowered);
				if (Time.time - lastSoundTime > soundCd)
				{
					LightScript.PlayNoise(LightScript.activeClips[6], 0.2f);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MenuManager), "Start")]
		private static void DisplayNetworkingPopup(ref MenuManager __instance)
		{
			if (Plugin.enableNetworking.Value)
			{
				__instance.DisplayMenuNotification("<size=150%>HEY!!!!!!</size>\n<size=60%>you have LocalFlashlight's networking enabled, if you didn't intend to enable it, edit it from your mod manager of choice and then restart the game</size>", "got it");
			}
		}

		private static void MakeIndicator(HUDManager hudManager)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f1: Expected O, but got Unknown
			//IL_094f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0964: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_0988: Unknown result type (might be due to invalid IL or missing references)
			//IL_098d: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c7: Expected O, but got Unknown
			//IL_0a11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a67: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Expected O, but got Unknown
			//IL_0724: Unknown result type (might be due to invalid IL or missing references)
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_075d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0762: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Expected O, but got Unknown
			//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_082b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0830: Unknown result type (might be due to invalid IL or missing references)
			//IL_084f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0854: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Expected O, but got Unknown
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Expected O, but got Unknown
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Expected O, but got Unknown
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aeb: Expected O, but got Unknown
			//IL_0b2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b59: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				UIContainer = new GameObject("LF_MOD_HUD", new Type[2]
				{
					typeof(RectTransform),
					typeof(CanvasGroup)
				});
				UIContainer.transform.SetParent(hudManager.HUDContainer.transform, false);
				UIContainer.transform.localPosition = Vector2.op_Implicit(new Vector2(Plugin.UIPositionX.Value, Plugin.UIPositionY.Value));
				UIContainer.transform.localScale = new Vector3(elemScale, elemScale, elemScale);
				switch (selectedStyle)
				{
				case BatteryDisplayOptions.Bar:
					frame = Plugin.bundle.LoadAsset<Sprite>("frame.png");
					meter = Plugin.bundle.LoadAsset<Sprite>("meter.png");
					frameObj = new GameObject("FrameHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					frameObj.transform.SetParent(UIContainer.transform, false);
					frameObj.GetComponent<RectTransform>();
					frameImage = frameObj.GetComponent<Image>();
					frameImage.sprite = frame;
					((Graphic)frameImage).color = UIColorHex;
					frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.5f, 1.25f));
					meterObj = new GameObject("MeterHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					meterObj.transform.SetParent(UIContainer.transform, false);
					meterObj.GetComponent<RectTransform>();
					meterImage = meterObj.GetComponent<Image>();
					meterImage.sprite = meter;
					((Graphic)meterImage).color = UIColorHex;
					meterImage.type = (Type)3;
					meterImage.fillMethod = (FillMethod)0;
					meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.5f, 1.25f));
					UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered);
					frameObj.SetActive(true);
					meterObj.SetActive(true);
					break;
				case BatteryDisplayOptions.Text:
				{
					textmesh = UIContainer.AddComponent<TextMeshProUGUI>();
					RectTransform rectTransform = ((TMP_Text)textmesh).rectTransform;
					((Transform)rectTransform).SetParent(UIContainer.transform, false);
					((TMP_Text)textmesh).font = ((TMP_Text)hudManager.controlTipLines[0]).font;
					((Graphic)textmesh).color = UIColorHex;
					((TMP_Text)textmesh).fontSize = 23f;
					((TMP_Text)textmesh).overflowMode = (TextOverflowModes)0;
					((Behaviour)textmesh).enabled = true;
					((TMP_Text)textmesh).text = "";
					UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered);
					break;
				}
				case BatteryDisplayOptions.All:
				{
					frame = Plugin.bundle.LoadAsset<Sprite>("meter.png");
					meter = Plugin.bundle.LoadAsset<Sprite>("meter.png");
					textObj = new GameObject("TextHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(TextMeshProUGUI)
					});
					textObj.transform.SetParent(UIContainer.transform, false);
					textObj.GetComponent<RectTransform>();
					textmesh = textObj.GetComponent<TextMeshProUGUI>();
					RectTransform rectTransform2 = ((TMP_Text)textmesh).rectTransform;
					((Transform)rectTransform2).SetParent(textObj.transform, false);
					((Transform)rectTransform2).localPosition = Vector2.op_Implicit(new Vector2(15f, 0f));
					((TMP_Text)textmesh).font = ((TMP_Text)hudManager.controlTipLines[0]).font;
					((Graphic)textmesh).color = UIColorHex;
					((TMP_Text)textmesh).fontSize = 20f;
					((TMP_Text)textmesh).overflowMode = (TextOverflowModes)0;
					((Behaviour)textmesh).enabled = true;
					((TMP_Text)textmesh).text = "";
					frameObj = new GameObject("FrameHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					frameObj.transform.SetParent(UIContainer.transform, false);
					frameObj.GetComponent<RectTransform>();
					frameImage = frameObj.GetComponent<Image>();
					frameImage.sprite = frame;
					((Graphic)frameImage).color = new Color(0f, 0f, 0f, 0.5f);
					frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(2.625f, 0.875f));
					meterObj = new GameObject("MeterHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					meterObj.transform.SetParent(UIContainer.transform, false);
					meterObj.GetComponent<RectTransform>();
					meterImage = meterObj.GetComponent<Image>();
					meterImage.sprite = meter;
					((Graphic)meterImage).color = UIColorHex;
					meterImage.type = (Type)3;
					meterImage.fillMethod = (FillMethod)0;
					meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(2.625f, 0.875f));
					UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered);
					break;
				}
				case BatteryDisplayOptions.CircularBar:
					frame = Plugin.bundle.LoadAsset<Sprite>("meter2.png");
					meter = Plugin.bundle.LoadAsset<Sprite>("meter2.png");
					frameObj = new GameObject("FrameHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					frameObj.transform.SetParent(UIContainer.transform, false);
					frameObj.GetComponent<RectTransform>();
					frameImage = frameObj.GetComponent<Image>();
					frameImage.sprite = frame;
					((Graphic)frameImage).color = new Color(0f, 0f, 0f, 0.3f);
					frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(0.7f, 0.7f));
					meterObj = new GameObject("MeterHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					meterObj.transform.SetParent(UIContainer.transform, false);
					meterObj.GetComponent<RectTransform>();
					meterImage = meterObj.GetComponent<Image>();
					meterImage.sprite = meter;
					((Graphic)meterImage).color = UIColorHex;
					meterImage.type = (Type)3;
					meterImage.fillMethod = (FillMethod)4;
					meterImage.fillClockwise = false;
					meterImage.fillOrigin = 2;
					meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(0.7f, 0.7f));
					UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered);
					frameObj.SetActive(true);
					meterObj.SetActive(true);
					break;
				case BatteryDisplayOptions.VerticalBar:
					frame = Plugin.bundle.LoadAsset<Sprite>("meter3.png");
					meter = Plugin.bundle.LoadAsset<Sprite>("meter3.png");
					frameObj = new GameObject("FrameHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					frameObj.transform.SetParent(UIContainer.transform, false);
					frameObj.GetComponent<RectTransform>();
					frameImage = frameObj.GetComponent<Image>();
					frameImage.sprite = frame;
					((Graphic)frameImage).color = new Color(0f, 0f, 0f, 0.5f);
					frameObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					frameObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.25f, 3f));
					meterObj = new GameObject("MeterHUD", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					meterObj.transform.SetParent(UIContainer.transform, false);
					meterObj.GetComponent<RectTransform>();
					meterImage = meterObj.GetComponent<Image>();
					meterImage.sprite = meter;
					((Graphic)meterImage).color = UIColorHex;
					meterImage.type = (Type)3;
					meterImage.fillMethod = (FillMethod)1;
					meterObj.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
					meterObj.transform.localScale = Vector2.op_Implicit(new Vector2(1.25f, 3f));
					UIContainer.SetActive(selectedRecharge != RechargeOptions.FacilityPowered || !isFacilityPowered);
					frameObj.SetActive(true);
					meterObj.SetActive(true);
					break;
				case BatteryDisplayOptions.Disabled:
					if (warningEnabled)
					{
						warningObj = new GameObject("WarningHUD", new Type[2]
						{
							typeof(RectTransform),
							typeof(Image)
						});
						warningObj.transform.SetParent(UIContainer.transform, false);
						warningObj.GetComponent<RectTransform>();
						warningObj.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
						warningImage = warningObj.GetComponent<Image>();
						warningImage.sprite = warning;
						((Graphic)warningImage).color = UIColorHex;
					}
					UIContainer.SetActive(false);
					break;
				}
			}
			catch (Exception arg)
			{
				Plugin.mls.LogError((object)$"error while making the hud:\n{arg}");
			}
		}

		private static void UpdateHUDText(float timeMinutes, float timeSeconds)
		{
			if ((Object)(object)textmesh == (Object)null)
			{
				return;
			}
			switch (selectedText)
			{
			case TextDisplayOptions.Percent:
				if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = LightScript.BatteryPercent + "%";
				}
				if (LightScript.batteryTime <= 0f)
				{
					((TMP_Text)textmesh).text = "0%";
				}
				if (LightScript.batteryTime >= LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = "100%";
				}
				break;
			case TextDisplayOptions.AccuratePercent:
				if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = LightScript.truePercentBattery.ToString("0.0") + "%";
				}
				if (LightScript.batteryTime <= 0f)
				{
					((TMP_Text)textmesh).text = "0.0%";
				}
				if (LightScript.batteryTime >= LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = "100.0%";
				}
				break;
			case TextDisplayOptions.Time:
				if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = $"{timeMinutes:0}:{timeSeconds:00}";
				}
				if (LightScript.batteryTime <= 0f)
				{
					((TMP_Text)textmesh).text = "0:00";
				}
				if (LightScript.batteryTime >= LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = $"{Mathf.FloorToInt(LightScript.maxBatteryTime / 60f):0}:{Mathf.RoundToInt(LightScript.maxBatteryTime % 60f):00}";
				}
				break;
			case TextDisplayOptions.All:
				if (LightScript.batteryTime > 0f || LightScript.batteryTime < LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = LightScript.truePercentBattery.ToString("0.0") + "%" + $" | {timeMinutes:0}:{timeSeconds:00}";
				}
				if (LightScript.batteryTime <= 0f)
				{
					((TMP_Text)textmesh).text = "0.0% | 0:00";
				}
				if (LightScript.batteryTime >= LightScript.maxBatteryTime)
				{
					((TMP_Text)textmesh).text = "100.0%" + $" | {Mathf.FloorToInt(LightScript.maxBatteryTime / 60f):0}:{Mathf.RoundToInt(LightScript.maxBatteryTime % 60f):00}";
				}
				break;
			}
		}
	}
	public class ToggleButton : LcInputActions
	{
		[InputAction("<Keyboard>/f", Name = "Toggle key")]
		public InputAction toggleKey { get; set; }

		[InputAction("<Keyboard>/h", Name = "Position switch key")]
		public InputAction switchLightPosKey { get; set; }

		[InputAction("<Keyboard>/q", Name = "Recharge key")]
		public InputAction rechargeKey { get; set; }
	}
	[BepInPlugin("command.localFlashlight", "LocalFlashlight", "1.5.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string VERSION = "1.5.1";

		public const string GUID = "command.localFlashlight";

		public const string NAME = "LocalFlashlight";

		public static AssetBundle bundle;

		internal static ToggleButton flashlightToggleInstance = new ToggleButton();

		private readonly Harmony har = new Harmony("command.localFlashlight");

		private static string sceneName;

		public static bool hasReservedSlots = false;

		public static bool hasLCSoundTool = false;

		public static ConfigEntry<float> lightIntensity { get; private set; }

		public static ConfigEntry<float> lightRange { get; private set; }

		public static ConfigEntry<float> lightAngle { get; private set; }

		public static ConfigEntry<float> BatteryLife { get; private set; }

		public static ConfigEntry<float> RechargeMult { get; private set; }

		public static ConfigEntry<float> BurnOutCool { get; private set; }

		public static ConfigEntry<bool> BatteryBurnOut { get; private set; }

		public static ConfigEntry<float> BatteryCool { get; private set; }

		public static ConfigEntry<BatteryDisplayOptions> BatteryDisplay { get; private set; }

		public static ConfigEntry<TextDisplayOptions> TextDisplay { get; private set; }

		public static ConfigEntry<SoundOptions> soundOption { get; private set; }

		public static ConfigEntry<RechargeOptions> rechargeOption { get; private set; }

		public static ConfigEntry<bool> HideUI { get; private set; }

		public static ConfigEntry<float> HideUIDelay { get; private set; }

		public static ConfigEntry<float> UIScale { get; private set; }

		public static ConfigEntry<float> UIHiddenAlpha { get; private set; }

		public static ConfigEntry<bool> UIDisabledLowBatteryWarning { get; private set; }

		public static ConfigEntry<int> LowBatteryWarningPercentage { get; private set; }

		public static ConfigEntry<int> FlashVolume { get; private set; }

		public static ConfigEntry<float> UIPositionX { get; private set; }

		public static ConfigEntry<float> UIPositionY { get; private set; }

		public static ConfigEntry<bool> ShadowsEnabled { get; private set; }

		public static ConfigEntry<bool> soundAggros { get; private set; }

		public static ConfigEntry<bool> flashlightToggleModSynergyquestionmark { get; private set; }

		public static ConfigEntry<int> shakeStaminaConsume { get; private set; }

		public static ConfigEntry<float> shakeActionCooldown { get; private set; }

		public static ConfigEntry<float> apparaticeFlashlightIntensityMult { get; private set; }

		public static ConfigEntry<float> dynamoUseMoveMult { get; private set; }

		public static ConfigEntry<bool> dimEnabled { get; private set; }

		public static ConfigEntry<int> flashlightStopDimBatteryValue { get; private set; }

		public static ConfigEntry<bool> flickerOnBatteryBurn { get; private set; }

		public static ConfigEntry<bool> enableNetworking { get; private set; }

		public static ConfigEntry<int> networkedPlayersVol { get; private set; }

		public static ConfigEntry<string> flashlightColorHex { get; private set; }

		public static ConfigEntry<string> HUDColorHex { get; private set; }

		public static ConfigEntry<int> DarkVisionMult { get; private set; }

		public static ConfigEntry<bool> rechargeInOrbit { get; private set; }

		public static ConfigEntry<bool> soundOnRecharge { get; private set; }

		public static ConfigEntry<bool> rechargeInShip { get; private set; }

		public static ConfigEntry<float> lightPosX1 { get; private set; }

		public static ConfigEntry<float> lightPosY1 { get; private set; }

		public static ConfigEntry<float> lightPosZ1 { get; private set; }

		public static ConfigEntry<float> lightRotX1 { get; private set; }

		public static ConfigEntry<float> lightRotY1 { get; private set; }

		public static ConfigEntry<float> lightRotZ1 { get; private set; }

		public static ConfigEntry<float> lightPosX2 { get; private set; }

		public static ConfigEntry<float> lightPosY2 { get; private set; }

		public static ConfigEntry<float> lightPosZ2 { get; private set; }

		public static ConfigEntry<float> lightRotX2 { get; private set; }

		public static ConfigEntry<float> lightRotY2 { get; private set; }

		public static ConfigEntry<float> lightRotZ2 { get; private set; }

		public static ManualLogSource mls { get; private set; }

		private void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Expected O, but got Unknown
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Expected O, but got Unknown
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Expected O, but got Unknown
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected O, but got Unknown
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Expected O, but got Unknown
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Expected O, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Expected O, but got Unknown
			//IL_03ce: Expected O, but got Unknown
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Expected O, but got Unknown
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Expected O, but got Unknown
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Expected O, but got Unknown
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_0441: Expected O, but got Unknown
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Expected O, but got Unknown
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Expected O, but got Unknown
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Expected O, but got Unknown
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Expected O, but got Unknown
			//IL_04b4: Expected O, but got Unknown
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Expected O, but got Unknown
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Expected O, but got Unknown
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Expected O, but got Unknown
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Expected O, but got Unknown
			//IL_0527: Expected O, but got Unknown
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Expected O, but got Unknown
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Expected O, but got Unknown
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Expected O, but got Unknown
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Expected O, but got Unknown
			//IL_059a: Expected O, but got Unknown
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Expected O, but got Unknown
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d8: Expected O, but got Unknown
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Expected O, but got Unknown
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Expected O, but got Unknown
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Expected O, but got Unknown
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Expected O, but got Unknown
			//IL_063a: Expected O, but got Unknown
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Expected O, but got Unknown
			//IL_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Expected O, but got Unknown
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Expected O, but got Unknown
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Expected O, but got Unknown
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Expected O, but got Unknown
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Expected O, but got Unknown
			//IL_06db: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ed: Expected O, but got Unknown
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f2: Expected O, but got Unknown
			//IL_0719: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Expected O, but got Unknown
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Expected O, but got Unknown
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Expected O, but got Unknown
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Unknown result type (might be due to invalid IL or missing references)
			//IL_077e: Expected O, but got Unknown
			//IL_077f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0787: Expected O, but got Unknown
			//IL_078d: Expected O, but got Unknown
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Expected O, but got Unknown
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bf: Expected O, but got Unknown
			//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d9: Expected O, but got Unknown
			//IL_080c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0813: Expected O, but got Unknown
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_082f: Expected O, but got Unknown
			//IL_0832: Unknown result type (might be due to invalid IL or missing references)
			//IL_083c: Expected O, but got Unknown
			//IL_0863: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Expected O, but got Unknown
			//IL_0879: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Expected O, but got Unknown
			//IL_08b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c8: Expected O, but got Unknown
			//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Expected O, but got Unknown
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0906: Expected O, but got Unknown
			//IL_0901: Unknown result type (might be due to invalid IL or missing references)
			//IL_090b: Expected O, but got Unknown
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_093a: Expected O, but got Unknown
			//IL_0945: Unknown result type (might be due to invalid IL or missing references)
			//IL_094c: Expected O, but got Unknown
			//IL_095e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0968: Expected O, but got Unknown
			//IL_097e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0988: Expected O, but got Unknown
			//IL_09af: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c1: Expected O, but got Unknown
			//IL_09bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Expected O, but got Unknown
			//IL_09ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ff: Expected O, but got Unknown
			//IL_09fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a04: Expected O, but got Unknown
			//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a33: Expected O, but got Unknown
			//IL_0a3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a52: Expected O, but got Unknown
			//IL_0a53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5b: Expected O, but got Unknown
			//IL_0a61: Expected O, but got Unknown
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a66: Expected O, but got Unknown
			//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9f: Expected O, but got Unknown
			//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac2: Expected O, but got Unknown
			//IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ace: Expected O, but got Unknown
			//IL_0ad4: Expected O, but got Unknown
			//IL_0acf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad9: Expected O, but got Unknown
			//IL_0b08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b12: Expected O, but got Unknown
			//IL_0b1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b35: Expected O, but got Unknown
			//IL_0b36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b41: Expected O, but got Unknown
			//IL_0b47: Expected O, but got Unknown
			//IL_0b42: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4c: Expected O, but got Unknown
			//IL_0b7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b85: Expected O, but got Unknown
			//IL_0b90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba8: Expected O, but got Unknown
			//IL_0ba9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb4: Expected O, but got Unknown
			//IL_0bba: Expected O, but got Unknown
			//IL_0bb5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbf: Expected O, but got Unknown
			//IL_0be0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bea: Expected O, but got Unknown
			//IL_0bf5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0d: Expected O, but got Unknown
			//IL_0c0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c19: Expected O, but got Unknown
			//IL_0c1f: Expected O, but got Unknown
			//IL_0c1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c24: Expected O, but got Unknown
			//IL_0c45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4f: Expected O, but got Unknown
			//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c72: Expected O, but got Unknown
			//IL_0c73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7e: Expected O, but got Unknown
			//IL_0c84: Expected O, but got Unknown
			//IL_0c7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c89: Expected O, but got Unknown
			//IL_0caa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb4: Expected O, but got Unknown
			//IL_0cbf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ccc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd7: Expected O, but got Unknown
			//IL_0cd8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce3: Expected O, but got Unknown
			//IL_0ce9: Expected O, but got Unknown
			//IL_0ce4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cee: Expected O, but got Unknown
			//IL_0d1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d27: Expected O, but got Unknown
			//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4a: Expected O, but got Unknown
			//IL_0d4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d56: Expected O, but got Unknown
			//IL_0d5c: Expected O, but got Unknown
			//IL_0d57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d61: Expected O, but got Unknown
			//IL_0d90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9a: Expected O, but got Unknown
			//IL_0da5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0daa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbd: Expected O, but got Unknown
			//IL_0dbe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc9: Expected O, but got Unknown
			//IL_0dcf: Expected O, but got Unknown
			//IL_0dca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd4: Expected O, but got Unknown
			//IL_0e03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0d: Expected O, but got Unknown
			//IL_0e18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e30: Expected O, but got Unknown
			//IL_0e31: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3c: Expected O, but got Unknown
			//IL_0e42: Expected O, but got Unknown
			//IL_0e3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e47: Expected O, but got Unknown
			//IL_0e68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e72: Expected O, but got Unknown
			//IL_0e7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e95: Expected O, but got Unknown
			//IL_0e96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea1: Expected O, but got Unknown
			//IL_0ea7: Expected O, but got Unknown
			//IL_0ea2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eac: Expected O, but got Unknown
			//IL_0ecd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed7: Expected O, but got Unknown
			//IL_0ee2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efa: Expected O, but got Unknown
			//IL_0efb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f06: Expected O, but got Unknown
			//IL_0f0c: Expected O, but got Unknown
			//IL_0f07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f11: Expected O, but got Unknown
			//IL_0f32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3c: Expected O, but got Unknown
			//IL_0f47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f54: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5f: Expected O, but got Unknown
			//IL_0f60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6b: Expected O, but got Unknown
			//IL_0f71: Expected O, but got Unknown
			//IL_0f6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f76: Expected O, but got Unknown
			//IL_0fa1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb9: Expected O, but got Unknown
			//IL_0fba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fc5: Expected O, but got Unknown
			//IL_0fcb: Expected O, but got Unknown
			//IL_0fc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd0: Expected O, but got Unknown
			//IL_0ff7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ffe: Expected O, but got Unknown
			//IL_1010: Unknown result type (might be due to invalid IL or missing references)
			//IL_101a: Expected O, but got Unknown
			//IL_101d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1027: Expected O, but got Unknown
			//IL_1052: Unknown result type (might be due to invalid IL or missing references)
			//IL_1057: Unknown result type (might be due to invalid IL or missing references)
			//IL_105f: Unknown result type (might be due to invalid IL or missing references)
			//IL_106a: Expected O, but got Unknown
			//IL_106b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1076: Expected O, but got Unknown
			//IL_107c: Expected O, but got Unknown
			//IL_1077: Unknown result type (might be due to invalid IL or missing references)
			//IL_1081: Expected O, but got Unknown
			//IL_10a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_10ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_10ba: Expected O, but got Unknown
			//IL_10b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_10bf: Expected O, but got Unknown
			//IL_10ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f0: Expected O, but got Unknown
			//IL_1100: Unknown result type (might be due to invalid IL or missing references)
			//IL_110a: Expected O, but got Unknown
			//IL_1124: Unknown result type (might be due to invalid IL or missing references)
			//IL_112e: Expected O, but got Unknown
			//IL_114b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1155: Expected O, but got Unknown
			//IL_1160: Unknown result type (might be due to invalid IL or missing references)
			//IL_1165: Unknown result type (might be due to invalid IL or missing references)
			//IL_116d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1174: Expected O, but got Unknown
			//IL_1175: Unknown result type (might be due to invalid IL or missing references)
			//IL_117d: Expected O, but got Unknown
			//IL_1183: Expected O, but got Unknown
			//IL_117e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1188: Expected O, but got Unknown
			//IL_11b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_11b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cb: Expected O, but got Unknown
			//IL_11cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d7: Expected O, but got Unknown
			//IL_11dd: Expected O, but got Unknown
			//IL_11d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e2: Expected O, but got Unknown
			//IL_120d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1213: Expected O, but got Unknown
			//IL_1223: Unknown result type (might be due to invalid IL or missing references)
			//IL_122d: Expected O, but got Unknown
			//IL_1247: Unknown result type (might be due to invalid IL or missing references)
			//IL_1251: Expected O, but got Unknown
			//IL_1278: Unknown result type (might be due to invalid IL or missing references)
			//IL_127f: Expected O, but got Unknown
			//IL_1291: Unknown result type (might be due to invalid IL or missing references)
			//IL_129b: Expected O, but got Unknown
			//IL_129e: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a8: Expected O, but got Unknown
			//IL_12cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_12d7: Expected O, but got Unknown
			//IL_12e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_12e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_12f6: Expected O, but got Unknown
			//IL_12f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ff: Expected O, but got Unknown
			//IL_1305: Expected O, but got Unknown
			//IL_1300: Unknown result type (might be due to invalid IL or missing references)
			//IL_130a: Expected O, but got Unknown
			mls = ((BaseUnityPlugin)this).Logger;
			lightIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Flashlight", "Light intensity", 350f, new ConfigDescription("The intensity of the light in lumens", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5000f), Array.Empty<object>()));
			ConfigEntry<float> obj = lightIntensity;
			FloatInputFieldOptions val = new FloatInputFieldOptions();
			((BaseOptions)val).RequiresRestart = false;
			((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig);
			((BaseRangeOptions<float>)(object)val).Min = 1f;
			((BaseRangeOptions<float>)(object)val).Max = 5000f;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj, val));
			lightRange = ((BaseUnityPlugin)this).Config.Bind<float>("Flashlight", "Light range", 17f, new ConfigDescription("The range of the light in units", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<float> obj2 = lightRange;
			val = new FloatInputFieldOptions();
			((BaseOptions)val).RequiresRestart = false;
			((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig);
			((BaseRangeOptions<float>)(object)val).Min = 1f;
			((BaseRangeOptions<float>)(object)val).Max = float.PositiveInfinity;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj2, val));
			lightAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Flashlight", "Light angle", 55f, new ConfigDescription("The size of the light's area", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), Array.Empty<object>()));
			ConfigEntry<float> obj3 = lightAngle;
			val = new FloatInputFieldOptions();
			((BaseOptions)val).RequiresRestart = false;
			((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig);
			((BaseRangeOptions<float>)(object)val).Min = 1f;
			((BaseRangeOptions<float>)(object)val).Max = 120f;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(obj3, val));
			BatteryLife = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Battery life", 12f, new ConfigDescription("The battery life of the flashlight in seconds", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<float> batteryLife = BatteryLife;
			val = new FloatInputFieldOptions();
			((BaseOptions)val).RequiresRestart = false;
			((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			((BaseRangeOptions<float>)(object)val).Min = 1f;
			((BaseRangeOptions<float>)(object)val).Max = float.PositiveInfinity;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(batteryLife, val));
			RechargeMult = ((BaseUnityPlugin)this).Config.Bind<float>("Battery", "Recharge Multiplier", 0.8f, new ConfigDescription("The flashlight's battery recharge multiplier (For instance, setting it to 1 will make it recharge at about the same rate that it is depleted when using the Time recharge method, however this config also applies to other recharge methods)", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<float> rechargeMult = RechargeMult;
			val = new FloatInputFieldOptions();
			((BaseOptions)val).RequiresRestart = false;
			((BaseOptions)val).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			((BaseRangeOptions<float>)(object)val).Min = 0f;
			((BaseRangeOptions<float>)(object)val).Max = float.PositiveInfinity;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(rechargeMult, val));
			BatteryDisplay = ((BaseUnityPlugin)this).Config.Bind<BatteryDisplayOptions>("Indicator", "Battery Details", BatteryDisplayOptions.Bar, "How the indicator displays the flashlight's remaining battery time");
			ConfigEntry<BatteryDisplayOptions> batteryDisplay = BatteryDisplay;
			EnumDropDownOptions val2 = new EnumDropDownOptions();
			((BaseOptions)val2).RequiresRestart = false;
			((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<BatteryDisplayOptions>(batteryDisplay, val2));
			TextDisplay = ((BaseUnityPlugin)this).Config.Bind<TextDisplayOptions>("Indicator", "Battery text display", TextDisplayOptions.Percent, "(Only applies to \"Text\" and \"All\" indicator display options) Wherether the mod should display the battery information text in percents, accurate percents or time left");
			ConfigEntry<TextDisplayOptions> textDisplay = TextDisplay;
			val2 = new EnumDropDownOptions();
			((BaseOptions)val2).RequiresRestart = false;
			((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<TextDisplayOptions>(textDisplay, val2));
			HideUI = ((BaseUnityPlugin)this).Config.Bind<bool>("Indicator", "Indicator fading", true, "Fades out the battery indicator when the flashlight is inactive for a while");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HideUI, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			}));
			HideUIDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "Battery indicator fade delay", 2f, new ConfigDescription("The delay before fading out the indicator in seconds", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<float> hideUIDelay = HideUIDelay;
			FloatInputFieldOptions val3 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = float.PositiveInfinity;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(hideUIDelay, val3));
			UIHiddenAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "Indicator faded out opacity", 0.2f, new ConfigDescription("The opacity of the indicator when the indicator is faded out", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ConfigEntry<float> uIHiddenAlpha = UIHiddenAlpha;
			FloatInputFieldOptions val4 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val4).Min = 0f;
			((BaseRangeOptions<float>)val4).Max = 1f;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(uIHiddenAlpha, val4));
			UIScale = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "Indicator scale", 1f, new ConfigDescription("Battery indicator scale", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>()));
			ConfigEntry<float> uIScale = UIScale;
			FloatInputFieldOptions val5 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val5).Min = 0.01f;
			((BaseRangeOptions<float>)val5).Max = float.PositiveInfinity;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(uIScale, val5));
			UIPositionX = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "IndicatorPositionX", 350f, new ConfigDescription("The position of the battery indicator on the X axis", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-450f, 450f), Array.Empty<object>()));
			ConfigEntry<float> uIPositionX = UIPositionX;
			FloatSliderOptions val6 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val6).Min = -450f;
			((BaseRangeOptions<float>)val6).Max = 450f;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(uIPositionX, val6));
			UIPositionY = ((BaseUnityPlugin)this).Config.Bind<float>("Indicator", "IndicatorPositionY", -150f, new ConfigDescription("The position of the battery indicator on the Y axis", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-280f, 280f), Array.Empty<object>()));
			ConfigEntry<float> uIPositionY = UIPositionY;
			FloatSliderOptions val7 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val7).Min = -280f;
			((BaseRangeOptions<float>)val7).Max = 280f;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(uIPositionY, val7));
			UIDisabledLowBatteryWarning = ((BaseUnityPlugin)this).Config.Bind<bool>("Indicator", "Low Battery Warning toggle", true, "(Only applies when the indicator is disabled) Shows a warning on the HUD when the battery charge reaches a certain percentage");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(UIDisabledLowBatteryWarning, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			}));
			LowBatteryWarningPercentage = ((BaseUnityPlugin)this).Config.Bind<int>("Indicator", "Low Battery Warning %", 30, new ConfigDescription("(Only applies when the indicator is disabled) The percentage at which the low battery warning shows up", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ConfigEntry<int> lowBatteryWarningPercentage = LowBatteryWarningPercentage;
			IntInputFieldOptions val8 = new IntInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<int>)val8).Min = 0;
			((BaseRangeOptions<int>)val8).Max = 100;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(lowBatteryWarningPercentage, val8));
			flashlightColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "Flashlight Color (Hex)", "#FFFFFF", new ConfigDescription("very important, add the # before the hex! if it breaks or doesn't work, try resetting the config and typing the code in manually", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<string> obj4 = flashlightColorHex;
			TextInputFieldOptions val9 = new TextInputFieldOptions();
			((BaseOptions)val9).RequiresRestart = false;
			((BaseOptions)val9).CanModifyCallback = new CanModifyDelegate(modifySpecialConfig);
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(obj4, val9));
			HUDColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "Indicator Color (Hex)", "#FFFFFF", new ConfigDescription("very important, add the # before the hex! if it breaks or doesn't work, try resetting the config and typing the code in manually", (AcceptableValueBase)null, Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(HUDColorHex, new TextInputFieldOptions
			{
				RequiresRestart = false
			}));
			flashlightToggleModSynergyquestionmark = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Prioritize flashlights in the inventory", true, "Prevents the localflashlight from turning on while there already is a flashlight in your inventory (doesn't take into account modded flashlights)");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(flashlightToggleModSynergyquestionmark, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			}));
			FlashVolume = ((BaseUnityPlugin)this).Config.Bind<int>("Other", "Flashlight volume", 50, new ConfigDescription("The volume of the flashlight's sounds. Does not apply to how well others can hear it.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ConfigEntry<int> flashVolume = FlashVolume;
			IntSliderOptions val10 = new IntSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<int>)val10).Min = 0;
			((BaseRangeOptions<int>)val10).Max = 100;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(flashVolume, val10));
			soundOption = ((BaseUnityPlugin)this).Config.Bind<SoundOptions>("Other", "Sound options", SoundOptions.InGameFlashlight, "Switch between default sounds and custom sounds, with only the former being heard by other players when networking is enabled. To apply custom sounds you need to have LCSoundTool installed and enabled, as well as having the custom sounds in the customsounds folder of this mod (refer to readme if you don't know how to do that).");
			ConfigEntry<SoundOptions> obj5 = soundOption;
			val2 = new EnumDropDownOptions();
			((BaseOptions)val2).RequiresRestart = false;
			((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<SoundOptions>(obj5, val2));
			ShadowsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Enable shadows", true, "The light also emits shadows when enabled. Good for when modded items are too large and block the light.");
			ConfigEntry<bool> shadowsEnabled = ShadowsEnabled;
			BoolCheckBoxOptions val11 = new BoolCheckBoxOptions();
			((BaseOptions)val11).RequiresRestart = false;
			((BaseOptions)val11).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(shadowsEnabled, val11));
			rechargeOption = ((BaseUnityPlugin)this).Config.Bind<RechargeOptions>("Other", "Recharge method", RechargeOptions.Time, "How the flashlight is recharged. Different options result in different playstyles and battery management.");
			ConfigEntry<RechargeOptions> obj6 = rechargeOption;
			val2 = new EnumDropDownOptions();
			((BaseOptions)val2).RequiresRestart = false;
			((BaseOptions)val2).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<RechargeOptions>(obj6, val2));
			rechargeInOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Fully recharge in orbit", true, "When set to true, fully recharges the flashlight when reaching orbit (when the round ends). Good for slow recharge times or longer battery times.");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(rechargeInOrbit, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			}));
			rechargeInShip = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Recharge in ship", true, "When set to true, recharges the flashlight at a fast rate while in the ship when the flashlight is turned off. Good for longer battery times or slow recharge multipliers.");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(rechargeInShip, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			}));
			DarkVisionMult = ((BaseUnityPlugin)this).Config.Bind<int>("Other", "Ambient light intensity multiplier", 100, new ConfigDescription("Determines the multiplier of the indoor ambient light. Useful if you want to use the flashlight more.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ConfigEntry<int> darkVisionMult = DarkVisionMult;
			IntSliderOptions val12 = new IntSliderOptions();
			((BaseOptions)val12).RequiresRestart = false;
			((BaseOptions)val12).CanModifyCallback = new CanModifyDelegate(modifyConfig);
			((BaseRangeOptions<int>)(object)val12).Min = 0;
			((BaseRangeOptions<int>)(object)val12).Max = 100;
			LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(darkVisionMult, val12));
			flickerOnBatteryBurn = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Enable light flickering", true, "When true, the local