Decompiled source of ShipWindows v2.6.0

ShipWindows.dll

Decompiled 3 weeks ago
#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using InteractiveTerminalAPI.UI;
using InteractiveTerminalAPI.UI.Application;
using InteractiveTerminalAPI.UI.Cursor;
using InteractiveTerminalAPI.UI.Screen;
using LethalModDataLib.Attributes;
using LethalModDataLib.Features;
using LethalModDataLib.Helpers;
using Microsoft.CodeAnalysis;
using ShipWindows.Api;
using ShipWindows.Api.events;
using ShipWindows.Config;
using ShipWindows.Networking;
using ShipWindows.Patches.BuildManagerFix;
using ShipWindows.Patches.EnemyFixes;
using ShipWindows.Patches.Networking;
using ShipWindows.Patches.SellAudios;
using ShipWindows.Patches.ShipReset;
using ShipWindows.Patches.Shutters;
using ShipWindows.Patches.Skybox;
using ShipWindows.Patches.WindowManager;
using ShipWindows.ShutterSwitch;
using ShipWindows.SkyBox;
using ShipWindows.SoftDependencies;
using ShipWindows.Utilities;
using ShipWindows.WindowDefinition;
using TestAccount666.ShipWindows.NetcodePatcher;
using TestAccountCore;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("CelestialTint")]
[assembly: IgnoresAccessChecksTo("ShipColors")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.ShipWindows")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds glass windows to the ship so you can see what's going on outside.")]
[assembly: AssemblyFileVersion("2.6.0.0")]
[assembly: AssemblyInformationalVersion("2.6.0+fa4d7cc3885a5ff8eb82a069b7ff20cc880a41c2")]
[assembly: AssemblyProduct("ShipWindows")]
[assembly: AssemblyTitle("TestAccount666.ShipWindows")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.6.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ShipWindows
{
	public class ShipWindowApplication : InteractiveTerminalApplication
	{
		public override void Initialization()
		{
			List<CursorElement> list = new List<CursorElement>();
			list.AddRange(from windowInfo in ShipWindows.windowRegistry.Windows
				where !windowInfo.alwaysUnlocked
				let isUnlocked = WindowUnlockData.UnlockedWindows.Contains(windowInfo.windowName)
				let elementAction = (!isUnlocked) ? WindowBuyAction(windowInfo) : WindowAlreadyUnlockedAction(windowInfo)
				select CursorElement.Create(windowInfo.windowName, $"{windowInfo.cost}'", elementAction, (Func<CursorElement, bool>)((CursorElement _) => !isUnlocked), true));
			if (list.Count <= 0)
			{
				((InteractiveTerminalApplication)this).ErrorMessage("Ship Windows", (Action)delegate
				{
				}, "No unlockable windows found");
				return;
			}
			CursorMenu val = CursorMenu.Create(0, '>', list.ToArray(), (Func<CursorElement, CursorElement, int>[])null);
			((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen((IScreen)(object)BoxedScreen.Create("Ship Windows", (ITextElement[])(object)new ITextElement[1] { (ITextElement)val }), val, false);
		}

		public Action WindowAlreadyUnlockedAction(WindowInfo window)
		{
			WindowInfo window2 = window;
			return delegate
			{
				((InteractiveTerminalApplication)this).ErrorMessage(window2.windowName, window2.windowDescription, (Action)((TerminalApplication)this).Initialization, window2.windowName + " already unlocked!");
			};
		}

		public Action WindowBuyAction(WindowInfo window)
		{
			WindowInfo window2 = window;
			return delegate
			{
				((InteractiveTerminalApplication)this).Confirm(window2.windowName, window2.windowDescription, (Action)delegate
				{
					int groupCredits = ((TerminalApplication)this).terminal.groupCredits;
					if (groupCredits < window2.cost)
					{
						((InteractiveTerminalApplication)this).ErrorMessage(window2.windowName, window2.windowDescription, (Action)((TerminalApplication)this).Initialization, "Not enough money!");
					}
					else
					{
						ShipWindows.networkManager?.SpawnWindow(window2);
						((TerminalApplication)this).terminal.PlayTerminalAudioServerRpc(0);
						((InteractiveTerminalApplication)this).ErrorMessage(window2.windowName, window2.windowDescription, (Action)((TerminalApplication)this).Initialization, "Thanks for your purchase!");
					}
				}, (Action)((TerminalApplication)this).Initialization, "");
			};
		}
	}
	[BepInIncompatibility("veri.lc.shipwindow")]
	[BepInIncompatibility("TestAccount666.ShipWindowsBeta")]
	[BepInDependency("WhiteSpike.InteractiveTerminalAPI", "1.1.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("TestAccount666.TestAccountCore", "1.14.0")]
	[BepInDependency("evaisa.lethallib", "0.16.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("TestAccount666.ShipWindows", "ShipWindows", "2.6.0")]
	public class ShipWindows : BaseUnityPlugin
	{
		public const string ASSET_BUNDLE_PATH_PREFIX = "Assets/LethalCompany/Mods/plugins/ShipWindows";

		public static AssetBundle mainAssetBundle;

		public static WindowRegistry windowRegistry;

		public static WindowManager windowManager;

		public static INetworkManager? networkManager;

		public static AbstractSkyBox? skyBox;

		private GameObject _decapitatedShipPrefab = null;

		private GameObject _networkManagerPrefab = null;

		private GameObject _hdriSpacePrefab = null;

		private GameObject _celestialTintOverlayPrefab = null;

		private GameObject _starsPrefab = null;

		public static ShipWindows Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; private set; }

		private void Awake()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			if (Harmony == null)
			{
				Harmony = new Harmony("TestAccount666.ShipWindows");
			}
			WindowConfig.InitializeConfig(((BaseUnityPlugin)this).Config);
			if (!LoadAssetBundle())
			{
				Logger.LogError((object)"Failed to load asset bundle! Abort mission!");
				return;
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			try
			{
				Netcode.ExecuteNetcodePatcher(executingAssembly);
			}
			catch (Exception ex)
			{
				Logger.LogError((object)"Something went wrong with the netcode patcher!");
				Logger.LogError((object)ex);
				return;
			}
			if (!WindowConfig.vanillaMode.Value)
			{
				AssetLoader.LoadBundle(executingAssembly, "ship_windows_shutter");
				AssetLoader.LoadUnlockables(((BaseUnityPlugin)this).Config);
			}
			windowRegistry = new WindowRegistry();
			WindowLoader.LoadWindows();
			if (!WindowConfig.vanillaMode.Value)
			{
				InteractiveTerminalManager.RegisterApplication<ShipWindowApplication>(new string[2] { "windows", "window" }, false);
				Harmony.PatchAll(typeof(NetworkingStuffPatch));
			}
			else
			{
				networkManager = new DummyNetworkManager();
			}
			Harmony.PatchAll(typeof(WindowManagerCreatePatch));
			Harmony.PatchAll(typeof(ShipResetPatch));
			Harmony.PatchAll(typeof(EnemyMeshPatch));
			Harmony.PatchAll(typeof(SkyboxCreatePatch));
			Harmony.PatchAll(typeof(HideMoonTransitionPatch));
			Harmony.PatchAll(typeof(HideMoonLandingPatch));
			Harmony.PatchAll(typeof(AddSellAudiosPatch));
			Harmony.PatchAll(typeof(FixEnemyAttackPatch));
			Harmony.PatchAll(typeof(BuildManagerFixPatch));
			((MonoBehaviour)this).StartCoroutine(SoundLoader.LoadAudioClips());
			Logger.LogInfo((object)"Loaded successfully!");
		}

		private static bool LoadAssetBundle()
		{
			Logger.LogInfo((object)"Loading ShipWindow AssetBundle...");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Debug.Assert(directoryName != null, "assemblyLocation != null");
			mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "ship_window"));
			return (Object)(object)mainAssetBundle != (Object)null;
		}

		public GameObject GetDecapitatedShipPrefab()
		{
			if (Object.op_Implicit((Object)(object)_decapitatedShipPrefab))
			{
				return _decapitatedShipPrefab;
			}
			_decapitatedShipPrefab = mainAssetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/ShipWindows/PrefabDecapitatedShip.prefab");
			return _decapitatedShipPrefab;
		}

		public GameObject GetNetworkManagerPrefab()
		{
			if (Object.op_Implicit((Object)(object)_networkManagerPrefab))
			{
				return _networkManagerPrefab;
			}
			_networkManagerPrefab = mainAssetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/ShipWindows/PrefabShipWindowsNetworkManager.prefab");
			return _networkManagerPrefab;
		}

		public GameObject GetSpaceHdriPrefab()
		{
			if (Object.op_Implicit((Object)(object)_hdriSpacePrefab))
			{
				return _hdriSpacePrefab;
			}
			_hdriSpacePrefab = mainAssetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/ShipWindows/SkyBox/HDRI/UniverseVolume.prefab");
			return _hdriSpacePrefab;
		}

		public GameObject GetCelestialTintOverlayPrefab()
		{
			if (Object.op_Implicit((Object)(object)_celestialTintOverlayPrefab))
			{
				return _celestialTintOverlayPrefab;
			}
			_celestialTintOverlayPrefab = mainAssetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/ShipWindows/SkyBox/HDRI/CelestialTintOverride.prefab");
			return _celestialTintOverlayPrefab;
		}

		public GameObject GetStarsPrefab()
		{
			if (Object.op_Implicit((Object)(object)_starsPrefab))
			{
				return _starsPrefab;
			}
			_starsPrefab = mainAssetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/ShipWindows/SkyBox/StarsSphereLarge.prefab");
			return _starsPrefab;
		}
	}
	public static class WindowUnlockData
	{
		[ModData(/*Could not decode attribute arguments.*/)]
		public static readonly List<string> UnlockedWindows = new List<string>();
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TestAccount666.ShipWindows";

		public const string PLUGIN_NAME = "ShipWindows";

		public const string PLUGIN_VERSION = "2.6.0";
	}
}
namespace ShipWindows.WindowDefinition
{
	[RequireComponent(typeof(Animator))]
	public abstract class AbstractWindow : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <WaitAndRegister>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public AbstractWindow <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitAndRegister>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => ShipWindows.windowManager != null));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ShipWindows.windowManager.spawnedWindows.Add(<>4__this);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static readonly int CloseShutterAnimatorHash = Animator.StringToHash("CloseShutter");

		public static readonly int LockShutterAnimatorHash = Animator.StringToHash("LockShutter");

		public WindowInfo windowInfo;

		public MeshRenderer[] meshRenderers;

		public Collider[] colliders;

		public Animator shutterAnimator;

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine(WaitAndRegister());
			UpdateMaterial();
			WindowConfig.glassMaterial.SettingChanged += delegate
			{
				UpdateMaterial();
			};
			UpdateLayer();
			WindowConfig.allowEnemyTriggerThroughWindows.SettingChanged += delegate
			{
				UpdateLayer();
			};
		}

		[IteratorStateMachine(typeof(<WaitAndRegister>d__7))]
		private IEnumerator WaitAndRegister()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitAndRegister>d__7(0)
			{
				<>4__this = this
			};
		}

		private void OnDestroy()
		{
			ShipWindows.windowManager.spawnedWindows.Remove(this);
		}

		public virtual void UpdateLayer()
		{
			bool value = WindowConfig.allowEnemyTriggerThroughWindows.Value;
			Collider[] array = colliders;
			foreach (Collider val in array)
			{
				((Component)val).gameObject.layer = LayerMask.NameToLayer(value ? "Railing" : "Room");
			}
		}

		public virtual void UpdateMaterial()
		{
			MeshRenderer[] array = meshRenderers;
			foreach (MeshRenderer val in array)
			{
				((Renderer)val).sharedMaterial = WindowConfig.glassMaterial.Value.GetMaterial();
			}
		}

		public virtual void ToggleWindowShutter(bool closeShutter, bool lockShutter = false)
		{
			shutterAnimator.SetBool(CloseShutterAnimatorHash, closeShutter);
			shutterAnimator.SetBool(LockShutterAnimatorHash, lockShutter);
		}

		public abstract void Initialize();
	}
	public class Window : AbstractWindow
	{
		public override void Initialize()
		{
		}
	}
}
namespace ShipWindows.WindowBehaviors
{
	public class DoorWindow : AbstractWindow
	{
		public GameObject leftDoorWindow;

		public GameObject rightDoorWindow;

		public Mesh leftDoorMesh;

		public Mesh rightDoorMesh;

		public Mesh originalLeftDoorMesh;

		public Mesh originalRightDoorMesh;

		public override void Initialize()
		{
			GameObject gameObject = ((Component)StartOfRound.Instance.shipDoorsAnimator).gameObject;
			GameObject gameObject2 = ((Component)gameObject.transform.Find("HangarDoorLeft (1)")).gameObject;
			GameObject gameObject3 = ((Component)gameObject.transform.Find("HangarDoorRight (1)")).gameObject;
			MeshRenderer component = gameObject3.GetComponent<MeshRenderer>();
			((Renderer)component).materials = ((Renderer)component).materials.Reverse().ToArray();
			Transform transform = leftDoorWindow.transform;
			ReplaceDoorSide(gameObject2, transform, leftDoorMesh, out originalLeftDoorMesh);
			Transform transform2 = rightDoorWindow.transform;
			ReplaceDoorSide(gameObject3, transform2, rightDoorMesh, out originalRightDoorMesh);
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)leftDoorWindow);
			Object.Destroy((Object)(object)rightDoorWindow);
			GameObject gameObject = ((Component)StartOfRound.Instance.shipDoorsAnimator).gameObject;
			GameObject gameObject2 = ((Component)gameObject.transform.Find("HangarDoorLeft (1)")).gameObject;
			GameObject gameObject3 = ((Component)gameObject.transform.Find("HangarDoorRight (1)")).gameObject;
			MeshRenderer component = gameObject3.GetComponent<MeshRenderer>();
			((Renderer)component).materials = ((Renderer)component).materials.Reverse().ToArray();
			RestoreDoorSide(gameObject2, originalLeftDoorMesh);
			RestoreDoorSide(gameObject3, originalRightDoorMesh);
		}

		private static void RestoreDoorSide(GameObject doorSide, Mesh doorMesh)
		{
			doorSide.GetComponent<MeshFilter>().mesh = doorMesh;
			((Collider)doorSide.GetComponent<BoxCollider>()).enabled = true;
			Object.Destroy((Object)(object)doorSide.GetComponent<MeshCollider>());
		}

		private static void ReplaceDoorSide(GameObject doorSide, Transform doorWindowTransform, Mesh doorMesh, out Mesh originalMesh)
		{
			//IL_001e: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			doorWindowTransform.parent = doorSide.transform;
			doorWindowTransform.localScale = new Vector3(1f, 1f, 1f);
			doorWindowTransform.localPosition = new Vector3(0f, 0f, 0f);
			doorWindowTransform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			MeshFilter component = doorSide.GetComponent<MeshFilter>();
			originalMesh = component.mesh;
			component.mesh = doorMesh;
			((Collider)doorSide.GetComponent<BoxCollider>()).enabled = false;
			doorSide.AddComponent<MeshCollider>().sharedMesh = doorMesh;
		}
	}
	public class FloorWindow : AbstractWindow
	{
		public GameObject underlights;

		public override void Initialize()
		{
			underlights.SetActive(WindowConfig.enableUnderLights.Value);
		}
	}
	public class RightWindow : AbstractWindow
	{
		public Mesh postersMesh;

		private Mesh _originalPostersMesh = null;

		public override void Initialize()
		{
			if (WindowConfig.movePosters.Value && !DependencyChecker.IsAnyShipModInstalled())
			{
				UpdatePostersMesh(postersMesh);
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)_originalPostersMesh))
			{
				UpdatePostersMesh(_originalPostersMesh);
			}
		}

		public void UpdatePostersMesh(Mesh newMesh)
		{
			Transform val = ((Component)StartOfRound.Instance.shipAnimator).transform.Find("Plane.001");
			if (!Object.op_Implicit((Object)(object)val))
			{
				ShipWindows.Logger.LogWarning((object)"Could not find posters!");
				return;
			}
			MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
			if (!Object.op_Implicit((Object)(object)_originalPostersMesh))
			{
				_originalPostersMesh = component.mesh;
			}
			component.mesh = newMesh;
		}
	}
}
namespace ShipWindows.Utilities
{
	public static class SoundLoader
	{
		[CompilerGenerated]
		private sealed class <LoadAudioClips>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private string <assemblyDirectory>5__1;

			private string <audioPath>5__2;

			private string <voiceLinesAudioPath>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadAudioClips>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<assemblyDirectory>5__1 = null;
				<audioPath>5__2 = null;
				<voiceLinesAudioPath>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				<assemblyDirectory>5__1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				Debug.Assert(<assemblyDirectory>5__1 != null, "assemblyDirectory != null");
				<audioPath>5__2 = Path.Combine(<assemblyDirectory>5__1, "sounds");
				<audioPath>5__2 = (Directory.Exists(<audioPath>5__2) ? <audioPath>5__2 : Path.Combine(<assemblyDirectory>5__1));
				ShipWindows.Logger.LogInfo((object)"Loading Wesley voice lines...");
				<voiceLinesAudioPath>5__3 = Path.Combine(<audioPath>5__2, "voicelines");
				<voiceLinesAudioPath>5__3 = (Directory.Exists(<voiceLinesAudioPath>5__3) ? <voiceLinesAudioPath>5__3 : Path.Combine(<audioPath>5__2));
				LoadShutterCloseClip(<voiceLinesAudioPath>5__3);
				LoadShutterOpenClip(<voiceLinesAudioPath>5__3);
				if (WindowConfig.enableWesleySellAudio.Value)
				{
					LoadSellCounterClips(<voiceLinesAudioPath>5__3);
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static readonly AudioClip[] CommonSellCounterLines = (AudioClip[])(object)new AudioClip[1];

		public static readonly AudioClip[] RareSellCounterLines = (AudioClip[])(object)new AudioClip[1];

		public static readonly AudioClip[] VoiceLines = (AudioClip[])(object)new AudioClip[2];

		[IteratorStateMachine(typeof(<LoadAudioClips>d__3))]
		public static IEnumerator LoadAudioClips()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadAudioClips>d__3(0);
		}

		private static void LoadShutterOpenClip(string voiceLinesAudioPath)
		{
			string text = Path.Combine(voiceLinesAudioPath, "ShutterOpen.wav");
			string fileName = Path.GetFileName(text);
			Uri filePath = new Uri(text);
			string text2 = fileName;
			AudioClip val = LoadAudioClipFromFile(filePath, text2.Substring(0, text2.Length - 4));
			if ((Object)(object)val == (Object)null)
			{
				ShipWindows.Logger.LogError((object)"Failed to load voice line 'ShutterOpen'!");
				ShipWindows.Logger.LogError((object)("Path: " + voiceLinesAudioPath));
			}
			else
			{
				VoiceLines[0] = val;
				ShipWindows.Logger.LogInfo((object)("Loaded line '" + ((Object)val).name + "'!"));
			}
		}

		private static void LoadShutterCloseClip(string voiceLinesAudioPath)
		{
			string text = Path.Combine(voiceLinesAudioPath, "ShutterClose.wav");
			string fileName = Path.GetFileName(text);
			Uri filePath = new Uri(text);
			string text2 = fileName;
			AudioClip val = LoadAudioClipFromFile(filePath, text2.Substring(0, text2.Length - 4));
			if ((Object)(object)val == (Object)null)
			{
				ShipWindows.Logger.LogError((object)"Failed to load voice line 'ShutterClose'!");
				ShipWindows.Logger.LogError((object)("Path: " + voiceLinesAudioPath));
			}
			else
			{
				VoiceLines[1] = val;
				ShipWindows.Logger.LogInfo((object)("Loaded line '" + ((Object)val).name + "'!"));
			}
		}

		private static void LoadSellCounterClips(string voiceLinesAudioPath)
		{
			string text = Path.Combine(voiceLinesAudioPath, "SellCounter1.wav");
			string fileName = Path.GetFileName(text);
			Uri filePath = new Uri(text);
			string text2 = fileName;
			AudioClip val = LoadAudioClipFromFile(filePath, text2.Substring(0, text2.Length - 4));
			if ((Object)(object)val == (Object)null)
			{
				ShipWindows.Logger.LogError((object)"Failed to load voice line 'SellCounter1'!");
				ShipWindows.Logger.LogError((object)("Path: " + voiceLinesAudioPath));
				return;
			}
			if (WindowConfig.makeWesleySellAudioRare.Value)
			{
				RareSellCounterLines[0] = val;
			}
			else
			{
				CommonSellCounterLines[0] = val;
			}
			ShipWindows.Logger.LogInfo((object)("Loaded line '" + ((Object)val).name + "'!"));
		}

		private static AudioClip? LoadAudioClipFromFile(Uri filePath, string name)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(filePath, (AudioType)20);
			try
			{
				UnityWebRequestAsyncOperation val = audioClip.SendWebRequest();
				while (!((AsyncOperation)val).isDone)
				{
					Thread.Sleep(100);
				}
				if ((int)audioClip.result != 1)
				{
					ShipWindows.Logger.LogError((object)("Failed to load AudioClip: " + audioClip.error));
					return null;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
				((Object)content).name = name;
				return content;
			}
			finally
			{
				((IDisposable)audioClip)?.Dispose();
			}
		}
	}
	internal static class WindowLoader
	{
		public static void LoadWindows()
		{
			WindowInfo[] array = ShipWindows.mainAssetBundle.LoadAllAssets<WindowInfo>();
			if (array == null)
			{
				array = Array.Empty<WindowInfo>();
			}
			Action<ConfigFile, WindowInfo>[] additionalConfigActions = GetAdditionalConfigActions();
			WindowInfo[] array2 = array;
			foreach (WindowInfo windowInfo in array2)
			{
				if (Object.op_Implicit((Object)(object)windowInfo))
				{
					ShipWindows.windowRegistry.RegisterWindow(windowInfo, additionalConfigActions);
				}
			}
		}

		private static Action<ConfigFile, WindowInfo>[] GetAdditionalConfigActions()
		{
			List<Action<ConfigFile, WindowInfo>> list = new List<Action<ConfigFile, WindowInfo>>(2)
			{
				delegate(ConfigFile config, WindowInfo windowInfo)
				{
					if (windowInfo.windowName.Equals("Floor Window"))
					{
						WindowConfig.enableUnderLights = config.Bind<bool>(windowInfo.windowName + " (" + windowInfo.windowType + ")", "4. Spawn Underlights", true, "If set to true, will spawn additional floodlights underneath the ship");
					}
				},
				delegate(ConfigFile config, WindowInfo windowInfo)
				{
					if (windowInfo.windowName.Equals("Right Window"))
					{
						WindowConfig.movePosters = config.Bind<bool>(windowInfo.windowName + " (" + windowInfo.windowType + ")", "4. Move Posters", true, "If set to true, will move the poster that's obstructing the window");
					}
				}
			};
			return list.ToArray();
		}
	}
	public class WindowManager
	{
		public GameObject decapitatedShip = null;

		public readonly List<AbstractWindow> spawnedWindows = new List<AbstractWindow>();

		public WindowManager()
		{
			WindowUnlockData.UnlockedWindows.Clear();
			SaveLoadHandler.LoadData(ModDataHelper.GetModDataKey((object)typeof(WindowUnlockData), "UnlockedWindows"));
			CreateDecapitatedShip();
			foreach (string windowName in WindowUnlockData.UnlockedWindows)
			{
				WindowInfo windowInfo2 = ShipWindows.windowRegistry.Windows.FirstOrDefault((WindowInfo info) => info.windowName.Equals(windowName));
				if (Object.op_Implicit((Object)(object)windowInfo2))
				{
					CreateWindow(windowInfo2, addToList: false, check: false);
				}
			}
			foreach (WindowInfo item in ShipWindows.windowRegistry.Windows.Where((WindowInfo windowInfo) => windowInfo.alwaysUnlocked))
			{
				CreateWindow(item, addToList: false);
			}
		}

		private void CreateDecapitatedShip()
		{
			Transform val = ((Component)StartOfRound.Instance.shipAnimator).transform.Find("ShipInside");
			if (!Object.op_Implicit((Object)(object)val))
			{
				throw new NullReferenceException("Could not find ShipInside!");
			}
			GameObject decapitatedShipPrefab = ShipWindows.Instance.GetDecapitatedShipPrefab();
			decapitatedShip = Object.Instantiate<GameObject>(decapitatedShipPrefab, ((Component)val).transform);
			((Object)decapitatedShip).name = "DecapitatedShip";
			((Renderer)((Component)val).GetComponent<MeshRenderer>()).enabled = false;
			((Collider)((Component)val).GetComponent<MeshCollider>()).enabled = false;
		}

		public void CreateWindow(WindowInfo windowInfo, bool addToList = true, bool check = true)
		{
			bool flag = WindowUnlockData.UnlockedWindows.Contains(windowInfo.windowName);
			if (check && flag)
			{
				return;
			}
			EventAPI.BeforeWindowSpawn(windowInfo);
			if (!Object.op_Implicit((Object)(object)decapitatedShip))
			{
				CreateDecapitatedShip();
			}
			GameObject val = Object.Instantiate<GameObject>(windowInfo.windowPrefab, decapitatedShip.transform);
			if (((Object)val).name.ToLower().StartsWith("prefab"))
			{
				string name = ((Object)val).name;
				int length = "prefab".Length;
				((Object)val).name = name.Substring(length, name.Length - length);
			}
			AbstractWindow componentInChildren = val.GetComponentInChildren<AbstractWindow>();
			componentInChildren.Initialize();
			foreach (string item in windowInfo.objectsToDisable)
			{
				if (!Utility.IsNullOrWhiteSpace(item))
				{
					GameObject val2 = null;
					if (item.StartsWith("Environment/HangarShip/"))
					{
						Transform transform = ((Component)StartOfRound.Instance.shipAnimator).transform;
						string name = item;
						int length = "Environment/HangarShip/".Length;
						val2 = ((Component)transform.Find(name.Substring(length, name.Length - length))).gameObject;
					}
					else
					{
						GameObject.Find(item);
					}
					if (!Object.op_Implicit((Object)(object)val2))
					{
						ShipWindows.Logger.LogError((object)("Couldn't find object '" + item + "'!"));
					}
					else
					{
						val2.SetActive(false);
					}
				}
			}
			if (addToList && !flag)
			{
				WindowUnlockData.UnlockedWindows.Add(windowInfo.windowName);
			}
			EventAPI.AfterWindowSpawn(windowInfo, val);
		}
	}
}
namespace ShipWindows.SoftDependencies
{
	public static class DependencyChecker
	{
		private static readonly Dictionary<string, bool> _DependencyDictionary = new Dictionary<string, bool>();

		public static bool thereIsAShipModInstalled;

		public static bool IsCelestialTintInstalled()
		{
			return IsDependencyInstalled("CelestialTint");
		}

		public static bool IsWiderShipInstalled()
		{
			return IsDependencyInstalled("mborsh.WiderShipMod");
		}

		public static bool IsTwoStoryShipInstalled()
		{
			return IsDependencyInstalled("MelanieMelicious.2StoryShip");
		}

		public static bool IsShipBuilderInstalled()
		{
			return IsDependencyInstalled("mborsh.ShipBuilder");
		}

		public static bool IsAnyShipModInstalled()
		{
			return IsTwoStoryShipInstalled() || IsWiderShipInstalled() || IsShipBuilderInstalled() || thereIsAShipModInstalled;
		}

		public static bool IsDependencyInstalled(string dependencyName)
		{
			string dependencyName2 = dependencyName;
			if (_DependencyDictionary.TryGetValue(dependencyName2, out var value))
			{
				return value;
			}
			value = Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains(dependencyName2));
			_DependencyDictionary[dependencyName2] = value;
			return value;
		}
	}
}
namespace ShipWindows.SkyBox
{
	public abstract class AbstractSkyBox : MonoBehaviour
	{
		private SceneListener _sceneListener = null;

		public abstract float CurrentRotation { get; set; }

		public virtual void Awake()
		{
			EventAPI.AfterSkyboxCreated(this);
			if (SceneListener.Instance != null)
			{
				_sceneListener = SceneListener.Instance;
			}
			else
			{
				_sceneListener = new SceneListener(this);
			}
		}

		public abstract void ToggleSkyBox(bool enabled);

		public abstract void SetSkyboxTexture(Texture? skybox);
	}
	public class CelestialTintSkybox : AbstractSkyBox
	{
		public Volume skyVolume;

		private PhysicallyBasedSky _sky = null;

		public static CelestialTintSkybox Instance { get; private set; }

		public override float CurrentRotation
		{
			get
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_sky) && !skyVolume.profile.TryGet<PhysicallyBasedSky>(ref _sky))
				{
					throw new NullReferenceException("Could not find the skybox!");
				}
				return ((VolumeParameter<Vector3>)(object)_sky.spaceRotation).value.y;
			}
			set
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)_sky) && !skyVolume.profile.TryGet<PhysicallyBasedSky>(ref _sky))
				{
					throw new NullReferenceException("Could not find the skybox!");
				}
				if (((VolumeParameter<Vector3>)(object)_sky.spaceRotation).value.y > 360f)
				{
					Vector3Parameter spaceRotation = _sky.spaceRotation;
					((VolumeParameter<Vector3>)(object)spaceRotation).value = ((VolumeParameter<Vector3>)(object)spaceRotation).value - new Vector3(0f, 360f, 0f);
				}
				if (((VolumeParameter<Vector3>)(object)_sky.spaceRotation).value.y < 0f)
				{
					Vector3Parameter spaceRotation2 = _sky.spaceRotation;
					((VolumeParameter<Vector3>)(object)spaceRotation2).value = ((VolumeParameter<Vector3>)(object)spaceRotation2).value + new Vector3(0f, 360f, 0f);
				}
				Vector3Parameter spaceRotation3 = _sky.spaceRotation;
				((VolumeParameter<Vector3>)(object)spaceRotation3).value = ((VolumeParameter<Vector3>)(object)spaceRotation3).value + new Vector3(0f, value - ((VolumeParameter<Vector3>)(object)_sky.spaceRotation).value.y, 0f);
			}
		}

		public override void Awake()
		{
			base.Awake();
			Instance = this;
			ShipWindows.skyBox = this;
		}

		private void Update()
		{
			CurrentRotation += Time.deltaTime * WindowConfig.skyboxRotateSpeed.Value;
		}

		public override void SetSkyboxTexture(Texture? skybox)
		{
			((VolumeParameter<Texture>)(object)_sky.spaceEmissionTexture).value = skybox;
		}

		public override void ToggleSkyBox(bool enable)
		{
			((Component)skyVolume).gameObject.SetActive(enable);
			((Behaviour)skyVolume).enabled = enable;
		}
	}
	public class HdriSpaceSkybox : AbstractSkyBox
	{
		public Volume skyVolume;

		private HDRISky _sky = null;

		public static HdriSpaceSkybox Instance { get; private set; }

		public override float CurrentRotation
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_sky) && !skyVolume.profile.TryGet<HDRISky>(ref _sky))
				{
					throw new NullReferenceException("Could not find the skybox!");
				}
				return ((VolumeParameter<float>)(object)((SkySettings)_sky).rotation).value;
			}
			set
			{
				if (!Object.op_Implicit((Object)(object)_sky) && !skyVolume.profile.TryGet<HDRISky>(ref _sky))
				{
					throw new NullReferenceException("Could not find the skybox!");
				}
				ClampedFloatParameter rotation = ((SkySettings)_sky).rotation;
				((VolumeParameter<float>)(object)rotation).value = ((VolumeParameter<float>)(object)rotation).value + (value - ((VolumeParameter<float>)(object)((SkySettings)_sky).rotation).value);
				if (((VolumeParameter<float>)(object)((SkySettings)_sky).rotation).value >= 360f)
				{
					((VolumeParameter<float>)(object)((SkySettings)_sky).rotation).value = 0f;
				}
				if (((VolumeParameter<float>)(object)((SkySettings)_sky).rotation).value <= 0f)
				{
					((VolumeParameter<float>)(object)((SkySettings)_sky).rotation).value = 360f;
				}
			}
		}

		public override void Awake()
		{
			base.Awake();
			Instance = this;
			ShipWindows.skyBox = this;
		}

		private void Update()
		{
			CurrentRotation += Time.deltaTime * WindowConfig.skyboxRotateSpeed.Value;
		}

		public override void SetSkyboxTexture(Texture? skybox)
		{
			((VolumeParameter<Texture>)(object)_sky.hdriSky).value = skybox;
		}

		public override void ToggleSkyBox(bool enable)
		{
			((Component)skyVolume).gameObject.SetActive(enable);
			((Behaviour)skyVolume).enabled = enable;
		}
	}
	public class SceneListener
	{
		[CompilerGenerated]
		private sealed class <CheckSceneStateDelayed>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SceneListener <>4__this;

			object? IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object? IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CheckSceneStateDelayed>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>4__this.CheckSceneState();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private readonly AbstractSkyBox _skyBox;

		public static SceneListener? Instance { get; private set; }

		public SceneListener(AbstractSkyBox skyBox)
		{
			Instance = this;
			_skyBox = skyBox;
			SceneManager.sceneLoaded += delegate
			{
				if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
				{
					((MonoBehaviour)StartOfRound.Instance).StartCoroutine(CheckSceneStateDelayed());
				}
			};
			SceneManager.sceneUnloaded += delegate
			{
				if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
				{
					((MonoBehaviour)StartOfRound.Instance).StartCoroutine(CheckSceneStateDelayed());
				}
			};
		}

		[IteratorStateMachine(typeof(<CheckSceneStateDelayed>d__6))]
		private IEnumerator CheckSceneStateDelayed()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CheckSceneStateDelayed>d__6(0)
			{
				<>4__this = this
			};
		}

		private void CheckSceneState()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ShipWindows.skyBox))
			{
				return;
			}
			if (SceneManager.sceneCount == 1)
			{
				Scene activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "SampleSceneRelay")
				{
					ShipWindows.skyBox.ToggleSkyBox(enabled: true);
					EventAPI.AfterSkyboxLoaded(_skyBox);
					if (WindowConfig.hideSpaceProps.Value)
					{
						((Component)StartOfRound.Instance.currentPlanetPrefab.transform.parent).gameObject.SetActive(false);
					}
					return;
				}
			}
			ShipWindows.skyBox.ToggleSkyBox(enabled: false);
			EventAPI.AfterSkyboxUnloaded(_skyBox);
		}
	}
	public class StarsSkybox : AbstractSkyBox
	{
		public Transform stars;

		public GameObject starsObject;

		public MeshRenderer starsRenderer;

		public static StarsSkybox Instance { get; private set; }

		public override float CurrentRotation
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				Quaternion rotation = stars.rotation;
				return ((Quaternion)(ref rotation)).eulerAngles.y;
			}
			set
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//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_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				Quaternion rotation = stars.rotation;
				Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
				eulerAngles.y += value - eulerAngles.y;
				if (eulerAngles.y >= 360f)
				{
					eulerAngles.y -= 360f;
				}
				if (eulerAngles.y <= 0f)
				{
					eulerAngles.y += 360f;
				}
				stars.rotation = Quaternion.Euler(eulerAngles);
			}
		}

		public override void Awake()
		{
			base.Awake();
			Instance = this;
			ShipWindows.skyBox = this;
		}

		private void Update()
		{
			CurrentRotation += Time.deltaTime * WindowConfig.skyboxRotateSpeed.Value;
		}

		public override void ToggleSkyBox(bool enable)
		{
			starsObject.SetActive(enable);
		}

		public override void SetSkyboxTexture(Texture? skybox)
		{
			((Renderer)starsRenderer).material.mainTexture = skybox;
		}
	}
}
namespace ShipWindows.ShutterSwitch
{
	[RequireComponent(typeof(Animator))]
	[RequireComponent(typeof(InteractTrigger))]
	public class ShutterSwitchBehavior : MonoBehaviour
	{
		public static readonly int EnabledAnimatorHash = Animator.StringToHash("Enabled");

		public Animator animator;

		public InteractTrigger interactTrigger;

		public AudioSource shutterSound;

		public AudioClip enableSound;

		public AudioClip disableSound;

		public GameObject scanNodeObject;

		public BoxCollider scanNodeCollider;

		public static ShutterSwitchBehavior Instance { get; private set; } = null;


		private void Awake()
		{
			Instance = this;
			WindowConfig.enableShutterSwitchScanNode.SettingChanged += delegate
			{
				UpdateScanNode();
			};
		}

		private void UpdateScanNode()
		{
			scanNodeObject.SetActive(WindowConfig.enableShutterSwitchScanNode.Value);
			((Collider)scanNodeCollider).enabled = WindowConfig.enableShutterSwitchScanNode.Value;
		}

		public void ToggleSwitch()
		{
			ToggleSwitch(!animator.GetBool(EnabledAnimatorHash));
			ShipWindows.networkManager?.ToggleShutters(animator.GetBool(EnabledAnimatorHash), lockShutters: false, WindowConfig.playShutterVoiceLinesOnShutterToggle.Value);
		}

		public void ToggleSwitch(PlayerControllerB playerControllerB)
		{
			ToggleSwitch();
		}

		public void ToggleSwitch(bool enable, bool locked = false)
		{
			animator.SetBool(EnabledAnimatorHash, enable);
			interactTrigger.interactable = !locked;
			shutterSound.PlayOneShot(enable ? enableSound : disableSound);
		}
	}
}
namespace ShipWindows.Patches.WindowManager
{
	[HarmonyPatch(typeof(HUDManager))]
	public static class WindowManagerCreatePatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void CreateWindowManager()
		{
			ShipWindows.windowManager = new global::ShipWindows.Utilities.WindowManager();
		}
	}
}
namespace ShipWindows.Patches.Skybox
{
	[HarmonyPatch(typeof(HUDManager))]
	public static class SkyboxCreatePatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void CreateSkybox()
		{
			bool flag = DependencyChecker.IsCelestialTintInstalled();
			switch (WindowConfig.spaceOutsideSetting.Value)
			{
			case SpaceOutside.SPACE_HDRI:
			{
				Transform parent = ((Component)StartOfRound.Instance.blackSkyVolume).transform.parent;
				if (flag)
				{
					if (!WindowConfig.celestialTintOverrideSpace.Value)
					{
						ShipWindows.Logger.LogWarning((object)"Skybox set to HDRI, but Celestial Tint Override is set to false!");
					}
					else
					{
						Object.Instantiate<GameObject>(ShipWindows.Instance.GetCelestialTintOverlayPrefab(), parent);
					}
				}
				else
				{
					Object.Instantiate<GameObject>(ShipWindows.Instance.GetSpaceHdriPrefab(), parent);
				}
				break;
			}
			case SpaceOutside.BLACK_AND_STARS:
				if (!flag)
				{
					Object.Instantiate<GameObject>(ShipWindows.Instance.GetStarsPrefab());
				}
				break;
			case SpaceOutside.OTHER_MODS:
				break;
			default:
				throw new NotImplementedException();
			}
		}
	}
}
namespace ShipWindows.Patches.Shutters
{
	[HarmonyPatch(typeof(StartOfRound))]
	public static class HideMoonLandingPatch
	{
		[CompilerGenerated]
		private sealed class <ShutAndLockShuttersForTransition>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private bool <playAudio>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ShutAndLockShuttersForTransition>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<playAudio>5__1 = WindowConfig.playShutterVoiceLinesOnLanding.Value;
					ShipWindows.networkManager?.ToggleShutters(closeShutters: true, lockShutters: true, <playAudio>5__1);
					<>2__current = (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.shipDoorsEnabled));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ShipWindows.networkManager?.ToggleShutters(closeShutters: false, lockShutters: false, <playAudio>5__1);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		public static void HideMoonLanding()
		{
			if ((((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer) && WindowConfig.hideMoonLanding.Value)
			{
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ShutAndLockShuttersForTransition());
			}
		}

		[IteratorStateMachine(typeof(<ShutAndLockShuttersForTransition>d__1))]
		private static IEnumerator ShutAndLockShuttersForTransition()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShutAndLockShuttersForTransition>d__1(0);
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public static class HideMoonTransitionPatch
	{
		[CompilerGenerated]
		private sealed class <ShutAndLockShuttersForTransition>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float transitionTime;

			private bool <playAudio>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ShutAndLockShuttersForTransition>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<playAudio>5__1 = WindowConfig.playShutterVoiceLinesOnTransitions.Value;
					ShipWindows.networkManager?.ToggleShutters(closeShutters: true, lockShutters: true, <playAudio>5__1);
					<>2__current = (object)new WaitForSeconds(transitionTime + 2.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ShipWindows.networkManager?.ToggleShutters(closeShutters: false, lockShutters: false, <playAudio>5__1);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static bool skippedFirstAnnouncement;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void ResetState()
		{
			skippedFirstAnnouncement = false;
		}

		[HarmonyPatch("ChangeLevel")]
		[HarmonyPostfix]
		public static void HideMoonTransition()
		{
			if ((((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer) && WindowConfig.shuttersHideMoonTransitions.Value)
			{
				if (!skippedFirstAnnouncement)
				{
					skippedFirstAnnouncement = true;
					return;
				}
				SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ShutAndLockShuttersForTransition(currentLevel.timeToArrive));
			}
		}

		[IteratorStateMachine(typeof(<ShutAndLockShuttersForTransition>d__3))]
		private static IEnumerator ShutAndLockShuttersForTransition(float transitionTime)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShutAndLockShuttersForTransition>d__3(0)
			{
				transitionTime = transitionTime
			};
		}
	}
}
namespace ShipWindows.Patches.ShipReset
{
	[HarmonyPatch(typeof(StartOfRound))]
	public static class ShipResetPatch
	{
		[CompilerGenerated]
		private sealed class <DeleteAndRespawnCoroutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private GameObject <decapitatedShip>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DeleteAndRespawnCoroutine>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<decapitatedShip>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<decapitatedShip>5__1 = ShipWindows.windowManager.decapitatedShip;
					if (Object.op_Implicit((Object)(object)<decapitatedShip>5__1))
					{
						Object.Destroy((Object)(object)<decapitatedShip>5__1);
					}
					WindowUnlockData.UnlockedWindows.Clear();
					SaveLoadHandler.SaveData(ModDataHelper.GetModDataKey((object)typeof(WindowUnlockData), "UnlockedWindows"));
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ShipWindows.windowManager = new global::ShipWindows.Utilities.WindowManager();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPatch("ResetShip")]
		[HarmonyPostfix]
		public static void DeleteAndRespawnWindows()
		{
			((MonoBehaviour)StartOfRound.Instance).StartCoroutine(DeleteAndRespawnCoroutine());
		}

		[IteratorStateMachine(typeof(<DeleteAndRespawnCoroutine>d__1))]
		private static IEnumerator DeleteAndRespawnCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DeleteAndRespawnCoroutine>d__1(0);
		}
	}
}
namespace ShipWindows.Patches.SellAudios
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	public static class AddSellAudiosPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void AddVoiceLines(DepositItemsDesk __instance)
		{
			List<AudioClip> list = __instance.rareMicrophoneAudios.ToList();
			list.AddRange(SoundLoader.RareSellCounterLines);
			list.RemoveAll((AudioClip clip) => (Object)(object)clip == (Object)null);
			__instance.rareMicrophoneAudios = list.ToArray();
			List<AudioClip> list2 = __instance.microphoneAudios.ToList();
			list2.AddRange(SoundLoader.CommonSellCounterLines);
			list2.RemoveAll((AudioClip clip) => (Object)(object)clip == (Object)null);
			__instance.microphoneAudios = list2.ToArray();
		}
	}
}
namespace ShipWindows.Patches.Networking
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	public static class NetworkingStuffPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void RegisterNetworkPrefab()
		{
			GameObject networkManagerPrefab = ShipWindows.Instance.GetNetworkManagerPrefab();
			if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(networkManagerPrefab))
			{
				NetworkManager.Singleton.AddNetworkPrefab(networkManagerPrefab);
			}
		}

		[HarmonyPatch("Disconnect")]
		[HarmonyPrefix]
		public static void DestroyNetworkManager(GameNetworkManager __instance)
		{
			if (!__instance.isHostingGame)
			{
				ShipWindows.networkManager = null;
				return;
			}
			INetworkManager? networkManager = ShipWindows.networkManager;
			if (networkManager != null)
			{
				networkManager.NetworkObject.Despawn(true);
			}
		}

		[HarmonyPatch("SetLobbyJoinable")]
		[HarmonyPostfix]
		public static void SpawnNetworkManager(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame)
			{
				if (Object.op_Implicit((Object)(object)ShipWindows.networkManager?.NetworkObject))
				{
					ShipWindows.Logger.LogDebug((object)"Network manager already exists! Destroying...");
					ShipWindows.networkManager.NetworkObject.Despawn(true);
				}
				GameObject val = Object.Instantiate<GameObject>(ShipWindows.Instance.GetNetworkManagerPrefab());
				NetworkObject component = val.GetComponent<NetworkObject>();
				((Object)component).name = "ShipWindowsNetworkManager";
				component.Spawn(false);
				Object.DontDestroyOnLoad((Object)(object)val);
			}
		}
	}
}
namespace ShipWindows.Patches.EnemyFixes
{
	[HarmonyPatch]
	public static class EnemyMeshPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "SetPlayerSafeInShip")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> EnableAllEnemyMeshes(IEnumerable<CodeInstruction> instructions)
		{
			ShipWindows.Logger.LogDebug((object)"Searching for start: ldfld bool StartOfRound::hangarDoorsClosed");
			ShipWindows.Logger.LogDebug((object)"Searching for end: ret NULL");
			List<CodeInstruction> list = instructions.ToList();
			int num = -1;
			int num2 = -1;
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (num == -1 && ((object)val).ToString().Equals("ldfld bool StartOfRound::hangarDoorsClosed"))
				{
					num = i - 1;
				}
				else if (((object)val).ToString().Equals("ret NULL"))
				{
					num2 = i;
					break;
				}
			}
			if (num == -1 || num2 == -1)
			{
				ShipWindows.Logger.LogError((object)"Couldn't find instructions to remove!");
				ShipWindows.Logger.LogError((object)("Start: " + num));
				ShipWindows.Logger.LogError((object)("End: " + num2));
				ShipWindows.Logger.LogError((object)"Please report this error!");
				return list;
			}
			ShipWindows.Logger.LogDebug((object)("Found start at: " + num));
			ShipWindows.Logger.LogDebug((object)("Found end at: " + num2));
			list.RemoveRange(num, num2 - num);
			return list;
		}

		[HarmonyPatch(typeof(EnemyAI), "Start")]
		[HarmonyPostfix]
		private static void EnableEnemyMesh(EnemyAI __instance)
		{
			EnableEnemyMeshGeneric(__instance);
		}

		[HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")]
		[HarmonyPostfix]
		private static void EnableEnemyMesh(MaskedPlayerEnemy __instance)
		{
			EnableEnemyMeshGeneric((EnemyAI)(object)__instance);
		}

		private static void EnableEnemyMeshGeneric(EnemyAI enemyAI)
		{
			enemyAI.EnableEnemyMesh(true, false);
		}
	}
	[HarmonyPatch(typeof(EnemyAICollisionDetect))]
	public static class FixEnemyAttackPatch
	{
		[HarmonyPatch("OnTriggerStay")]
		[HarmonyPrefix]
		private static bool CanCollide(EnemyAI ___mainScript, ref Collider other)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			if (!WindowConfig.enableEnemyFix.Value)
			{
				return true;
			}
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)component != (Object)(object)localPlayerController)
			{
				return true;
			}
			bool flag = ___mainScript.isInsidePlayerShip == localPlayerController.isInHangarShipRoom;
			if (!flag)
			{
				other = new Collider();
			}
			return flag;
		}
	}
}
namespace ShipWindows.Patches.BuildManagerFix
{
	[HarmonyPatch(typeof(ShipBuildModeManager))]
	public class BuildManagerFixPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void ChangeLayerMasks(ShipBuildModeManager __instance)
		{
			__instance.placementMask |= 0x10000000;
			__instance.placementMaskAndBlockers |= 0x10000000;
			__instance.placeableShipObjectsMask |= 0x10000000;
		}
	}
}
namespace ShipWindows.Networking
{
	public class DummyNetworkManager : INetworkManager
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass9_0
		{
			public AudioSource speakerAudio;

			internal bool <PlayWesleyVoiceCoroutine>b__0()
			{
				return !speakerAudio.isPlaying;
			}
		}

		[CompilerGenerated]
		private sealed class <PlayWesleyVoiceCoroutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int index;

			private <>c__DisplayClass9_0 <>8__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PlayWesleyVoiceCoroutine>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass9_0();
					<>8__1.speakerAudio = StartOfRound.Instance.speakerAudioSource;
					if (<>8__1.speakerAudio.isPlaying)
					{
						StartOfRound.Instance.speakerAudioSource.Stop();
						StartOfRound.Instance.speakerAudioSource.PlayOneShot(StartOfRound.Instance.disableSpeakerSFX);
					}
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.speakerAudio.isPlaying));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>8__1.speakerAudio.PlayOneShot(SoundLoader.VoiceLines[index]);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public NetworkObject NetworkObject => null;

		public void SpawnWindow(WindowInfo windowInfo)
		{
		}

		public void ToggleShutters(bool closeShutters, bool lockShutters = false, bool playAudio = false)
		{
			if (playAudio)
			{
				PlayWesleyVoice(closeShutters ? 1 : 0);
			}
			ToggleShutterOnLocalClient(closeShutters, lockShutters);
		}

		private static void ToggleShutterOnLocalClient(bool closeShutters, bool lockShutters)
		{
			List<AbstractWindow> spawnedWindows = ShipWindows.windowManager.spawnedWindows;
			foreach (AbstractWindow item in spawnedWindows)
			{
				item.ToggleWindowShutter(closeShutters, lockShutters);
			}
		}

		public void SyncUnlockedWindows()
		{
		}

		public void SyncSkyboxRotation()
		{
		}

		public void SyncShutter()
		{
		}

		public void PlayWesleyVoice(int index)
		{
			((MonoBehaviour)StartOfRound.Instance).StartCoroutine(PlayWesleyVoiceCoroutine(index));
		}

		[IteratorStateMachine(typeof(<PlayWesleyVoiceCoroutine>d__9))]
		private static IEnumerator PlayWesleyVoiceCoroutine(int index)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PlayWesleyVoiceCoroutine>d__9(0)
			{
				index = index
			};
		}
	}
	public interface INetworkManager
	{
		NetworkObject NetworkObject { get; }

		void SpawnWindow(WindowInfo windowInfo);

		void ToggleShutters(bool closeShutters, bool lockShutters = false, bool playAudio = false);

		void SyncUnlockedWindows();

		void SyncSkyboxRotation();

		void SyncShutter();

		void PlayWesleyVoice(int index);
	}
	public class NetworkManager : NetworkBehaviour, INetworkManager
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass16_0
		{
			public AudioSource speakerAudio;

			internal bool <PlayWesleyVoiceCoroutine>b__0()
			{
				return !speakerAudio.isPlaying;
			}
		}

		[CompilerGenerated]
		private sealed class <PlayWesleyVoiceCoroutine>d__16 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int index;

			private <>c__DisplayClass16_0 <>8__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PlayWesleyVoiceCoroutine>d__16(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass16_0();
					<>8__1.speakerAudio = StartOfRound.Instance.speakerAudioSource;
					if (<>8__1.speakerAudio.isPlaying)
					{
						StartOfRound.Instance.speakerAudioSource.Stop();
						StartOfRound.Instance.speakerAudioSource.PlayOneShot(StartOfRound.Instance.disableSpeakerSFX);
					}
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.speakerAudio.isPlaying));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>8__1.speakerAudio.PlayOneShot(SoundLoader.VoiceLines[index]);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public NetworkObject NetworkObject { get; private set; } = null;


		public override void OnNetworkSpawn()
		{
			ShipWindows.networkManager = this;
			NetworkObject = ((NetworkBehaviour)this).NetworkObject;
			SyncUnlockedWindows();
			SyncSkyboxRotation();
			SyncShutter();
		}

		public override void OnNetworkDespawn()
		{
			ShipWindows.networkManager = null;
		}

		public void SpawnWindow(WindowInfo windowInfo)
		{
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				SpawnWindowServerRpc(windowInfo.windowName);
				return;
			}
			Terminal terminalScript = HUDManager.Instance.terminalScript;
			if (terminalScript.groupCredits >= windowInfo.cost)
			{
				terminalScript.SyncGroupCreditsClientRpc(terminalScript.groupCredits - windowInfo.cost, terminalScript.numberOfItemsInDropship);
				SpawnWindowOnLocalClient(windowInfo);
				SpawnWindowClientRpc(windowInfo.windowName);
			}
		}

		private static void SpawnWindowOnLocalClient(WindowInfo windowInfo)
		{
			ShipWindows.windowManager.CreateWindow(windowInfo);
		}

		public void ToggleShutters(bool closeShutters, bool lockShutters = false, bool playAudio = false)
		{
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				ToggleShuttersServerRpc(closeShutters);
				return;
			}
			if (playAudio)
			{
				PlayWesleyVoice(closeShutters ? 1 : 0);
			}
			ToggleShuttersClientRpc(closeShutters, lockShutters);
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleShuttersServerRpc(bool closeShutters)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1991866666u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref closeShutters, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1991866666u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ToggleShutters(closeShutters);
				}
			}
		}

		[ClientRpc]
		public void ToggleShuttersClientRpc(bool closeShutters, bool lockShutters = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3991969001u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref closeShutters, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lockShutters, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3991969001u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ToggleShutterOnLocalClient(closeShutters, lockShutters);
				}
			}
		}

		private static void ToggleShutterOnLocalClient(bool closeShutters, bool lockShutters)
		{
			List<AbstractWindow> spawnedWindows = ShipWindows.windowManager.spawnedWindows;
			foreach (AbstractWindow item in spawnedWindows)
			{
				item.ToggleWindowShutter(closeShutters, lockShutters);
			}
			if (Object.op_Implicit((Object)(object)ShutterSwitchBehavior.Instance))
			{
				ShutterSwitchBehavior.Instance.ToggleSwitch(closeShutters, lockShutters);
			}
		}

		public void SyncUnlockedWindows()
		{
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				SyncUnlockedWindowsServerRpc();
				return;
			}
			foreach (string unlockedWindow in WindowUnlockData.UnlockedWindows)
			{
				SpawnWindowClientRpc(unlockedWindow);
			}
		}

		public void SyncSkyboxRotation()
		{
			if (Object.op_Implicit((Object)(object)ShipWindows.skyBox))
			{
				if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
				{
					SyncSkyboxRotationServerRpc();
				}
				else
				{
					SyncSkyboxRotationClientRpc(ShipWindows.skyBox.CurrentRotation);
				}
			}
		}

		public void SyncShutter()
		{
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				SyncShutterServerRpc();
				return;
			}
			ShutterSwitchBehavior instance = ShutterSwitchBehavior.Instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				bool @bool = instance.animator.GetBool(ShutterSwitchBehavior.EnabledAnimatorHash);
				bool lockShutters = !instance.interactTrigger.interactable;
				SyncShutterClientRpc(@bool, lockShutters);
			}
		}

		public void PlayWesleyVoice(int index)
		{
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				PlayWesleyVoiceServerRpc(index);
			}
			else
			{
				PlayWesleyVoiceClientRpc(index);
			}
		}

		[IteratorStateMachine(typeof(<PlayWesleyVoiceCoroutine>d__16))]
		private static IEnumerator PlayWesleyVoiceCoroutine(int index)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PlayWesleyVoiceCoroutine>d__16(0)
			{
				index = index
			};
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayWesleyVoiceServerRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(620452605u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 620452605u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					PlayWesleyVoiceClientRpc(index);
				}
			}
		}

		[ClientRpc]
		public void PlayWesleyVoiceClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2926304101u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2926304101u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StopAllCoroutines();
					((MonoBehaviour)this).StartCoroutine(PlayWesleyVoiceCoroutine(index));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncShutterServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1912918784u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1912918784u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SyncShutter();
				}
			}
		}

		[ClientRpc]
		public void SyncShutterClientRpc(bool closeShutters, bool lockShutters = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4220045506u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref closeShutters, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lockShutters, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4220045506u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ToggleShutterOnLocalClient(closeShutters, lockShutters);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncSkyboxRotationServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1765872416u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1765872416u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SyncSkyboxRotation();
				}
			}
		}

		[ClientRpc]
		public void SyncSkyboxRotationClientRpc(float rotation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3030095197u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref rotation, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3030095197u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (Object.op_Implicit((Object)(object)ShipWindows.skyBox))
				{
					ShipWindows.skyBox.CurrentRotation = rotation;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncUnlockedWindowsServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1877518591u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1877518591u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SyncUnlockedWindows();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnWindowServerRpc(string windowName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3368557420u, val, (RpcDelivery)0);
				bool flag = windowName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(windowName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3368557420u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				string windowName2 = windowName;
				WindowInfo windowInfo = ShipWindows.windowRegistry.Windows.FirstOrDefault((WindowInfo info) => info.windowName.Equals(windowName2));
				if (Object.op_Implicit((Object)(object)windowInfo))
				{
					SpawnWindow(windowInfo);
				}
			}
		}

		[ClientRpc]
		public void SpawnWindowClientRpc(string windowName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1697985261u, val, (RpcDelivery)0);
				bool flag = windowName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(windowName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1697985261u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			string windowName2 = windowName;
			if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer)
			{
				WindowInfo windowInfo = ShipWindows.windowRegistry.Windows.FirstOrDefault((WindowInfo info) => info.windowName.Equals(windowName2));
				if (Object.op_Implicit((Object)(object)windowInfo))
				{
					SpawnWindowOnLocalClient(windowInfo);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1991866666u, new RpcReceiveHandler(__rpc_handler_1991866666), "ToggleShuttersServerRpc");
			((NetworkBehaviour)this).__registerRpc(3991969001u, new RpcReceiveHandler(__rpc_handler_3991969001), "ToggleShuttersClientRpc");
			((NetworkBehaviour)this).__registerRpc(620452605u, new RpcReceiveHandler(__rpc_handler_620452605), "PlayWesleyVoiceServerRpc");
			((NetworkBehaviour)this).__registerRpc(2926304101u, new RpcReceiveHandler(__rpc_handler_2926304101), "PlayWesleyVoiceClientRpc");
			((NetworkBehaviour)this).__registerRpc(1912918784u, new RpcReceiveHandler(__rpc_handler_1912918784), "SyncShutterServerRpc");
			((NetworkBehaviour)this).__registerRpc(4220045506u, new RpcReceiveHandler(__rpc_handler_4220045506), "SyncShutterClientRpc");
			((NetworkBehaviour)this).__registerRpc(1765872416u, new RpcReceiveHandler(__rpc_handler_1765872416), "SyncSkyboxRotationServerRpc");
			((NetworkBehaviour)this).__registerRpc(3030095197u, new RpcReceiveHandler(__rpc_handler_3030095197), "SyncSkyboxRotationClientRpc");
			((NetworkBehaviour)this).__registerRpc(1877518591u, new RpcReceiveHandler(__rpc_handler_1877518591), "SyncUnlockedWindowsServerRpc");
			((NetworkBehaviour)this).__registerRpc(3368557420u, new RpcReceiveHandler(__rpc_handler_3368557420), "SpawnWindowServerRpc");
			((NetworkBehaviour)this).__registerRpc(1697985261u, new RpcReceiveHandler(__rpc_handler_1697985261), "SpawnWindowClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1991866666(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool closeShutters = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref closeShutters, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).ToggleShuttersServerRpc(closeShutters);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3991969001(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool closeShutters = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref closeShutters, default(ForPrimitives));
				bool lockShutters = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lockShutters, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).ToggleShuttersClientRpc(closeShutters, lockShutters);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_620452605(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).PlayWesleyVoiceServerRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2926304101(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).PlayWesleyVoiceClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1912918784(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SyncShutterServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4220045506(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool closeShutters = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref closeShutters, default(ForPrimitives));
				bool lockShutters = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lockShutters, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SyncShutterClientRpc(closeShutters, lockShutters);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1765872416(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SyncSkyboxRotationServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3030095197(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float rotation = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotation, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SyncSkyboxRotationClientRpc(rotation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1877518591(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SyncUnlockedWindowsServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3368557420(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string windowName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref windowName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SpawnWindowServerRpc(windowName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1697985261(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string windowName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref windowName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkManager)(object)target).SpawnWindowClientRpc(windowName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NetworkManager";
		}
	}
}
namespace ShipWindows.Config
{
	public enum SpaceOutside
	{
		OTHER_MODS,
		SPACE_HDRI,
		BLACK_AND_STARS
	}
	public static class WindowConfig
	{
		public static ConfigEntry<bool> vanillaMode;

		public static ConfigEntry<WindowMaterial> glassMaterial;

		public static ConfigEntry<bool> hideMoonLanding;

		public static ConfigEntry<bool> shuttersHideMoonTransitions;

		public static ConfigEntry<bool> enableShutterSwitchScanNode;

		public static ConfigEntry<bool> hideSpaceProps;

		public static ConfigEntry<SpaceOutside> spaceOutsideSetting;

		public static ConfigEntry<float> skyboxRotateSpeed;

		public static ConfigEntry<bool> enableUnderLights;

		public static ConfigEntry<bool> movePosters;

		public static ConfigEntry<bool> playShutterVoiceLinesOnShutterToggle;

		public static ConfigEntry<bool> playShutterVoiceLinesOnTransitions;

		public static ConfigEntry<bool> playShutterVoiceLinesOnLanding;

		public static ConfigEntry<bool> enableWesleySellAu