#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.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.ShipWindowsBeta.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.ShipWindowsBeta")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds glass windows to the ship so you can see what's going on outside.")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0+ed2fa641945b576ae0c9a7d4ef1505adfc14a70c")]
[assembly: AssemblyProduct("ShipWindowsBeta")]
[assembly: AssemblyTitle("TestAccount666.ShipWindowsBeta")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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
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));
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")]
[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.ShipWindowsBeta", "ShipWindowsBeta", "2.1.0")]
public class ShipWindows : BaseUnityPlugin
{
public const string ASSET_BUNDLE_PATH_PREFIX = "Assets/LethalCompany/Mods/plugins/ShipWindows/Beta";
public static AssetBundle mainAssetBundle;
public static WindowRegistry windowRegistry;
public static WindowManager windowManager;
public static INetworkManager? networkManager;
public static ISkyBox? 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.ShipWindowsBeta");
}
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>("windows", 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));
((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/Beta/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/Beta/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/Beta/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/Beta/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/Beta/SkyBox/StarsSphereLarge.prefab");
return _starsPrefab;
}
}
public class ToDoClass
{
}
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.ShipWindowsBeta";
public const string PLUGIN_NAME = "ShipWindowsBeta";
public const string PLUGIN_VERSION = "2.1.0";
}
}
namespace ShipWindows.WindowDefinition
{
[RequireComponent(typeof(Animator))]
public abstract class AbstractWindow : MonoBehaviour
{
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();
};
}
private IEnumerator WaitAndRegister()
{
yield return (object)new WaitUntil((Func<bool>)(() => ShipWindows.windowManager != null));
ShipWindows.windowManager.spawnedWindows.Add(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).material = 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);
}
}
}
namespace ShipWindows.Utilities
{
public static class SoundLoader
{
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];
public static IEnumerator LoadAudioClips()
{
string assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Debug.Assert(assemblyDirectory != null, "assemblyDirectory != null");
string audioPath = Path.Combine(assemblyDirectory, "sounds");
audioPath = (Directory.Exists(audioPath) ? audioPath : Path.Combine(assemblyDirectory));
ShipWindows.Logger.LogInfo((object)"Loading Wesley voice lines...");
string voiceLinesAudioPath2 = Path.Combine(audioPath, "voicelines");
voiceLinesAudioPath2 = (Directory.Exists(voiceLinesAudioPath2) ? voiceLinesAudioPath2 : Path.Combine(audioPath));
LoadShutterCloseClip(voiceLinesAudioPath2);
LoadShutterOpenClip(voiceLinesAudioPath2);
if (WindowConfig.enableWesleySellAudio.Value)
{
LoadSellCounterClips(voiceLinesAudioPath2);
}
yield break;
}
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>>(1)
{
delegate(ConfigFile config, WindowInfo windowInfo)
{
if (windowInfo.windowName.Equals("Floor Window"))
{
WindowConfig.enableUnderLights = config.Bind<bool>(windowInfo.windowName + " (" + windowInfo.windowType + ")", "4. Spawn Underlights", true, (ConfigDescription)null);
}
}
};
return list.ToArray();
}
}
public class WindowManager
{
public GameObject decapitatedShip = null;
public List<AbstractWindow> spawnedWindows = new List<AbstractWindow>();
public WindowManager()
{
SaveLoadHandler.LoadData(ModDataHelper.GetModDataKey((object)typeof(WindowUnlockData), "UnlockedWindows"));
CreateDecapitatedShip();
foreach (WindowInfo item in ShipWindows.windowRegistry.windows.Where((WindowInfo windowInfo) => windowInfo.alwaysUnlocked))
{
CreateWindow(item, addToList: true, check: false);
}
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);
}
}
}
private void CreateDecapitatedShip()
{
GameObject val = GameObject.Find("Environment/HangarShip/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, val.transform);
((Object)decapitatedShip).name = "DecapitatedShip";
((Renderer)val.GetComponent<MeshRenderer>()).enabled = false;
((Collider)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)
{
GameObject val2 = 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
{
public static bool IsCelestialTintInstalled()
{
return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("CelestialTint"));
}
}
}
namespace ShipWindows.SkyBox
{
public class CelestialTintSkybox : MonoBehaviour, ISkyBox
{
public Volume skyVolume;
private PhysicallyBasedSky _sky = null;
private SceneListener _sceneListener = null;
public static CelestialTintSkybox Instance { get; private set; }
public 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);
}
}
private void Awake()
{
Instance = this;
ShipWindows.skyBox = this;
_sceneListener = new SceneListener();
}
private void Update()
{
CurrentRotation += Time.deltaTime * WindowConfig.skyboxRotateSpeed.Value;
}
public void SetSkyboxTexture(Texture? skybox)
{
((VolumeParameter<Texture>)(object)_sky.spaceEmissionTexture).value = skybox;
}
public void ToggleSkyBox(bool enable)
{
((Behaviour)skyVolume).enabled = enable;
}
}
public class HdriSpaceSkybox : MonoBehaviour, ISkyBox
{
public Volume skyVolume;
private HDRISky _sky = null;
private SceneListener _sceneListener = null;
public static HdriSpaceSkybox Instance { get; private set; }
public 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;
}
}
}
private void Awake()
{
Instance = this;
ShipWindows.skyBox = this;
_sceneListener = new SceneListener();
}
private void Update()
{
CurrentRotation += Time.deltaTime * WindowConfig.skyboxRotateSpeed.Value;
}
public void SetSkyboxTexture(Texture? skybox)
{
((VolumeParameter<Texture>)(object)_sky.hdriSky).value = skybox;
}
public void ToggleSkyBox(bool enable)
{
((Behaviour)skyVolume).enabled = enable;
}
}
public interface ISkyBox
{
float CurrentRotation { get; set; }
void ToggleSkyBox(bool enabled);
void SetSkyboxTexture(Texture? skybox);
}
public class SceneListener
{
public SceneListener()
{
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());
}
};
}
private static IEnumerator CheckSceneStateDelayed()
{
yield return (object)new WaitForEndOfFrame();
yield return (object)new WaitForEndOfFrame();
CheckSceneState();
}
private static void CheckSceneState()
{
//IL_0009: 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)
if (SceneManager.sceneCount == 1)
{
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "SampleSceneRelay")
{
ShipWindows.skyBox?.ToggleSkyBox(enabled: true);
if (WindowConfig.hideSpaceProps.Value)
{
((Component)StartOfRound.Instance.currentPlanetPrefab.transform.parent).gameObject.SetActive(false);
}
return;
}
}
ShipWindows.skyBox?.ToggleSkyBox(enabled: false);
}
}
public class StarsSkybox : MonoBehaviour, ISkyBox
{
public Transform stars;
public GameObject starsObject;
public MeshRenderer starsRenderer;
private SceneListener _sceneListener = null;
public static StarsSkybox Instance { get; private set; }
public 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);
}
}
private void Awake()
{
Instance = this;
ShipWindows.skyBox = this;
_sceneListener = new SceneListener();
}
private void Update()
{
CurrentRotation += Time.deltaTime * WindowConfig.skyboxRotateSpeed.Value;
}
public void ToggleSkyBox(bool enable)
{
starsObject.SetActive(enable);
}
public 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
{
[HarmonyPatch("StartGame")]
[HarmonyPostfix]
public static void HideMoonLanding()
{
if ((((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer) && WindowConfig.hideMoonLanding.Value)
{
((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ShutAndLockShuttersForTransition());
}
}
private static IEnumerator ShutAndLockShuttersForTransition()
{
bool playAudio = WindowConfig.playShutterVoiceLinesOnLanding.Value;
ShipWindows.networkManager?.ToggleShutters(closeShutters: true, lockShutters: true, playAudio);
yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.shipDoorsEnabled));
ShipWindows.networkManager?.ToggleShutters(closeShutters: false, lockShutters: false, playAudio);
}
}
[HarmonyPatch(typeof(StartOfRound))]
public static class HideMoonTransitionPatch
{
[HarmonyPatch("ChangeLevel")]
[HarmonyPostfix]
public static void HideMoonTransition()
{
if ((((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer) && WindowConfig.shuttersHideMoonTransitions.Value)
{
SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
((MonoBehaviour)StartOfRound.Instance).StartCoroutine(ShutAndLockShuttersForTransition(currentLevel.timeToArrive));
}
}
private static IEnumerator ShutAndLockShuttersForTransition(float transitionTime)
{
bool playAudio = WindowConfig.playShutterVoiceLinesOnTransitions.Value;
ShipWindows.networkManager?.ToggleShutters(closeShutters: true, lockShutters: true, playAudio);
yield return (object)new WaitForSeconds(transitionTime + 2.5f);
ShipWindows.networkManager?.ToggleShutters(closeShutters: false, lockShutters: false, playAudio);
}
}
}
namespace ShipWindows.Patches.ShipReset
{
[HarmonyPatch(typeof(StartOfRound))]
public static class ShipResetPatch
{
[HarmonyPatch("ResetShip")]
[HarmonyPostfix]
public static void DeleteAndRespawnWindows()
{
((MonoBehaviour)StartOfRound.Instance).StartCoroutine(DeleteAndRespawnCoroutine());
}
private static IEnumerator DeleteAndRespawnCoroutine()
{
GameObject decapitatedShip = ShipWindows.windowManager.decapitatedShip;
if (Object.op_Implicit((Object)(object)decapitatedShip))
{
Object.Destroy((Object)(object)decapitatedShip);
}
WindowUnlockData.UnlockedWindows.Clear();
SaveLoadHandler.SaveData(ModDataHelper.GetModDataKey((object)typeof(WindowUnlockData), "UnlockedWindows"));
yield return null;
ShipWindows.windowManager = new global::ShipWindows.Utilities.WindowManager();
}
}
}
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.Networking
{
public class DummyNetworkManager : INetworkManager
{
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));
}
private static IEnumerator PlayWesleyVoiceCoroutine(int index)
{
AudioSource speakerAudio = StartOfRound.Instance.speakerAudioSource;
if (speakerAudio.isPlaying)
{
StartOfRound.Instance.DisableShipSpeakerLocalClient();
}
yield return (object)new WaitUntil((Func<bool>)(() => !speakerAudio.isPlaying));
speakerAudio.PlayOneShot(SoundLoader.VoiceLines[index]);
yield return (object)new WaitUntil((Func<bool>)(() => !speakerAudio.isPlaying));
speakerAudio.PlayOneShot(StartOfRound.Instance.disableSpeakerSFX);
}
}
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
{
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)
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(1932619742u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref closeShutters, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1932619742u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3146015763u, 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, 3146015763u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
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 (ShipWindows.skyBox != null)
{
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);
}
}
private static IEnumerator PlayWesleyVoiceCoroutine(int index)
{
AudioSource speakerAudio = StartOfRound.Instance.speakerAudioSource;
if (speakerAudio.isPlaying)
{
StartOfRound.Instance.DisableShipSpeakerLocalClient();
}
yield return (object)new WaitUntil((Func<bool>)(() => !speakerAudio.isPlaying));
speakerAudio.PlayOneShot(SoundLoader.VoiceLines[index]);
yield return (object)new WaitUntil((Func<bool>)(() => !speakerAudio.isPlaying));
speakerAudio.PlayOneShot(StartOfRound.Instance.disableSpeakerSFX);
}
[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)
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(2411596017u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2411596017u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(384987074u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 384987074u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((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)
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(569931498u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 569931498u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2541429421u, 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, 2541429421u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
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)
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(2077949471u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2077949471u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3258236508u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref rotation, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3258236508u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ShipWindows.skyBox != null)
{
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)
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(739351144u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 739351144u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
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_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(4236749717u, 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, 4236749717u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
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_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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1716991692u, 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, 1716991692u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
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();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_NetworkManager()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//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
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1932619742u, new RpcReceiveHandler(__rpc_handler_1932619742));
NetworkManager.__rpc_func_table.Add(3146015763u, new RpcReceiveHandler(__rpc_handler_3146015763));
NetworkManager.__rpc_func_table.Add(2411596017u, new RpcReceiveHandler(__rpc_handler_2411596017));
NetworkManager.__rpc_func_table.Add(384987074u, new RpcReceiveHandler(__rpc_handler_384987074));
NetworkManager.__rpc_func_table.Add(569931498u, new RpcReceiveHandler(__rpc_handler_569931498));
NetworkManager.__rpc_func_table.Add(2541429421u, new RpcReceiveHandler(__rpc_handler_2541429421));
NetworkManager.__rpc_func_table.Add(2077949471u, new RpcReceiveHandler(__rpc_handler_2077949471));
NetworkManager.__rpc_func_table.Add(3258236508u, new RpcReceiveHandler(__rpc_handler_3258236508));
NetworkManager.__rpc_func_table.Add(739351144u, new RpcReceiveHandler(__rpc_handler_739351144));
NetworkManager.__rpc_func_table.Add(4236749717u, new RpcReceiveHandler(__rpc_handler_4236749717));
NetworkManager.__rpc_func_table.Add(1716991692u, new RpcReceiveHandler(__rpc_handler_1716991692));
}
private static void __rpc_handler_1932619742(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_3146015763(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)2;
((NetworkManager)(object)target).ToggleShuttersClientRpc(closeShutters, lockShutters);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2411596017(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_384987074(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)2;
((NetworkManager)(object)target).PlayWesleyVoiceClientRpc(index);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_569931498(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_2541429421(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)2;
((NetworkManager)(object)target).SyncShutterClientRpc(closeShutters, lockShutters);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2077949471(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_3258236508(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)2;
((NetworkManager)(object)target).SyncSkyboxRotationClientRpc(rotation);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_739351144(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_4236749717(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_1716991692(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)2;
((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> dontMovePosters;
public static ConfigEntry<bool> playShutterVoiceLinesOnShutterToggle;
public static ConfigEntry<bool> playShutterVoiceLinesOnTransitions;
public static ConfigEntry<bool> playShutterVoiceLinesOnLanding;
public static ConfigEntry<bool> enableWesleySellAudio;
public static ConfigEntry<bool> makeWesleySellAudioRare;
public static ConfigEntry<bool> celestialTintOverrideSpace;
public static ConfigEntry<bool> enableEnemyFix;
public static ConfigEntry<bool> allowEnemyTriggerThroughWindows;
public static void InitializeConfig(ConfigFile configFile)
{
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
vanillaMode = configFile.Bind<bool>("General", "VanillaMode", false, "Enable this to preserve vanilla network compatability. This will disable unlockables and the shutter toggle switch. (default = false)");
glassMaterial = configFile.Bind<WindowMaterial>("Windows", "Window Material", WindowMaterial.NO_REFRACTION_IRIDESCENCE, "Defines what material will be used for the glass. Iridescence will give you some nice rainbow colors. They are more visible with Refraction, but Refraction breaks some VFX.");
allowEnemyTriggerThroughWindows = configFile.Bind<bool>("Windows", "Allow Enemy Trigger Through Windows", true, "If set to true, will allow you to trigger enemies through windows. Will also allow enemies to see you through windows. Does not have any effect on vanilla mode.");
hideMoonLanding = configFile.Bind<bool>("Shutter", "Hide Moon Landing", true, "If enabled, will hide the transition between space and moon.");
shuttersHideMoonTransitions = configFile.Bind<bool>("Shutter", "Hide Moon Transitions", true, "If set to true, will close the window shutters when routing to a new moon.Disabling this will look weird, if CelestialTint isn't installed.");
enableShutterSwitchScanNode = configFile.Bind<bool>("Shutter", "Enable Shutter Switch scan node", true, "If set to true, will enable the scan node for the shutter switch.");
spaceOutsideSetting = configFile.Bind<SpaceOutside>("Skybox", "Skybox Type", SpaceOutside.SPACE_HDRI, "Set this value to control how the outside space looks.");
celestialTintOverrideSpace = configFile.Bind<bool>("Skybox", "Override Celestial Tint Skybox", true, "If Celestial Tint is installed, override the skybox. Only effective if skybox is set to Space HDRRI Volume.");
skyboxRotateSpeed = configFile.Bind<float>("Skybox", "Skybox Rotation Speed", 0.1f, new ConfigDescription("Sets the rotation speed of the space skybox for visual effect.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>()));
hideSpaceProps = configFile.Bind<bool>("Skybox", "HideSpaceProps", false, "Should the planet and moon outside the ship be hidden?");
playShutterVoiceLinesOnShutterToggle = configFile.Bind<bool>("Shutter Misc", "Play Wesley Shutter Voice Lines On Shutter Toggle", true, "If set to true, will play Wesley's voice lines for opening/closing the window shutters.");
playShutterVoiceLinesOnTransitions = configFile.Bind<bool>("Shutter Misc", "Play Wesley Shutter Voice Lines On Transitions", true, "If set to true, will play the voice lines, if opening/closing the window shutters is caused by a transition.");
playShutterVoiceLinesOnLanding = configFile.Bind<bool>("Shutter Misc", "Play Wesley Shutter Voice Lines On Landing", true, "If set to true, will play the voice lines, if opening/closing the window shutters is caused by a landing.");
makeWesleySellAudioRare = configFile.Bind<bool>("Misc", "Make Wesley Sell Audio Rare", false, "If set to true, will add the wesley sell audio to the rare audio list.");
enableWesleySellAudio = configFile.Bind<bool>("Misc", "Enable Wesley Sell Audio", true, "If set to true, will add the wesley sell audio to the audio list.");
enableEnemyFix = configFile.Bind<bool>("Fixes", "Enable Enemy Fix", true, "If set to true, will add a check to enemy's ai to prevent them from killing you through the windows. Enabling this might cause some issues though.");
}
}
public enum WindowMaterial
{
NO_REFRACTION,
NO_REFRACTION_IRIDESCENCE,
REFRACTION,
REFRACTION_IRIDESCENCE
}
public static class WindowMaterialConverter
{
private static readonly Dictionary<WindowMaterial, Material> _MaterialDictionary = new Dictionary<WindowMaterial, Material>();
public static Material? GetMaterial(this WindowMaterial windowMaterial)
{
LoadMaterial(windowMaterial);
return _MaterialDictionary[windowMaterial];
}
private static void LoadMaterial(WindowMaterial windowMaterial)
{
if (!_MaterialDictionary.ContainsKey(windowMaterial))
{
if (1 == 0)
{
}
string text = windowMaterial switch
{
WindowMaterial.NO_REFRACTION => "Assets/LethalCompany/Mods/plugins/ShipWindows/Beta/Windows/Materials/GlassNoRefraction.mat",
WindowMaterial.NO_REFRACTION_IRIDESCENCE => "Assets/LethalCompany/Mods/plugins/ShipWindows/Beta/Windows/Materials/GlassNoRefractionIridescence.mat",
WindowMaterial.REFRACTION => "Assets/LethalCompany/Mods/plugins/ShipWindows/Beta/Windows/Materials/GlassWithRefraction.mat",
WindowMaterial.REFRACTION_IRIDESCENCE => "Assets/LethalCompany/Mods/plugins/ShipWindows/Beta/Windows/Materials/GlassWithRefractionIridescence.mat",
_ => null,
};
if (1 == 0)
{
}
string text2 = text;
if (!Utility.IsNullOrWhiteSpace(text2))
{
Material value = ShipWindows.mainAssetBundle.LoadAsset<Material>(text2);
_MaterialDictionary.Add(windowMaterial, value);
}
}
}
}
}
namespace ShipWindows.Api
{
[CreateAssetMenu(menuName = "ShipWindows/WindowInfo", order = 1)]
public class WindowInfo : ScriptableObject
{
public string windowName;
public string windowDescription;
public int cost;
[Header("Please keep window types conform to docs.")]
public string windowType;
public List<string> objectsToDisable;
public GameObject windowPrefab;
public bool deactivatedByDefault;
[Header("Not part of the API and initial value will be ignored.")]
public bool alwaysUnlocked;
}
public class WindowRegistry
{
internal readonly HashSet<WindowInfo> windows = new HashSet<WindowInfo>();
public void UnregisterWindow(WindowInfo window)
{
string name = Assembly.GetCallingAssembly().GetName().Name;
windows.Remove(window);
ShipWindows.Logger.LogDebug((object)("Unregistering window " + window.windowName + " from " + name + "!"));
}
public void RegisterWindow(WindowInfo window, Action<ConfigFile, WindowInfo>? configAction = null)
{
RegisterWindow(window, (configAction == null) ? null : new Action<ConfigFile, WindowInfo>[1] { configAction });
}
public void RegisterWindow(WindowInfo window, Action<ConfigFile, WindowInfo>[]? configAction = null)
{
WindowInfo window2 = window;
if (configAction == null)
{
configAction = Array.Empty<Action<ConfigFile, WindowInfo>>();
}
string name = Assembly.GetCallingAssembly().GetName().Name;
string windowName = window2.windowName;
if (((BaseUnityPlugin)ShipWindows.Instance).Config.Bind<bool>(windowName + " (" + window2.windowType + ")", "1. Enabled", !window2.deactivatedByDefault, "If " + windowName + " is enabled").Value)
{
bool value = ((BaseUnityPlugin)ShipWindows.Instance).Config.Bind<bool>(windowName + " (" + window2.windowType + ")", "2. Always unlocked", false, "If " + windowName + " is always unlocked").Value;
window2.alwaysUnlocked = value;
int value2 = ((BaseUnityPlugin)ShipWindows.Instance).Config.Bind<int>(windowName + " (" + window2.windowType + ")", "3. Unlock Cost", window2.cost, "Cost to unlock " + windowName).Value;
window2.cost = value2;
Action<ConfigFile, WindowInfo>[] array = configAction;
foreach (Action<ConfigFile, WindowInfo> action in array)
{
action(((BaseUnityPlugin)ShipWindows.Instance).Config, window2);
}
if (windows.Any((WindowInfo info) => info.windowName.Equals(windowName)))
{
throw new DuplicateNameException("There is already a window with name " + windowName + "! Source: " + name);
}
if (windows.Any((WindowInfo info) => info.windowType.Equals(window2.windowType)))
{
throw new DuplicateNameException("Window " + windowName + " has duplicate window type " + window2.windowType + "! Source: " + name);
}
windows.Add(window2);
ShipWindows.Logger.LogDebug((object)("Registering window " + windowName + " from " + name + "!"));
}
}
}
}
namespace ShipWindows.Api.events
{
public static class EventAPI
{
public delegate void WindowEvent(WindowEventArguments windowEvent);
public static event WindowEvent BeforeWindowSpawned;
public static event WindowEvent AfterWindowSpawned;
internal static WindowEventArguments BeforeWindowSpawn(WindowInfo windowInfo)
{
WindowEventArguments windowEventArguments = new WindowEventArguments(windowInfo);
EventAPI.BeforeWindowSpawned?.Invoke(windowEventArguments);
return windowEventArguments;
}
internal static WindowEventArguments AfterWindowSpawn(WindowInfo windowInfo, GameObject windowObject)
{
WindowEventArguments windowEventArguments = new WindowEventArguments(windowInfo, windowObject);
EventAPI.AfterWindowSpawned?.Invoke(windowEventArguments);
return windowEventArguments;
}
}
public struct WindowEventArguments
{
public WindowInfo windowInfo;
public GameObject? windowObject;
public WindowEventArguments(WindowInfo windowInfo, GameObject? windowObject = null)
{
this.windowInfo = windowInfo;
this.windowObject = windowObject;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace TestAccount666.ShipWindowsBeta.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}