Decompiled source of GeneralImprovements v1.4.4

GeneralImprovements.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using GeneralImprovements.API;
using GeneralImprovements.Assets;
using GeneralImprovements.Items;
using GeneralImprovements.NetcodePatcher;
using GeneralImprovements.Patches;
using GeneralImprovements.Patches.Other;
using GeneralImprovements.Utilities;
using HarmonyLib;
using Mono.Cecil;
using TMPro;
using Unity.Netcode;
using Unity.Profiling;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GeneralImprovements")]
[assembly: AssemblyConfiguration("Deploy")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+595be2f0de8bb3bb2087d09a86d655b75e4acd6b")]
[assembly: AssemblyProduct("GeneralImprovements")]
[assembly: AssemblyTitle("GeneralImprovements")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace GeneralImprovements
{
	public class Enums
	{
		public enum eAutoLaunchOption
		{
			NONE,
			ONLINE,
			LAN
		}

		public enum eShowHiddenMoons
		{
			Never,
			AfterDiscovery,
			Always
		}

		public enum eMaskedEntityCopyLook
		{
			None,
			Suit,
			SuitAndCosmetics
		}

		public enum eSaveFurniturePlacement
		{
			None,
			StartingFurniture,
			All
		}

		public enum eShipCamRotation
		{
			None,
			North,
			East,
			South,
			West
		}

		public enum eMonitorNames
		{
			None,
			AverageDailyScrap,
			CompanyBuyRate,
			Credits,
			DailyProfit,
			DangerLevel,
			DaysSinceDeath,
			Deadline,
			DoorPower,
			FancyWeather,
			OvertimeCalculator,
			PlayerHealth,
			PlayerHealthExact,
			ProfitQuota,
			Sales,
			ScrapLeft,
			ShipScrap,
			Time,
			TotalDays,
			TotalDeaths,
			TotalQuotas,
			Weather,
			ExternalCam,
			InternalCam
		}

		public enum eValidKeys
		{
			None,
			Space,
			Enter,
			Tab,
			Backquote,
			Quote,
			Semicolon,
			Comma,
			Period,
			Slash,
			Backslash,
			LeftBracket,
			RightBracket,
			Minus,
			Equals,
			A,
			B,
			C,
			D,
			E,
			F,
			G,
			H,
			I,
			J,
			K,
			L,
			M,
			N,
			O,
			P,
			Q,
			R,
			S,
			T,
			U,
			V,
			W,
			X,
			Y,
			Z,
			Digit1,
			Digit2,
			Digit3,
			Digit4,
			Digit5,
			Digit6,
			Digit7,
			Digit8,
			Digit9,
			Digit0,
			LeftShift,
			RightShift,
			LeftAlt,
			AltGr,
			LeftCtrl,
			RightCtrl,
			LeftWindows,
			RightCommand,
			ContextMenu,
			Escape,
			LeftArrow,
			RightArrow,
			UpArrow,
			DownArrow,
			Backspace,
			PageDown,
			PageUp,
			Home,
			End,
			Insert,
			Delete,
			CapsLock,
			NumLock,
			PrintScreen,
			ScrollLock,
			Pause,
			NumpadEnter,
			NumpadDivide,
			NumpadMultiply,
			NumpadPlus,
			NumpadMinus,
			NumpadPeriod,
			NumpadEquals,
			Numpad0,
			Numpad1,
			Numpad2,
			Numpad3,
			Numpad4,
			Numpad5,
			Numpad6,
			Numpad7,
			Numpad8,
			Numpad9,
			F1,
			F2,
			F3,
			F4,
			F5,
			F6,
			F7,
			F8,
			F9,
			F10,
			F11,
			F12,
			MouseLeft,
			MouseRight,
			MouseMiddle,
			MouseBackButton,
			MouseForwardButton
		}

		public enum eItemsToKeep
		{
			None,
			Held,
			NonScrap,
			All
		}

		public static ButtonControl GetMouseButtonMapping(eValidKeys mouseButton)
		{
			return (ButtonControl)(mouseButton switch
			{
				eValidKeys.MouseLeft => Mouse.current.leftButton, 
				eValidKeys.MouseRight => Mouse.current.rightButton, 
				eValidKeys.MouseMiddle => Mouse.current.middleButton, 
				eValidKeys.MouseBackButton => Mouse.current.backButton, 
				eValidKeys.MouseForwardButton => Mouse.current.forwardButton, 
				_ => throw new NotImplementedException(), 
			});
		}
	}
	internal static class Metadata
	{
		public const string GUID = "ShaosilGaming.GeneralImprovements";

		public const string PLUGIN_NAME = "GeneralImprovements";

		public const string VERSION = "1.4.4";
	}
	[BepInPlugin("ShaosilGaming.GeneralImprovements", "GeneralImprovements", "1.4.4")]
	[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
	{
		private const string EnemiesSection = "Enemies";

		private const string ExtraMonitorsSection = "ExtraMonitors";

		private const string FixesSection = "Fixes";

		private const string GameLaunchSection = "GameLaunch";

		private const string InventorySection = "Inventory";

		private const string MechanicsSection = "Mechanics";

		private const string ScannerSection = "Scanner";

		private const string ShipSection = "Ship";

		private const string TeleportersSection = "Teleporters";

		private const string TerminalSection = "Terminal";

		private const string ToolsSection = "Tools";

		private const string UISection = "UI";

		public static ManualLogSource MLS { get; private set; }

		public static ConfigEntry<Enums.eMaskedEntityCopyLook> MaskedEntitiesCopyPlayerLooks { get; private set; }

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

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

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

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

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

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

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

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

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

		public static Color MonitorBackgroundColorVal { get; private set; }

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

		public static Color MonitorTextColorVal { get; private set; }

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

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

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

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

		public static ConfigEntry<Enums.eMonitorNames>[] ShipMonitorAssignments { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static ConfigEntry<Enums.eAutoLaunchOption> AutoSelectLaunchMode { get; private set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static int MinimumStartingMoneyVal => Math.Clamp(MinimumStartingMoney.Value, Math.Max(StartingMoneyPerPlayerVal, 0), 10000);

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

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

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

		public static Dictionary<string, float> SanitizedScrapValueWeatherMultipliers { get; private set; }

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

		public static Dictionary<string, float> SanitizedScrapAmountWeatherMultipliers { get; private set; }

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

		public static int StartingMoneyPerPlayerVal => Math.Clamp(StartingMoneyPerPlayer.Value, -1, 10000);

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

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

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

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

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

		public static bool AllowChargerPlacement { get; private set; } = false;


		public static ConfigEntry<Enums.eValidKeys> CounterClockwiseKey { get; private set; }

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

		public static ConfigEntry<Enums.eValidKeys> FreeRotateKey { get; private set; }

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

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

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

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

		public static ConfigEntry<Enums.eSaveFurniturePlacement> SaveShipFurniturePlaces { get; private set; }

		public static ConfigEntry<Enums.eShipCamRotation> ShipMapCamRotation { get; private set; }

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

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

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

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

		public static ConfigEntry<Enums.eItemsToKeep> KeepItemsDuringInverse { get; private set; }

		public static ConfigEntry<Enums.eItemsToKeep> KeepItemsDuringTeleport { get; private set; }

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

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

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

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

		public static ConfigEntry<Enums.eShowHiddenMoons> ShowHiddenMoonsInCatalog { get; private set; }

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

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

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

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

		public static ConfigEntry<Enums.eValidKeys> FlashlightToggleShortcut { get; private set; }

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

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

		public static List<Type> ScannableToolVals { get; private set; } = new List<Type>();


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

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

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

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

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

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

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

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

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

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

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

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

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

		private void Awake()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			MLS = ((BaseUnityPlugin)this).Logger;
			OtherModHelper.Initialize();
			AssetBundleHelper.Initialize();
			BindConfigs();
			MigrateOldConfigValues();
			MLS.LogInfo((object)"Configuration Initialized.");
			Harmony val = new Harmony("ShaosilGaming.GeneralImprovements");
			val.PatchAll(typeof(ILManipulatorPatch));
			MLS.LogInfo((object)"ILManipulator patched (fixes rare cases where transpilers do not emit the expected IL code.");
			val.PatchAll(typeof(AudioReverbTriggerPatch));
			MLS.LogInfo((object)"AudioReverbTrigger patched.");
			val.PatchAll(typeof(AutoParentToShipPatch));
			MLS.LogInfo((object)"AutoParentToShip patched.");
			val.PatchAll(typeof(DepositItemsDeskPatch));
			MLS.LogInfo((object)"DepositItemsDesk patched.");
			val.PatchAll(typeof(DoorLockPatch));
			MLS.LogInfo((object)"DoorLock patched.");
			val.PatchAll(typeof(EnemyAIPatch));
			MLS.LogInfo((object)"EnemyAI patched.");
			val.PatchAll(typeof(EntranceTeleportPatch));
			MLS.LogInfo((object)"EntranceTeleport patched.");
			if (!OtherModHelper.FlashlightFixActive)
			{
				val.PatchAll(typeof(FlashlightItemPatch));
				MLS.LogInfo((object)"FlashlightItem patched.");
			}
			else
			{
				MLS.LogWarning((object)"Outdated version of FlashlightFix detected - please update your mods.");
			}
			val.PatchAll(typeof(GameNetworkManagerPatch));
			MLS.LogInfo((object)"GameNetworkManager patched.");
			val.PatchAll(typeof(GrabbableObjectsPatch));
			MLS.LogInfo((object)"GrabbableObjects patched.");
			val.PatchAll(typeof(HangarShipDoorPatch));
			MLS.LogInfo((object)"HangarShipDoor patched.");
			val.PatchAll(typeof(HUDManagerPatch));
			MLS.LogInfo((object)"HUDManager patched.");
			val.PatchAll(typeof(ItemDropshipPatch));
			MLS.LogInfo((object)"ItemDropship patched.");
			val.PatchAll(typeof(LandminePatch));
			MLS.LogInfo((object)"Landmine patched.");
			val.PatchAll(typeof(ManualCameraRendererPatch));
			MLS.LogInfo((object)"ManualCameraRenderer patched.");
			val.PatchAll(typeof(MaskedPlayerEnemyPatch));
			MLS.LogInfo((object)"MaskedPlayerEnemy patched.");
			val.PatchAll(typeof(MenuPatches));
			MLS.LogInfo((object)"Menus patched.");
			val.PatchAll(typeof(PlayerControllerBPatch));
			MLS.LogInfo((object)"PlayerControllerB patched.");
			val.PatchAll(typeof(RoundManagerPatch));
			MLS.LogInfo((object)"RoundManager patched.");
			val.PatchAll(typeof(ShipBuildModeManagerPatch));
			MLS.LogInfo((object)"ShipBuildModeManager patched.");
			val.PatchAll(typeof(ShipTeleporterPatch));
			MLS.LogInfo((object)"ShipTeleporter patched.");
			val.PatchAll(typeof(SprayPaintItemPatch));
			MLS.LogInfo((object)"SprayPaintItem patched.");
			val.PatchAll(typeof(StartMatchLeverPatch));
			MLS.LogInfo((object)"StartMatchLever patched.");
			val.PatchAll(typeof(StartOfRoundPatch));
			MLS.LogInfo((object)"StartOfRound patched.");
			val.PatchAll(typeof(StormyWeatherPatch));
			MLS.LogInfo((object)"StormyWeather patched.");
			val.PatchAll(typeof(TerminalAccessibleObjectPatch));
			MLS.LogInfo((object)"TerminalAccessibleObject patched.");
			val.PatchAll(typeof(TerminalPatch));
			MLS.LogInfo((object)"Terminal patched.");
			val.PatchAll(typeof(TimeOfDayPatch));
			MLS.LogInfo((object)"TimeOfDay patched.");
			val.PatchAll(typeof(UnlockableSuitPatch));
			MLS.LogInfo((object)"UnlockableSuit patched.");
			GameNetworkManagerPatch.PatchNetcode();
			OtherModHelper.PatchBuyRateSettingsIfNeeded(val);
			OtherModHelper.PatchCodeRebirthIfNeeded(val);
			MLS.LogInfo((object)"GeneralImprovements v1.4.4 fully loaded.");
		}

		public void BindConfigs()
		{
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Expected O, but got Unknown
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Expected O, but got Unknown
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Expected O, but got Unknown
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Expected O, but got Unknown
			//IL_0546: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Expected O, but got Unknown
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Expected O, but got Unknown
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Expected O, but got Unknown
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Expected O, but got Unknown
			//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae5: Expected O, but got Unknown
			//IL_0b34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3e: Expected O, but got Unknown
			//IL_0baa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb4: Expected O, but got Unknown
			//IL_0c7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c87: Expected O, but got Unknown
			//IL_0de5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0def: Expected O, but got Unknown
			//IL_0e22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2c: Expected O, but got Unknown
			//IL_0fca: Unknown result type (might be due to invalid IL or missing references)
			//IL_1005: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			string text2 = "Leaving this on its default value will ensure no vanilla code is changed.";
			int[] array = (from n in Enumerable.Range(0, 24)
				select n * 15 into n
				where n == 0 || 360 % n == 0
				select n).ToArray();
			List<Type> list = new List<Type>
			{
				typeof(BoomboxItem),
				typeof(ExtensionLadderItem),
				typeof(FlashlightItem),
				typeof(JetpackItem),
				typeof(LockPicker),
				typeof(RadarBoosterItem),
				typeof(KnifeItem),
				typeof(Shovel),
				typeof(SprayPaintItem),
				typeof(StunGrenadeItem),
				typeof(TetraChemicalItem),
				typeof(WalkieTalkie),
				typeof(PatcherTool)
			};
			string text3 = string.Join(", ", new string[1] { "All" }.Concat(list.Select((Type t) => t.Name)));
			MaskedEntitiesCopyPlayerLooks = ((BaseUnityPlugin)this).Config.Bind<Enums.eMaskedEntityCopyLook>("Enemies", "MaskedEntitiesCopyPlayerLooks", Enums.eMaskedEntityCopyLook.None, "How much masked entities should look like a targeted player.");
			MaskedEntitiesReachTowardsPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "MaskedEntitiesReachTowardsPlayer", true, "If set to true, masked entities will reach towards the player they are chasing in a zombie-like way.");
			MaskedEntitiesShowPlayerNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "MaskedEntitiesShowPlayerNames", false, "If set to true, masked entities will display their targeted player's name above their head, as well as be scannable if ScanPlayers = True.");
			MaskedEntitiesShowScrapIconChance = ((BaseUnityPlugin)this).Config.Bind<int>("Enemies", "MaskedEntitiesShowScrapIconChance", 0, new ConfigDescription("The percentage (0-100) a masked entity will spawn with a radar map scrap icon attached.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			MaskedEntitiesSpinOnRadar = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "MaskedEntitiesSpinOnRadar", true, "If set to true, masked entities' radar dots will spin randomly, slightly giving away their identity.");
			MaskedEntitiesWearMasks = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "MaskedEntitiesWearMasks", true, "If set to true, masked entities will wear their default masks.");
			AddMoreBetterMonitors = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "AddMoreBetterMonitors", true, "If set to true and paired with UseBetterMonitors (required), adds 4 more small and 1 large monitor to the left of the main ship monitor group.");
			AlwaysRenderMonitors = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "AlwaysRenderMonitors", false, "If using better monitors and set to true, text-based monitors will render updates even when you are not in the ship. May slightly affect performance.");
			CenterAlignMonitorText = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "CenterAlignMonitorText", true, "If set to true, all small monitors in the ship will have their text center aligned, instead of left.");
			MonitorBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<string>("ExtraMonitors", "MonitorBackgroundColor", "160959", "The hex color code of what the backgrounds of the monitors should be. A recommended value close to black is 050505.");
			MonitorTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("ExtraMonitors", "MonitorTextColor", "00FF2C", "The hex color code of what the text on the monitors should be.");
			ShipExternalCamFPS = ((BaseUnityPlugin)this).Config.Bind<int>("ExtraMonitors", "ShipExternalCamFPS", 0, new ConfigDescription("Limits the FPS of the external ship cam for performance. 0 = Unrestricted.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 30), Array.Empty<object>()));
			ShipExternalCamSizeMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("ExtraMonitors", "ShipExternalCamSizeMultiplier", 1, new ConfigDescription("How many times to double the external ship cam's resolution.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>()));
			ShipInternalCamFPS = ((BaseUnityPlugin)this).Config.Bind<int>("ExtraMonitors", "ShipInternalCamFPS", 0, new ConfigDescription("Limits the FPS of the internal ship cam for performance. 0 = Unrestricted.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 30), Array.Empty<object>()));
			ShipInternalCamSizeMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("ExtraMonitors", "ShipInternalCamSizeMultiplier", 1, new ConfigDescription("How many times to double the internal ship cam's resolution.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>()));
			ShipMonitorAssignments = new ConfigEntry<Enums.eMonitorNames>[14];
			for (int i = 0; i < ShipMonitorAssignments.Length; i++)
			{
				ShipMonitorAssignments[i] = ((BaseUnityPlugin)this).Config.Bind<Enums.eMonitorNames>("ExtraMonitors", $"ShipMonitor{i + 1}", i switch
				{
					4 => Enums.eMonitorNames.ProfitQuota, 
					5 => Enums.eMonitorNames.Deadline, 
					10 => Enums.eMonitorNames.InternalCam, 
					13 => Enums.eMonitorNames.ExternalCam, 
					_ => Enums.eMonitorNames.None, 
				}, $"What to display on the ship monitor at position {i + 1}, if anything.");
			}
			ShowBackgroundOnAllScreens = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "ShowBackgroundOnAllScreens", false, "If set to true, will show the MonitorBackgroundColor on ALL monitors when they are on, not just used ones.");
			ShowBlueMonitorBackground = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "ShowBlueMonitorBackground", true, "If set to true and NOT using UseBetterMonitors, keeps the vanilla blue backgrounds on the extra monitors. Set to false to hide.");
			SyncExtraMonitorsPower = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "SyncExtraMonitorsPower", true, "If set to true, The smaller monitors above the map screen will turn off and on when the map screen power is toggled.");
			SyncMonitorsFromOtherHost = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "SyncMonitorsFromOtherHost", false, "If set to true, all monitor placements will be synced from the host when joining a game, if the host is also using this mod. Settings such as color, FPS, etc will not be synced.");
			UseBetterMonitors = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtraMonitors", "UseBetterMonitors", false, "If set to true, upgrades the vanilla monitors with integrated and more customizable overlays.");
			AutomaticallyCollectTeleportedCorpses = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "AutomaticallyCollectTeleportedCorpses", true, "If set to true, dead bodies will be automatically collected as scrap when being teleported to the ship.");
			DropShipItemLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Fixes", "DropShipItemLimit", 24, new ConfigDescription("Sets the max amount of items a single dropship delivery will allow. Vanilla = 12.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 100), Array.Empty<object>()));
			FixInternalFireExits = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "FixInternalFireExits", true, "If set to true, the player will face the interior of the facility when entering through a fire entrance.");
			FixItemsFallingThrough = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "FixItemsFallingThrough", true, "Fixes items falling through furniture on the ship when loading the game.");
			FixItemsLoadingSameRotation = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixes", "FixItemsLoadingSameRotation", true, "Fixes items all facing the same way when loading a save file. Now they will store their rotations as well.");
			SellCounterItemLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Fixes", "SellCounterItemLimit", 24, new ConfigDescription("Sets the max amount of items the company selling counter will hold at one time. Vanilla = 12.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 999), Array.Empty<object>()));
			AllowPreGameLeverPullAsClient = ((BaseUnityPlugin)this).Config.Bind<bool>("GameLaunch", "AllowPreGameLeverPullAsClient", true, "If set to true, you will be able to pull the ship lever to start the game as a connected player.");
			AlwaysShowNews = ((BaseUnityPlugin)this).Config.Bind<bool>("GameLaunch", "AlwaysShowNews", false, "If set to true, will always display the news popup when starting the game.");
			AutoSelectLaunchMode = ((BaseUnityPlugin)this).Config.Bind<Enums.eAutoLaunchOption>("GameLaunch", "AutoSelectLaunchMode", Enums.eAutoLaunchOption.NONE, "If set to 'ONLINE' or 'LAN', will automatically launch the correct mode, saving you from having to click the menu option when the game loads. **WARNING** THIS MAY PREVENT CERTAIN OTHER MODS FROM BEING ABLE TO PROPERLY INITIALIZE.");
			MenuMusicVolume = ((BaseUnityPlugin)this).Config.Bind<int>("GameLaunch", "MenuMusicVolume", 100, new ConfigDescription("Controls the volume of the menu music, from 0-100.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			SkipStartupScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("GameLaunch", "SkipStartupScreen", true, "Skips the main menu loading screen bootup animation.");
			PickupInOrder = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "PickupInOrder", false, "When picking up items, will always put them in left - right order.");
			RearrangeOnDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "RearrangeOnDrop", false, "When dropping items, will rearrange other inventory items to ensure slots are filled left - right.");
			ScrollDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Inventory", "ScrollDelay", 0.1f, new ConfigDescription("The minimum time you must wait to scroll to another item in your inventory. Vanilla: 0.3.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 0.3f), Array.Empty<object>()));
			TwoHandedInSlotOne = ((BaseUnityPlugin)this).Config.Bind<bool>("Inventory", "TwoHandedInSlotOne", false, "When picking up a two handed item, it will always place it in slot 1 and shift things to the right if needed. Makes selling quicker when paired with RearrangeOnDrop.");
			AddHealthRechargeStation = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "AddHealthRechargeStation", false, "[Host Only] If set to true, a medical charging station will be above the ship's battery charger, and can be used to heal to full. " + text);
			AllowOvertimeBonus = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "AllowOvertimeBonus", true, "[Host Only] If set to false, will prevent the vanilla overtime bonus from being applied after the end of a quota.");
			AllowPickupOfAllItemsPreStart = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "AllowPickupOfAllItemsPreStart", true, "Allows you to pick up all grabbable items before the game is started.");
			AllowQuotaRollover = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "AllowQuotaRollover", false, "[Host Required] If set to true, will keep the surplus money remaining after selling things to the company, and roll it over to the next quota. If clients do not set this, they will see visual desyncs.");
			DestroyKeysAfterOrbiting = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "DestroyKeysAfterOrbiting", false, "If set to true, all keys in YOUR inventory (and IF HOSTING, the ship) will be destroyed after orbiting. Works well to nerf KeysHaveInfiniteUses. Players who do not have this enabled will keep keys currently in their inventory.");
			KeysHaveInfiniteUses = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "KeysHaveInfiniteUses", false, "If set to true, keys will not despawn when they are used.");
			MinimumStartingMoney = ((BaseUnityPlugin)this).Config.Bind<int>("Mechanics", "MinimumStartingMoney", 30, "[Host Only] When paired with StartingMoneyPerPlayer, will ensure a group always starts with at least this much money. Must be at least the value of StartingMoneyPerPlayer. Internally capped at 10k. " + text2);
			SavePlayerSuits = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "SavePlayerSuits", true, "If set to true, the host will keep track of every player's last used suit, and will persist between loads and ship resets for each save file. Only works in Online mode.");
			ScanCommandUsesExactAmount = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "ScanCommandUsesExactAmount", false, "If set to true, the terminal's scan command (and ScrapLeft monitor) will use display the exact scrap value remaining instead of approximate.");
			ScrapValueWeatherMultipliers = ((BaseUnityPlugin)this).Config.Bind<string>("Mechanics", "ScrapValueWeatherMultipliers", string.Empty, "[Host Only] You may specify comma separated weather:multiplier (0.1 - 2.0) for all weather types, including modded weather. Default vanilla scrap value multiplier is 0.4, which will default for any unspecified weather type. A recommended value would be 'None:0.4, DustClouds:0.5, Foggy:0.5, Rainy:0.55, Flooded:0.6, Stormy:0.7, Eclipsed:0.8'.");
			ScrapAmountWeatherMultipliers = ((BaseUnityPlugin)this).Config.Bind<string>("Mechanics", "ScrapAmountWeatherMultipliers", string.Empty, "[Host Only] You may specify comma separated weather:multiplier (1.0 - 5.0) for all weather types, including modded weather. Default vanilla scrap amount multiplier is 1.0, which will default for any unspecified weather type. A recommended value would be 'None:1.0, DustClouds:1.2, Foggy:1.2, Rainy:1.3, Flooded:1.4, Stormy:1.5, Eclipsed:1.6'.");
			StartingMoneyPerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Mechanics", "StartingMoneyPerPlayer", -1, "[Host Only] How much starting money the group gets per player. Set to -1 to disable. Adjusts money as players join and leave, until the game starts. Internally capped at 10k. " + text2);
			UnlockDoorsFromInventory = ((BaseUnityPlugin)this).Config.Bind<bool>("Mechanics", "UnlockDoorsFromInventory", false, "If set to true, keys in your inventory do not have to be held when unlocking facility doors.");
			FixPersonalScanner = ((BaseUnityPlugin)this).Config.Bind<bool>("Scanner", "FixPersonalScanner", false, "If set to true, will tweak the behavior of the scan action and more reliably ping items closer to you, and the ship/main entrance.");
			ScanPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Scanner", "ScanPlayers", false, "If set to true, players (and sneaky masked entities) will be scannable.");
			ShowDoorsOnScanner = ((BaseUnityPlugin)this).Config.Bind<bool>("Scanner", "ShowDoorsOnScanner", false, "If set to true, all fire entrances and facility exits will be scannable. Compatible with mimics mod (they show up as an exit as well).");
			ShowDropshipOnScanner = ((BaseUnityPlugin)this).Config.Bind<bool>("Scanner", "ShowDropshipOnScanner", false, "If set to true, the item drop ship will be scannable.");
			CounterClockwiseKey = ((BaseUnityPlugin)this).Config.Bind<Enums.eValidKeys>("Ship", "CounterClockwiseKey", Enums.eValidKeys.LeftShift, "If SnapObjectsByDegrees > 0, configures which modifier key spins it CCW.");
			DisableShipCamPostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "DisableShipCamPostProcessing", false, "If set to true, the internal and external ship cameras will no longer use post processing. This may improve performance with higher resolution camera settings.");
			FreeRotateKey = ((BaseUnityPlugin)this).Config.Bind<Enums.eValidKeys>("Ship", "FreeRotateKey", Enums.eValidKeys.LeftAlt, "If SnapObjectsByDegrees > 0, configures which modifer key activates free rotation.");
			HideClipboardAndStickyNote = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "HideClipboardAndStickyNote", false, "If set to true, the game will not show the clipboard or sticky note when the game loads.");
			HideShipCabinetDoors = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "HideShipCabinetDoors", false, "If set to true, the storage shelves in the ship will not have doors.");
			LightSwitchScanNode = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "LightSwitchScanNode", true, "If set to true, the light switch will have a scan node attached.");
			MoveShipClipboardToWall = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "MoveShipClipboardToWall", true, "If set to true, the ship's clipboard will not start on the table but instead on the wall in front of the player.");
			SaveShipFurniturePlaces = ((BaseUnityPlugin)this).Config.Bind<Enums.eSaveFurniturePlacement>("Ship", "SaveShipFurniturePlaces", Enums.eSaveFurniturePlacement.StartingFurniture, "Determines what ship furniture positions and storage states will not be reset after being fired.");
			ShipMapCamRotation = ((BaseUnityPlugin)this).Config.Bind<Enums.eShipCamRotation>("Ship", "ShipMapCamRotation", Enums.eShipCamRotation.None, "If specified, makes the ship cam face a specific direction instead of a 45 degree SW angle.");
			ShipPlaceablesCollide = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "ShipPlaceablesCollide", true, "If set to true, placeable ship objects will check for collisions with each other during placement.");
			SnapObjectsByDegrees = ((BaseUnityPlugin)this).Config.Bind<int>("Ship", "SnapObjectsByDegrees", 45, new ConfigDescription("Build mode will switch to snap turning (press instead of hold) by this many degrees at a time. Setting it to 0 uses vanilla behavior.", (AcceptableValueBase)(object)new AcceptableValueList<int>(array), Array.Empty<object>()));
			SpeakerPlaysIntroVoice = ((BaseUnityPlugin)this).Config.Bind<bool>("Ship", "SpeakerPlaysIntroVoice", true, "If set to true, the ship's speaker will play the introductory welcome audio on the first day.");
			InverseTeleporterCooldown = ((BaseUnityPlugin)this).Config.Bind<int>("Teleporters", "InverseTeleporterCooldown", 210, new ConfigDescription("How many seconds to wait in between button presses for the INVERSE teleporter. Vanilla = 210. If using the vanilla value, the teleporter code will not be modified.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			KeepItemsDuringInverse = ((BaseUnityPlugin)this).Config.Bind<Enums.eItemsToKeep>("Teleporters", "KeepItemsDuringInverse", Enums.eItemsToKeep.None, "Whether to keep Held, Non Scrap, or All items in inventory when using the inverse teleporter. *WARNING:* THIS WILL CAUSE INVENTORY DESYNCS IF OTHER PLAYERS DO NOT SHARE YOUR SETTING!");
			KeepItemsDuringTeleport = ((BaseUnityPlugin)this).Config.Bind<Enums.eItemsToKeep>("Teleporters", "KeepItemsDuringTeleport", Enums.eItemsToKeep.None, "Whether to keep Held, Non Scrap, or All items in inventory when using the regular teleporter. *WARNING:* THIS WILL CAUSE INVENTORY DESYNCS IF OTHER PLAYERS DO NOT SHARE YOUR SETTING!");
			RegularTeleporterCooldown = ((BaseUnityPlugin)this).Config.Bind<int>("Teleporters", "RegularTeleporterCooldown", 10, new ConfigDescription("How many seconds to wait in between button presses for the REGULAR teleporter. Vanilla = 10. If using the vanilla value, the teleporter code will not be modified.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>()));
			FitCreditsInBackgroundImage = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "FitCreditsInBackgroundImage", true, "If set to true, the credits displayed in the terminal will always fit nicely inside its dark green background.");
			LockCameraAtTerminal = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "LockCameraAtTerminal", true, "If set to true, the camera will no longer move around when moving your mouse/controller while at the terminal.");
			ShowBlanksDuringViewMonitor = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "ShowBlanksDuringViewMonitor", true, "If set to true, typing commands while View Monitor is active requires you to scroll down to see the result.");
			ShowHiddenMoonsInCatalog = ((BaseUnityPlugin)this).Config.Bind<Enums.eShowHiddenMoons>("Terminal", "ShowHiddenMoonsInCatalog", Enums.eShowHiddenMoons.AfterDiscovery, "When to show any hidden moons in the terminal's moon catalog. AfterDiscovery is per save file.");
			ShowMoonPricesInTerminal = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "ShowMoonPricesInTerminal", false, "If set to true, the moons will also display the cost to fly to them next to their name and weather.");
			TerminalHistoryItemCount = ((BaseUnityPlugin)this).Config.Bind<int>("Terminal", "TerminalHistoryItemCount", 20, new ConfigDescription("How many items to keep in your terminal's command history. Previous terminal commands may be navigated by using the up/down arrow keys.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			TerminalFastCamSwitch = ((BaseUnityPlugin)this).Config.Bind<bool>("Terminal", "TerminalFastCamSwitch", true, "If set to true, will allow use of the left/right arrow keys to quickly cycle through radar cameras while using the terminal.");
			AutoChargeOnOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("Tools", "AutoChargeOnOrbit", false, "If set to true, all owned* battery-using items will be automatically charged every time the ship goes into orbit. *You are considered to 'own' an item if you are the last person to have held it.");
			FlashlightToggleShortcut = ((BaseUnityPlugin)this).Config.Bind<Enums.eValidKeys>("Tools", "FlashlightToggleShortcut", Enums.eValidKeys.None, "A shortcut key to allow toggling a flashlight at any time.");
			OnlyAllowOneActiveFlashlight = ((BaseUnityPlugin)this).Config.Bind<bool>("Tools", "OnlyAllowOneActiveFlashlight", true, "When turning on any flashlight, will turn off any others in your inventory that are still active.");
			ScannableTools = ((BaseUnityPlugin)this).Config.Bind<string>("Tools", "ScannableTools", string.Empty, "A comma separated list of which tools, if any, should be scannable. Accepted values: " + text3);
			ToolsDoNotAttractLightning = ((BaseUnityPlugin)this).Config.Bind<bool>("Tools", "ToolsDoNotAttractLightning", false, "[Host Only] If set to true, all useful tools (ladders, jetpacks, keys, radar boosters, shovels & signs, tzp inhalant, knives, and zap guns) will no longer attract lighning.");
			TreatLasersAsFlashlights = ((BaseUnityPlugin)this).Config.Bind<bool>("Tools", "TreatLasersAsFlashlights", false, "If set to true, laser pointers will be like flashlights and automatically toggle off and on when switching to them, etc.");
			AlwaysShowClock = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "AlwaysShowClock", false, "If set to true, the clock will always be displayed on the HUD when landed on a moon.");
			CenterSignalTranslatorText = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "CenterSignalTranslatorText", true, "If set to true, the signal translator text will always be perfectly horizontally centered.");
			ChatFadeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "ChatFadeDelay", 4f, new ConfigDescription("How long to wait before fading chat after a new chat message appears.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			ChatOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "ChatOpacity", 0.2f, new ConfigDescription("How faded the chat should be after the fade delay. 0 = fully transparent, 1 = solid.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			DisplayKgInsteadOfLb = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "DisplayKgInsteadOfLb", false, "If set to true, your carry weight will be converted from lb to kg.");
			HideEmptySubtextOfScanNodes = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "HideEmptySubtextOfScanNodes", true, "If set to true, will hide the subtext section of scannables that do not have subtext or scrap value.");
			HidePlayerNames = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "HidePlayerNames", false, "If set to true, player names will no longer show above players.");
			ShowHitPoints = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowHitPoints", true, "If set to true, the HUD will display your current remaining hitpoints.");
			ShowLightningWarnings = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowLightningWarnings", true, "If set to true, the inventory slots will flash electrically when an item in the slot is being targeted by lightning.");
			ShowUIReticle = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowUIReticle", false, "If set to true, the HUD will display a small dot so you can see exactly where you are pointing at all times.");
			TwentyFourHourClock = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "TwentyFourHourClock", false, "If set to true, the clock will be 24 hours instead of 12.");
			string text4 = Regex.Match(MonitorBackgroundColor.Value, "([a-fA-F0-9]{6})").Groups[1].Value.ToUpper();
			string text5 = Regex.Match(MonitorTextColor.Value, "([a-fA-F0-9]{6})").Groups[1].Value.ToUpper();
			if (text4.Length != 6)
			{
				MLS.LogWarning((object)"Invalid hex code used for monitor background color! Reverting to default.");
			}
			if (text5.Length != 6)
			{
				MLS.LogWarning((object)"Invalid hex code used for monitor text color! Reverting to default.");
			}
			MonitorBackgroundColor.Value = ((text4.Length == 6) ? text4 : ((ConfigEntryBase)MonitorBackgroundColor).DefaultValue.ToString());
			MonitorBackgroundColorVal = HexToColor(MonitorBackgroundColor.Value);
			MonitorTextColor.Value = ((text5.Length == 6) ? text5 : ((ConfigEntryBase)MonitorTextColor).DefaultValue.ToString());
			MonitorTextColorVal = HexToColor(MonitorTextColor.Value);
			if (MinimumStartingMoney.Value < StartingMoneyPerPlayer.Value)
			{
				MinimumStartingMoney.Value = StartingMoneyPerPlayer.Value;
			}
			List<string> list2 = new List<string>();
			if (ScannableTools.Value.Replace(" ", "").Split(',').Any((string s) => s.ToUpper() == "ALL"))
			{
				ScannableToolVals = list;
			}
			else
			{
				string[] array2 = ScannableTools.Value.Replace(" ", "").Split(',');
				foreach (string scannableTool in array2)
				{
					Type type = list.FirstOrDefault((Type g) => g.Name.ToUpper().Contains(scannableTool.ToUpper()));
					if (type == null)
					{
						MLS.LogWarning((object)("Could not find item type " + scannableTool + " when trying to add a scan node! Check your spelling and the acceptable values."));
						continue;
					}
					ScannableToolVals.Add(type);
					list2.Add(scannableTool);
				}
				ScannableTools.Value = string.Join(',', list2.ToArray());
			}
			MatchCollection matchCollection = Regex.Matches(ScrapValueWeatherMultipliers.Value, "[a-z]+:\\d*([\\. ]\\d+)?", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			MatchCollection matchCollection2 = Regex.Matches(ScrapAmountWeatherMultipliers.Value, "[a-z]+:\\d([\\. ]\\d+)?", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
			List<string[]> list3 = new List<string[]>();
			List<string[]> list4 = new List<string[]>();
			foreach (Match item in matchCollection)
			{
				string[] array3 = item.Value.Split(":");
				if (float.TryParse(array3[1], out var result))
				{
					list3.Add(new string[2]
					{
						array3[0],
						Mathf.Clamp(result, 0.1f, 2f).ToString()
					});
				}
			}
			foreach (Match item2 in matchCollection2)
			{
				string[] array4 = item2.Value.Split(":");
				if (float.TryParse(array4[1], out var result2))
				{
					list4.Add(new string[2]
					{
						array4[0],
						Mathf.Clamp(result2, 1f, 5f).ToString()
					});
				}
			}
			ScrapValueWeatherMultipliers.Value = string.Join(", ", list3.Select((string[] s) => s[0] + ":" + s[1]));
			SanitizedScrapValueWeatherMultipliers = list3.ToDictionary((string[] k) => k[0], (string[] v) => float.Parse(v[1]));
			ScrapAmountWeatherMultipliers.Value = string.Join(", ", list4.Select((string[] s) => s[0] + ":" + s[1]));
			SanitizedScrapAmountWeatherMultipliers = list4.ToDictionary((string[] k) => k[0], (string[] v) => float.Parse(v[1]));
		}

		private static Color HexToColor(string hex)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)int.Parse(hex.Substring(0, 2), NumberStyles.HexNumber) / 255f;
			float num2 = (float)int.Parse(hex.Substring(2, 2), NumberStyles.HexNumber) / 255f;
			float num3 = (float)int.Parse(hex.Substring(4, 2), NumberStyles.HexNumber) / 255f;
			return new Color(num, num2, num3);
		}

		private void MigrateOldConfigValues()
		{
			try
			{
				ConfigFile config = ((BaseUnityPlugin)this).Config;
				if (!((config == null) ? null : config.OrphanedEntries?.Any()).GetValueOrDefault())
				{
					return;
				}
				foreach (KeyValuePair<ConfigDefinition, string> orphanedEntry in ((BaseUnityPlugin)this).Config.OrphanedEntries)
				{
					MigrateSpecificValue(orphanedEntry);
				}
				((BaseUnityPlugin)this).Config.OrphanedEntries.Clear();
				((BaseUnityPlugin)this).Config.Save();
			}
			catch (Exception arg)
			{
				MLS.LogError((object)$"Error encountered while migrating old config values! This will not affect gameplay, but please verify your config file to ensure the settings are as you expect.\n\n{arg}");
			}
		}

		private void MigrateSpecificValue(KeyValuePair<ConfigDefinition, string> entry)
		{
			MLS.LogMessage((object)("Found unused config value: " + entry.Key.Key + ". Migrating and removing if possible..."));
			Action<Enums.eMonitorNames> action = delegate(Enums.eMonitorNames s)
			{
				if (int.TryParse(entry.Value, out var result2) && result2 >= 1 && result2 <= ShipMonitorAssignments.Length)
				{
					MLS.LogInfo((object)$"Migrating {s} to monitor position {result2}.");
					ShipMonitorAssignments[result2 - 1].Value = s;
				}
			};
			bool result;
			switch (entry.Key.Key)
			{
			case "ShipProfitQuotaMonitorNum":
				action(Enums.eMonitorNames.ProfitQuota);
				break;
			case "ShipDeadlineMonitorNum":
				action(Enums.eMonitorNames.Deadline);
				break;
			case "ShipTotalMonitorNum":
				action(Enums.eMonitorNames.ShipScrap);
				break;
			case "ShipTimeMonitorNum":
				action(Enums.eMonitorNames.Time);
				break;
			case "ShipWeatherMonitorNum":
				action(Enums.eMonitorNames.Weather);
				break;
			case "FancyWeatherMonitor":
			{
				ConfigEntry<Enums.eMonitorNames> val = ((IEnumerable<ConfigEntry<Enums.eMonitorNames>>)ShipMonitorAssignments).FirstOrDefault((Func<ConfigEntry<Enums.eMonitorNames>, bool>)((ConfigEntry<Enums.eMonitorNames> a) => a.Value == Enums.eMonitorNames.Weather));
				if (entry.Value.ToUpper() == "TRUE" && val != null)
				{
					MLS.LogInfo((object)"Migrating fancy weather to override weather monitor.");
					val.Value = Enums.eMonitorNames.FancyWeather;
				}
				break;
			}
			case "ShipSalesMonitorNum":
				action(Enums.eMonitorNames.Sales);
				break;
			case "ShipInternalCamMonitorNum":
				action(Enums.eMonitorNames.InternalCam);
				break;
			case "ShipExternalCamMonitorNum":
				action(Enums.eMonitorNames.ExternalCam);
				break;
			case "FixPersonalScanner":
				FixPersonalScanner.Value = entry.Value.ToUpper() == "TRUE";
				break;
			case "MaskedLookLikePlayers":
			{
				bool flag = bool.TryParse(entry.Value, out result);
				MaskedEntitiesWearMasks.Value = !flag;
				MaskedEntitiesShowPlayerNames.Value = flag;
				MaskedEntitiesCopyPlayerLooks.Value = (flag ? Enums.eMaskedEntityCopyLook.SuitAndCosmetics : Enums.eMaskedEntityCopyLook.None);
				MaskedEntitiesSpinOnRadar.Value = !flag;
				MaskedEntitiesReachTowardsPlayer.Value = !flag;
				break;
			}
			case "MaskedEntityBlendLevel":
			{
				string text = entry.Value.ToUpper();
				MaskedEntitiesWearMasks.Value = new string[3] { "NONE", "JUSTCOPYSUIT", "JUSTCOPYSUITANDCOSMETICS" }.Contains(text);
				MaskedEntitiesShowPlayerNames.Value = text == "FULL";
				switch (text)
				{
				case "JUSTCOPYSUIT":
				case "NOMASKANDCOPYSUIT":
					MaskedEntitiesCopyPlayerLooks.Value = Enums.eMaskedEntityCopyLook.Suit;
					break;
				case "JUSTCOPYSUITANDCOSMETICS":
				case "FULL":
					MaskedEntitiesCopyPlayerLooks.Value = Enums.eMaskedEntityCopyLook.SuitAndCosmetics;
					break;
				default:
					MaskedEntitiesCopyPlayerLooks.Value = Enums.eMaskedEntityCopyLook.None;
					break;
				}
				MaskedEntitiesSpinOnRadar.Value = text != "FULL";
				MaskedEntitiesReachTowardsPlayer.Value = text != "FULL";
				break;
			}
			case "SaveShipFurniturePlaces":
				SaveShipFurniturePlaces.Value = (bool.TryParse(entry.Value, out result) ? Enums.eSaveFurniturePlacement.All : Enums.eSaveFurniturePlacement.None);
				break;
			case "ShipMapCamDueNorth":
				ShipMapCamRotation.Value = (bool.TryParse(entry.Value, out result) ? Enums.eShipCamRotation.North : Enums.eShipCamRotation.None);
				break;
			default:
				MLS.LogDebug((object)"No matching migration");
				break;
			}
		}
	}
}
namespace GeneralImprovements.Utilities
{
	internal static class AssetBundleHelper
	{
		private static AssetBundle _bundle;

		public static GameObject MonitorsPrefab { get; private set; }

		public static Sprite Reticle { get; private set; }

		public static GameObject MedStationPrefab { get; private set; }

		public static GameObject LightningOverlay { get; private set; }

		public static void Initialize()
		{
			if ((Object)(object)_bundle == (Object)null)
			{
				string text = Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName, "GeneralImprovementsAssets");
				if (!new FileInfo(text).Exists)
				{
					Plugin.MLS.LogError((object)"Could not find asset bundle!");
					return;
				}
				_bundle = AssetBundle.LoadFromFile(text, 3932230955u);
				Plugin.MLS.LogInfo((object)"Loading assets...");
				MonitorsPrefab = _bundle.LoadAsset<GameObject>("MonitorGroup.prefab");
				Reticle = _bundle.LoadAsset<Sprite>("reticle.png");
				MedStationPrefab = _bundle.LoadAsset<GameObject>("MedStation.prefab");
				LightningOverlay = _bundle.LoadAsset<GameObject>("LightningOverlay.prefab");
			}
		}
	}
	public static class MonitorsHelper
	{
		private static Vector3 _originalProfitQuotaLocation = Vector3.zero;

		private static Vector3 _originalProfitQuotaRotation = Vector3.zero;

		private static Image _originalProfitQuotaBG;

		private static TextMeshProUGUI _originalProfitQuotaText;

		private static Image _originalDeadlineBG;

		private static TextMeshProUGUI _originalDeadlineText;

		private static float _originalFontSize;

		private static List<TextMeshProUGUI> _profitQuotaTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _deadlineTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _averageDailyScrapMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _companyBuyRateMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _dailyProfitMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _shipScrapMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _scrapLeftMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _timeMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _weatherMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _fancyWeatherMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _salesMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _creditsMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _doorPowerMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _totalDaysMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _totalQuotasMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _totalDeathsMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _daysSinceDeathMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _dangerLevelMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _overtimeCalculatorMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _playerHealthMonitorTexts = new List<TextMeshProUGUI>();

		private static List<TextMeshProUGUI> _playerExactHealthMonitorTexts = new List<TextMeshProUGUI>();

		private static List<Image> _monitorBackgrounds = new List<Image>();

		private static bool _usingAnyMonitorTweaks = false;

		private static int _lastUpdatedCredits = -1;

		private static float _lastUpdatedDoorPower = -1f;

		private static float _updateDoorPowerTimer = 0f;

		private static Monitors _newMonitors;

		private static Dictionary<TextMeshProUGUI, Action> _queuedMonitorRefreshes = new Dictionary<TextMeshProUGUI, Action>();

		private static int _curWeatherAnimIndex = 0;

		private static int _curWeatherOverlayIndex = 0;

		private static string[] _curWeatherAnimations = new string[0];

		private static string[] _curWeatherOverlays = new string[0];

		private static float _weatherAnimTimer = 0f;

		private static float _weatherAnimCycle = 0.25f;

		private static bool _weatherHasOverlays = false;

		private static float _weatherOverlayTimer = 0f;

		private static bool _weatherShowingOverlay = false;

		private static float _weatherOverlayCycle;

		private static int _curSalesAnimIndex = 0;

		private static List<string> _curSalesAnimations = new List<string>();

		private static float _salesAnimTimer = 0f;

		private static float _salesAnimCycle = 2f;

		private static int _curPlayerHealthAnimIndex = 0;

		private static List<string> _curPlayerHealthAnimations = new List<string>();

		private static List<string> _curPlayerExactHealthAnimations = new List<string>();

		private static float _playerHealthAnimTimer = 0f;

		private static float _playerHealthAnimCycle = 3f;

		private static float _curCreditsUpdateCounter = 0f;

		private static Transform _oldMonitorsObject;

		private static Transform _oldBigMonitors;

		private static Transform _UIContainer;

		private static ScanNodeProperties _profitQuotaScanNode;

		public static void InitializeMonitors(Enums.eMonitorNames[] monitorAssignments, bool includeCamSetup)
		{
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			_originalProfitQuotaBG = StartOfRound.Instance.profitQuotaMonitorBGImage;
			_originalProfitQuotaText = StartOfRound.Instance.profitQuotaMonitorText;
			_originalDeadlineBG = StartOfRound.Instance.deadlineMonitorBGImage;
			_originalDeadlineText = StartOfRound.Instance.deadlineMonitorText;
			_originalFontSize = ((TMP_Text)_originalProfitQuotaText).fontSize;
			Image originalProfitQuotaBG = _originalProfitQuotaBG;
			_UIContainer = ((originalProfitQuotaBG != null) ? ((Component)originalProfitQuotaBG).transform.parent : null);
			if (Plugin.CenterAlignMonitorText.Value)
			{
				((TMP_Text)_originalProfitQuotaText).alignment = (TextAlignmentOptions)514;
				((TMP_Text)_originalDeadlineText).alignment = (TextAlignmentOptions)514;
			}
			Transform obj = StartOfRound.Instance.elevatorTransform.Find("Cameras/ShipCamera");
			Camera val = ((obj != null) ? ((Component)obj).GetComponent<Camera>() : null);
			Transform obj2 = StartOfRound.Instance.elevatorTransform.Find("Cameras/FrontDoorSecurityCam/SecurityCamera");
			Camera val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Camera>() : null);
			if (Plugin.DisableShipCamPostProcessing.Value)
			{
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).GetComponent<HDAdditionalCameraData>().volumeLayerMask = LayerMask.op_Implicit(0);
				}
				if ((Object)(object)val2 != (Object)null)
				{
					((Component)val2).GetComponent<HDAdditionalCameraData>().volumeLayerMask = LayerMask.op_Implicit(0);
				}
			}
			if (!Plugin.UseBetterMonitors.Value && Plugin.ShowBlueMonitorBackground.Value && !Plugin.ShowBackgroundOnAllScreens.Value && !Plugin.SyncMonitorsFromOtherHost.Value && !(Plugin.MonitorBackgroundColor.Value != ((ConfigEntryBase)Plugin.MonitorBackgroundColor).DefaultValue.ToString()) && !(Plugin.MonitorTextColor.Value != ((ConfigEntryBase)Plugin.MonitorTextColor).DefaultValue.ToString()) && Plugin.ShipInternalCamFPS.Value == (int)((ConfigEntryBase)Plugin.ShipInternalCamFPS).DefaultValue && Plugin.ShipInternalCamSizeMultiplier.Value == (int)((ConfigEntryBase)Plugin.ShipInternalCamSizeMultiplier).DefaultValue && Plugin.ShipExternalCamFPS.Value == (int)((ConfigEntryBase)Plugin.ShipExternalCamFPS).DefaultValue && Plugin.ShipExternalCamSizeMultiplier.Value == (int)((ConfigEntryBase)Plugin.ShipExternalCamSizeMultiplier).DefaultValue && !Plugin.ShipMonitorAssignments.Any((ConfigEntry<Enums.eMonitorNames> m) => m.Value != (Enums.eMonitorNames?)((ConfigEntryBase)m).DefaultValue))
			{
				return;
			}
			_usingAnyMonitorTweaks = true;
			_lastUpdatedCredits = -1;
			_lastUpdatedDoorPower = -1f;
			RemoveExistingMonitors();
			((Graphic)_originalProfitQuotaBG).color = Plugin.MonitorBackgroundColorVal;
			((Graphic)_originalProfitQuotaText).color = Plugin.MonitorTextColorVal;
			((Graphic)_originalDeadlineBG).color = Plugin.MonitorBackgroundColorVal;
			((Graphic)_originalDeadlineText).color = Plugin.MonitorTextColorVal;
			((TMP_Text)_originalProfitQuotaText).rectTransform.sizeDelta = ((Graphic)_originalProfitQuotaBG).rectTransform.sizeDelta;
			((TMP_Text)_originalProfitQuotaText).transform.position = ((Component)_originalProfitQuotaBG).transform.TransformPoint(Vector3.back);
			((TMP_Text)_originalProfitQuotaText).fontSize = _originalFontSize * 0.9f;
			((TMP_Text)_originalProfitQuotaText).margin = Vector4.one * 5f;
			((TMP_Text)_originalDeadlineText).rectTransform.sizeDelta = ((Graphic)_originalDeadlineBG).rectTransform.sizeDelta;
			((TMP_Text)_originalDeadlineText).transform.position = ((Component)_originalDeadlineBG).transform.TransformPoint(Vector3.back);
			((TMP_Text)_originalDeadlineText).fontSize = _originalFontSize * 0.9f;
			((TMP_Text)_originalDeadlineText).margin = Vector4.one * 5f;
			_oldMonitorsObject = _UIContainer.parent.parent;
			MeshRenderer component = ((Component)_oldMonitorsObject).GetComponent<MeshRenderer>();
			_oldBigMonitors = ((Component)((Component)_oldMonitorsObject.parent).GetComponentInChildren<ManualCameraRenderer>()).transform.parent;
			_profitQuotaScanNode = ((IEnumerable<ScanNodeProperties>)((Component)StartOfRound.Instance.elevatorTransform).GetComponentsInChildren<ScanNodeProperties>()).FirstOrDefault((Func<ScanNodeProperties, bool>)((ScanNodeProperties s) => s.headerText == "Quota"));
			if (includeCamSetup)
			{
				if (Plugin.ShipInternalCamFPS.Value != (int)((ConfigEntryBase)Plugin.ShipInternalCamFPS).DefaultValue || Plugin.ShipInternalCamSizeMultiplier.Value != (int)((ConfigEntryBase)Plugin.ShipInternalCamSizeMultiplier).DefaultValue)
				{
					UpdateSecurityCamFPSAndResolution(val, Plugin.ShipInternalCamFPS.Value, Plugin.ShipInternalCamSizeMultiplier.Value);
				}
				if (Plugin.ShipExternalCamFPS.Value != (int)((ConfigEntryBase)Plugin.ShipExternalCamFPS).DefaultValue || Plugin.ShipExternalCamSizeMultiplier.Value != (int)((ConfigEntryBase)Plugin.ShipExternalCamSizeMultiplier).DefaultValue)
				{
					UpdateSecurityCamFPSAndResolution(val2, Plugin.ShipExternalCamFPS.Value, Plugin.ShipExternalCamSizeMultiplier.Value);
				}
				((Renderer)component).sharedMaterials[2].mainTexture = (Texture)(object)val.targetTexture;
				((Renderer)((Component)_oldBigMonitors).GetComponent<MeshRenderer>()).sharedMaterials[2].mainTexture = (Texture)(object)val2.targetTexture;
			}
			MonitorsAPI.AllMonitors = new Dictionary<int, MonitorsAPI.MonitorInfo>();
			MonitorsAPI.NewMonitorMeshActive = Plugin.AddMoreBetterMonitors.Value;
			MonitorsAPI.NumMonitorsActive = 0;
			if (Plugin.UseBetterMonitors.Value)
			{
				CreateNewStyleMonitors(monitorAssignments);
			}
			else
			{
				CreateOldStyleMonitors(monitorAssignments);
				if (monitorAssignments[6] != 0)
				{
					Material[] sharedMaterials = ((Renderer)component).sharedMaterials;
					sharedMaterials[2] = sharedMaterials[1];
					((Renderer)component).sharedMaterials = sharedMaterials;
				}
			}
			CopyProfitQuotaAndDeadlineTexts();
			UpdateAverageDailyScrapMonitors();
			UpdateCompanyBuyRateMonitors();
			UpdateDailyProfitMonitors();
			UpdateDangerLevelMonitors();
			UpdateDoorPowerMonitors();
			UpdateCalculatedScrapMonitors();
			UpdateTimeMonitors();
			UpdateWeatherMonitors();
			if ((Object)(object)_profitQuotaScanNode != (Object)null && !monitorAssignments.Any((Enums.eMonitorNames a) => a == Enums.eMonitorNames.ProfitQuota))
			{
				Object.Destroy((Object)(object)((Component)_profitQuotaScanNode).gameObject);
			}
		}

		private static void UpdateSecurityCamFPSAndResolution(Camera cam, int fps, int resMultiplier)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			ManualCameraRenderer component = ((Component)cam).GetComponent<ManualCameraRenderer>();
			component.renderAtLowerFramerate = fps > 0;
			component.fps = fps;
			if (resMultiplier > 1)
			{
				int num = ((Texture)cam.targetTexture).width * (2 * resMultiplier);
				int num2 = ((Texture)cam.targetTexture).height * (2 * resMultiplier);
				RenderTexture targetTexture = cam.targetTexture;
				RenderTexture targetTexture2 = new RenderTexture(num, num2, cam.targetTexture.depth, cam.targetTexture.format);
				cam.targetTexture = targetTexture2;
				Object.Destroy((Object)(object)targetTexture);
			}
		}

		private static void RemoveExistingMonitors()
		{
			if (!Plugin.UseBetterMonitors.Value)
			{
				_profitQuotaTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_deadlineTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_averageDailyScrapMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_companyBuyRateMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_dailyProfitMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_shipScrapMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_scrapLeftMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_timeMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_weatherMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_fancyWeatherMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_salesMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_creditsMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_doorPowerMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_totalDaysMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_totalQuotasMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_totalDeathsMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_daysSinceDeathMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_dangerLevelMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_overtimeCalculatorMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_playerHealthMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_playerExactHealthMonitorTexts.ForEach(delegate(TextMeshProUGUI g)
				{
					Object.Destroy((Object)(object)g);
				});
				_monitorBackgrounds.ForEach(delegate(Image g)
				{
					Object.Destroy((Object)(object)g);
				});
			}
			else if ((Object)(object)_newMonitors != (Object)null)
			{
				foreach (KeyValuePair<int, MonitorsAPI.MonitorInfo> item in MonitorsAPI.AllMonitors.Where((KeyValuePair<int, MonitorsAPI.MonitorInfo> m) => (Object)(object)((Renderer)m.Value.MeshRenderer).sharedMaterial != (Object)(object)m.Value.TargetMaterial))
				{
					Plugin.MLS.LogInfo((object)$"Detected overwritten material on monitor {item.Key + 1} ({((Object)((Renderer)item.Value.MeshRenderer).sharedMaterial).name}). Saving before recreating monitors.");
					item.Value.OverwrittenMaterial = ((Renderer)item.Value.MeshRenderer).sharedMaterial;
				}
				Object.Destroy((Object)(object)((Component)_newMonitors).gameObject);
			}
			_profitQuotaTexts = new List<TextMeshProUGUI>();
			_deadlineTexts = new List<TextMeshProUGUI>();
			_averageDailyScrapMonitorTexts = new List<TextMeshProUGUI>();
			_companyBuyRateMonitorTexts = new List<TextMeshProUGUI>();
			_dailyProfitMonitorTexts = new List<TextMeshProUGUI>();
			_shipScrapMonitorTexts = new List<TextMeshProUGUI>();
			_scrapLeftMonitorTexts = new List<TextMeshProUGUI>();
			_timeMonitorTexts = new List<TextMeshProUGUI>();
			_weatherMonitorTexts = new List<TextMeshProUGUI>();
			_fancyWeatherMonitorTexts = new List<TextMeshProUGUI>();
			_salesMonitorTexts = new List<TextMeshProUGUI>();
			_creditsMonitorTexts = new List<TextMeshProUGUI>();
			_doorPowerMonitorTexts = new List<TextMeshProUGUI>();
			_totalDaysMonitorTexts = new List<TextMeshProUGUI>();
			_totalQuotasMonitorTexts = new List<TextMeshProUGUI>();
			_totalDeathsMonitorTexts = new List<TextMeshProUGUI>();
			_daysSinceDeathMonitorTexts = new List<TextMeshProUGUI>();
			_dangerLevelMonitorTexts = new List<TextMeshProUGUI>();
			_overtimeCalculatorMonitorTexts = new List<TextMeshProUGUI>();
			_playerHealthMonitorTexts = new List<TextMeshProUGUI>();
			_playerExactHealthMonitorTexts = new List<TextMeshProUGUI>();
			_monitorBackgrounds = new List<Image>();
		}

		private static void CreateOldStyleMonitors(Enums.eMonitorNames[] monitorAssignments)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: 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_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//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_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_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			Plugin.MLS.LogInfo((object)"Creating old style monitor overlays.");
			if (_originalProfitQuotaLocation == Vector3.zero)
			{
				_originalProfitQuotaLocation = ((Component)_originalProfitQuotaBG).transform.localPosition;
			}
			if (_originalProfitQuotaRotation == Vector3.zero)
			{
				_originalProfitQuotaRotation = ((Component)_originalProfitQuotaBG).transform.localEulerAngles;
			}
			((Behaviour)_originalProfitQuotaBG).enabled = false;
			((Behaviour)_originalProfitQuotaText).enabled = false;
			((Behaviour)_originalDeadlineBG).enabled = false;
			((Behaviour)_originalDeadlineText).enabled = false;
			((Component)_originalDeadlineBG).transform.localPosition = _originalProfitQuotaLocation;
			((Component)_originalDeadlineBG).transform.localEulerAngles = _originalProfitQuotaRotation;
			((TMP_Text)_originalDeadlineText).transform.localPosition = _originalProfitQuotaLocation;
			((TMP_Text)_originalDeadlineText).transform.localEulerAngles = _originalProfitQuotaRotation;
			List<KeyValuePair<Vector3, Vector3>> list = new List<KeyValuePair<Vector3, Vector3>>
			{
				new KeyValuePair<Vector3, Vector3>(new Vector3(0f, 465f, -22f), new Vector3(-18f, 0f, 0f)),
				new KeyValuePair<Vector3, Vector3>(new Vector3(470f, 465f, -22f), new Vector3(-18f, 0f, 0f)),
				new KeyValuePair<Vector3, Vector3>(new Vector3(970f, 485f, -128f), new Vector3(-18f, 25f, 5f)),
				new KeyValuePair<Vector3, Vector3>(new Vector3(1390f, 525f, -329f), new Vector3(-18f, 25f, 5f)),
				new KeyValuePair<Vector3, Vector3>(Vector3.zero, Vector3.zero),
				new KeyValuePair<Vector3, Vector3>(new Vector3(470f, 0f, 0f), Vector3.zero),
				new KeyValuePair<Vector3, Vector3>(new Vector3(1025f, 30f, -115f), new Vector3(-1f, 25f, 5f)),
				new KeyValuePair<Vector3, Vector3>(new Vector3(1445f, 72f, -320f), new Vector3(-1f, 27f, 5f))
			};
			for (int i = 0; i < list.Count; i++)
			{
				Enums.eMonitorNames eMonitorNames = monitorAssignments[i];
				List<TextMeshProUGUI> list2 = null;
				switch (eMonitorNames)
				{
				case Enums.eMonitorNames.AverageDailyScrap:
					list2 = _averageDailyScrapMonitorTexts;
					break;
				case Enums.eMonitorNames.CompanyBuyRate:
					list2 = _companyBuyRateMonitorTexts;
					break;
				case Enums.eMonitorNames.DailyProfit:
					list2 = _dailyProfitMonitorTexts;
					break;
				case Enums.eMonitorNames.Credits:
					list2 = _creditsMonitorTexts;
					break;
				case Enums.eMonitorNames.DangerLevel:
					list2 = _dangerLevelMonitorTexts;
					break;
				case Enums.eMonitorNames.DaysSinceDeath:
					list2 = _daysSinceDeathMonitorTexts;
					break;
				case Enums.eMonitorNames.Deadline:
					list2 = _deadlineTexts;
					break;
				case Enums.eMonitorNames.DoorPower:
					list2 = _doorPowerMonitorTexts;
					break;
				case Enums.eMonitorNames.FancyWeather:
					list2 = _fancyWeatherMonitorTexts;
					break;
				case Enums.eMonitorNames.OvertimeCalculator:
					list2 = _overtimeCalculatorMonitorTexts;
					break;
				case Enums.eMonitorNames.PlayerHealth:
					list2 = _playerHealthMonitorTexts;
					break;
				case Enums.eMonitorNames.PlayerHealthExact:
					list2 = _playerExactHealthMonitorTexts;
					break;
				case Enums.eMonitorNames.ProfitQuota:
					list2 = _profitQuotaTexts;
					break;
				case Enums.eMonitorNames.Sales:
					list2 = _salesMonitorTexts;
					break;
				case Enums.eMonitorNames.ScrapLeft:
					list2 = _scrapLeftMonitorTexts;
					break;
				case Enums.eMonitorNames.ShipScrap:
					list2 = _shipScrapMonitorTexts;
					break;
				case Enums.eMonitorNames.Time:
					list2 = _timeMonitorTexts;
					break;
				case Enums.eMonitorNames.TotalDays:
					list2 = _totalDaysMonitorTexts;
					break;
				case Enums.eMonitorNames.TotalDeaths:
					list2 = _totalDeathsMonitorTexts;
					break;
				case Enums.eMonitorNames.TotalQuotas:
					list2 = _totalQuotasMonitorTexts;
					break;
				case Enums.eMonitorNames.Weather:
					list2 = _weatherMonitorTexts;
					break;
				}
				if (list2 == null && eMonitorNames != 0)
				{
					Plugin.MLS.LogError((object)$"Could not find '{eMonitorNames}' for monitor assignment! Please check your config is using acceptable values.");
				}
				Vector3 key = list[i].Key;
				Vector3 value = list[i].Value;
				if (Plugin.ShowBlueMonitorBackground.Value && (list2 != null || (Plugin.ShowBackgroundOnAllScreens.Value && i != 6)))
				{
					Image val = Object.Instantiate<Image>(_originalProfitQuotaBG, ((Component)_originalProfitQuotaBG).transform.parent);
					((Behaviour)val).enabled = true;
					((Object)val).name = string.Format("{0}BG{1}", (eMonitorNames == Enums.eMonitorNames.None) ? "ExtraBackground" : eMonitorNames.ToString(), i + 1);
					((Component)val).transform.localPosition = _originalProfitQuotaLocation + key;
					((Component)val).transform.localEulerAngles = _originalProfitQuotaRotation + value;
					_monitorBackgrounds.Add(val);
				}
				if (list2 != null)
				{
					Plugin.MLS.LogInfo((object)$"Creating {eMonitorNames} monitor at position {i + 1}");
					TextMeshProUGUI val2 = Object.Instantiate<TextMeshProUGUI>(_originalProfitQuotaText, ((TMP_Text)_originalProfitQuotaText).transform.parent);
					((Behaviour)val2).enabled = true;
					((Object)val2).name = $"{eMonitorNames}Text{i + 1}";
					((TMP_Text)val2).transform.localPosition = _originalProfitQuotaLocation + key + new Vector3(0f, 0f, -1f);
					((TMP_Text)val2).transform.localEulerAngles = _originalProfitQuotaRotation + value + new Vector3(1f, 0f, 0f);
					list2.Add(val2);
					if (eMonitorNames == Enums.eMonitorNames.ProfitQuota && (Object)(object)_profitQuotaScanNode != (Object)null)
					{
						((Component)_profitQuotaScanNode).transform.parent = ((TMP_Text)_profitQuotaTexts[0]).transform;
						((Component)_profitQuotaScanNode).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
					}
				}
			}
			foreach (TextMeshProUGUI salesMonitorText in _salesMonitorTexts)
			{
				((TMP_Text)salesMonitorText).overflowMode = (TextOverflowModes)1;
			}
			foreach (TextMeshProUGUI fancyWeatherMonitorText in _fancyWeatherMonitorTexts)
			{
				((TMP_Text)fancyWeatherMonitorText).alignment = (TextAlignmentOptions)4097;
				Transform transform = ((TMP_Text)fancyWeatherMonitorText).transform;
				transform.localPosition += new Vector3(25f, 0f, -10f);
				Transform transform2 = ((TMP_Text)fancyWeatherMonitorText).transform;
				transform2.localEulerAngles += new Vector3(-2f, 1f, 0f);
			}
			foreach (TextMeshProUGUI item in _playerHealthMonitorTexts.Concat(_playerExactHealthMonitorTexts))
			{
				((TMP_Text)item).fontSize = 30f;
				((TMP_Text)item).enableWordWrapping = false;
				((TMP_Text)item).alignment = (TextAlignmentOptions)4097;
			}
		}

		private static void CreateNewStyleMonitors(Enums.eMonitorNames[] monitorAssignments)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			Plugin.MLS.LogInfo((object)$"Creating new style monitors (additional monitors: {Plugin.AddMoreBetterMonitors.Value}).");
			GameObject val = Object.Instantiate<GameObject>(AssetBundleHelper.MonitorsPrefab, ((Component)_oldMonitorsObject).transform.parent);
			val.transform.SetLocalPositionAndRotation(_oldMonitorsObject.localPosition, Quaternion.identity);
			_newMonitors = val.AddComponent<Monitors>();
			MonitorsAPI.NewMonitors = _newMonitors;
			MeshRenderer component = ((Component)_oldMonitorsObject).GetComponent<MeshRenderer>();
			MeshRenderer component2 = ((Component)_oldBigMonitors).GetComponent<MeshRenderer>();
			_newMonitors.Initialize(((Renderer)component).sharedMaterials[0], ((Renderer)component2).sharedMaterials[1], ((Renderer)component).sharedMaterials[1]);
			Material val2 = ((IEnumerable<Material>)((Renderer)component).sharedMaterials).FirstOrDefault((Func<Material, bool>)((Material m) => ((Object)m).name.StartsWith("ShipScreen")));
			Material externalCamMat = ((IEnumerable<Material>)((Renderer)component2).sharedMaterials).FirstOrDefault((Func<Material, bool>)((Material m) => ((Object)m).name.StartsWith("ShipScreen")));
			for (int i = 0; i < (Plugin.AddMoreBetterMonitors.Value ? 14 : 9) && i < monitorAssignments.Length; i++)
			{
				Enums.eMonitorNames eMonitorNames = monitorAssignments[i];
				Plugin.MLS.LogInfo((object)$"Creating {eMonitorNames} monitor at position {i + 1}");
				MonitorsAPI.MonitorInfo monitorInfo = MonitorsAPI.AllMonitors[i];
				switch (eMonitorNames)
				{
				case Enums.eMonitorNames.AverageDailyScrap:
					_averageDailyScrapMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.CompanyBuyRate:
					_companyBuyRateMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.DailyProfit:
					_dailyProfitMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.Credits:
					_creditsMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.DangerLevel:
					_dangerLevelMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.DaysSinceDeath:
					_daysSinceDeathMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.Deadline:
					_deadlineTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.DoorPower:
					_doorPowerMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.FancyWeather:
					if (Plugin.CenterAlignMonitorText.Value)
					{
						((TMP_Text)monitorInfo.TextCanvas).alignment = (TextAlignmentOptions)4097;
						TextMeshProUGUI textCanvas = monitorInfo.TextCanvas;
						((TMP_Text)textCanvas).margin = ((TMP_Text)textCanvas).margin + new Vector4(20f, 10f, 0f, 0f);
					}
					else
					{
						((TMP_Text)monitorInfo.TextCanvas).alignment = (TextAlignmentOptions)257;
						TextMeshProUGUI textCanvas2 = monitorInfo.TextCanvas;
						((TMP_Text)textCanvas2).margin = ((TMP_Text)textCanvas2).margin + new Vector4(10f, 10f, 0f, 0f);
					}
					_fancyWeatherMonitorTexts.Add(monitorInfo.TextCanvas);
					UpdateWeatherMonitors();
					break;
				case Enums.eMonitorNames.OvertimeCalculator:
					_overtimeCalculatorMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.PlayerHealth:
				case Enums.eMonitorNames.PlayerHealthExact:
					((TMP_Text)monitorInfo.TextCanvas).fontSize = 20f;
					((TMP_Text)monitorInfo.TextCanvas).enableWordWrapping = false;
					((TMP_Text)monitorInfo.TextCanvas).alignment = (TextAlignmentOptions)4097;
					((TMP_Text)monitorInfo.TextCanvas).margin = new Vector4(20f, 5f, 20f, 5f);
					if (eMonitorNames == Enums.eMonitorNames.PlayerHealth)
					{
						_playerHealthMonitorTexts.Add(monitorInfo.TextCanvas);
					}
					else
					{
						_playerExactHealthMonitorTexts.Add(monitorInfo.TextCanvas);
					}
					break;
				case Enums.eMonitorNames.ProfitQuota:
					_profitQuotaTexts.Add(monitorInfo.TextCanvas);
					if ((Object)(object)_profitQuotaScanNode != (Object)null)
					{
						((Component)_profitQuotaScanNode).transform.parent = ((Component)monitorInfo.MeshRenderer).transform;
						((Component)_profitQuotaScanNode).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
					}
					CopyProfitQuotaAndDeadlineTexts();
					break;
				case Enums.eMonitorNames.Sales:
					((TMP_Text)monitorInfo.TextCanvas).overflowMode = (TextOverflowModes)1;
					_salesMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.ScrapLeft:
					_scrapLeftMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.ShipScrap:
					_shipScrapMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.Time:
					_timeMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.TotalDays:
					_totalDaysMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.TotalDeaths:
					_totalDeathsMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.TotalQuotas:
					_totalQuotasMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.Weather:
					_weatherMonitorTexts.Add(monitorInfo.TextCanvas);
					break;
				case Enums.eMonitorNames.ExternalCam:
					monitorInfo.AssignedMaterial = externalCamMat;
					((Renderer)monitorInfo.MeshRenderer).sharedMaterial = externalCamMat;
					((Component)StartOfRound.Instance.elevatorTransform.Find("Cameras/FrontDoorSecurityCam/SecurityCamera")).GetComponent<ManualCameraRenderer>().mesh = monitorInfo.MeshRenderer;
					break;
				case Enums.eMonitorNames.InternalCam:
					monitorInfo.AssignedMaterial = val2;
					((Renderer)monitorInfo.MeshRenderer).sharedMaterial = val2;
					((Component)StartOfRound.Instance.elevatorTransform.Find("Cameras/ShipCamera")).GetComponent<ManualCameraRenderer>().mesh = monitorInfo.MeshRenderer;
					break;
				}
			}
			Transform val3 = val.transform.Find("Monitors/TopGroupL");
			Transform val4 = val.transform.Find("Monitors/BigLeft");
			if ((Object)(object)val3 != (Object)null)
			{
				((Component)val3).gameObject.SetActive(Plugin.AddMoreBetterMonitors.Value);
			}
			if ((Object)(object)val4 != (Object)null)
			{
				((Component)val4).gameObject.SetActive(Plugin.AddMoreBetterMonitors.Value);
			}
			MeshRenderer component3 = ((Component)val.transform.Find("Monitors/BigMiddle")).GetComponent<MeshRenderer>();
			StartOfRound.Instance.mapScreen.mesh = component3;
			Transform obj = StartOfRound.Instance.elevatorTransform.Find("ShipModels2b/MonitorWall/SingleScreen");
			MeshRenderer val5 = ((obj != null) ? ((Component)obj).GetComponent<MeshRenderer>() : null);
			if (!MonitorsAPI.AllMonitors.Values.Any((MonitorsAPI.MonitorInfo m) => (Object)(object)m.AssignedMaterial == (Object)(object)externalCamMat) && (Object)(object)val5 != (Object)null && ((Renderer)val5).sharedMaterials.Any((Material m) => ((Object)m).name.StartsWith("ShipScreen2")))
			{
				((Component)StartOfRound.Instance.elevatorTransform.Find("Cameras/FrontDoorSecurityCam/SecurityCamera")).GetComponent<ManualCameraRenderer>().mesh = val5;
			}
		}

		public static void HideOldMonitors()
		{
			Plugin.MLS.LogInfo((object)"Hiding old monitors");
			if (!((Object)(object)_oldBigMonitors != (Object)null) || !((Object)(object)_oldMonitorsObject != (Object)null) || !((Object)(object)_UIContainer != (Object)null))
			{
				return;
			}
			((Renderer)((Component)_oldBigMonitors).GetComponent<MeshRenderer>()).enabled = false;
			((Component)_oldBigMonitors).GetComponent<Collider>().enabled = false;
			((Renderer)((Component)_oldMonitorsObject).GetComponent<MeshRenderer>()).enabled = false;
			((Component)_oldMonitorsObject).GetComponent<Collider>().enabled = false;
			for (int i = 0; i < _UIContainer.childCount; i++)
			{
				Image component = ((Component)_UIContainer.GetChild(i)).GetComponent<Image>();
				if (component != null)
				{
					((Behaviour)component).enabled = false;
					continue;
				}
				TextMeshProUGUI component2 = ((Component)_UIContainer.GetChild(i)).GetComponent<TextMeshProUGUI>();
				if (component2 != null)
				{
					((Behaviour)component2).enabled = false;
				}
			}
		}

		public static void CopyProfitQuotaAndDeadlineTexts()
		{
			if (_profitQuotaTexts.Count <= 0 && _deadlineTexts.Count <= 0)
			{
				return;
			}
			TextMeshProUGUI deadlineMonitorText = StartOfRound.Instance.deadlineMonitorText;
			string text = ((deadlineMonitorText != null) ? ((TMP_Text)deadlineMonitorText).text : null);
			if (!string.IsNullOrWhiteSpace(text))
			{
				Match match = Regex.Match(text, "(\\d+) DAYS?", RegexOptions.IgnoreCase);
				if (match.Success)
				{
					int num = int.Parse(match.Groups[1].Value);
					string text2 = ((num >= 3) ? "00ff00" : (num switch
					{
						1 => "ff8800", 
						2 => "ffff00", 
						_ => "ff0000", 
					}));
					text = text.Replace(match.Groups[0].Value, "<color=#" + text2 + ">" + match.Groups[0].Value + "</color>");
				}
			}
			List<TextMeshProUGUI> profitQuotaTexts = _profitQuotaTexts;
			TextMeshProUGUI profitQuotaMonitorText = StartOfRound.Instance.profitQuotaMonitorText;
			if (UpdateGenericTextList(profitQuotaTexts, (profitQuotaMonitorText != null) ? ((TMP_Text)profitQuotaMonitorText).text : null) & UpdateGenericTextList(_deadlineTexts, text))
			{
				Plugin.MLS.LogInfo((object)"Updated profit quota and deadline monitors");
			}
		}

		public static void UpdateAverageDailyScrapMonitors()
		{
			if (_averageDailyScrapMonitorTexts.Count > 0)
			{
				double value = ((StartOfRoundPatch.DailyScrapCollected.Count > 0) ? StartOfRoundPatch.DailyScrapCollected.Values.Average() : 0.0);
				if (UpdateGenericTextList(_averageDailyScrapMonitorTexts, $"AVERAGE SCRAP:\n${Math.Round(value, 0)}"))
				{
					Plugin.MLS.LogInfo((object)"Updated average daily scrap monitors.");
				}
			}
		}

		public static void UpdateCompanyBuyRateMonitors()
		{
			if (_companyBuyRateMonitorTexts.Count > 0 && (Object)(object)StartOfRound.Instance != (Object)null)
			{
				string arg = ((StartOfRound.Instance.companyBuyingRate > 1f) ? "0080ff" : ((StartOfRound.Instance.companyBuyingRate == 1f) ? "00ff00" : ((StartOfRound.Instance.companyBuyingRate >= 0.75f) ? "ffff00" : ((StartOfRound.Instance.companyBuyingRate >= 0.5f) ? "ff8800" : "ff0000"))));
				if (UpdateGenericTextList(_companyBuyRateMonitorTexts, $"COMPANY RATE:\n<color=#{arg}>{(int)Mathf.Round(StartOfRound.Instance.companyBuyingRate * 100f)}%</color>"))
				{
					Plugin.MLS.LogInfo((object)"Updated company buy rate monitors.");
				}
			}
		}

		public static void UpdateCalculatedScrapMonitors(bool pending = false)
		{
			List<GrabbableObject> list = new List<GrabbableObject>();
			List<GrabbableObject> list2 = new List<GrabbableObject>();
			List<GrabbableObject> list3 = new List<GrabbableObject>();
			if (_shipScrapMonitorTexts.Count > 0 || _scrapLeftMonitorTexts.Count > 0 || _overtimeCalculatorMonitorTexts.Count > 0)
			{
				list = GrabbableObjectsPatch.GetAllScrap();
				foreach (GrabbableObject item in list)
				{
					if (item.isInShipRoom && item.isInElevator)
					{
						list2.Add(item);
					}
					else
					{
						list3.Add(item);
					}
				}
			}
			if (_shipScrapMonitorTexts.Count > 0)
			{
				int num = list2.Sum((GrabbableObject s) => s.scrapValue);
				if (UpdateGenericTextList(_shipScrapMonitorTexts, $"SHIP SCRAP:\n<color=#80ffff>${num}</color>\n({list2.Count} ITEMS)"))
				{
					Plugin.MLS.LogInfo((object)$"Updated ship scrap total monitors to ${num} ({list2.Count} items).");
				}
			}
			if (_scrapLeftMonitorTexts.Count > 0)
			{
				KeyValuePair<int, int> scrapAmountAndValue = GrabbableObjectsPatch.GetScrapAmountAndValue(!Plugin.ScanCommandUsesExactAmount.Value, list3);
				bool flag = false;
				if (scrapAmountAndValue.Key > 0)
				{
					string text = (pending ? "(PENDING)" : $"{scrapAmountAndValue.Key} ITEMS\n<color=#80ffff>${scrapAmountAndValue.Value}</color>");
					flag = UpdateGenericTextList(_scrapLeftMonitorTexts, "SCRAP LEFT:\n" + text);
				}
				else
				{
					flag = UpdateGenericTextList(_scrapLeftMonitorTexts, "NO EXTERNAL SCRAP DETECTED");
				}
				if (flag)
				{
					Plugin.MLS.LogInfo((object)"Updated remaining scrap display.");
				}
			}
			if (_overtimeCalculatorMonitorTexts.Count <= 0)
			{
				return;
			}
			int num2 = 0;
			if ((Object)(object)TimeOfDay.Instance != (Object)null)
			{
				int num3 = ((RoundManager.Instance?.currentLevel?.PlanetName == "71 Gordion") ? list : list2).Sum((GrabbableObject s) => s.scrapValue);
				int num4 = TimeOfDay.Instance.profitQuota - TimeOfDay.Instance.quotaFulfilled;
				int num5 = num3 - num4;
				num2 = ((num5 > 0) ? (num5 / 5 - 15) : 0);
			}
			if (UpdateGenericTextList(_overtimeCalculatorMonitorTexts, $"OVERTIME ESTIMATE:\n${Mathf.Max(num2, 0)}"))
			{
				Plugin.MLS.LogInfo((object)"Updated overtime calculator display.");
			}
		}

		public static void UpdateDailyProfitMonitors()
		{
			if (_dailyProfitMonitorTexts.Count > 0 && (Object)(object)RoundManager.Instance != (Object)null)
			{
				int num = RoundManager.Instance.scrapCollectedThisRound.Sum((GrabbableObject s) => s.scrapValue);
				if (UpdateGenericTextList(_dailyProfitMonitorTexts, $"DAY'S PROFIT:\n${num}"))
				{
					Plugin.MLS.LogInfo((object)$"Updated daily profit monitors. ({RoundManager.Instance.scrapCollectedThisRound.Count} items, {num} profit)");
				}
			}
		}

		public static void UpdateTimeMonitors()
		{
			if (_timeMonitorTexts.Count > 0 && UpdateGenericTextList(text: (!TimeOfDay.Instance.movingGlobalTimeForward || !((Object)(object)HUDManager.Instance?.clockNumber != (Object)null)) ? "TIME:\n(PENDING)" : ("TIME:\n" + ((TMP_Text)HUDManager.Instance.clockNumber).text.Replace('\n', ' ')), textList: _timeMonitorTexts))
			{
				Plugin.MLS.LogDebug((object)"Updated time display.");
			}
		}

		public static void UpdateWeatherMonitors()
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected I4, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Invalid comparison between Unknown and I4
			if (_weatherMonitorTexts.Count <= 0 && _fancyWeatherMonitorTexts.Count <= 0)
			{
				return;
			}
			if (_weatherMonitorTexts.Count > 0)
			{
				List<TextMeshProUGUI> weatherMonitorTexts = _weatherMonitorTexts;
				SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
				if (UpdateGenericTextList(weatherMonitorTexts, "WEATHER:\n" + (((currentLevel != null) ? ((object)(LevelWeatherType)(ref currentLevel.currentWeather)).ToString() : null) ?? string.Empty)))
				{
					Plugin.MLS.LogInfo((object)"Updated basic weather monitors");
				}
			}
			if (_fancyWeatherMonitorTexts.Count > 0)
			{
				_curWeatherAnimations = StartOfRound.Instance.currentLevel?.currentWeather switch
				{
					0L => WeatherASCIIArt.ClearAnimations, 
					2L => WeatherASCIIArt.RainAnimations, 
					3L => WeatherASCIIArt.RainAnimations, 
					4L => WeatherASCIIArt.FoggyAnimations, 
					5L => WeatherASCIIArt.FloodedAnimations, 
					6L => WeatherASCIIArt.EclipsedAnimations, 
					_ => new string[1] { string.Empty }, 
				};
				SelectableLevel currentLevel2 = StartOfRound.Instance.currentLevel;
				_weatherHasOverlays = currentLevel2 != null && (int)currentLevel2.currentWeather == 2;
				if (_weatherHasOverlays)
				{
					_weatherOverlayTimer = 0f;
					_weatherOverlayCycle = Random.Range(0.1f, 3f);
					_curWeatherOverlays = WeatherASCIIArt.LightningOverlays;
					_curWeatherOverlayIndex = Random.Range(0, _curWeatherOverlays.Length);
				}
				_weatherShowingOverlay = false;
				_curWeatherAnimIndex = 0;
				_weatherAnimTimer = 0f;
				if (UpdateGenericTextList(_fancyWeatherMonitorTexts, _curWeatherAnimations[_curWeatherAnimIndex]))
				{
					Plugin.MLS.LogInfo((object)"Updated fancy weather monitors");
				}
			}
		}

		public static void AnimateSpecialMonitors()
		{
			if (_fancyWeatherMonitorTexts.Count > 0 && _curWeatherAnimations.Length >= 2)
			{
				Action action = delegate
				{
					StringBuilder stringBuilder = new StringBuilder();
					string[] array = _curWeatherAnimations[_curWeatherAnimIndex].Split(Environment.NewLine);
					string[] source = (_weatherShowingOverlay ? _curWeatherOverlays[_curWeatherOverlayIndex] : string.Empty).Split(Environment.NewLine);
					for (int i = 0; i < array.Length; i++)
					{
						string text2 = array[i];
						string text3 = source.ElementAtOrDefault(i);
						for (int j = 0; j < text2.Length; j++)
						{
							bool flag = !string.IsNullOrWhiteSpace(text3) && text3.Length > j && text3[j] != ' ';
							stringBuilder.Append(flag ? $"<color=#ffe100>{text3[j]}</color>" : $"{text2[j]}");
						}
						stringBuilder.AppendLine();
					}
					UpdateGenericTextList(_fancyWeatherMonitorTexts, stringBuilder.ToString());
				};
				_weatherAnimTimer += Time.deltaTime;
				if (_weatherAnimTimer >= _weatherAnimCycle)
				{
					_curWeatherAnimIndex = (_curWeatherAnimIndex + 1) % _curWeatherAnimations.Length;
					_weatherAnimTimer = 0f;
					action();
				}
				if (_weatherHasOverlays)
				{
					_weatherOverlayTimer += Time.deltaTime;
					if (_weatherOverlayTimer >= (_weatherShowingOverlay ? 0.5f : _weatherOverlayCycle))
					{
						_weatherOverlayTimer = 0f;
						_weatherShowingOverlay = !_weatherShowingOverlay;
						if (!_weatherShowingOverlay)
						{
							_weatherOverlayCycle = Random.Range(0.1f, 3f);
							_curWeatherOverlayIndex = Random.Range(0, _curWeatherOverlays.Length);
						}
						action();
					}
				}
			}
			if (_salesMonitorTexts.Count > 0 && _curSalesAnimations.Count >= 2)
			{
				_salesAnimTimer += Time.deltaTime;
				if (_salesAnimTimer >= _salesAnimCycle)
				{
					_salesAnimTimer