using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using CSync.Extensions; using CSync.Lib; using DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using Poltergeist.GhostInteractibles; using Poltergeist.GhostInteractibles.Specific; using Poltergeist.NetcodePatcher; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Poltergeist")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f259155f09d6ba2fce21d496843e09d312c6b7db")] [assembly: AssemblyProduct("Poltergeist")] [assembly: AssemblyTitle("Poltergeist")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Poltergeist { public static class AudioManager { public const string SOUND_FOLDER_NAME = "PoltergeistSounds"; private static AudioClip[] clips; public static AudioClip defaultClip; public static AudioClip GetClip(int index) { if (clips.Length == 0) { return defaultClip; } return clips[index % clips.Length]; } private static void FindAllAudioFiles(string dirPath, List filePaths) { if (!Directory.Exists(dirPath)) { return; } if (Path.GetFileName(dirPath).Equals("PoltergeistSounds")) { string[] files = Directory.GetFiles(dirPath); foreach (string text in files) { if (Poltergeist.Config.DisableDuplicateSounds.Value) { bool flag = false; foreach (string filePath in filePaths) { if (Path.GetFileNameWithoutExtension(text).Equals(Path.GetFileNameWithoutExtension(filePath))) { flag = true; break; } } if (flag) { continue; } } filePaths.Add(text); } } else { string[] files = Directory.GetDirectories(dirPath); for (int i = 0; i < files.Length; i++) { FindAllAudioFiles(files[i], filePaths); } } } public static void LoadClips() { List list = ((!Poltergeist.Config.UseDefaultSounds.Value) ? new List() : new List(Directory.GetFiles(Path.Combine(Poltergeist.dllFolderPath, "sounds")))); FindAllAudioFiles(Paths.PluginPath, list); list.Sort((string path1, string path2) => Path.GetFileName(path1).CompareTo(Path.GetFileName(path2))); List list2 = new List(); foreach (string path3 in list) { try { Poltergeist.DebugLog("Found an audio file " + Path.GetFileName(path3)); Task task = Task.Run(async () => await GetAudioClip(path3)); Poltergeist.DebugLog("Waiting for file load task to complete"); task.Wait(); if ((Object)(object)task.Result != (Object)null) { list2.Add(task.Result); } Poltergeist.DebugLog("Clip loaded successfully"); } catch (Exception) { Poltergeist.LogError("An exception was encountered while loading audio!"); } } clips = list2.ToArray(); } private static async Task GetAudioClip(string path) { string extension = Path.GetExtension(path); AudioType val; switch (extension) { case ".wav": val = (AudioType)20; break; case ".ogg": val = (AudioType)14; break; case ".mp3": val = (AudioType)13; break; default: Poltergeist.LogWarning("Ran into illegal extension " + extension + " while loading audio!"); return null; } path = "file:///" + path.Replace("+", "%2B"); UnityWebRequest www2; if ((int)val == 13) { Poltergeist.DebugLog("Loading MP3 file"); DownloadHandlerAudioClip dh = new DownloadHandlerAudioClip(path, (AudioType)13); dh.compressed = true; www2 = new UnityWebRequest(path, "GET", (DownloadHandler)(object)dh, (UploadHandler)null); try { UnityWebRequestAsyncOperation result2 = www2.SendWebRequest(); while (!((AsyncOperation)result2).isDone) { await Task.Yield(); } if ((int)www2.result != 1) { Poltergeist.LogError("An MP3 file failed to load!"); return null; } AudioClip audioClip = dh.audioClip; ((Object)audioClip).name = Path.GetFileNameWithoutExtension(path); return audioClip; } finally { ((IDisposable)www2)?.Dispose(); } } Poltergeist.DebugLog("Loading non-MP3 file"); www2 = UnityWebRequestMultimedia.GetAudioClip(path, val); try { UnityWebRequestAsyncOperation result2 = www2.SendWebRequest(); while (!((AsyncOperation)result2).isDone) { await Task.Yield(); } if ((int)www2.result != 1) { Poltergeist.LogError("A non-MP3 file failed to load!"); return null; } AudioClip content = DownloadHandlerAudioClip.GetContent(www2); ((Object)content).name = Path.GetFileNameWithoutExtension(path); return content; } finally { ((IDisposable)www2)?.Dispose(); } } } public class GhostFollowTrigger : MonoBehaviour { private void OnTriggerEnter(Collider other) { GhostHead component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)SpectatorCamController.instance.head) { SpectatorCamController.instance.ParentTo(((Component)this).transform); } } private void OnTriggerExit(Collider other) { GhostHead component = ((Component)other).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)SpectatorCamController.instance.head) { SpectatorCamController.instance.ParentTo(null); } } } public class GhostHead : NetworkBehaviour { public static Dictionary headMapping = new Dictionary(); private bool initialized; public bool isActive; public bool isHostHead; private float playTime; private Light light; private Renderer renderer; private AudioSource manifestSource; private AudioSource barkSource; private const int KEYFRAMES = 6; private static float[] keyTimes = new float[6] { 0f, 1f, 1.4f, 1.8f, 2.2f, 3f }; private static float[] visibilities = new float[6] { 0f, 1f, 1f, 0.5f, 1f, 0f }; private int keyIndex = 999; private float startTime; public static string[] matNames = new string[9] { "ace_mat", "bi_mat", "lesbian_mat", "pan_mat", "pride_mat", "trans_mat", "nb_mat", "fluid_mat", "aro_mat" }; private static float randMatChance = 0.15f; private static Material[] sharedMats = null; private static Material sharedDefaultMat = null; private Material[] materials; private Material defaultMat; private Material matInstance; private RandomStream matRNG; private ColorAdjustments colorAdj; private float maxOpacity = 1f; private float maxIntensity = 1f; private Color filterCol = Color.white; private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) light = ((Component)this).GetComponentInChildren(); renderer = ((Component)this).GetComponentInChildren(); matInstance = renderer.material; maxOpacity = matInstance.color.a; maxIntensity = light.intensity; manifestSource = ((Component)((Component)this).transform.Find("manifest_audio")).GetComponent(); manifestSource.volume = Poltergeist.Config.GhostVolume.Value; barkSource = ((Component)((Component)this).transform.Find("bark_audio")).GetComponent(); barkSource.volume = Poltergeist.Config.GhostVolume.Value; materials = (Material[])(object)new Material[sharedMats.Length]; for (int i = 0; i < sharedMats.Length; i++) { materials[i] = Object.Instantiate(sharedMats[i]); } defaultMat = Object.Instantiate(sharedDefaultMat); } private void LateUpdate() { //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) if (!initialized && (Object)(object)SpectatorCamController.instance != (Object)null && ((NetworkBehaviour)this).IsOwner && (!((NetworkBehaviour)this).IsServer || isHostHead)) { initialized = true; SpectatorCamController.instance.head = this; renderer.enabled = false; Object.Instantiate(Poltergeist.colorVolObject).GetComponent().profile.TryGet(ref colorAdj); ((VolumeParameter)colorAdj.colorFilter).overrideState = true; filterCol = ((VolumeParameter)(object)colorAdj.colorFilter).value; ((VolumeParameter)(object)colorAdj.colorFilter).value = Color.white; Poltergeist.DebugLog("Assigning head to local client"); AudioManager.defaultClip = manifestSource.clip; manifestSource.spatialBlend = 0f; barkSource.spatialBlend = 0f; } if (keyIndex < 6) { if (Time.time >= startTime + keyTimes[keyIndex]) { keyIndex++; } if (keyIndex == 6) { ((Behaviour)light).enabled = false; ((Component)renderer).gameObject.layer = 23; light.intensity = maxIntensity; matInstance.color = new Color(matInstance.color.r, matInstance.color.g, matInstance.color.b, maxOpacity); if ((Object)(object)colorAdj != (Object)null) { ((VolumeParameter)(object)colorAdj.colorFilter).value = Color.white; } manifestSource.Stop(); } else { float num = keyTimes[keyIndex] - keyTimes[keyIndex - 1]; float num2 = (Time.time - (startTime + keyTimes[keyIndex - 1])) / num; float num3 = Mathf.Lerp(visibilities[keyIndex - 1], visibilities[keyIndex], num2); Color color = matInstance.color; matInstance.color = new Color(color.r, color.g, color.b, num3 * maxOpacity); light.intensity = num3 * maxIntensity; if ((Object)(object)colorAdj != (Object)null) { ((VolumeParameter)(object)colorAdj.colorFilter).value = Color.Lerp(Color.white, filterCol, num3); } } } if (playTime > 0f) { playTime -= Time.deltaTime; if (playTime <= 0f) { barkSource.Stop(); } } } public void UpdateHeadMat() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (matRNG == null) { matRNG = new RandomStream(); } double num = matRNG.NextDouble(); int index = ((Poltergeist.Config.PrideMode.Value || DateTime.Now.Month == 6 || !(num > (double)randMatChance)) ? (matRNG.Next() % materials.Length) : (-1)); ApplyMatServerRPC(index); } public void Deactivate() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = StartOfRound.Instance.notSpawnedPosition.position; keyIndex = 6; ((Behaviour)light).enabled = false; ((Component)renderer).gameObject.layer = 23; light.intensity = maxIntensity; matInstance.color = new Color(matInstance.color.r, matInstance.color.g, matInstance.color.b, maxOpacity); if ((Object)(object)colorAdj != (Object)null) { ((VolumeParameter)(object)colorAdj.colorFilter).value = Color.white; } manifestSource.Stop(); } public static void LoadMats(AssetBundle bundle) { sharedMats = (Material[])(object)new Material[matNames.Length]; for (int i = 0; i < sharedMats.Length; i++) { sharedMats[i] = bundle.LoadAsset("Assets/Materials/" + matNames[i] + ".mat"); } sharedDefaultMat = bundle.LoadAsset("Assets/Materials/ghost_mat.mat"); } [ClientRpc] public void ManifestClientRpc() { //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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1243495895u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1243495895u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayFlickerAnim(); } } } [ServerRpc] public void ManifestServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1669939383u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1669939383u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ManifestClientRpc(); } } public bool IsManifesting() { return keyIndex < 6; } public bool PlayFlickerAnim() { if (IsManifesting()) { return false; } keyIndex = 1; startTime = Time.time; ((Behaviour)light).enabled = true; ((Component)renderer).gameObject.layer = 0; manifestSource.Play(); return true; } [ClientRpc] public void BarkClientRpc(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(390338682u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 390338682u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayBarkAudio(index); } } } [ServerRpc] public void BarkServerRpc(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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3939474390u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3939474390u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; BarkClientRpc(index); } } public bool IsBarking() { return barkSource.isPlaying; } public void PlayBarkAudio(int index) { if (!IsBarking()) { Poltergeist.DebugLog("Playing a bark locally"); playTime = Poltergeist.Config.AudioTime.Value; barkSource.clip = AudioManager.GetClip(index); barkSource.Play(); } } [ServerRpc] private void ApplyMatServerRPC(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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2520582034u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2520582034u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ApplyMatClientRPC(index); } } [ClientRpc] private void ApplyMatClientRPC(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(1685652734u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1685652734u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ApplyMatLocally(index); } } } private void ApplyMatLocally(int index) { if (index < 0) { matInstance = defaultMat; } else { matInstance = materials[index]; } renderer.sharedMaterial = matInstance; } 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 ((NetworkBehaviour)this).__registerRpc(1243495895u, new RpcReceiveHandler(__rpc_handler_1243495895), "ManifestClientRpc"); ((NetworkBehaviour)this).__registerRpc(1669939383u, new RpcReceiveHandler(__rpc_handler_1669939383), "ManifestServerRpc"); ((NetworkBehaviour)this).__registerRpc(390338682u, new RpcReceiveHandler(__rpc_handler_390338682), "BarkClientRpc"); ((NetworkBehaviour)this).__registerRpc(3939474390u, new RpcReceiveHandler(__rpc_handler_3939474390), "BarkServerRpc"); ((NetworkBehaviour)this).__registerRpc(2520582034u, new RpcReceiveHandler(__rpc_handler_2520582034), "ApplyMatServerRPC"); ((NetworkBehaviour)this).__registerRpc(1685652734u, new RpcReceiveHandler(__rpc_handler_1685652734), "ApplyMatClientRPC"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1243495895(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; ((GhostHead)(object)target).ManifestClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1669939383(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0029: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((GhostHead)(object)target).ManifestServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_390338682(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; ((GhostHead)(object)target).BarkClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3939474390(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((GhostHead)(object)target).BarkServerRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2520582034(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((GhostHead)(object)target).ApplyMatServerRPC(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1685652734(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; ((GhostHead)(object)target).ApplyMatClientRPC(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GhostHead"; } } public class GhostItemTrigger : MonoBehaviour { private GrabbableObject itemScript; private void Start() { itemScript = ((Component)((Component)this).transform.parent).GetComponent(); } private void OnTriggerEnter(Collider other) { if ((Object)(object)((Component)other).gameObject.GetComponent() != (Object)null) { itemScript.ActivatePhysicsTrigger(other); } } } [HarmonyPatch] public static class Patches { public static bool vanillaMode; public static GrabbableObject ignoreObj; public static bool shouldGameOver; public static bool camControllerActive; private static int cachedHealth; [HarmonyPrefix] [HarmonyPatch(typeof(SandSpiderAI), "TriggerChaseWithPlayer")] public static bool PreventSpiderBug(PlayerControllerB playerScript) { return (Object)(object)playerScript != (Object)null; } [HarmonyPostfix] [HarmonyPatch(typeof(ManualCameraRenderer), "MeetsCameraEnabledConditions")] public static void RenderForGhosts(ref bool __result) { if (camControllerActive) { __result = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(StartMatchLever), "Start")] public static void MakeFollowTrigger(StartMatchLever __instance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(Poltergeist.followTriggerObject, ((Component)__instance).transform).transform.localPosition = Vector3.zero; } [HarmonyPrefix] [HarmonyPatch(typeof(CadaverBloomAI), "HitEnemy")] [HarmonyPatch(typeof(CaveDwellerAI), "HitEnemy")] public static void PreHitHeal(EnemyAI __instance, int force) { if (force == 0) { cachedHealth = __instance.enemyHP; __instance.enemyHP++; } } [HarmonyPostfix] [HarmonyPatch(typeof(CadaverBloomAI), "HitEnemy")] [HarmonyPatch(typeof(CaveDwellerAI), "HitEnemy")] public static void PostHitPreventHeal(EnemyAI __instance, int force) { if (force == 0) { __instance.enemyHP = cachedHealth; } } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "SetSpectateCameraToGameOverMode")] public static bool PreventSpectateFollow(bool enableGameOver) { shouldGameOver = enableGameOver; return vanillaMode; } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] public static void OverrideSpectateCam(PlayerControllerB __instance) { if (!vanillaMode) { __instance.playersManager.overrideSpectateCamera = true; } } [HarmonyPrefix] [HarmonyPatch(typeof(AdjacentRoomCullingModified), "SetTileVisibility")] public static void CancelCulling(Tile tile, ref bool visible) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) if (camControllerActive) { Vector3 val = ((Component)tile).transform.position - ((Component)SpectatorCamController.instance).transform.position; visible = ((Vector3)(ref val)).magnitude <= Poltergeist.Config.CullDistance.Value; } } [HarmonyPrefix] [HarmonyPatch(typeof(AdjacentRoomCullingModified), "LateUpdate")] public static void CullEveryFrame(AdjacentRoomCullingModified __instance) { if (!__instance.Ready || !camControllerActive) { return; } foreach (Tile allTile in __instance.allTiles) { if ((Object)(object)allTile != (Object)null) { __instance.SetTileVisibility(allTile, true); } } } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "SwitchCamera")] public static void ManageCameraController(StartOfRound __instance, Camera newCamera) { if ((Object)(object)newCamera == (Object)(object)__instance.spectateCamera) { SpectatorCamController.instance.EnableCam(); } else { SpectatorCamController.instance.DisableCam(); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] public static void MakeCamController(StartOfRound __instance) { ((Component)__instance.spectateCamera).gameObject.AddComponent(); } [HarmonyPostfix] [HarmonyPatch(typeof(InteractTrigger), "Start")] public static void AddGhostInteractor(InteractTrigger __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent() != (Object)null) { ((Component)__instance).gameObject.AddComponent().costType = CostType.DOOR; return; } if (((Object)__instance).name.Equals("LightSwitch") || ((Object)(object)((Component)__instance).transform.parent != (Object)null && ((Object)((Component)__instance).transform.parent).name.Contains("storage"))) { ((Component)__instance).gameObject.AddComponent(); return; } Transform parent = ((Component)__instance).transform.parent; if ((Object)(object)parent != (Object)null && (((Object)parent).name.Contains("Pumpkin") || ((Object)parent).name.Contains("Television") || ((Object)parent).name.Contains("Record") || ((Object)parent).name.Contains("Romantic") || ((Object)parent).name.Contains("Shower") || ((Object)parent).name.Contains("Toilet") || ((Object)parent).name.Contains("Plushie"))) { ((Component)__instance).gameObject.AddComponent(); } else if ((Object)(object)parent != (Object)null && (((Object)parent).name.Equals("StartButton") || ((Object)parent).name.Equals("StopButton"))) { ((Component)__instance).gameObject.AddComponent().costType = CostType.SHIPDOOR; } else if ((Object)(object)((Component)__instance).gameObject.GetComponent() != (Object)null) { ((Component)__instance).gameObject.AddComponent().costType = CostType.VALVE; } else if ((Object)(object)parent != (Object)null && ((Object)parent).name.Equals("BellDinger")) { ((Component)__instance).gameObject.AddComponent().costType = CostType.COMPANYBELL; } else if (((Object)__instance).name.Contains("LeverSwitchHandle")) { ((Component)__instance).gameObject.AddComponent().costType = CostType.HANGARDOOR; } else if ((Object)(object)((Component)__instance).GetComponent() != (Object)null) { BasicInteractible basicInteractible = ((Component)__instance).gameObject.AddComponent(); basicInteractible.costType = CostType.MISC; basicInteractible.isHeld = true; } else if ((Object)(object)((Component)__instance).transform.parent != (Object)null && ((Object)((Component)__instance).transform.parent).name.Equals("ElevatorButtonTrigger")) { ((Component)__instance).gameObject.AddComponent().costType = CostType.HANGARDOOR; } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] public static void AddInteractorForProp(GrabbableObject __instance) { if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (__instance is NoisemakerProp || __instance is BoomboxItem || __instance is RadarBoosterItem || __instance is RemoteProp)) { GameObject obj = Object.Instantiate(Poltergeist.propInteractibleObject, ((Component)__instance).transform); obj.GetComponent().intendedParent = ((Component)__instance).transform; ((Object)obj).name = ((Object)__instance).name + "Interactor"; obj.GetComponent().Spawn(false); obj.transform.parent = ((Component)__instance).transform; } } [HarmonyPostfix] [HarmonyPatch(typeof(TerminalAccessibleObject), "Start")] public static void AddInteractorForBigDoors(TerminalAccessibleObject __instance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (((Object)__instance).name.Contains("BigDoor")) { GameObject val = new GameObject(); val.transform.parent = ((Component)__instance).transform; val.transform.localPosition = new Vector3(0f, 2.4f, 0f); val.transform.localEulerAngles = Vector3.zero; val.transform.localScale = Vector3.one; val.layer = LayerMask.NameToLayer("Ignore Raycast"); ((Object)val).name = "GhostInteractable"; BoxCollider obj = val.AddComponent(); obj.size = new Vector3(0.7f, 4f, 3f); ((Collider)obj).isTrigger = true; val.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")] public static void AddInteractorForEnemies(EnemyAI __instance) { if (!(__instance is DoublewingAI) && !Poltergeist.EnemyInBlacklist(__instance) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)) { Poltergeist.DebugLog("Making interactor for " + ((Object)__instance).name); GameObject obj = Object.Instantiate(Poltergeist.enemyInteractibleObject, ((Component)__instance).transform); ((Object)obj).name = ((Object)__instance).name + "Interactor"; obj.GetComponent().intendedParent = ((Component)__instance).transform; obj.GetComponent().Spawn(false); obj.transform.parent = ((Component)__instance).transform; } } [HarmonyPostfix] [HarmonyPatch(typeof(GrabbableObject), "Start")] public static void WhoopiePatch(GrabbableObject __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (__instance is WhoopieCushionItem) { Object.Instantiate(Poltergeist.itemTriggerObject, ((Component)__instance).transform).transform.localPosition = Vector3.zero; } } [HarmonyPostfix] [HarmonyPatch(typeof(MaskedPlayerEnemy), "Start")] public static void RegisterMasked(MaskedPlayerEnemy __instance) { if ((Object)(object)__instance.mimickingPlayer != (Object)null) { SpectatorCamController.masked.Add(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(MaskedPlayerEnemy), "OnDestroy")] public static void DeregisterMasked(MaskedPlayerEnemy __instance) { if ((Object)(object)__instance.mimickingPlayer != (Object)null) { SpectatorCamController.masked.Remove(__instance); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void LoadNetworkPrefabs() { if (!((Object)(object)Poltergeist.propInteractibleObject != (Object)null)) { Poltergeist.propInteractibleObject = Poltergeist.poltergeistAssetBundle.LoadAsset("Assets/Prefabs/PropInteractible.prefab"); Poltergeist.propInteractibleObject.AddComponent(); Poltergeist.enemyInteractibleObject = Poltergeist.poltergeistAssetBundle.LoadAsset("Assets/Prefabs/EnemyInteractible.prefab"); Poltergeist.enemyInteractibleObject.AddComponent(); Poltergeist.ghostHeadObject = Poltergeist.poltergeistAssetBundle.LoadAsset("Assets/Prefabs/ghosthead.prefab"); Poltergeist.ghostHeadObject.AddComponent(); Poltergeist.ghostHeadObject.AddComponent(); NetworkManager.Singleton.AddNetworkPrefab(Poltergeist.propInteractibleObject); NetworkManager.Singleton.AddNetworkPrefab(Poltergeist.enemyInteractibleObject); NetworkManager.Singleton.AddNetworkPrefab(Poltergeist.ghostHeadObject); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "Awake")] public static void MakeGhostHeads(PlayerControllerB __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject obj = Object.Instantiate(Poltergeist.ghostHeadObject); GhostHead component = obj.GetComponent(); obj.transform.position = __instance.playersManager.notSpawnedPosition.position; GhostHead.headMapping.Add(__instance, component); obj.GetComponent().Spawn(false); component.isHostHead = (Object)(object)((Component)__instance).gameObject == (Object)(object)__instance.playersManager.allPlayerObjects[0]; } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] public static void AssignPlayerHead(StartOfRound __instance, ulong clientId) { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { int num = __instance.ClientPlayerList[clientId]; ((Component)GhostHead.headMapping[__instance.allPlayerScripts[num]]).GetComponent().ChangeOwnership(clientId); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] public static void ClearHeadDict() { GhostHead.headMapping.Clear(); Poltergeist.DebugLog("Cleared dict after local dc"); } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] public static void HandleHeadOnDC(StartOfRound __instance, int playerObjectNumber) { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { PlayerControllerB key = __instance.allPlayerScripts[playerObjectNumber]; if (GhostHead.headMapping.ContainsKey(key)) { GhostHead ghostHead = GhostHead.headMapping[key]; Poltergeist.DebugLog("Moving head after client dc: " + ((NetworkBehaviour)ghostHead).IsOwner); ghostHead.Deactivate(); } } } } [BepInPlugin("coderCleric.Poltergeist", "Poltergeist", "1.2.12")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("com.sigurd.csync", "5.0.1")] public class Poltergeist : BaseUnityPlugin { public const string MOD_GUID = "coderCleric.Poltergeist"; public const string MOD_NAME = "Poltergeist"; public const string MOD_VERSION = "1.2.12"; public static GameObject propInteractibleObject; public static GameObject enemyInteractibleObject; public static GameObject ghostHeadObject; public static GameObject colorVolObject; public static GameObject itemTriggerObject; public static GameObject followTriggerObject; private static Poltergeist instance; public static AssetBundle poltergeistAssetBundle; public static string dllFolderPath; public static PoltergeistConfig Config { get; private set; } public static string[] pesterBlacklist { get; private set; } private void Awake() { instance = this; Config = new PoltergeistConfig(((BaseUnityPlugin)this).Config); DebugLog("Config setup done"); string text = Config.PesterBlacklist.Value.ToLower(); string[] separator = new string[2] { ", ", "," }; pesterBlacklist = text.Split(separator, StringSplitOptions.None); if (pesterBlacklist.Length == 1 && pesterBlacklist[0].Equals("")) { pesterBlacklist = new string[0]; } Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); DebugLog("Patches done"); new PoltergeistCustomInputs(); DebugLog("Input instance created"); dllFolderPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); poltergeistAssetBundle = AssetBundle.LoadFromFile(Path.Combine(dllFolderPath, "bundles", "poltergeist")); DebugLog("Bundle loaded"); GhostHead.LoadMats(poltergeistAssetBundle); colorVolObject = poltergeistAssetBundle.LoadAsset("Assets/Prefabs/ghosthead_postprocess.prefab"); itemTriggerObject = poltergeistAssetBundle.LoadAsset("Assets/Prefabs/GhostItemTrigger.prefab"); itemTriggerObject.AddComponent(); followTriggerObject = poltergeistAssetBundle.LoadAsset("Assets/Prefabs/GhostFollowTrigger.prefab"); followTriggerObject.AddComponent(); DebugLog("Important objects extracted from bundle"); AudioManager.LoadClips(); DebugLog("Audio loaded"); NetcodePatcher(); DebugLog("Netcode patcher ran"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin coderCleric.Poltergeist v1.2.12 is loaded!"); } public static bool EnemyInBlacklist(EnemyAI enemy) { if ((Config.PesterBlacklistType.Value & PoltergeistConfig.NAME_TYPE.INTERNAL) > (PoltergeistConfig.NAME_TYPE)0) { string text = ((Object)enemy.enemyType).name.ToLower().Trim(); string[] array = pesterBlacklist; foreach (string value in array) { if (text.Contains(value)) { return true; } } } if ((Config.PesterBlacklistType.Value & PoltergeistConfig.NAME_TYPE.COMMON) > (PoltergeistConfig.NAME_TYPE)0) { ScanNodeProperties componentInChildren = ((Component)enemy).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { string text2 = componentInChildren.headerText.ToLower().Trim(); string[] array = pesterBlacklist; foreach (string value2 in array) { if (text2.Contains(value2)) { return true; } } } } return false; } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } public static void DebugLog(string msg) { if (Config.ShowDebugLogs.Value) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)msg); } } public static void Log(string msg) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)msg); } public static void LogError(string msg) { ((BaseUnityPlugin)instance).Logger.LogError((object)msg); } public static void LogWarning(string msg) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)msg); } } public class PoltergeistConfig : SyncedConfig2 { public enum NAME_TYPE { INTERNAL = 1, COMMON, BOTH } public ConfigEntry DefaultToVanilla { get; private set; } public ConfigEntry LightIntensity { get; private set; } public ConfigEntry ShowDebugLogs { get; private set; } public ConfigEntry GhostVolume { get; private set; } public ConfigEntry DisableDuplicateSounds { get; private set; } public ConfigEntry UseDefaultSounds { get; private set; } public ConfigEntry PrideMode { get; private set; } public ConfigEntry CullDistance { get; private set; } [field: SyncedEntryField] public SyncedEntry MaxPower { get; private set; } [field: SyncedEntryField] public SyncedEntry PowerRegen { get; private set; } [field: SyncedEntryField] public SyncedEntry AliveForMax { get; private set; } [field: SyncedEntryField] public SyncedEntry TimeForAggro { get; private set; } [field: SyncedEntryField] public SyncedEntry HitsForAggro { get; private set; } [field: SyncedEntryField] public SyncedEntry AudioTime { get; private set; } public ConfigEntry PesterBlacklistType { get; private set; } public ConfigEntry PesterBlacklist { get; private set; } [field: SyncedEntryField] public SyncedEntry DoorCost { get; private set; } [field: SyncedEntryField] public SyncedEntry BigDoorCost { get; private set; } [field: SyncedEntryField] public SyncedEntry NoisyItemCost { get; private set; } [field: SyncedEntryField] public SyncedEntry ValveCost { get; private set; } [field: SyncedEntryField] public SyncedEntry ShipDoorCost { get; private set; } [field: SyncedEntryField] public SyncedEntry CompanyBellCost { get; private set; } [field: SyncedEntryField] public SyncedEntry PesterCost { get; private set; } [field: SyncedEntryField] public SyncedEntry ManifestCost { get; private set; } [field: SyncedEntryField] public SyncedEntry BarkCost { get; private set; } [field: SyncedEntryField] public SyncedEntry MiscCost { get; private set; } public PoltergeistConfig(ConfigFile cfg) : base("coderCleric.Poltergeist") { //IL_0017: 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_0032: Expected O, but got Unknown //IL_0032: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0070: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_009c: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00da: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0106: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0132: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_015e: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_018e: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_01cc: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_020a: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0240: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_027e: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown //IL_02b4: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_02f2: Expected O, but got Unknown //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown //IL_031e: Expected O, but got Unknown //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Expected O, but got Unknown //IL_034e: Expected O, but got Unknown //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Expected O, but got Unknown //IL_038c: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03ca: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown //IL_0408: Expected O, but got Unknown //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Expected O, but got Unknown //IL_0446: Expected O, but got Unknown //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Expected O, but got Unknown //IL_0484: Expected O, but got Unknown //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //IL_04c2: Expected O, but got Unknown //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Expected O, but got Unknown //IL_0500: Expected O, but got Unknown //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Expected O, but got Unknown //IL_053e: Expected O, but got Unknown //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Expected O, but got Unknown //IL_057c: Expected O, but got Unknown //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Expected O, but got Unknown //IL_05ba: Expected O, but got Unknown DefaultToVanilla = cfg.Bind(new ConfigDefinition("Client-Side", "DefaultToVanilla"), false, new ConfigDescription("If true, you will be placed into the default spectate mode when you die.", (AcceptableValueBase)null, Array.Empty())); LightIntensity = cfg.Bind(new ConfigDefinition("Client-Side", "LightIntensity"), 8f, new ConfigDescription("The intensity of the ghost light.\n", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); ShowDebugLogs = cfg.Bind(new ConfigDefinition("Client-Side", "ShowDebugLogs"), false, new ConfigDescription("If true, you will see debug logs.", (AcceptableValueBase)null, Array.Empty())); GhostVolume = cfg.Bind(new ConfigDefinition("Client-Side", "Ghost Volume"), 1f, new ConfigDescription("Volume of the audio ghosts make", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); DisableDuplicateSounds = cfg.Bind(new ConfigDefinition("Client-Side", "Disable Duplicate Sounds"), false, new ConfigDescription("Whether or not sound files with identical names should be loaded alongside each other.", (AcceptableValueBase)null, Array.Empty())); UseDefaultSounds = cfg.Bind(new ConfigDefinition("Client-Side", "Use Default Sounds"), true, new ConfigDescription("Whether or not the files found in Poltergeist's \"sounds\" folder should be included.", (AcceptableValueBase)null, Array.Empty())); PrideMode = cfg.Bind(new ConfigDefinition("Client-Side", "Pride mode"), false, new ConfigDescription("If true, forces the mod to give you a pride flag material on your ghost.", (AcceptableValueBase)null, Array.Empty())); CullDistance = cfg.Bind(new ConfigDefinition("Client-Side", "Cull distance"), 150f, new ConfigDescription("If a ghost is farther than this distance from a room, rendering for that room will be disabled\nIf you're having framerate issues, lowering this value may help", (AcceptableValueBase)null, Array.Empty())); MaxPower = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced", "Max power"), 100f, new ConfigDescription("The maximum amount of power that will be available to the ghosts.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); PowerRegen = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced", "Power regen"), 5f, new ConfigDescription("How much power the ghosts regenerate per second.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); AliveForMax = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced", "Alive for max power"), 1, new ConfigDescription("The maximum number of players that can be alive for the ghosts to have max power.\n(As soon as this number or fewer players are left alive, ghosts will be at max power.)", (AcceptableValueBase)(object)new AcceptableValueRange(0, int.MaxValue), Array.Empty())); TimeForAggro = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced", "Pester aggro timespan"), 3f, new ConfigDescription("How many seconds can be between pesterings for an enemy to get mad at a nearby player.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); HitsForAggro = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced", "Aggro hit requirement"), 2, new ConfigDescription("How many times an enemy has to be pestered in the timespan in order to get mad at a nearby player.", (AcceptableValueBase)(object)new AcceptableValueRange(1, int.MaxValue), Array.Empty())); AudioTime = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced", "Audio play time"), 5f, new ConfigDescription("The maximum time (in seconds) that ghost audio can play before stopping.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); PesterBlacklistType = cfg.Bind(new ConfigDefinition("Synced", "Enemy Name Type"), NAME_TYPE.BOTH, new ConfigDescription("What type of name Poltergeist should look at when blacklisting enemies. Valid values are:\nINTERNAL: The internal name used by the game (GiantKiwi). You may need to look it up/ask a mod dev for this name.\nCOMMON: The name that appears when the enemy is scanned (Giant Sapsucker). This may not work for all enemies.\nBOTH: Both of the other name types.\n", (AcceptableValueBase)null, Array.Empty())); PesterBlacklist = cfg.Bind(new ConfigDefinition("Synced", "Pester Blacklist"), "", new ConfigDescription("A comma-separated list of monster names. Monsters who's names contain values from here will not be able to be pestered.\nExample: \"Bracken,mask\" will disable pestering for the \"BRACKEN\", the \"MASKed\", and the \"MASK Hornets\".", (AcceptableValueBase)null, Array.Empty())); DoorCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Door cost"), 10f, new ConfigDescription("The power required to open/close regular doors.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); BigDoorCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Big door cost"), 50f, new ConfigDescription("The power required to open/close larger doors and mess with the mineshaft elevator.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); NoisyItemCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Noisy item cost"), 5f, new ConfigDescription("The power required to use noisy items.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); ValveCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Valve cost"), 20f, new ConfigDescription("The power required to turn valves.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); ShipDoorCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Ship door cost"), 30f, new ConfigDescription("The power required to use the ship doors.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); CompanyBellCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Company bell cost"), 15f, new ConfigDescription("The power required to ring the bell at the company building.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); PesterCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Pester cost"), 20f, new ConfigDescription("The power required to pester enemies.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); ManifestCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Manifest cost"), 60f, new ConfigDescription("The power required to manifest in the realm of the living.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); BarkCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Audio playing cost"), 40f, new ConfigDescription("The power required to play audio that the living can hear.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); MiscCost = SyncedBindingExtensions.BindSyncedEntry(cfg, new ConfigDefinition("Synced: Costs", "Misc cost"), 10f, new ConfigDescription("The power required to do any interactions not covered by another section.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, float.MaxValue), Array.Empty())); ConfigManager.Register((SyncedConfig2)this); } } public class PoltergeistCustomInputs : LcInputActions { public static PoltergeistCustomInputs instance { get; private set; } [InputAction("/leftButton", Name = "Toggle Ghost Light")] public InputAction SwitchLightButton { get; private set; } [InputAction("/scroll/up", Name = "Accelerate")] public InputAction AccelerateButton { get; private set; } [InputAction("/scroll/down", Name = "Decelerate")] public InputAction DecelerateButton { get; private set; } [InputAction("/e", Name = "Ghost Interact")] public InputAction InteractButton { get; private set; } [InputAction("/q", Name = "Toggle Spectate Mode")] public InputAction ToggleButton { get; private set; } [InputAction("/r", Name = "Up")] public InputAction UpKey { get; private set; } [InputAction("/f", Name = "Down")] public InputAction DownKey { get; private set; } [InputAction("/l", Name = "Lock Altitude")] public InputAction LockKey { get; private set; } [InputAction("/c", Name = "Manifest")] public InputAction ManifestKey { get; private set; } [InputAction("/v", Name = "Play Audio")] public InputAction BarkKey { get; private set; } [InputAction("/h", Name = "Toggle Controls")] public InputAction ToggleControlsKey { get; private set; } public PoltergeistCustomInputs() { instance = this; } public static string GetInteractString() { return GetKeyString(instance.InteractButton); } public static string GetKeyString(InputAction action) { string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(action, (DisplayStringOptions)0, (string)null); if (bindingDisplayString.Length <= 0) { return "None"; } if (!bindingDisplayString.Contains("|")) { return bindingDisplayString; } string[] array = bindingDisplayString.Split(" | "); bool flag = false; bool flag2 = false; if (array[0].Length > 0) { flag = true; } if (array[1].Length > 0) { flag2 = true; } string text = ""; if (flag) { text += array[0]; } if (flag && flag2) { text += " | "; } if (flag2) { text += array[1]; } return text; } } public class RPCTransform : NetworkBehaviour { private float posLastUpdateTime; private float rotLastUpdateTime; private float curUpdateDelay; private float updateDist = 0.1f; private Vector3 lastPos = Vector3.zero; private Vector3 lastRot = Vector3.zero; private float updateDelay; private void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner) { return; } curUpdateDelay -= Time.deltaTime; if (curUpdateDelay <= 0f) { curUpdateDelay = updateDelay; if (Vector3.Distance(lastPos, ((Component)this).transform.position) >= updateDist) { UpdatePosServerRPC(((Component)this).transform.position.x, ((Component)this).transform.position.y, ((Component)this).transform.position.z, Time.time); lastPos = ((Component)this).transform.position; } if (Vector3.Distance(lastRot, ((Component)this).transform.eulerAngles) >= updateDist) { UpdateRotServerRPC(((Component)this).transform.eulerAngles.x, ((Component)this).transform.eulerAngles.y, ((Component)this).transform.eulerAngles.z, Time.time); lastRot = ((Component)this).transform.eulerAngles; } } } [ServerRpc] private void UpdatePosServerRPC(float x, float y, float z, float time) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2162933541u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref x, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref y, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref z, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2162933541u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; UpdatePosClientRPC(x, y, z, time); } } [ClientRpc] private void UpdatePosClientRPC(float x, float y, float z, float time) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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(1733768950u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref x, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref y, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref z, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1733768950u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; UpdatePosLocally(x, y, z, time); } } } private void UpdatePosLocally(float x, float y, float z, float time) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner && !(time < posLastUpdateTime)) { ((Component)this).transform.position = new Vector3(x, y, z); posLastUpdateTime = time; } } [ServerRpc] private void UpdateRotServerRPC(float x, float y, float z, float time) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(970604896u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref x, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref y, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref z, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 970604896u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; UpdateRotClientRPC(x, y, z, time); } } [ClientRpc] private void UpdateRotClientRPC(float x, float y, float z, float time) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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(2154348699u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref x, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref y, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref z, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref time, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2154348699u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; UpdateRotLocally(x, y, z, time); } } } private void UpdateRotLocally(float x, float y, float z, float time) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner && !(time < rotLastUpdateTime)) { ((Component)this).transform.eulerAngles = new Vector3(x, y, z); rotLastUpdateTime = time; } } 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 ((NetworkBehaviour)this).__registerRpc(2162933541u, new RpcReceiveHandler(__rpc_handler_2162933541), "UpdatePosServerRPC"); ((NetworkBehaviour)this).__registerRpc(1733768950u, new RpcReceiveHandler(__rpc_handler_1733768950), "UpdatePosClientRPC"); ((NetworkBehaviour)this).__registerRpc(970604896u, new RpcReceiveHandler(__rpc_handler_970604896), "UpdateRotServerRPC"); ((NetworkBehaviour)this).__registerRpc(2154348699u, new RpcReceiveHandler(__rpc_handler_2154348699), "UpdateRotClientRPC"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2162933541(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0029: 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_0082: 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_009d: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } float x = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref x, default(ForPrimitives)); float y = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref y, default(ForPrimitives)); float z = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref z, default(ForPrimitives)); float time = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref time, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RPCTransform)(object)target).UpdatePosServerRPC(x, y, z, time); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_1733768950(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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float x = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref x, default(ForPrimitives)); float y = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref y, default(ForPrimitives)); float z = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref z, default(ForPrimitives)); float time = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref time, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RPCTransform)(object)target).UpdatePosClientRPC(x, y, z, time); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_970604896(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0029: 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_0082: 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_009d: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } float x = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref x, default(ForPrimitives)); float y = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref y, default(ForPrimitives)); float z = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref z, default(ForPrimitives)); float time = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref time, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RPCTransform)(object)target).UpdateRotServerRPC(x, y, z, time); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_2154348699(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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float x = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref x, default(ForPrimitives)); float y = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref y, default(ForPrimitives)); float z = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref z, default(ForPrimitives)); float time = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref time, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RPCTransform)(object)target).UpdateRotClientRPC(x, y, z, time); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RPCTransform"; } } public class SpectatorCamController : MonoBehaviour { public static SpectatorCamController instance = null; private Camera cam; private float camMoveSpeed = 5f; private Light[] lights = (Light[])(object)new Light[4]; private float maxPower = 100f; private float power; private Transform ghostParent; private PlayerControllerB clientPlayer; public GhostHead head; private IGhostInteractible currentGhostInteractible; private Transform hintPanelRoot; private Transform hintPanelOrigParent; private Transform deathUIRoot; private TextMeshProUGUI controlsText; private bool controlsHidden = true; private float accelTime = -1f; private float decelTime = -1f; private bool altitudeLock; public static List masked = new List(); private static RandomStream rand = null; public float Power => power; public PlayerControllerB ClientPlayer => clientPlayer; private void Awake() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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) if ((Object)(object)instance != (Object)null) { Object.Destroy((Object)(object)this); return; } instance = this; for (int i = 0; i < 4; i++) { Vector3 eulerAngles = default(Vector3); switch (i) { case 0: ((Vector3)(ref eulerAngles))..ctor(50f, 0f, 0f); break; case 1: ((Vector3)(ref eulerAngles))..ctor(120f, 0f, 0f); break; case 2: ((Vector3)(ref eulerAngles))..ctor(50f, 90f, 0f); break; case 3: ((Vector3)(ref eulerAngles))..ctor(50f, -90f, 0f); break; } GameObject val = new GameObject("GhostLight" + i); Light val2 = val.AddComponent(); HDAdditionalLightData val3 = val.AddComponent(); val.transform.eulerAngles = eulerAngles; val2.type = (LightType)1; val2.shadows = (LightShadows)0; val2.intensity = Poltergeist.Config.LightIntensity.Value; ((Object)val).hideFlags = (HideFlags)52; val3.affectsVolumetric = false; lights[i] = val2; } cam = ((Component)this).GetComponent(); Camera obj = cam; obj.cullingMask |= 0x800000; DisableCam(); } public void ParentTo(Transform parent) { ghostParent = parent; if (((Behaviour)this).enabled && !Patches.vanillaMode) { ((Component)this).transform.parent = ghostParent; } } public void EnableCam() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown if (!((Behaviour)this).enabled) { ((Behaviour)this).enabled = true; head.isActive = true; head.UpdateHeadMat(); if (!Patches.vanillaMode) { ((Component)this).transform.parent = ghostParent; Transform transform = ((Component)StartOfRound.Instance.activeCamera).transform; ((Component)this).transform.position = transform.position; ((Component)this).transform.rotation = transform.rotation; Patches.camControllerActive = true; } if ((Object)(object)hintPanelRoot == (Object)null) { hintPanelRoot = ((Component)HUDManager.Instance.tipsPanelAnimator).transform.parent; hintPanelOrigParent = hintPanelRoot.parent; deathUIRoot = ((Component)HUDManager.Instance.SpectateBoxesContainer).transform.parent; GameObject val = Object.Instantiate(((Component)HUDManager.Instance.holdButtonToEndGameEarlyText).gameObject, deathUIRoot); controlsText = val.GetComponent(); ((Object)val).name = "PoltergeistControlsText"; } hintPanelRoot.parent = deathUIRoot; power = 0f; IGhostOnlyInteractible.SetGhostActivation(active: true); UpdateControlText(); if (rand == null) { rand = new RandomStream(); } } } public void DisableCam() { if (((Behaviour)this).enabled) { ((Behaviour)this).enabled = false; Light[] array = lights; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } Patches.vanillaMode = Poltergeist.Config.DefaultToVanilla.Value; Patches.camControllerActive = false; altitudeLock = false; if ((Object)(object)head != (Object)null) { head.isActive = false; head.Deactivate(); } if ((Object)(object)hintPanelRoot != (Object)null) { hintPanelRoot.parent = hintPanelOrigParent; } IGhostOnlyInteractible.SetGhostActivation(active: false); controlsHidden = true; } } private void UpdateControlText() { if (controlsHidden) { ((TMP_Text)controlsText).text = "Show Poltergeist Controls; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.ToggleControlsKey) + "]"; return; } string text = "Hide Poltergeist Controls; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.ToggleControlsKey) + "]\n"; text = text + "Switch Spectate Mode; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.ToggleButton) + "]\n\n"; if (!Patches.vanillaMode) { text = text + "Increase Speed; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.AccelerateButton) + "]\n"; text = text + "Decrease Speed; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.DecelerateButton) + "]\n"; text = text + "Up; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.UpKey) + "]\n"; text = text + "Down; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.DownKey) + "]\n"; text = text + "Lock Altitude; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.LockKey) + "]\n\n"; text += "Teleport to players; [1-9]\n"; text = text + "Toggle Ghost Light; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.SwitchLightButton) + "]\n"; text = text + "Manifest; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.ManifestKey) + "] (Cost: " + Poltergeist.Config.ManifestCost.Value + ")\n"; text = text + "Play Audio; [" + PoltergeistCustomInputs.GetKeyString(PoltergeistCustomInputs.instance.BarkKey) + "] (Cost: " + Poltergeist.Config.BarkCost.Value + ")"; } ((TMP_Text)controlsText).text = text; } private void SwitchLight(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !Patches.vanillaMode && clientPlayer.isPlayerDead && !clientPlayer.isTypingChat && !clientPlayer.quickMenuManager.isMenuOpen) { Light[] array = lights; foreach (Light obj in array) { ((Behaviour)obj).enabled = !((Behaviour)obj).enabled; } } } public void TeleportToPlayer(PlayerControllerB player) { //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) ((object)HUDManager.Instance).GetType().GetMethod("DisplaySpectatorTip", BindingFlags.Instance | BindingFlags.NonPublic); if (player.isPlayerDead) { MaskedPlayerEnemy val = null; foreach (MaskedPlayerEnemy item in masked) { if ((Object)(object)item.mimickingPlayer == (Object)(object)player) { val = item; break; } } if ((Object)(object)val != (Object)null) { if (!((EnemyAI)val).isEnemyDead) { Transform val2 = ((Component)val).transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004"); ((Component)this).transform.position = val2.position + val2.up * 0.2f; ((Component)this).transform.eulerAngles = new Vector3(val2.eulerAngles.x, val2.eulerAngles.y, 0f); } else { ((Component)this).transform.position = ((Component)val).transform.position + Vector3.up; } } else if ((Object)(object)player.deadBody != (Object)null && !player.deadBody.deactivated) { ((Component)this).transform.position = ((Component)player.deadBody).transform.position + Vector3.up; } else { HUDManager.Instance.DisplayTip("Can't Teleport", "Specified player is dead with no body!", true, false, "LC_Tip1"); } } else if (!player.isPlayerControlled) { HUDManager.Instance.DisplayTip("Can't Teleport", "Specified player is not connected!", true, false, "LC_Tip1"); } else { ((Component)this).transform.position = ((Component)player.gameplayCamera).transform.position; ((Component)this).transform.rotation = ((Component)player.gameplayCamera).transform.rotation; clientPlayer.spectatedPlayerScript = player; clientPlayer.SetSpectatedPlayerEffects(false); } } private void DoInteract(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !Patches.vanillaMode && !clientPlayer.isTypingChat && !clientPlayer.quickMenuManager.isMenuOpen && currentGhostInteractible != null) { power -= currentGhostInteractible.Interact(((Component)clientPlayer).transform); } } private void Accelerate(CallbackContext context) { if (!Patches.vanillaMode) { accelTime = Time.time + 0.3f; decelTime = -1f; } } private void Decelerate(CallbackContext context) { if (!Patches.vanillaMode) { decelTime = Time.time + 0.3f; accelTime = -1f; } } private void SwitchModes(CallbackContext context) { if (!((CallbackContext)(ref context)).performed || clientPlayer.isTypingChat || clientPlayer.quickMenuManager.isMenuOpen) { return; } Patches.vanillaMode = !Patches.vanillaMode; if (Patches.vanillaMode) { Light[] array = lights; for (int i = 0; i < array.Length; i++) { ((Behaviour)array[i]).enabled = false; } clientPlayer.spectatedPlayerScript = null; currentGhostInteractible = null; ((TMP_Text)clientPlayer.cursorTip).text = ""; StartOfRound.Instance.SetSpectateCameraToGameOverMode(Patches.shouldGameOver, clientPlayer); Patches.camControllerActive = false; UpdateControlText(); } else { ((Component)this).transform.parent = ghostParent; Patches.camControllerActive = true; UpdateControlText(); } } private void LockAltitude(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !Patches.vanillaMode && !clientPlayer.isTypingChat && !clientPlayer.quickMenuManager.isMenuOpen) { altitudeLock = !altitudeLock; } } private void ManifestHead(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !Patches.vanillaMode && !clientPlayer.isTypingChat && !clientPlayer.quickMenuManager.isMenuOpen && power >= Poltergeist.Config.ManifestCost.Value && !head.IsManifesting()) { head.ManifestServerRpc(); power -= Poltergeist.Config.ManifestCost.Value; } } private void Bark(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !Patches.vanillaMode && !clientPlayer.isTypingChat && !clientPlayer.quickMenuManager.isMenuOpen && power >= Poltergeist.Config.BarkCost.Value && !head.IsBarking()) { head.BarkServerRpc(rand.Next()); power -= Poltergeist.Config.BarkCost.Value; } } private void ToggleControlVis(CallbackContext context) { if (((CallbackContext)(ref context)).performed && !clientPlayer.isTypingChat && !clientPlayer.quickMenuManager.isMenuOpen) { controlsHidden = !controlsHidden; UpdateControlText(); } } private void OnEnable() { PoltergeistCustomInputs.instance.SwitchLightButton.performed += SwitchLight; PoltergeistCustomInputs.instance.InteractButton.performed += DoInteract; PoltergeistCustomInputs.instance.AccelerateButton.performed += Accelerate; PoltergeistCustomInputs.instance.DecelerateButton.performed += Decelerate; PoltergeistCustomInputs.instance.ToggleButton.performed += SwitchModes; PoltergeistCustomInputs.instance.LockKey.performed += LockAltitude; PoltergeistCustomInputs.instance.ManifestKey.performed += ManifestHead; PoltergeistCustomInputs.instance.BarkKey.performed += Bark; PoltergeistCustomInputs.instance.ToggleControlsKey.performed += ToggleControlVis; } private void OnDisable() { PoltergeistCustomInputs.instance.SwitchLightButton.performed -= SwitchLight; PoltergeistCustomInputs.instance.InteractButton.performed -= DoInteract; PoltergeistCustomInputs.instance.AccelerateButton.performed -= Accelerate; PoltergeistCustomInputs.instance.DecelerateButton.performed -= Decelerate; PoltergeistCustomInputs.instance.ToggleButton.performed -= SwitchModes; PoltergeistCustomInputs.instance.LockKey.performed -= LockAltitude; PoltergeistCustomInputs.instance.ManifestKey.performed -= ManifestHead; PoltergeistCustomInputs.instance.BarkKey.performed -= Bark; PoltergeistCustomInputs.instance.ToggleControlsKey.performed -= ToggleControlVis; } private void OnDestroy() { Light[] array = lights; foreach (Light val in array) { if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } } } private void PositionControlText() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0055: 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) Transform transform = ((TMP_Text)controlsText).transform; Bounds textBounds = ((TMP_Text)HUDManager.Instance.holdButtonToEndGameEarlyVotesText).textBounds; if (((Bounds)(ref textBounds)).extents.y < 0f) { transform.position = new Vector3(transform.position.x, ((TMP_Text)HUDManager.Instance.holdButtonToEndGameEarlyVotesText).transform.position.y, transform.position.z); return; } float x = transform.localPosition.x; float y = (((Bounds)(ref textBounds)).min + ((TMP_Text)HUDManager.Instance.holdButtonToEndGameEarlyVotesText).transform.localPosition).y; Bounds bounds = ((TMP_Text)controlsText).bounds; transform.localPosition = new Vector3(x, y - (((Bounds)(ref bounds)).extents.y + 22f), transform.localPosition.z); } private void LateUpdate() { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Invalid comparison between Unknown and I4 //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Expected I4, but got Unknown //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clientPlayer == (Object)null) { clientPlayer = StartOfRound.Instance.localPlayerController; if ((Object)(object)clientPlayer == (Object)null) { return; } } float num = -1 * Poltergeist.Config.AliveForMax.Value; float num2 = 0f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerDead) { num += 1f; num2 += 1f; } else if (val.isPlayerControlled) { num += 1f; } } num2 = Mathf.Min(num2, num); if (num <= 0f) { maxPower = Poltergeist.Config.MaxPower.Value; } else { maxPower = num2 / num * Poltergeist.Config.MaxPower.Value; } power = Mathf.Min(maxPower, power + Poltergeist.Config.PowerRegen.Value * Time.deltaTime); if (clientPlayer.isTypingChat || clientPlayer.quickMenuManager.isMenuOpen || Patches.vanillaMode) { currentGhostInteractible = null; if ((Object)(object)head != (Object)null && head.isActive) { ((Component)head).transform.position = ((Component)this).transform.position; ((Component)head).transform.rotation = ((Component)this).transform.rotation; } return; } Vector2 val2 = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).ReadValue(); MovementActions movement = clientPlayer.playerActions.Movement; Vector2 val3 = ((MovementActions)(ref movement)).Look.ReadValue() * 0.008f * (float)IngamePlayerSettings.Instance.settings.lookSensitivity; if (!IngamePlayerSettings.Instance.settings.invertYAxis) { val3.y *= -1f; } bool num3 = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).ReadValue() > 0.3f; ((Component)this).transform.Rotate(0f, val3.x, 0f, (Space)0); float num4 = ((Component)this).transform.eulerAngles.x % 360f + val3.y; if (num4 < 270f && num4 > 90f) { if (270f - num4 < num4 - 90f) { ((Component)this).transform.eulerAngles = new Vector3(270f, ((Component)this).transform.eulerAngles.y, 0f); } else { ((Component)this).transform.eulerAngles = new Vector3(90f, ((Component)this).transform.eulerAngles.y, 0f); } } else { ((Component)this).transform.eulerAngles = new Vector3(num4, ((Component)this).transform.eulerAngles.y, 0f); } float num5 = camMoveSpeed; if (num3) { num5 *= 5f; } Vector3 val4 = ((Component)this).transform.right * val2.x * num5 * Time.deltaTime; Vector3 val5; if (!altitudeLock) { val5 = ((Component)this).transform.forward * val2.y * num5 * Time.deltaTime; } else { val5 = (((double)((Component)this).transform.forward.y < -0.99) ? ((Component)this).transform.up : ((!((double)((Component)this).transform.forward.y > 0.99)) ? ((Component)this).transform.forward : (((Component)this).transform.up * -1f))); val5.y = 0f; val5 = ((Vector3)(ref val5)).normalized; val5 = val5 * val2.y * num5 * Time.deltaTime; } Transform transform = ((Component)this).transform; transform.position += val4 + val5; float num6 = (PoltergeistCustomInputs.instance.UpKey.ReadValue() - PoltergeistCustomInputs.instance.DownKey.ReadValue()) * num5 * Time.deltaTime; Transform transform2 = ((Component)this).transform; transform2.position += Vector3.up * num6; if (accelTime > Time.time) { camMoveSpeed += Time.deltaTime * camMoveSpeed; camMoveSpeed = Mathf.Clamp(camMoveSpeed, 0f, 100f); } else if (decelTime > Time.time) { camMoveSpeed -= Time.deltaTime * camMoveSpeed; camMoveSpeed = Mathf.Clamp(camMoveSpeed, 0f, 100f); } ((TMP_Text)HUDManager.Instance.spectatingPlayerText).text = "Power: " + power.ToString("F0") + " / " + maxPower.ToString("F0"); int num7 = -1; for (Key val6 = (Key)41; (int)val6 <= 50; val6 = (Key)(val6 + 1)) { if (((ButtonControl)Keyboard.current[val6]).wasPressedThisFrame) { num7 = val6 - 41; break; } } if (num7 != -1) { PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; if (num7 >= allPlayerScripts2.Length) { HUDManager.Instance.DisplayTip("Cannot Teleport", "Specified player index is invalid!", true, false, "LC_Tip1"); } else { TeleportToPlayer(allPlayerScripts2[num7]); } } currentGhostInteractible = null; ((TMP_Text)clientPlayer.cursorTip).text = ""; RaycastHit val7 = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val7, 5f, 525120) && ((Component)((RaycastHit)(ref val7)).collider).gameObject.layer != 8) { IGhostInteractible component = ((Component)((RaycastHit)(ref val7)).collider).gameObject.GetComponent(); if (component == null) { foreach (Transform item in ((Component)((RaycastHit)(ref val7)).collider).transform) { component = ((Component)item).GetComponent(); if (component != null) { break; } } } if (component != null) { currentGhostInteractible = component; ((TMP_Text)clientPlayer.cursorTip).text = component.GetTipText(); } } if ((Object)(object)head != (Object)null && head.isActive) { ((Component)head).transform.position = ((Component)this).transform.position; ((Component)head).transform.rotation = ((Component)this).transform.rotation; } PositionControlText(); allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val8 in allPlayerScripts) { if ((Object)(object)val8 != (Object)(object)clientPlayer && val8.isPlayerControlled) { val8.ShowNameBillboard(); val8.usernameBillboard.LookAt(((Component)this).transform.position); } } } } } namespace Poltergeist.GhostInteractibles { public interface IGhostInteractible { float GetCost(); float Interact(Transform playerTransform); string GetTipText(); } public interface IGhostOnlyInteractible : IGhostInteractible { protected static List managedInteractibles = new List(); void SetActivation(bool activation); static void Register(IGhostOnlyInteractible interactible) { managedInteractibles.Add(interactible); } static void Unregister(IGhostOnlyInteractible interactible) { managedInteractibles.Remove(interactible); } static void SetGhostActivation(bool active) { foreach (IGhostOnlyInteractible managedInteractible in managedInteractibles) { managedInteractible.SetActivation(active); } } } public abstract class NaiveInteractible : MonoBehaviour, IGhostInteractible { public abstract float Interact(Transform playerTransform); public abstract float GetCost(); public abstract string GetTipText(); } public abstract class NetworkedInteractible : NetworkBehaviour, IGhostInteractible { protected float waitTime = 2f; protected bool wasBugged; public Transform intendedParent; public abstract float Interact(Transform playerTransform); public abstract float GetCost(); public abstract string GetTipText(); protected abstract void DoSetup(); private void Update() { if (waitTime > 0f) { waitTime -= Time.deltaTime; if (waitTime <= 0f) { DoSetup(); } } } [ServerRpc(RequireOwnership = false)] public void SendWarningServerRpc() { //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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4042915134u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4042915134u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; Poltergeist.LogWarning("A player is having an issue with interactible " + ((Object)((Component)this).gameObject).name + "!"); if ((Object)(object)intendedParent == (Object)null) { Poltergeist.LogWarning("No parent found, killing interactor!"); ((Component)this).GetComponent().Despawn(true); return; } NetworkObject component = ((Component)intendedParent).GetComponent(); if ((Object)(object)component == (Object)null || !component.IsSpawned) { Poltergeist.LogWarning("Parent has incorrect network seup, killing interactor!"); ((Component)this).GetComponent().Despawn(true); } else { ((Component)this).transform.parent = intendedParent; } } 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 ((NetworkBehaviour)this).__registerRpc(4042915134u, new RpcReceiveHandler(__rpc_handler_4042915134), "SendWarningServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4042915134(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; ((NetworkedInteractible)(object)target).SendWarningServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetworkedInteractible"; } } } namespace Poltergeist.GhostInteractibles.Specific { public enum CostType { DOOR, VALVE, SHIPDOOR, COMPANYBELL, HANGARDOOR, MISC } public class BasicInteractible : NaiveInteractible { public CostType costType = CostType.MISC; private InteractTrigger trigger; private float interactDuration = 1f; private float interactTime; public bool isHeld; private void Awake() { trigger = ((Component)this).GetComponent(); } public override float GetCost() { return costType switch { CostType.DOOR => Poltergeist.Config.DoorCost.Value, CostType.VALVE => Poltergeist.Config.ValveCost.Value, CostType.SHIPDOOR => Poltergeist.Config.ShipDoorCost.Value, CostType.COMPANYBELL => Poltergeist.Config.CompanyBellCost.Value, CostType.HANGARDOOR => Poltergeist.Config.BigDoorCost.Value, _ => Poltergeist.Config.MiscCost.Value, }; } public override float Interact(Transform playerTransform) { if (SpectatorCamController.instance.Power < GetCost()) { return 0f; } if (trigger.interactable && (!trigger.interactCooldown || trigger.currentCooldownValue <= 0f)) { if (!isHeld) { trigger.Interact(playerTransform); } else { interactTime = interactDuration; } return GetCost(); } return 0f; } public override string GetTipText() { string text = ""; if (SpectatorCamController.instance.Power < GetCost()) { return "Not Enough Power (" + GetCost().ToString("F0") + ")"; } if (!trigger.interactable) { return trigger.disabledHoverTip; } StringBuilder stringBuilder = (trigger.hoverTip.Equals("") ? new StringBuilder("Interact; [LMB]") : new StringBuilder(trigger.hoverTip)); text = stringBuilder.Replace("[LMB]", "[" + PoltergeistCustomInputs.GetInteractString() + "]").ToString(); return text + " (" + GetCost().ToString("F0") + ")"; } private void Update() { interactTime -= Time.deltaTime; if (interactTime > 0f && trigger.holdInteraction) { trigger.HoldInteractNotFilled(); } } } public class BigDoorInteractible : NaiveInteractible, IGhostOnlyInteractible, IGhostInteractible { private TerminalAccessibleObject bigDoorObj; private void Awake() { bigDoorObj = ((Component)((Component)this).transform.parent).gameObject.GetComponent(); IGhostOnlyInteractible.Register(this); } public override float GetCost() { return Poltergeist.Config.BigDoorCost.Value; } public override float Interact(Transform playerTransform) { if (SpectatorCamController.instance.Power < GetCost()) { return 0f; } if ((bool)typeof(TerminalAccessibleObject).GetField("isPoweredOn", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(bigDoorObj)) { bigDoorObj.SetDoorToggleLocalClient(); return GetCost(); } return 0f; } public override string GetTipText() { string text = ""; if (SpectatorCamController.instance.Power < GetCost()) { return "Not Enough Power (" + GetCost().ToString("F0") + ")"; } if ((bool)typeof(TerminalAccessibleObject).GetField("isPoweredOn", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(bigDoorObj)) { text = "Toggle door : [" + PoltergeistCustomInputs.GetInteractString() + "]"; return text + " (" + GetCost().ToString("F0") + ")"; } return "Door is unpowered"; } public void SetActivation(bool activation) { if (activation) { ((Component)this).gameObject.layer = LayerMask.NameToLayer("InteractableObject"); } else { ((Component)this).gameObject.layer = LayerMask.NameToLayer("Ignore Raycast"); } } private void OnDestroy() { IGhostOnlyInteractible.Unregister(this); } } public class EnemyDetector : NaiveInteractible { public EnemyInteractible enemyInteractible; public void RegisterInteractible(EnemyInteractible enemyInteractible) { this.enemyInteractible = enemyInteractible; } public override float GetCost() { return enemyInteractible.GetCost(); } public override float Interact(Transform playerTransform) { return enemyInteractible.Interact(playerTransform); } public override string GetTipText() { return enemyInteractible.GetTipText(); } } public class EnemyInteractible : NetworkedInteractible { private EnemyAI enemy; private float lastInteractTime; private int consecutiveHits; private EnemyDetector[] detectors; protected override void DoSetup() { if ((Object)(object)((Component)this).transform.parent == (Object)null) { waitTime = 2f; wasBugged = true; Poltergeist.LogWarning($"An enemy interactible is orphaned! Trying setup again in {waitTime} seconds.\nThe host log should show what type of enemy is causing this."); SendWarningServerRpc(); return; } Transform parent = ((Component)this).transform.parent; enemy = ((Component)parent).GetComponent(); EnemyAICollisionDetect[] componentsInChildren = ((Component)parent).GetComponentsInChildren(true); int num = componentsInChildren.Length; detectors = new EnemyDetector[num]; for (int i = 0; i < num; i++) { detectors[i] = ((Component)componentsInChildren[i]).gameObject.AddComponent(); detectors[i].RegisterInteractible(this); } if (wasBugged) { Poltergeist.Log("Bugged enemy " + ((Object)((Component)this).gameObject).name + " was recovered"); } } public override float GetCost() { return Poltergeist.Config.PesterCost.Value; } public override float Interact(Transform playerTransform) { if ((Object)(object)enemy == (Object)null) { return 0f; } if (SpectatorCamController.instance.Power < GetCost()) { return 0f; } if ((Object)(object)enemy == (Object)null || enemy.isEnemyDead) { return 0f; } if (lastInteractTime + Poltergeist.Config.TimeForAggro.Value < Time.time) { consecutiveHits = 1; } else { consecutiveHits++; } if (consecutiveHits < Poltergeist.Config.HitsForAggro.Value) { InteractServerRpc(-1); } else { Poltergeist.DebugLog("Pestered " + ((Object)((Component)enemy).gameObject).name + " into targeting a player"); PlayerControllerB closestPlayer = enemy.GetClosestPlayer(true, true, true); if ((Object)(object)closestPlayer != (Object)null) { InteractServerRpc((int)closestPlayer.playerClientId); } else { InteractServerRpc(-1); } } lastInteractTime = Time.time; return GetCost(); } public void InteractLocallyOnly(PlayerControllerB accusedPlayer) { if (!((Object)(object)enemy == (Object)null)) { Poltergeist.DebugLog("Interacting locally with " + ((Object)((Component)enemy).gameObject).name); enemy.HitEnemy(0, accusedPlayer, true, -1); } } public override string GetTipText() { if ((Object)(object)enemy == (Object)null) { return "Enemy is not synced!"; } if ((Object)(object)enemy == (Object)null || enemy.isEnemyDead) { return "Enemy is dead"; } if (SpectatorCamController.instance.Power < GetCost()) { return "Not Enough Power (" + GetCost().ToString("F0") + ")"; } return string.Concat("Pester enemy : [" + PoltergeistCustomInputs.GetInteractString() + "]", " (", GetCost().ToString("F0"), ")"); } [ClientRpc] public void InteractClientRpc(int accussedID) { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(26984558u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, accussedID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 26984558u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (accussedID == -1) { InteractLocallyOnly(null); } else { InteractLocallyOnly(StartOfRound.Instance.allPlayerScripts[accussedID]); } } } [ServerRpc(RequireOwnership = false)] public void InteractServerRpc(int accussedID) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2342660931u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, accussedID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2342660931u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; InteractClientRpc(accussedID); } } } protected override void __initializeVariables() { base.__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 ((NetworkBehaviour)this).__registerRpc(26984558u, new RpcReceiveHandler(__rpc_handler_26984558), "InteractClientRpc"); ((NetworkBehaviour)this).__registerRpc(2342660931u, new RpcReceiveHandler(__rpc_handler_2342660931), "InteractServerRpc"); base.__initializeRpcs(); } private static void __rpc_handler_26984558(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 accussedID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref accussedID); target.__rpc_exec_stage = (__RpcExecStage)1; ((EnemyInteractible)(object)target).InteractClientRpc(accussedID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2342660931(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 accussedID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref accussedID); target.__rpc_exec_stage = (__RpcExecStage)1; ((EnemyInteractible)(object)target).InteractServerRpc(accussedID); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EnemyInteractible"; } } public class PropInteractible : NetworkedInteractible { private GrabbableObject prop; protected override void DoSetup() { if ((Object)(object)((Component)this).transform.parent == (Object)null) { waitTime = 2f; wasBugged = true; Poltergeist.LogWarning($"A prop interactible is orphaned! Trying setup again in {waitTime} seconds.\nThe host log should show exactly what type of prop is causing this."); SendWarningServerRpc(); } else { prop = ((Component)((Component)this).transform.parent).GetComponent(); if (wasBugged) { Poltergeist.Log("Bugged prop " + ((Object)((Component)this).gameObject).name + " was recovered"); } } } public override float GetCost() { return Poltergeist.Config.NoisyItemCost.Value; } public override float Interact(Transform playerTransform) { if ((Object)(object)prop == (Object)null) { return 0f; } if (SpectatorCamController.instance.Power < GetCost()) { return 0f; } if (prop.RequireCooldown() || !prop.UseItemBatteries(!prop.itemProperties.holdButtonUse, true)) { return 0f; } Patches.ignoreObj = prop; if (prop.itemProperties.syncUseFunction) { InteractServerRpc((int)SpectatorCamController.instance.ClientPlayer.playerClientId, prop.isBeingUsed); } InteractLocallyOnly(); return GetCost(); } public void InteractLocallyOnly() { if (!((Object)(object)prop == (Object)null)) { Poltergeist.DebugLog("Interacting locally with " + ((Object)((Component)prop).gameObject).name); prop.ItemActivate(prop.isBeingUsed, true); } } public override string GetTipText() { if ((Object)(object)prop == (Object)null) { return "Prop not synced correctly!"; } if (SpectatorCamController.instance.Power < GetCost()) { return "Not Enough Power (" + GetCost().ToString("F0") + ")"; } return string.Concat("Use item : [" + PoltergeistCustomInputs.GetInteractString() + "]", " (", GetCost().ToString("F0"), ")"); } [ClientRpc] public void InteractClientRpc(int playerID, bool isBeingUsed) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2503838551u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isBeingUsed, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2503838551u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)prop == (Object)null) && (!((Object)(object)SpectatorCamController.instance.ClientPlayer != (Object)null) || playerID != (int)SpectatorCamController.instance.ClientPlayer.playerClientId)) { prop.isBeingUsed = isBeingUsed; InteractLocallyOnly(); } } } [ServerRpc(RequireOwnership = false)] public void InteractServerRpc(int playerID, bool isBeingUsed) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1197697737u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isBeingUsed, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1197697737u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; InteractClientRpc(playerID, isBeingUsed); } } } protected override void __initializeVariables() { base.__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 ((NetworkBehaviour)this).__registerRpc(2503838551u, new RpcReceiveHandler(__rpc_handler_2503838551), "InteractClientRpc"); ((NetworkBehaviour)this).__registerRpc(1197697737u, new RpcReceiveHandler(__rpc_handler_1197697737), "InteractServerRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2503838551(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); bool isBeingUsed = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isBeingUsed, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PropInteractible)(object)target).InteractClientRpc(playerID, isBeingUsed); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1197697737(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); bool isBeingUsed = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isBeingUsed, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PropInteractible)(object)target).InteractServerRpc(playerID, isBeingUsed); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PropInteractible"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Poltergeist.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }