using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using LethalLevelLoader.AssetBundles; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering.HighDefinition; using Welcome_To_Ooblterra.Enemies; using Welcome_To_Ooblterra.Enemies.EnemyThings; using Welcome_To_Ooblterra.Items; using Welcome_To_Ooblterra.NetcodePatcher; using Welcome_To_Ooblterra.Patches; using Welcome_To_Ooblterra.Properties; using Welcome_To_Ooblterra.RoomBehaviors; using Welcome_To_Ooblterra.Things; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Welcome_To_Ooblterra")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyInformationalVersion("3.0.0+e1384e274236bd06f1a4a6538a6f01dc86a52cf6")] [assembly: AssemblyProduct("Welcome_To_Ooblterra")] [assembly: AssemblyTitle("Welcome_To_Ooblterra")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Welcome_To_Ooblterra { internal class WTONetworkHandler : NetworkBehaviour { public static WTONetworkHandler Instance { get; private set; } public static event Action LevelEvent; public override void OnNetworkSpawn() { WTONetworkHandler.LevelEvent = null; if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { WTONetworkHandler instance = Instance; if (instance != null) { ((Component)instance).gameObject.GetComponent().Despawn(true); } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ClientRpc] public void EventClientRpc(string eventName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1907558404u, val, (RpcDelivery)0); bool flag = eventName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1907558404u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; WTONetworkHandler.LevelEvent?.Invoke(eventName); } } 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(1907558404u, new RpcReceiveHandler(__rpc_handler_1907558404), "EventClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1907558404(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string eventName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((WTONetworkHandler)(object)target).EventClientRpc(eventName); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WTONetworkHandler"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Welcome_To_Ooblterra"; public const string PLUGIN_NAME = "Welcome_To_Ooblterra"; public const string PLUGIN_VERSION = "3.0.0"; } } namespace Welcome_To_Ooblterra.Security { internal class SpikeTrap : NetworkBehaviour { [CompilerGenerated] private sealed class d__21 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SpikeTrap <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.TimeElapsed += Time.deltaTime; Log.Debug($"Current Lerp Position: {<>4__this.TimeElapsed / 0.2f}"); <>4__this.SpikeMesh.transform.localPosition = Vector3.Lerp(<>4__this.SpikeRaisePos, <>4__this.SpikeFallPos, <>4__this.TimeElapsed / 0.2f); if (<>4__this.TimeElapsed / 0.2f >= 1f) { <>4__this.AllowDamagePlayer = false; Log.Info("Finished Lowering Spikes"); ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.LowerSpikes()); <>4__this.SecondsSinceSpikesActivated = 0f; ((Renderer)<>4__this.SpikeMesh.GetComponent()).enabled = false; } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__20 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SpikeTrap <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0055: 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_0076: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.TimeElapsed += Time.deltaTime; <>4__this.SpikeMesh.transform.localPosition = Vector3.Lerp(<>4__this.SpikeFallPos, <>4__this.SpikeRaisePos, <>4__this.TimeElapsed / 0.2f); if (<>4__this.TimeElapsed / 0.2f >= 1f) { <>4__this.AllowDamagePlayer = true; Log.Info("Finished Raising Spikes"); ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.RaiseSpikes()); } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public GameObject SpikeMesh; public AudioClip SpikesExtend; public AudioClip SpikesRetract; public AudioClip SpikesDisable; public AudioSource SpikeSoundPlayer; public Transform RootRotation; private bool SpikesEnabled = true; private bool SpikesActivated; private bool AllowDamagePlayer; private float SecondsSinceSpikesActivated; private float SecondsUntilCanDamagePlayer; private int PlayerDamageAmount = 80; private float TimeElapsed; private const float MoveTime = 0.2f; private readonly Vector3 SpikeRaisePos = new Vector3(0f, 1.163f, 0f); private readonly Vector3 SpikeFallPos = new Vector3(0f, 0f, 0f); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(SpikeTrap), LogSourceType.Room); public void OnTriggerEnter(Collider other) { if (SpikesEnabled && !SpikesActivated && ((Component)other).gameObject.CompareTag("Player")) { Log.Debug("Player entered spike trap, calling Raise RPC!"); RaiseSpikesServerRpc(); } } public void OnTriggerStay(Collider other) { //IL_005f: 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) if (AllowDamagePlayer && ((Component)other).gameObject.CompareTag("Player") && SecondsUntilCanDamagePlayer <= 0f) { PlayerDamageAmount = ((StartOfRound.Instance.connectedPlayersAmount <= 0) ? 80 : 100); ((Component)other).GetComponent().DamagePlayer(PlayerDamageAmount, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); SecondsUntilCanDamagePlayer = 0.75f; } } public void Update() { if (SecondsUntilCanDamagePlayer > 0f) { SecondsUntilCanDamagePlayer -= Time.deltaTime; } if (SecondsSinceSpikesActivated >= 3f) { if (SpikesActivated) { SpikeSoundPlayer.clip = SpikesRetract; SpikeSoundPlayer.Play(); TimeElapsed = 0f; } SpikesActivated = false; Log.Info("Lowering Spikes!"); ((MonoBehaviour)this).StartCoroutine(LowerSpikes()); } if (SpikesEnabled && SpikesActivated) { Log.Info("Raising Spikes!"); ((MonoBehaviour)this).StartCoroutine(RaiseSpikes()); SecondsSinceSpikesActivated += Time.deltaTime; } } [IteratorStateMachine(typeof(d__20))] private IEnumerator RaiseSpikes() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__21))] private IEnumerator LowerSpikes() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__21(0) { <>4__this = this }; } public void RecieveToggleSpikes(bool enabled) { Log.Debug($"Called toggle spikes with state: {enabled}"); ToggleSpikesServerRpc(enabled); ToggleSpikes(enabled); } [ServerRpc(RequireOwnership = false)] public void ToggleSpikesServerRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1273677579u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1273677579u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug($"Toggling spikes to {enabled} serverRpc"); ToggleSpikesClientRpc(enabled); } } } [ClientRpc] public void ToggleSpikesClientRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1768198554u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1768198554u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug($"Toggling spikes to {enabled} clientRpc"); if (SpikesEnabled != enabled) { ToggleSpikes(enabled); } } } private void ToggleSpikes(bool enabled) { if (!enabled) { SpikeSoundPlayer.clip = SpikesDisable; SpikeSoundPlayer.Play(); } SpikesEnabled = enabled; Log.Debug($"SPIKES STATE: {SpikesEnabled}"); if (SpikesActivated) { SecondsSinceSpikesActivated = 5f; } } [ServerRpc(RequireOwnership = false)] public void RaiseSpikesServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2638217131u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2638217131u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; RaiseSpikesClientRpc(); } } } [ClientRpc] public void RaiseSpikesClientRpc() { //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(3449189664u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3449189664u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TimeElapsed = 0f; SpikeSoundPlayer.clip = SpikesExtend; SpikeSoundPlayer.Play(); ((Renderer)SpikeMesh.GetComponent()).enabled = true; SpikesActivated = true; } } } 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(1273677579u, new RpcReceiveHandler(__rpc_handler_1273677579), "ToggleSpikesServerRpc"); ((NetworkBehaviour)this).__registerRpc(1768198554u, new RpcReceiveHandler(__rpc_handler_1768198554), "ToggleSpikesClientRpc"); ((NetworkBehaviour)this).__registerRpc(2638217131u, new RpcReceiveHandler(__rpc_handler_2638217131), "RaiseSpikesServerRpc"); ((NetworkBehaviour)this).__registerRpc(3449189664u, new RpcReceiveHandler(__rpc_handler_3449189664), "RaiseSpikesClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1273677579(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SpikeTrap)(object)target).ToggleSpikesServerRpc(enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1768198554(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SpikeTrap)(object)target).ToggleSpikesClientRpc(enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2638217131(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; ((SpikeTrap)(object)target).RaiseSpikesServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3449189664(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; ((SpikeTrap)(object)target).RaiseSpikesClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SpikeTrap"; } } } namespace Welcome_To_Ooblterra.RoomBehaviors { public class FrankensteinVisuals : MonoBehaviour { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FrankensteinVisuals <>4__this; private ParticleSystem[] <>s__1; private int <>s__2; private ParticleSystem 5__3; private LightComponent[] <>s__4; private int <>s__5; private LightComponent 5__6; private ParticleSystem[] <>s__7; private int <>s__8; private ParticleSystem 5__9; private LightComponent[] <>s__10; private int <>s__11; private LightComponent 5__12; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; 5__3 = null; <>s__4 = null; 5__6 = null; <>s__7 = null; 5__9 = null; <>s__10 = null; 5__12 = null; <>1__state = -2; } private bool MoveNext() { //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!<>4__this.AnimStarted) { <>4__this.ReviveSoundPlayer.clip = <>4__this.ReviveSound; <>4__this.ReviveSoundPlayer.Play(); <>4__this.CoilAnim.SetTrigger("HeatCoils"); <>s__1 = <>4__this.LightningParticles; for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++) { 5__3 = <>s__1[<>s__2]; 5__3.Play(); 5__3 = null; } <>s__1 = null; <>4__this.AnimStarted = true; } if (!<>4__this.AnimStopped) { <>s__4 = <>4__this.Lights; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { 5__6 = <>s__4[<>s__5]; 5__6.SetLightBrightness((<>4__this.MyRandom.Next(0, 10) % 2 == 0) ? 200 : 0); 5__6 = null; } <>s__4 = null; } <>2__current = (object)new WaitForSeconds(3.4f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!<>4__this.AnimStopped) { <>s__7 = <>4__this.LightningParticles; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { 5__9 = <>s__7[<>s__8]; 5__9.Stop(); 5__9 = null; } <>s__7 = null; <>s__10 = <>4__this.Lights; for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++) { 5__12 = <>s__10[<>s__11]; 5__12.SetLightBrightness(0); 5__12 = null; } <>s__10 = null; <>4__this.AnimStopped = true; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [InspectorName("SceneAnim")] public AudioClip ReviveSound; public AudioSource ReviveSoundPlayer; public Animator CoilAnim; public ParticleSystem[] LightningParticles; public LightComponent[] Lights; private bool ShouldAnimate; private bool AnimStarted; private bool AnimStopped; private Random MyRandom; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FrankensteinVisuals), LogSourceType.Room); private void Start() { MyRandom = new Random(StartOfRound.Instance.randomMapSeed); } private void Update() { if (ShouldAnimate) { ((MonoBehaviour)this).StartCoroutine(VisualsHandler()); } } public void StartVisuals() { Log.Debug("Visuals script starting coroutine ..."); ShouldAnimate = true; } [IteratorStateMachine(typeof(d__13))] private IEnumerator VisualsHandler() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this }; } } } namespace Welcome_To_Ooblterra.Properties { [HideInInspector] public enum SuitStatus { Enable, Purchase, Disable, SleepsSpecial } public enum PosterStatus { ReplaceVanilla, AddAsDecor, Disable } public enum FootstepEnum { Enable, Quiet, Disable } public enum TiedToLabEnum { WTOOnly, AppendWTO, UseMoonDefault } public enum LogType { Debug, Info, Warning, Error } public enum LogSourceType { Generic, Enemy, Item, Thing, Room } public enum StartupType { Normal, ContourMapRender } [BepInPlugin("SkullCrusher.WTO", "Welcome To Ooblterra", "2.0.0")] public class WTOBase : BaseUnityPlugin { public class WTOLogger { public readonly Type Type; public readonly LogSourceType SourceType; public WTOLogger(Type Type, LogSourceType SourceType = LogSourceType.Generic) { this.Type = Type; this.SourceType = SourceType; base..ctor(); } public void Debug(string text, bool AddFlair = true, bool ForcePrint = false) { LogToConsole(Type, SourceType, LogType.Debug, text, AddFlair, ForcePrint); } public void Info(string text, bool AddFlair = true, bool ForcePrint = false) { LogToConsole(Type, SourceType, LogType.Info, text, AddFlair, ForcePrint); } public void Warning(string text, bool AddFlair = true, bool ForcePrint = false) { LogToConsole(Type, SourceType, LogType.Warning, text, AddFlair, ForcePrint); } public void Error(string text, bool AddFlair = true, bool ForcePrint = false) { LogToConsole(Type, SourceType, LogType.Error, text, AddFlair, ForcePrint); } } private class AssetBundleLoadException : Exception { public AssetBundleLoadException(string message) : base(message) { } } private const string modGUID = "SkullCrusher.WTO"; private const string modName = "Welcome To Ooblterra"; private const string modVersion = "2.0.0"; private readonly Harmony WTOHarmony = new Harmony("SkullCrusher.WTO"); public static ManualLogSource WTOLogSource; public static WTOBase Instance; private static AssetBundle ContentAssetBundle; private static readonly string[] RootPaths = new string[4] { "Assets/Resources/WelcomeToOoblterra/", "Assets/WelcomeToOoblterra/", "WelcomeToOoblterra/", "" }; private static string resolvedRootPath = ""; public static ConfigEntry WTODebug; public static ConfigEntry WTOCustomSuits; public static ConfigEntry WTOCustomPoster; public static ConfigEntry WTOScalePrice; public static ConfigEntry WTOHazardList; public static ConfigEntry WTOHazardMoonList; public static ConfigEntry WTOFootsteps; public static ConfigEntry WTOMusic; public static ConfigEntry WTOForceHazards; public static ConfigEntry WTOForceInsideMonsters; public static ConfigEntry WTOForceOutsideMonsters; public static ConfigEntry WTOForceDaytimeMonsters; public static ConfigEntry WTOForceScrap; public static ConfigEntry WTOForceOutsideOnly; public static ConfigEntry WTOWeightScale; public static ConfigEntry WTOLogging_Debug; public static ConfigEntry WTOLogging_Info; public static ConfigEntry WTOLogging_Warning; public static ConfigEntry WTOLogging_Error; public static ConfigEntry WTOLogging_Filter; public static ConfigEntry WTOTestRoom; public static ConfigEntry WTOStartupType; public static ConfigEntry WTOAutoRoute; public static ConfigEntry WTOContourMapWritePath; private static readonly WTOLogger Log = new WTOLogger(typeof(WTOBase)); private void Awake() { WTODebug = ((BaseUnityPlugin)this).Config.Bind("1. Debugging", "Print Debug Strings", false, "Whether or not to write WTO's debug print-strings to the log."); WTOLogging_Debug = ((BaseUnityPlugin)this).Config.Bind("1. Debugging", "Log Level Debug Messages", false, "Whether or not to write debug messages to the log. These are the lowest, most spammy logs."); WTOLogging_Info = ((BaseUnityPlugin)this).Config.Bind("1. Debugging", "Log Level Info Messages", true, "Whether or not to write info messages to the log. General info logs that shouldn't be printed too often."); WTOLogging_Warning = ((BaseUnityPlugin)this).Config.Bind("1. Debugging", "Log Level Warning Messages", true, "Whether or not to write warning messages to the log. Warnings that are potentially errors or misconfigurations."); WTOLogging_Error = ((BaseUnityPlugin)this).Config.Bind("1. Debugging", "Log Level Error Messages", true, "Whether or not to write error messages to the log. Errors that represent genuine problems that should not be happening."); WTOLogging_Filter = ((BaseUnityPlugin)this).Config.Bind("1. Debugging", "Log Filter", "WTO", "The filter to apply to the log. Only messages that match this RegEx filter will be printed. If empty, all messages will be printed. This is applied to the final log string, including class name."); WTOFootsteps = ((BaseUnityPlugin)this).Config.Bind("2. Accessibility", "Footstep Sounds", 100, "Adjust the volume of 523 Ooblterra's custom footstep sound. Binds between 0 and 100."); WTOMusic = ((BaseUnityPlugin)this).Config.Bind("2. Accessibility", "Music Volume", 100, "Adjust the volume of 523-Ooblterra's custom Time-Of-Day music. Binds between 0 and 100."); WTOCustomSuits = ((BaseUnityPlugin)this).Config.Bind("3. Ship Stuff", "Custom Suit Status", true, "Whether or not to add WTO's custom suits."); WTOCustomPoster = ((BaseUnityPlugin)this).Config.Bind("3. Ship Stuff", "Visit Ooblterra Poster Status", true, "Whether or not to add WTO's custom poster."); WTOHazardList = ((BaseUnityPlugin)this).Config.Bind("4. Map Hazards", "Custom Hazard List", "SpikeTrap, TeslaCoil, BabyLurkerEgg, BearTrap", "A list of all of WTO's custom hazards to enable. Affects 523-Ooblterra, and also has influence on the settings below."); WTOForceHazards = ((BaseUnityPlugin)this).Config.Bind("5. Modpack Controls", "Bind WTO Hazards to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with its own hazards, regardless of moon. See the wiki on Thunderstore for more information."); WTOForceInsideMonsters = ((BaseUnityPlugin)this).Config.Bind("5. Modpack Controls", "Bind WTO Inside Enemies to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with its own inside enemies, regardless of moon. See the wiki on Thunderstore for more information."); WTOForceOutsideMonsters = ((BaseUnityPlugin)this).Config.Bind("5. Modpack Controls", "Bind WTO Outside Enemies to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with 523 Ooblterra's outside enemies, regardless of moon. See the wiki on Thunderstore for more information."); WTOForceDaytimeMonsters = ((BaseUnityPlugin)this).Config.Bind("5. Modpack Controls", "Bind WTO Daytime Enemies to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with 523 Ooblterra's daytime enemies, regardless of moon. See the wiki on Thunderstore for more information."); WTOForceScrap = ((BaseUnityPlugin)this).Config.Bind("5. Modpack Controls", "Bind WTO Scrap to Oobl Lab", TiedToLabEnum.WTOOnly, "Whether the Oobl Lab should always spawn with its own scrap, regardless of moon. See the wiki on Thunderstore for more information."); WTOWeightScale = ((BaseUnityPlugin)this).Config.Bind("5. Modpack Controls", "WTOAppend Weight Scale", 1, "For any setting configured to WTOAppend above, this setting multiplies that thing's weight before appending it to list."); WTOTestRoom = ((BaseUnityPlugin)this).Config.Bind("6. Testing", "Enable Test Room Teleporter", false, "Whether or not to enable the test room teleporter in Ooblterra. This spawns a teleporter outside of the ship and spawns the test room."); WTOStartupType = ((BaseUnityPlugin)this).Config.Bind("6. Testing", "Startup Type", StartupType.Normal, "The type of startup to use for the game. Leave this set to Normal. The other modes are for internal use only (e.g. for automated tools)"); WTOAutoRoute = ((BaseUnityPlugin)this).Config.Bind("6. Testing", "Auto Route", false, "When true, automatically routes to Ooblterra on game start."); WTOContourMapWritePath = ((BaseUnityPlugin)this).Config.Bind("7. Contour Map Render", "Contour Map Write Path", "contourmap.exr", "The file path to write the contour map file to when Startup Type is set to ContourMapRender"); if (Instance == null) { Instance = this; } WTOLogSource = Logger.CreateLogSource("SkullCrusher.WTO"); FixLLLLoadingFreeze(); try { LoadWelcomeToOoblterra(); } catch (Exception ex) { Log.Error("Failed to load Welcome To Ooblterra. If you have the time, please report this error on our GitHub repository https://github.com/Skeleton-Studios/Welcome_To_Ooblterra/issues : " + ex.Message); } } private void FixLLLLoadingFreeze() { //IL_01c9: Unknown result type (might be due to invalid IL or missing references) Assembly assembly = Assembly.GetAssembly(typeof(AssetBundleLoader)); Type type = assembly.GetType("LethalLevelLoader.AssetBundles.AssetBundleLoader"); if (type == null) { Log.Warning("Could not find LethalLevelLoader.AssetBundles.AssetBundleLoader type"); return; } PropertyInfo property = type.GetProperty("AllowLoading", BindingFlags.Static | BindingFlags.NonPublic); if (property == null) { Log.Warning("Could not find AllowLoading field in AssetBundleLoader"); return; } if ((bool)property.GetValue(null)) { Log.Info("AllowLoading is already true, so AssetBundleLoader is not in a stuck state. No need to apply fix."); return; } PropertyInfo property2 = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); if (property2 == null) { Log.Warning("Could not find Instance field in AssetBundleLoader"); return; } object value = property2.GetValue(null); FieldInfo field = type.GetField("AssetBundleInfos", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { Log.Warning("Could not find AssetBundleInfos field in AssetBundleLoader"); return; } List list = (List)field.GetValue(value); if (list.Count == 0) { Log.Info("AssetBundleInfos list is empty, so AssetBundleLoader is not in a stuck state. No need to apply fix."); return; } FieldInfo field2 = type.GetField("knownSceneBundles", BindingFlags.Static | BindingFlags.NonPublic); if (field2 == null) { Log.Warning("Could not find knownSceneBundles field in AssetBundleLoader"); return; } Dictionary dictionary = (Dictionary)field2.GetValue(null); bool flag = true; foreach (AssetBundleInfo item in list) { if (!dictionary.TryGetValue(item.AssetBundleFileName, out var value2)) { flag = false; break; } if (value2.timestamp != File.GetLastWriteTime(item.AssetBundleFilePath).Ticks) { flag = false; break; } } if (!flag) { Log.Info("Not all scene bundles are known and skipped, so AssetBundleLoader is not in a stuck state. No need to apply fix."); return; } FieldInfo field3 = typeof(AssetBundleInfo).GetField("hasInitialized", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 == null) { Log.Warning("Could not find hasInitialized field in AssetBundleInfo"); return; } FieldInfo field4 = typeof(AssetBundleInfo).GetField("activeLoadRequest", BindingFlags.Instance | BindingFlags.NonPublic); if (field4 == null) { Log.Warning("Could not find activeLoadRequest field in AssetBundleInfo"); return; } foreach (AssetBundleInfo item2 in list) { bool flag2 = (bool)field3.GetValue(item2); object value3 = field4.GetValue(item2); if (!flag2 || value3 != null) { return; } } FieldInfo field5 = type.GetField("requestedBundleCount", BindingFlags.Static | BindingFlags.NonPublic); if (field5 == null) { Log.Warning("Could not find requestedBundleCount field in AssetBundleLoader"); return; } FieldInfo field6 = type.GetField("processedBundleCount", BindingFlags.Static | BindingFlags.NonPublic); if (field6 == null) { Log.Warning("Could not find processedBundleCount field in AssetBundleLoader"); return; } Log.Info("AssetBundleLoader appears to be in a stuck state where all bundles are being skipped due to being known, but they have not been marked as initialized. Attempting to fix by loading bundles directly."); field5.SetValue(value, list.Count); field6.SetValue(value, 0); foreach (AssetBundleInfo item3 in list) { item3.TryLoadBundle(); } } private void LoadWelcomeToOoblterra() { Log.Info("Loading - Start!"); WTOHarmony.PatchAll(typeof(WTOBase)); WTOHarmony.PatchAll(typeof(FactoryPatch)); WTOHarmony.PatchAll(typeof(ItemPatch)); WTOHarmony.PatchAll(typeof(MonsterPatch)); WTOHarmony.PatchAll(typeof(MoonPatch)); WTOHarmony.PatchAll(typeof(SuitPatch)); WTOHarmony.PatchAll(typeof(TerminalPatch)); Log.Info("Harmony Patches applied! Loading asset bundle..."); LoadAssetBundle(); Log.Info("Asset bundle loaded! Reading assets and registering objects..."); MoonPatch.Start(); FactoryPatch.Start(); ItemPatch.Start(); MonsterPatch.Start(); Log.Info("Assets read successfully! Applying netcode runtime init..."); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } Log.Info("Runtime init applied! Welcome To Ooblterra successfully loaded"); } private void LoadAssetBundle() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "content"); if (!File.Exists(text)) { throw new FileNotFoundException("Asset bundle not found at path: " + text); } ContentAssetBundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)ContentAssetBundle)) { throw new AssetBundleLoadException("Failed to load asset bundle from path: " + text); } } private static string ResolveRootPath(string pathToAsset) { string[] rootPaths = RootPaths; foreach (string text in rootPaths) { string text2 = Path.Join((ReadOnlySpan)text, (ReadOnlySpan)pathToAsset).ToLower(); if (ContentAssetBundle.Contains(text2)) { Log.Info("Resolved asset bundle root path: " + text); return text; } } string[] allAssetNames = ContentAssetBundle.GetAllAssetNames(); foreach (string text3 in allAssetNames) { string text4 = text3.ToLower(); if (text4.EndsWith(pathToAsset.ToLower())) { string text5 = text3; int length = pathToAsset.Length; return text5.Substring(0, text5.Length - length); } } Log.Error("Could not resolve asset bundle root path using target " + pathToAsset + ". This will most likely cause asset loading to fail."); return ""; } public static T ContextualLoadAsset(string PathToAsset, bool LogLoading = true) where T : Object { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)Application.platform == 7) { string text = PathToAsset.Substring(17); text = text.Substring(0, text.LastIndexOf(".")); if (LogLoading) { Log.Info("Loading " + text + " from resources folder...", AddFlair: true, ForcePrint: true); } return Resources.Load(text); } if (LogLoading) { Log.Info("Loading " + PathToAsset + "...", AddFlair: true, ForcePrint: true); } if (!Object.op_Implicit((Object)(object)ContentAssetBundle)) { throw new AssetBundleLoadException("Cannot load " + PathToAsset + " because ContentAssetBundle is not loaded yet."); } if (resolvedRootPath == "") { resolvedRootPath = ResolveRootPath(PathToAsset); } PathToAsset = Path.Join((ReadOnlySpan)resolvedRootPath, (ReadOnlySpan)PathToAsset); return ContentAssetBundle.LoadAsset(PathToAsset) ?? throw new AssetBundleLoadException("Failed to load asset at path " + PathToAsset + ". Asset was null after loading."); } private static void LogToConsole(Type LogClassType, LogSourceType SourceType, LogType logType, string text, bool AddFlair = true, bool ForcePrint = false) { if (!ForcePrint) { if (1 == 0) { } bool flag = logType switch { LogType.Debug => WTOLogging_Debug.Value, LogType.Info => WTOLogging_Info.Value, LogType.Warning => WTOLogging_Warning.Value, LogType.Error => WTOLogging_Error.Value, _ => true, }; if (1 == 0) { } bool flag2 = flag; if (!WTODebug.Value || !flag2) { return; } } text = "[" + LogClassType.Name + "]: " + text; if (AddFlair) { text = "=======" + text + "======="; } switch (logType) { case LogType.Debug: WTOLogSource.LogDebug((object)text); break; case LogType.Info: WTOLogSource.LogInfo((object)text); break; case LogType.Warning: WTOLogSource.LogWarning((object)text); break; case LogType.Error: WTOLogSource.LogError((object)text); break; default: WTOLogSource.LogMessage((object)text); break; } } public static List CSVSeperatedStringList(string InputString) { return new List(InputString.Replace(" ", "").ToLower().Split(',')); } public static ClientRpcSendParams AllClientsButSender(ServerRpcParams rpcParams) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_004d: Unknown result type (might be due to invalid IL or missing references) ClientRpcSendParams result = default(ClientRpcSendParams); List list = new List(); list.AddRange(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong id) => id != rpcParams.Receive.SenderClientId)); result.TargetClientIds = new <>z__ReadOnlyList(list); return result; } private static void PrintReferences(IEnumerable objects) { foreach (Object @object in objects) { PrintReference(@object); } static string HierarchyString(GameObject x) { string text = ((Object)x).name; while ((Object)(object)x.transform.parent != (Object)null) { x = ((Component)x.transform.parent).gameObject; text = ((Object)x).name + "/" + text; } return text; } static void PrintReference(Object o) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown if (!(o == (Object)null)) { if (o is GameObject) { GameObject val = (GameObject)o; Component[] components = val.GetComponents(typeof(Component)); foreach (Component o2 in components) { PrintReference((Object)(object)o2); } for (int j = 0; j < val.transform.childCount; j++) { PrintReference((Object)(object)((Component)val.transform.GetChild(j)).gameObject); } } else if (o is MeshFilter) { MeshFilter val2 = (MeshFilter)o; if (!((Object)(object)val2.sharedMesh == (Object)null)) { string text2 = HierarchyString(((Component)val2).gameObject); Log.Info(text2 + ": " + ((Object)val2.sharedMesh).name); } } else if (o is MeshRenderer) { MeshRenderer val3 = (MeshRenderer)o; string text3 = HierarchyString(((Component)val3).gameObject); for (int k = 0; k < ((Renderer)val3).materials.Length; k++) { Log.Info(text3 + " - " + k + ": " + ((Object)((Renderer)val3).materials[k]).name); } } else if (o is AudioSource) { AudioSource val4 = (AudioSource)o; string text4 = HierarchyString(((Component)val4).gameObject); if ((Object)(object)val4.clip != (Object)null) { Log.Info(text4 + ": " + ((Object)val4.clip).name); } if ((Object)(object)val4.outputAudioMixerGroup != (Object)null) { Log.Info(text4 + ": " + ((Object)val4.outputAudioMixerGroup).name); } } else { string name = o.name; Log.Info(name + ": " + ((object)o).GetType().ToString()); } } } } } } namespace Welcome_To_Ooblterra.Patches { internal class FactoryPatch { private const string DungeonPath = "CustomDungeon/Data/"; private const string BehaviorPath = "CustomDungeon/Behaviors/"; private const string SecurityPath = "CustomDungeon/Security/"; private const string DoorPath = "CustomDungeon/Doors/"; private const string EmptyPrefabsPath = "CustomDungeon/Rooms/EMPTY.PREFABS/"; public static List SecurityList = new List(); public static ExtendedDungeonFlow OoblDungeonFlow; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FactoryPatch)); [HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")] [HarmonyPrefix] private static bool WTOSpawnMapObjects(RoundManager __instance) { //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) if (WTOBase.WTOForceHazards.Value == TiedToLabEnum.UseMoonDefault && __instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName) { return true; } if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)OoblDungeonFlow) { return true; } if (__instance.currentLevel.spawnableMapObjects == null || __instance.currentLevel.spawnableMapObjects.Length == 0) { return true; } Random random = new Random(StartOfRound.Instance.randomMapSeed + 587); __instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer"); RandomMapObject[] array = Object.FindObjectsOfType(); List list = WTOBase.CSVSeperatedStringList(WTOBase.WTOHazardList.Value); if (WTOBase.WTOForceHazards.Value != 0) { SpawnableMapObject[] spawnableMapObjects = __instance.currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val in spawnableMapObjects) { list.Add(((Object)val.prefabToSpawn).name.ToLower()); } } for (int j = 0; j < __instance.currentLevel.spawnableMapObjects.Length; j++) { if (!list.Contains(((Object)__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn).name.ToLower())) { Log.Error("Object " + ((Object)__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn).name.ToLower() + " not found in valid spawn list!"); continue; } List list2 = new List(); int num = (int)__instance.currentLevel.spawnableMapObjects[j].numberToSpawn.Evaluate((float)random.NextDouble()); WTOBase.WTOLogSource.LogInfo((object)$"Attempting to spawn {__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn}; Quantity: {num}"); if (__instance.increasedMapHazardSpawnRateIndex == j) { num = Mathf.Min(num * 2, 150); } if (num <= 0) { continue; } for (int k = 0; k < array.Length; k++) { string text = ""; foreach (GameObject spawnablePrefab in array[k].spawnablePrefabs) { if (object.Equals(spawnablePrefab, __instance.currentLevel.spawnableMapObjects[j].prefabToSpawn)) { list2.Add(array[k]); } text = text + ((object)spawnablePrefab)?.ToString() + ", "; } } for (int l = 0; l < num; l++) { if (list2.Count <= 0) { WTOBase.WTOLogSource.LogInfo((object)"Objects will not spawn; no valid random spots found!"); break; } RandomMapObject val2 = list2[random.Next(0, list2.Count)]; Vector3 position = ((Component)val2).transform.position; GameObject val3 = Object.Instantiate(__instance.currentLevel.spawnableMapObjects[j].prefabToSpawn, position, ((Component)val2).transform.rotation, __instance.mapPropsContainer.transform); val3.GetComponent().Spawn(true); WTOBase.WTOLogSource.LogInfo((object)$"Spawned new {val3}"); list2.Remove(val2); } } return false; } public static void Start() { OoblDungeonFlow = WTOBase.ContextualLoadAsset("CustomDungeon/Data/OoblLabExtendedDungeonFlow.asset", LogLoading: true); PatchedContent.RegisterExtendedDungeonFlow(OoblDungeonFlow); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Behaviors/ChargedBattery.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Behaviors/DrainedBattery.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Behaviors/ScrapShelf.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Behaviors/BatteryRecepticleTransform.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Behaviors/OoblShutter.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Security/TeslaCoil.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Security/SpikeTrap.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Security/BabyLurkerEgg.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Rooms/EMPTY.PREFABS/EntranceTeleportA.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Rooms/EMPTY.PREFABS/EntranceTeleportB.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Rooms/EMPTY.PREFABS/Landmine.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Rooms/EMPTY.PREFABS/SpikeRoofTrapHazard.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Rooms/EMPTY.PREFABS/Turret.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/Rooms/EMPTY.PREFABS/VentEntrance.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/TestRoom.prefab", LogLoading: true)); NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomDungeon/TestRoomTeleport.prefab", LogLoading: true)); } } internal class ItemPatch { public class ItemData { private readonly string AssetName; private readonly int Rarity; private Item Itemref; public ItemData(string name, int rarity) { AssetName = "CustomItems/" + name; Rarity = rarity; } public string GetItemPath() { return AssetName; } public int GetRarity() { return Rarity; } public void SetItem(Item ItemToSet) { Itemref = ItemToSet; } public Item GetItem() { return Itemref; } } private static AudioClip CachedDiscoBallMusic; private static AudioClip OoblterraDiscoMusic; private const string ItemPath = "CustomItems/"; private static readonly Dictionary> MoonsToItemLists = new Dictionary>(); public static ItemData[] ItemList = new ItemData[11] { new ItemData("AlienCrate.asset", 30), new ItemData("FiveSixShovel.asset", 10), new ItemData("HandCrystal.asset", 30), new ItemData("OoblCorpse.asset", 5), new ItemData("StatueSmall.asset", 40), new ItemData("WandCorpse.asset", 5), new ItemData("WandFeed.asset", 20), new ItemData("SprintTotem.asset", 25), new ItemData("CursedTotem.asset", 20), new ItemData("Chems.asset", 0), new ItemData("Battery.asset", 0) }; [HarmonyPatch(typeof(RoundManager), "SetLockedDoors")] [HarmonyPrefix] private static void ReplaceKeys(RoundManager __instance) { if (!(__instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName)) { GameObject keyPrefab = Object.Instantiate(WTOBase.ContextualLoadAsset("CustomItems/OoblKey.prefab", LogLoading: true), __instance.mapPropsContainer.transform); __instance.keyPrefab = keyPrefab; } } [HarmonyPatch(typeof(CozyLights), "SetAudio")] [HarmonyPrefix] private static bool ReplaceDiscoBall(CozyLights __instance) { if (StartOfRound.Instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName) { if ((Object)(object)__instance.turnOnAudio != (Object)null) { __instance.turnOnAudio.clip = CachedDiscoBallMusic; } return true; } if ((Object)(object)__instance.turnOnAudio != (Object)null) { __instance.turnOnAudio.clip = OoblterraDiscoMusic; } return true; } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPrefix] private static void SetItemsWTO(RoundManager __instance) { string planetName = __instance.currentLevel.PlanetName; if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow) { if (MoonsToItemLists.TryGetValue(planetName, out List value)) { __instance.currentLevel.spawnableScrap = value; } } else { SetItemStuff(WTOBase.WTOForceScrap.Value, ref __instance.currentLevel.spawnableScrap, MoonsToItemLists[MoonPatch.MoonFriendlyName]); } } public static void Start() { ItemData[] itemList = ItemList; foreach (ItemData itemData in itemList) { Item val = WTOBase.ContextualLoadAsset(itemData.GetItemPath(), LogLoading: true); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, itemData.GetRarity(), (LevelTypes)1); itemData.SetItem(val); } NetworkPrefabs.RegisterNetworkPrefab(WTOBase.ContextualLoadAsset("CustomItems/OoblKey.prefab", LogLoading: true)); CachedDiscoBallMusic = WTOBase.ContextualLoadAsset("CustomItems/Boombox6QuestionMark.ogg", LogLoading: false); OoblterraDiscoMusic = WTOBase.ContextualLoadAsset("CustomItems/ooblboombox.ogg", LogLoading: false); if (!MoonsToItemLists.ContainsKey(MoonPatch.MoonFriendlyName)) { MoonsToItemLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.spawnableScrap); } } private static void SetItemStuff(TiedToLabEnum TiedToLabState, ref List CurrentMoonItemList, List OoblterraItemList) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown List list = new List(); foreach (SpawnableItemWithRarity OoblterraItem in OoblterraItemList) { list.Add(new SpawnableItemWithRarity { spawnableItem = OoblterraItem.spawnableItem, rarity = OoblterraItem.rarity * WTOBase.WTOWeightScale.Value }); } switch (TiedToLabState) { case TiedToLabEnum.WTOOnly: CurrentMoonItemList = OoblterraItemList; break; case TiedToLabEnum.AppendWTO: CurrentMoonItemList.AddRange(list); break; } } } internal class MonsterPatch { public static List InsideEnemies = new List(); public static List OutsideEnemies = new List(); public static List DaytimeEnemies = new List(); public static List AdultWandererContainer = new List(); private const string EnemyPath = "CustomEnemies/"; public const bool ShouldDebugEnemies = true; private static readonly Dictionary> MoonsToInsideSpawnLists = new Dictionary>(); private static readonly Dictionary> MoonsToOutsideSpawnLists = new Dictionary>(); private static readonly Dictionary> MoonsToDaytimeSpawnLists = new Dictionary>(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(MonsterPatch)); [HarmonyPatch(typeof(EnemyAI), "SetEnemyStunned")] [HarmonyPostfix] private static void SetOwnershipToStunningPlayer(EnemyAI __instance) { if (__instance is WTOEnemy && !((Object)(object)__instance.stunnedByPlayer == (Object)null)) { Log.Info($"Enemy: {((object)__instance).GetType()} STUNNED BY: {__instance.stunnedByPlayer}; Switching ownership..."); __instance.ChangeOwnershipOfEnemy(__instance.stunnedByPlayer.actualClientId); } } [HarmonyPatch(typeof(EnemyAI), "SetClientCalculatingAI")] [HarmonyPrefix] private static bool PreventGhostAgentEnable(EnemyAI __instance, bool enable) { if (__instance is OoblGhostAI) { __instance.isClientCalculatingAI = enable; return false; } return true; } [HarmonyPatch(typeof(HUDManager), "UseSignalTranslatorClientRpc")] [HarmonyPostfix] private static void TellAllGhostsOfSignalTransmission() { OoblGhostAI[] array = Object.FindObjectsOfType(); OoblGhostAI[] array2 = array; foreach (OoblGhostAI ooblGhostAI in array2) { ooblGhostAI.EvalulateSignalTranslatorUse(); } } [HarmonyPatch(typeof(RoundManager), "AssignRandomEnemyToVent")] [HarmonyPrefix] private static void SetInsideEnemiesWTO(RoundManager __instance) { string planetName = __instance.currentLevel.PlanetName; if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow) { if (MoonsToInsideSpawnLists.TryGetValue(planetName, out List value)) { __instance.currentLevel.Enemies = value; } } else { SetMonsterStuff(WTOBase.WTOForceInsideMonsters.Value, ref __instance.currentLevel.Enemies, MoonsToInsideSpawnLists[MoonPatch.MoonFriendlyName]); } } [HarmonyPatch(typeof(RoundManager), "SpawnRandomOutsideEnemy")] [HarmonyPrefix] private static void SetOutsideEnemiesWTO(RoundManager __instance, GameObject[] spawnPoints, float timeUpToCurrentHour) { string planetName = __instance.currentLevel.PlanetName; if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow) { if (MoonsToOutsideSpawnLists.TryGetValue(planetName, out List value)) { __instance.currentLevel.OutsideEnemies = value; } } else { SetMonsterStuff(WTOBase.WTOForceOutsideMonsters.Value, ref __instance.currentLevel.OutsideEnemies, MoonsToOutsideSpawnLists[MoonPatch.MoonFriendlyName]); } } [HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")] [HarmonyPrefix] private static void SetDaytimeEnemiesWTO(RoundManager __instance) { string planetName = __instance.currentLevel.PlanetName; if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)(object)FactoryPatch.OoblDungeonFlow) { if (MoonsToDaytimeSpawnLists.TryGetValue(planetName, out List value)) { __instance.currentLevel.OutsideEnemies = value; } } else { SetMonsterStuff(WTOBase.WTOForceDaytimeMonsters.Value, ref __instance.currentLevel.DaytimeEnemies, MoonsToDaytimeSpawnLists[MoonPatch.MoonFriendlyName]); } } public static void Start() { CreateEnemy("Wanderer.asset", DaytimeEnemies, 50, (SpawnType)1, "WandererTerminal.asset", "WandererKeyword.asset"); CreateEnemy("AdultWanderer.asset", AdultWandererContainer, 0, (SpawnType)2, "AdultWandererTerminal.asset", "AdultWandererKeyword.asset"); CreateEnemy("Gallenarma.asset", InsideEnemies, 30, (SpawnType)0, "GallenTerminal.asset", "GallenKeyword.asset"); CreateEnemy("EyeSecurity.asset", InsideEnemies, 20, (SpawnType)0, "EyeSecTerminal.asset", "EyeSecKeyword.asset"); CreateEnemy("OoblGhost.asset", InsideEnemies, 20, (SpawnType)0, "OoblGhostTerminal.asset", "OoblGhostKeyword.asset"); CreateEnemy("Enforcer.asset", InsideEnemies, 10, (SpawnType)0, "EnforcerTerminal.asset", "EnforcerKeyword.asset"); CreateEnemy("BabyLurker.asset", InsideEnemies, 10, (SpawnType)0, "BabyLurkerTerminal.asset", "BabyLurkerKeyword.asset"); CreateEnemy("GhostPlayer.asset", OutsideEnemies, 10, (SpawnType)2); if (!MoonsToInsideSpawnLists.ContainsKey(MoonPatch.MoonFriendlyName)) { MoonsToInsideSpawnLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.Enemies); } if (!MoonsToOutsideSpawnLists.ContainsKey(MoonPatch.MoonFriendlyName)) { MoonsToOutsideSpawnLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.OutsideEnemies); } if (!MoonsToDaytimeSpawnLists.ContainsKey(MoonPatch.MoonFriendlyName)) { MoonsToDaytimeSpawnLists.Add(MoonPatch.MoonFriendlyName, MoonPatch.OoblterraExtendedLevel.SelectableLevel.DaytimeEnemies); } } public static void CreateEnemy(string EnemyName, List EnemyList, int rarity, SpawnType SpawnType, string InfoName = null, string KeywordName = null) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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) //IL_00bb: Expected O, but got Unknown string text = EnemyName.Remove(EnemyName.Length - 6, 6) + "/"; TerminalNode val = null; TerminalKeyword val2 = null; EnemyType val3 = WTOBase.ContextualLoadAsset("CustomEnemies/" + text + EnemyName, LogLoading: true); val3.enemyPrefab.GetComponent().debugEnemyAI = false; if (InfoName != null) { val = WTOBase.ContextualLoadAsset("CustomEnemies/" + text + InfoName, LogLoading: true); } if (KeywordName != null) { val2 = WTOBase.ContextualLoadAsset("CustomEnemies/" + text + KeywordName, LogLoading: true); } NetworkPrefabs.RegisterNetworkPrefab(val3.enemyPrefab); Enemies.RegisterEnemy(val3, rarity, (LevelTypes)1, SpawnType, val, val2); EnemyList?.Add(new SpawnableEnemyWithRarity { enemyType = val3, rarity = rarity }); Log.Info("Monster Loaded: " + EnemyName.Remove(EnemyName.Length - 6, 6)); } private static void SetMonsterStuff(TiedToLabEnum TiedToLabState, ref List CurrentMoonEnemyList, List OoblterraEnemyList) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown List list = new List(); foreach (SpawnableEnemyWithRarity OoblterraEnemy in OoblterraEnemyList) { list.Add(new SpawnableEnemyWithRarity { enemyType = OoblterraEnemy.enemyType, rarity = OoblterraEnemy.rarity * WTOBase.WTOWeightScale.Value }); } switch (TiedToLabState) { case TiedToLabEnum.WTOOnly: CurrentMoonEnemyList = OoblterraEnemyList; break; case TiedToLabEnum.AppendWTO: CurrentMoonEnemyList.AddRange(list); break; } } } internal class MoonPatch { [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StartMatchLever startMatchLever; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Log.Info("Waiting for LLL to finish loading before routing to Ooblterra..."); <>2__current = (object)new WaitUntil(GetIsLLLReadyFunc()); <>1__state = 1; return true; case 1: <>1__state = -1; Log.Info("LLL finished loading, routing to Ooblterra..."); StartOfRound.Instance.ChangeLevel(OoblterraExtendedLevel.SelectableLevel.levelID); StartOfRound.Instance.ArriveAtLevel(); Log.Info("Pulling lever to start match..."); startMatchLever.leverHasBeenPulled = true; startMatchLever.leverAnimatorObject.SetBool("pullLever", true); startMatchLever.triggerScript.interactable = false; startMatchLever.PullLever(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string MoonFriendlyName; public static Animator OoblFogAnimator; public const string MoonPath = "CustomMoon/"; private static FootstepSurface GrassSurfaceRef; private static AudioClip[] OoblFootstepClips; private static AudioClip OoblHitSFX; private static AudioClip[] GrassFootstepClips; private static AudioClip GrassHitSFX; private static AudioClip[] CachedTODMusic; private static AudioClip[] CachedAmbientMusic; private static AudioClip[] OoblTODMusic; private static SpawnableMapObject[] CachedSpawnableMapObjects; public static ExtendedLevel OoblterraExtendedLevel; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(MoonPatch)); [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] private static void ManageNav(StartOfRound __instance) { GrassSurfaceRef = StartOfRound.Instance.footstepSurfaces[4]; if (GrassFootstepClips == null) { GrassFootstepClips = StartOfRound.Instance.footstepSurfaces[4].clips; GrassHitSFX = StartOfRound.Instance.footstepSurfaces[4].hitSurfaceSFX; } if (OoblFootstepClips == null) { OoblFootstepClips = (AudioClip[])(object)new AudioClip[5] { WTOBase.ContextualLoadAsset("CustomMoon/Sound/Footsteps/TENTACLESTEP01.wav", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Sound/Footsteps/TENTACLESTEP02.wav", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Sound/Footsteps/TENTACLESTEP03.wav", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Sound/Footsteps/TENTACLESTEP04.wav", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Sound/Footsteps/TENTACLESTEP05.wav", LogLoading: true) }; OoblHitSFX = WTOBase.ContextualLoadAsset("CustomMoon/Sound/Footsteps/TENTACLE_Fall.wav", LogLoading: true); } if (CachedTODMusic == null) { CachedTODMusic = TimeOfDay.Instance.timeOfDayCues; CachedAmbientMusic = SoundManager.Instance.DaytimeMusic; } if (OoblTODMusic == null) { OoblTODMusic = (AudioClip[])(object)new AudioClip[4] { WTOBase.ContextualLoadAsset("CustomMoon/Oobl_StartOfDay.ogg", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Oobl_MidDay.ogg", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Oobl_LateDay.ogg", LogLoading: true), WTOBase.ContextualLoadAsset("CustomMoon/Oobl_Night.ogg", LogLoading: true) }; } if (__instance.currentLevel.PlanetName != MoonFriendlyName) { TimeOfDay.Instance.timeOfDayCues = CachedTODMusic; SoundManager.Instance.DaytimeMusic = CachedAmbientMusic; GrassSurfaceRef.clips = GrassFootstepClips; GrassSurfaceRef.hitSurfaceSFX = GrassHitSFX; } else { MoveNavNodesToNewPositions(); GrassSurfaceRef.clips = OoblFootstepClips; GrassSurfaceRef.hitSurfaceSFX = OoblHitSFX; TimeOfDay.Instance.timeOfDayCues = OoblTODMusic; SoundManager.Instance.DaytimeMusic = (AudioClip[])(object)new AudioClip[0]; ReplaceStoryLogIDs(); } } [HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")] [HarmonyPostfix] private static void SetFogTies(StartOfRound __instance) { if (!(__instance.currentLevel.PlanetName != MoonFriendlyName)) { OoblFogAnimator = GameObject.Find("OoblFog").gameObject.GetComponent(); Log.Debug($"Fog animator found : {(Object)(object)OoblFogAnimator != (Object)null}"); if ((Object)(object)TimeOfDay.Instance.sunAnimator == (Object)(object)OoblFogAnimator) { Log.Debug("Sun Animator IS fog animator, supposedly"); return; } TimeOfDay.Instance.sunAnimator = OoblFogAnimator; Log.Debug($"Is Sun Animator Fog Animator? {(Object)(object)TimeOfDay.Instance.sunAnimator == (Object)(object)OoblFogAnimator}"); TimeOfDay.Instance.playDelayedMusicCoroutine = null; } } [HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")] [HarmonyPrefix] private static void SpoofLightValues(TimeOfDay __instance) { if (!(__instance.currentLevel.PlanetName != MoonFriendlyName)) { Light component = GameObject.Find("ActualSun").GetComponent(); Light component2 = GameObject.Find("ActualIndirect").GetComponent(); TimeOfDay val = Object.FindObjectOfType(); val.sunIndirect = component2; val.sunDirect = component; } } [HarmonyPatch(typeof(PlayerControllerB), "PlayFootstepSound")] [HarmonyPrefix] private static void PatchFootstepSound(PlayerControllerB __instance) { if (StartOfRound.Instance.currentLevel.PlanetName != MoonFriendlyName || __instance.currentFootstepSurfaceIndex != 4) { __instance.movementAudio.volume = 0.447f; return; } float num = Mathf.Clamp((float)WTOBase.WTOFootsteps.Value, 0f, 100f); __instance.movementAudio.volume = num / 100f * 0.447f; } [HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")] [HarmonyPrefix] private static bool WTOSpawnOutsideObjects(RoundManager __instance) { if (__instance.currentLevel.PlanetName != MoonFriendlyName) { return true; } if (!WTOBase.CSVSeperatedStringList(WTOBase.WTOHazardList.Value).Contains("beartrap")) { __instance.currentLevel.spawnableMapObjects = null; return false; } __instance.currentLevel.spawnableMapObjects = CachedSpawnableMapObjects; return true; } [HarmonyPatch(typeof(TimeOfDay), "Start")] [HarmonyPrefix] private static bool AdjustTODMusic(TimeOfDay __instance) { if (RoundManager.Instance.currentLevel.PlanetName != MoonFriendlyName) { __instance.TimeOfDayMusic.volume = 1f; return true; } float num = Mathf.Clamp((float)WTOBase.WTOFootsteps.Value, 0f, 100f); __instance.TimeOfDayMusic.volume = num / 100f; return true; } [HarmonyPatch(typeof(StartMatchLever), "Start")] [HarmonyPrefix] private static void AutoRouteToOoblterra(StartMatchLever __instance) { if (WTOBase.WTOAutoRoute.Value && ((NetworkBehaviour)StartOfRound.Instance).IsServer) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(RouteToOoblterraOnceLLLIsLoaded(__instance)); } } private static Func GetIsLLLReadyFunc() { Assembly assembly = Assembly.GetAssembly(typeof(AssetBundleLoader)); Type type = assembly.GetType("LethalLevelLoader.NetworkBundleManager"); if (type == null) { Log.Warning("Could not find LethalLevelLoader.NetworkBundleManager type"); return () => true; } PropertyInfo property = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); if (property == null) { Log.Warning("Could not find Instance field in NetworkBundleManager"); return () => true; } object value = property.GetValue(null); FieldInfo field = type.GetField("allowedToLoadLevel", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { Log.Warning("Could not find allowedToLoadLevel field in NetworkBundleManager"); return () => true; } NetworkVariable allowedToLoadLevel = field.GetValue(value) as NetworkVariable; return delegate { try { return allowedToLoadLevel.Value; } catch (Exception arg) { Log.Warning($"Exception while trying to get allowedToLoadLevel value: {arg}"); return true; } }; } [IteratorStateMachine(typeof(d__22))] private static IEnumerator RouteToOoblterraOnceLLLIsLoaded(StartMatchLever startMatchLever) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0) { startMatchLever = startMatchLever }; } public static void Start() { OoblterraExtendedLevel = WTOBase.ContextualLoadAsset("CustomMoon/OoblterraExtendedLevel.asset", LogLoading: true); MoonFriendlyName = OoblterraExtendedLevel.SelectableLevel.PlanetName; Log.Info($"Ooblterra Found: {(Object)(object)OoblterraExtendedLevel != (Object)null}"); PatchedContent.RegisterExtendedLevel(OoblterraExtendedLevel); CachedSpawnableMapObjects = OoblterraExtendedLevel.SelectableLevel.spawnableMapObjects; foreach (SpawnableItemWithRarity item in OoblterraExtendedLevel.SelectableLevel.spawnableScrap) { Log.Info(((Object)item.spawnableItem).name ?? ""); } } private static void MoveNavNodesToNewPositions() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode"); List list = new List(); IEnumerable enumerable = from obj in Object.FindObjectsOfType() where ((Object)obj).name == "OoblOutsideNode" select obj; foreach (GameObject item in enumerable) { list.Add(item); } Log.Info("Outside nav points: " + list.Count()); for (int i = 0; i < array.Count(); i++) { if (list.Count() > i) { array[i].transform.position = list[i].transform.position; } else { Object.Destroy((Object)(object)array[i]); } } } private static void ReplaceStoryLogIDs() { StoryLog[] array = Object.FindObjectsOfType(); StoryLog[] array2 = array; foreach (StoryLog val in array2) { if (TerminalPatch.LogDictionary.TryGetValue(val.storyLogID, out var value)) { val.storyLogID = value; } } } } internal class SuitPatch { private const string SuitPath = "CustomSuits/"; private const string BlackSuitPath = "CustomSuits/BlackSuits"; private const string PosterGameObject = "HangarShip/Plane.001"; private static readonly string[] SuitMaterialNames = new string[7] { "RedSuit.mat", "ProtSuit.mat", "YellowSuit.mat", "GreenSuit.mat", "BlueSuit.mat", "IndigoSuit.mat", "MackSuit.mat" }; private static bool SuitsLoaded = false; public static Material GhostPlayerSuit; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(SuitPatch)); [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPrefix] private static void StartPatch(ref StartOfRound __instance) { GhostPlayerSuit = WTOBase.ContextualLoadAsset("CustomSuits/GhostPlayerSuit.mat", LogLoading: true); if (WTOBase.WTOCustomSuits.Value) { LoadSuits("CustomSuits/"); } } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] [HarmonyPriority(0)] private static void PatchPosters(StartOfRound __instance) { if (WTOBase.WTOCustomPoster.Value) { ReplacePoster(); } } private static void LoadSuits(string RelevantPath) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown if (SuitsLoaded) { Log.Warning("SUITS ALREADY LOADED!"); return; } UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables.First((UnlockableItem x) => (Object)(object)x.suitMaterial != (Object)null); string[] suitMaterialNames = SuitMaterialNames; foreach (string text in suitMaterialNames) { UnlockableItem val2 = JsonUtility.FromJson(JsonUtility.ToJson((object)val)); UnlockableSuit val3 = new UnlockableSuit(); val2.suitMaterial = WTOBase.ContextualLoadAsset(RelevantPath + text, LogLoading: true); string unlockableName = text.Substring(0, text.Length - 4); val2.unlockableName = unlockableName; StartOfRound.Instance.unlockablesList.unlockables.Add(val2); } SuitsLoaded = true; } private static void AddSuitPurchaseNode() { } private static void ReplacePoster() { if (!((Object)(object)GameObject.Find("HangarShip/Plane.001") == (Object)null)) { Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent()).materials; materials[1] = WTOBase.ContextualLoadAsset("CustomSuits/Poster.mat", LogLoading: true); ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent()).materials = materials; } } private static void AddPosterShipDeco() { } } internal class TerminalPatch { public static Dictionary LogDictionary = new Dictionary(); private const string TerminalPath = "CustomTerminal/"; private static List KeywordList; private static List NodeList = new List(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(TerminalPatch)); [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void AddLogs() { LoadLogKeywords(); LoadLogNodes(); LoadStoryLogs(); } private static void LoadLogKeywords() { KeywordList = new List { WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile1Keyword.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile2Keyword.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile3Keyword.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile4Keyword.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile5Keyword.asset", LogLoading: true) }; } private static void LoadLogNodes() { NodeList = new List { WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile1.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile2.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile3.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile4.asset", LogLoading: true), WTOBase.ContextualLoadAsset("CustomTerminal/WTOLogFile5.asset", LogLoading: true) }; } private static void LoadStoryLogs() { try { Object.FindObjectOfType().logEntryFiles.First((TerminalNode x) => x.creatureName == NodeList[0].creatureName); return; } catch { Log.Info("WTO Story logs not found in list. Attempting to add..."); } int num = Object.FindObjectOfType().logEntryFiles.Count; TerminalKeyword val = Object.FindObjectOfType().terminalNodes.allKeywords[19]; List list = new List { 5231111, 5231112, 5231113, 5231114, 5231115 }; bool flag = false; TerminalKeyword[] allKeywords = Object.FindObjectOfType().terminalNodes.allKeywords; foreach (TerminalKeyword val2 in allKeywords) { if (val2.word == "mack1") { flag = true; } } for (int j = 0; j < NodeList.Count; j++) { Log.Debug($"nextIndex = {num}"); KeywordList[j].defaultVerb = val; NodeList[j].storyLogFileID = num; Object.FindObjectOfType().logEntryFiles.Add(NodeList[j]); try { LogDictionary.Add(list[j], num); } catch { } if (!flag) { Extensions.AddCompatibleNoun(val, KeywordList[j], NodeList[j]); num++; } } List list2 = new List(); list2.AddRange(Object.FindObjectOfType().terminalNodes.allKeywords); list2.AddRange(KeywordList); Object.FindObjectOfType().terminalNodes.allKeywords = list2.ToArray(); Log.Info("END ADD WTO STORY LOGS!"); } } } namespace Welcome_To_Ooblterra.Items { public class Chemical : GrabbableObject { [HideInInspector] public enum ChemColor { Red, Orange, Yellow, Green, Blue, Indigo, Purple, Clear } [InspectorName("Defaults")] public MeshRenderer BeakerMesh; public List ShakeSounds; private readonly Random MyRandom = new Random(); private float ShakeCooldownSeconds = 0f; private ChemColor Color = ChemColor.Clear; private int ScrapValue = 0; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(Chemical), LogSourceType.Item); public override void Start() { ((GrabbableObject)this).Start(); if (((NetworkBehaviour)this).IsServer) { Random random = new Random(StartOfRound.Instance.randomMapSeed); int num = random.Next(base.itemProperties.minValue, base.itemProperties.maxValue); num = (int)Mathf.Round((float)num * 0.4f); SetChemState(RandomColor(), num, playShakeSound: false); } } public override void Update() { ((GrabbableObject)this).Update(); if (ShakeCooldownSeconds > 0f) { ShakeCooldownSeconds -= Time.deltaTime; } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); base.playerHeldBy.equippedUsableItemQE = true; } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right && ShakeCooldownSeconds <= 0f && GetCurrentColor() != ChemColor.Clear) { ShakeCooldownSeconds = 1.2f; base.playerHeldBy.playerBodyAnimator.SetTrigger("shakeItem"); SetChemState(NextColor(Color), ScrapValue, playShakeSound: true); } } private ChemColor RandomColor() { return (ChemColor)MyRandom.Next(0, 7); } private static ChemColor NextColor(ChemColor color) { int num = (int)(color + 1); int num2 = 6; return (ChemColor)(num % num2); } public void EmptyBeaker() { SetChemState(ChemColor.Clear, ScrapValue / 3, playShakeSound: false); } public ChemColor GetCurrentColor() { return Color; } public static Color GetColorFromEnum(ChemColor inColor) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_008d: 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_00a4: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } Color result = (Color)(inColor switch { ChemColor.Red => new Color(1f, 0f, 0f), ChemColor.Orange => new Color(1f, 0.4f, 0f), ChemColor.Yellow => new Color(1f, 1f, 0f), ChemColor.Green => new Color(0f, 1f, 0f), ChemColor.Blue => new Color(0f, 1f, 1f), ChemColor.Indigo => new Color(0f, 0f, 1f), ChemColor.Purple => new Color(1f, 0f, 1f), ChemColor.Clear => new Color(0f, 0f, 0f, 0f), _ => new Color(1f, 1f, 1f), }); if (1 == 0) { } return result; } [ServerRpc] private void SetChemStateServerRpc(ChemColor color, int scrapValue, bool playShakeSound, ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0105: 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)((NetworkBehaviour)this).__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; } FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2988978897u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref color, default(ForEnums)); BytePacker.WriteValueBitPacked(val, scrapValue); ((FastBufferWriter)(ref val)).WriteValueSafe(ref playShakeSound, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2988978897u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetChemStateClientRpc(color, scrapValue, playShakeSound, new ClientRpcParams { Send = WTOBase.AllClientsButSender(rpcParams) }); } } [ClientRpc] private void SetChemStateClientRpc(ChemColor color, int scrapValue, bool playShakeSound, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_008c: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2956456148u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref color, default(ForEnums)); BytePacker.WriteValueBitPacked(val, scrapValue); ((FastBufferWriter)(ref val)).WriteValueSafe(ref playShakeSound, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2956456148u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; UpdateChemStateOnClient(color, scrapValue, playShakeSound); } } } private void UpdateChemStateOnClient(ChemColor color, int scrapValue, bool playShakeSound) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (playShakeSound) { ((Component)this).GetComponent().PlayOneShot(ShakeSounds[MyRandom.Next(0, ShakeSounds.Count - 1)]); } Color = color; ScrapValue = scrapValue; ((GrabbableObject)this).SetScrapValue(ScrapValue); ((Renderer)BeakerMesh).materials[1].SetColor("_BaseColor", GetColorFromEnum(Color)); } private void SetChemState(ChemColor color, int scrapValue, bool playShakeSound) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Log.Info($"Next Color Value: {color}"); if (((NetworkBehaviour)this).IsClient) { UpdateChemStateOnClient(color, scrapValue, playShakeSound); SetChemStateServerRpc(color, scrapValue, playShakeSound); } else { SetChemStateClientRpc(color, scrapValue, playShakeSound); } } protected override void __initializeVariables() { ((GrabbableObject)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 ((NetworkBehaviour)this).__registerRpc(2988978897u, new RpcReceiveHandler(__rpc_handler_2988978897), "SetChemStateServerRpc"); ((NetworkBehaviour)this).__registerRpc(2956456148u, new RpcReceiveHandler(__rpc_handler_2956456148), "SetChemStateClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_2988978897(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_008b: 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_00aa: 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_00b4: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) //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; } ChemColor color = default(ChemColor); ((FastBufferReader)(ref reader)).ReadValueSafe(ref color, default(ForEnums)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); bool playShakeSound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playShakeSound, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((Chemical)(object)target).SetChemStateServerRpc(color, scrapValue, playShakeSound, server); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_2956456148(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ChemColor color = default(ChemColor); ((FastBufferReader)(ref reader)).ReadValueSafe(ref color, default(ForEnums)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); bool playShakeSound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playShakeSound, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((Chemical)(object)target).SetChemStateClientRpc(color, scrapValue, playShakeSound, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Chemical"; } } internal class CursedEffigy : GrabbableObject { [CompilerGenerated] private sealed class <>c__DisplayClass13_0 { public float startTime; public NetworkObjectReference netObjectRef; public NetworkObject netObject; public CursedEffigy <>4__this; internal bool b__0() { return Time.realtimeSinceStartup - startTime > 20f || ((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null); } internal bool b__1() { return Time.realtimeSinceStartup - startTime > 20f || (Object)(object)<>4__this.previousPlayerHeldBy.deadBody != (Object)null; } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference netObjectRef; public bool inFactory; public CursedEffigy <>4__this; private <>c__DisplayClass13_0 <>8__1; private MaskedPlayerEnemy 5__2; private Material 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass13_0(); <>8__1.netObjectRef = netObjectRef; <>8__1.<>4__this = <>4__this; <>8__1.netObject = null; <>8__1.startTime = Time.realtimeSinceStartup; <>2__current = (object)new WaitUntil((Func)(() => Time.realtimeSinceStartup - <>8__1.startTime > 20f || ((NetworkObjectReference)(ref <>8__1.netObjectRef)).TryGet(ref <>8__1.netObject, (NetworkManager)null))); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.previousPlayerHeldBy.deadBody == (Object)null) { <>8__1.startTime = Time.realtimeSinceStartup; <>2__current = (object)new WaitUntil((Func)(() => Time.realtimeSinceStartup - <>8__1.startTime > 20f || (Object)(object)<>8__1.<>4__this.previousPlayerHeldBy.deadBody != (Object)null)); <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } <>4__this.previousPlayerHeldBy.deadBody.DeactivateBody(false); if ((Object)(object)<>8__1.netObject == (Object)null) { return false; } Log.Debug("Got network object for Ghost Player enemy client"); 5__2 = ((Component)<>8__1.netObject).GetComponent(); 5__2.mimickingPlayer = <>4__this.previousPlayerHeldBy; 5__3 = SuitPatch.GhostPlayerSuit; ((Renderer)5__2.rendererLOD0).material = 5__3; ((Renderer)5__2.rendererLOD1).material = 5__3; ((Renderer)5__2.rendererLOD2).material = 5__3; ((EnemyAI)5__2).SetEnemyOutside(!inFactory); 5__2.SetVisibilityOfMaskedEnemy(); 5__2.maskTypes[0].SetActive(false); 5__2.maskTypes[1].SetActive(false); 5__2.maskTypeIndex = 0; <>4__this.previousPlayerHeldBy.redirectToEnemy = (EnemyAI)(object)5__2; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public List AmbientSounds; public AudioSource AudioPlayer; public EnemyType TheMimic; private bool MimicSpawned; private PlayerControllerB previousPlayerHeldBy; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(CursedEffigy), LogSourceType.Item); public override void Update() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (!((Object)(object)previousPlayerHeldBy == (Object)null) && previousPlayerHeldBy.isPlayerDead && !MimicSpawned && ((NetworkBehaviour)this).IsOwner) { Log.Info($"Effigy knows that {previousPlayerHeldBy.playerUsername} is dead at position {((Component)previousPlayerHeldBy.deadBody).transform.position}"); CreateMimicServerRpc(previousPlayerHeldBy.isInsideFactory, ((Component)previousPlayerHeldBy.deadBody).transform.position); MimicSpawned = true; DestroyEffigyServerRpc(); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); SetOwningPlayerServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, base.playerHeldBy)); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if (!previousPlayerHeldBy.isPlayerDead) { SetOwningPlayerServerRpc(-1); } } [ServerRpc] public void SetOwningPlayerServerRpc(int OwnerID) { //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)((NetworkBehaviour)this).__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(3785399831u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, OwnerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3785399831u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetOwningPlayerClientRpc(OwnerID); } } [ClientRpc] public void SetOwningPlayerClientRpc(int OwnerID) { //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(3495210617u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, OwnerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3495210617u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (OwnerID == -1) { previousPlayerHeldBy = null; } else { previousPlayerHeldBy = StartOfRound.Instance.allPlayerScripts[OwnerID]; } } } [ServerRpc(RequireOwnership = false)] public void CreateMimicServerRpc(bool inFactory, Vector3 playerPositionAtDeath) { //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_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_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) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(442647051u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inFactory, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerPositionAtDeath); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 442647051u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)previousPlayerHeldBy == (Object)null) { Log.Error("Previousplayerheldby is null so the Ghost Player could not be spawned"); return; } Log.Info("Server creating Ghost Player from Effigy. Previous Player: " + previousPlayerHeldBy.playerUsername); Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(playerPositionAtDeath, default(NavMeshHit), 10f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { Log.Error("No nav mesh found; no Ghost Player could be created"); return; } TheMimic = StartOfRound.Instance.levels.First((SelectableLevel x) => x.PlanetName == "8 Titan").Enemies.First((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "Masked").enemyType; Log.Debug($"Masked Enemy Type Found: {(Object)(object)TheMimic != (Object)null}"); NetworkObjectReference netObjectRef = RoundManager.Instance.SpawnEnemyGameObject(navMeshPosition, 0f, -1, TheMimic); NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val3, (NetworkManager)null)) { Log.Debug("Got network object for Ghost Player"); MaskedPlayerEnemy component = ((Component)val3).GetComponent(); component.mimickingPlayer = previousPlayerHeldBy; Material ghostPlayerSuit = SuitPatch.GhostPlayerSuit; ((Renderer)component.rendererLOD0).material = ghostPlayerSuit; ((Renderer)component.rendererLOD1).material = ghostPlayerSuit; ((Renderer)component.rendererLOD2).material = ghostPlayerSuit; ((EnemyAI)component).SetEnemyOutside(!inFactory); component.SetVisibilityOfMaskedEnemy(); component.maskTypes[0].SetActive(false); component.maskTypes[1].SetActive(false); component.maskTypeIndex = 0; previousPlayerHeldBy.redirectToEnemy = (EnemyAI)(object)component; previousPlayerHeldBy.deadBody.DeactivateBody(false); } CreateMimicClientRpc(netObjectRef, inFactory); } [ClientRpc] public void CreateMimicClientRpc(NetworkObjectReference netObjectRef, bool inFactory) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4014314929u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netObjectRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref inFactory, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4014314929u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(WaitForMimicEnemySpawn(netObjectRef, inFactory)); } } } [IteratorStateMachine(typeof(d__13))] private IEnumerator WaitForMimicEnemySpawn(NetworkObjectReference netObjectRef, bool inFactory) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, netObjectRef = netObjectRef, inFactory = inFactory }; } [ServerRpc] private void DestroyEffigyServerRpc() { //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)((NetworkBehaviour)this).__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(420810508u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 420810508u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DestroyEffigyClientRpc(); } } [ClientRpc] private void DestroyEffigyClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1896734695u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1896734695u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy); } } } protected override void __initializeVariables() { ((GrabbableObject)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(3785399831u, new RpcReceiveHandler(__rpc_handler_3785399831), "SetOwningPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(3495210617u, new RpcReceiveHandler(__rpc_handler_3495210617), "SetOwningPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(442647051u, new RpcReceiveHandler(__rpc_handler_442647051), "CreateMimicServerRpc"); ((NetworkBehaviour)this).__registerRpc(4014314929u, new RpcReceiveHandler(__rpc_handler_4014314929), "CreateMimicClientRpc"); ((NetworkBehaviour)this).__registerRpc(420810508u, new RpcReceiveHandler(__rpc_handler_420810508), "DestroyEffigyServerRpc"); ((NetworkBehaviour)this).__registerRpc(1896734695u, new RpcReceiveHandler(__rpc_handler_1896734695), "DestroyEffigyClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3785399831(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 owningPlayerServerRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref owningPlayerServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((CursedEffigy)(object)target).SetOwningPlayerServerRpc(owningPlayerServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3495210617(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 owningPlayerClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref owningPlayerClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((CursedEffigy)(object)target).SetOwningPlayerClientRpc(owningPlayerClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_442647051(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_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool inFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inFactory, default(ForPrimitives)); Vector3 playerPositionAtDeath = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerPositionAtDeath); target.__rpc_exec_stage = (__RpcExecStage)1; ((CursedEffigy)(object)target).CreateMimicServerRpc(inFactory, playerPositionAtDeath); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4014314929(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjectRef, default(ForNetworkSerializable)); bool inFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inFactory, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CursedEffigy)(object)target).CreateMimicClientRpc(netObjectRef, inFactory); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_420810508(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; ((CursedEffigy)(object)target).DestroyEffigyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1896734695(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; ((CursedEffigy)(object)target).DestroyEffigyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CursedEffigy"; } } internal class OoblCorpsePart : GrabbableObject { public EnemyType OoblGhostTemplate; private OoblGhostAI MySpawnedGhost = null; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(OoblCorpsePart), LogSourceType.Item); public override void GrabItem() { ((GrabbableObject)this).GrabItem(); OnGrabItemServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, base.playerHeldBy)); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); OnDiscardItemServerRpc(); } [ServerRpc] private void OnGrabItemServerRpc(int clientId) { //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 //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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.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(2780701407u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2780701407u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (base.isInShipRoom) { return; } if (Object.op_Implicit((Object)(object)MySpawnedGhost)) { MySpawnedGhost.IsMovingTowardPlayer = true; MySpawnedGhost.SetGhostTargetServerRpc(clientId); return; } Log.Info("Spawning Oobl Ghost"); NetworkObjectReference val3 = RoundManager.Instance.SpawnEnemyGameObject(new Vector3(0f, -700f, 0f), 0f, 1, OoblGhostTemplate); NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref val3)).TryGet(ref val4, (NetworkManager)null)) { MySpawnedGhost = ((Component)val4).GetComponent(); MySpawnedGhost.IsMovingTowardPlayer = true; MySpawnedGhost.LinkedCorpsePart = this; MySpawnedGhost.SetGhostTargetServerRpc(clientId); } else { Log.Error("Could not link this corpse part to the Oobl Ghost!"); } } [ServerRpc] private void OnDiscardItemServerRpc() { //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)((NetworkBehaviour)this).__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(787149749u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 787149749u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (Object.op_Implicit((Object)(object)MySpawnedGhost)) { MySpawnedGhost.IsMovingTowardPlayer = false; } } } public void DestroyCorpsePart() { if (((NetworkBehaviour)this).IsHost) { DestroyCorpsePartClientRpc(); } else { DestroyCorpsePartServerRpc(); } } [ServerRpc] private void DestroyCorpsePartServerRpc() { //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)((NetworkBehaviour)this).__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(370162681u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 370162681u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DestroyCorpsePartClientRpc(); } } [ClientRpc] private void DestroyCorpsePartClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3500768280u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3500768280u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Log.Info($"Destroying: {this}"); ((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy); } } } protected override void __initializeVariables() { ((GrabbableObject)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(2780701407u, new RpcReceiveHandler(__rpc_handler_2780701407), "OnGrabItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(787149749u, new RpcReceiveHandler(__rpc_handler_787149749), "OnDiscardItemServerRpc"); ((NetworkBehaviour)this).__registerRpc(370162681u, new RpcReceiveHandler(__rpc_handler_370162681), "DestroyCorpsePartServerRpc"); ((NetworkBehaviour)this).__registerRpc(3500768280u, new RpcReceiveHandler(__rpc_handler_3500768280), "DestroyCorpsePartClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_2780701407(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 clientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((OoblCorpsePart)(object)target).OnGrabItemServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_787149749(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; ((OoblCorpsePart)(object)target).OnDiscardItemServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_370162681(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; ((OoblCorpsePart)(object)target).DestroyCorpsePartServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3500768280(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; ((OoblCorpsePart)(object)target).DestroyCorpsePartClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "OoblCorpsePart"; } } public class WTOBattery : GrabbableObject { public bool HasCharge; public Material ChargedMaterial; public Material EmptyMaterial; public ScanNodeProperties ScanNode; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(WTOBattery), LogSourceType.Item); public override void Start() { ((GrabbableObject)this).Start(); if ((Object)(object)ScanNode == (Object)null) { ScanNode = ((Component)this).gameObject.GetComponentInChildren(); } Log.Info($"Battery value: {base.scrapValue}"); if (base.scrapValue < 100) { Log.Info("Setting Battery State to Drained"); ScanNode.headerText = "Drained Battery"; HasCharge = false; ((Renderer)base.mainObjectRenderer).SetMaterials(new List { EmptyMaterial }); base.insertedBattery.charge = 100f; } else { Log.Info("Setting Battery State to Charged"); ScanNode.headerText = "Charged Battery"; ((Renderer)base.mainObjectRenderer).SetMaterials(new List { ChargedMaterial }); HasCharge = true; base.scrapValue = 200; } ((GrabbableObject)this).SetScrapValue(base.scrapValue); } public override void OnPlaceObject() { ((GrabbableObject)this).OnPlaceObject(); NetworkObject val = default(NetworkObject); if ((Object)(object)((Component)this).transform.parent == (Object)null || !((Component)((Component)this).transform.parent).TryGetComponent(ref val)) { Log.Info("Battery placed, but not in a recepticle transform. Ignoring."); } else if (((Object)val).name.StartsWith("BatteryRecepticleTransform")) { Log.Info("Battery placed in recepticle, setting parent object to recepticle transform."); base.parentObject = ((Component)val).transform; ((GrabbableObject)this).PlayDropSFX(); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WTOBattery"; } } } namespace Welcome_To_Ooblterra.Things { public class BabyLurkerEgg : NetworkBehaviour { public GameObject HiveMesh; public GameObject projectileTemplate; public GameObject MapDot; public Transform DropTransform; public Transform TraceTransform; public AudioClip[] BreakoffSound; public ScanNodeProperties ScanNode; private Random enemyRandom; private GameObject HiveProjectile; private bool EggSpawned = false; private bool EggDropped = false; private float SecondsUntilNextSpawnAttempt = 15f; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(BabyLurkerEgg), LogSourceType.Thing); private void OnTriggerStay(Collider other) { PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (((Component)other).gameObject.CompareTag("Player") && EggSpawned && !EggDropped) { SpawnProjectileServerRpc((int)component.actualClientId); } } private void Start() { enemyRandom = new Random(StartOfRound.Instance.randomMapSeed); SecondsUntilNextSpawnAttempt = enemyRandom.Next(15, 40); ScanNode.creatureScanID = ((IEnumerable)Enemies.spawnableEnemies).FirstOrDefault((Func)((SpawnableEnemy x) => x.enemy.enemyName == "Baby Lurker")).terminalNode.creatureFileID; SpawnEgg(); } private void Update() { if (!EggSpawned) { if (SecondsUntilNextSpawnAttempt > 0f) { SecondsUntilNextSpawnAttempt -= Time.deltaTime; } else if (enemyRandom.Next(0, 100) < 60) { SpawnEggServerRpc(); } else { SecondsUntilNextSpawnAttempt = enemyRandom.Next(15, 40); } } } public void SpawnEgg() { //IL_0031: 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_0041: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (!EggSpawned) { HiveMesh.SetActive(true); MapDot.SetActive(true); RaycastHit val = default(RaycastHit); if (Physics.Linecast(TraceTransform.position, TraceTransform.position + Vector3.up * 5000f, ref val, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { HiveMesh.transform.position = ((RaycastHit)(ref val)).point; HiveMesh.transform.rotation = new Quaternion(180f, 0f, 0f, 0f); Log.Info("Lurker Egg active!"); EggSpawned = true; } else { Log.Warning("Lurker Egg Line trace failed!"); } } } [ServerRpc] public void SpawnEggServerRpc() { //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(1413104468u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1413104468u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnEggClientRpc(); } } [ClientRpc] public void SpawnEggClientRpc() { //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(2661667374u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2661667374u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnEgg(); } } } [ServerRpc(RequireOwnership = false)] public void SpawnProjectileServerRpc(int targetID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1224589768u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, targetID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1224589768u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnProjectileClientRpc(targetID); } } } [ClientRpc] public void SpawnProjectileClientRpc(int targetID) { //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) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2345419954u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, targetID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2345419954u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!EggDropped) { MapDot.SetActive(false); AudioSource component = ((Component)this).GetComponent(); if (component != null) { component.PlayOneShot(BreakoffSound[enemyRandom.Next(0, BreakoffSound.Length)]); } Log.Info("Lurker egg projectile being spawned!"); HiveProjectile = Object.Instantiate(projectileTemplate, DropTransform.position, DropTransform.rotation); HiveProjectile.GetComponent().TargetID = targetID; EggDropped = true; Object.Destroy((Object)(object)HiveMesh); } } 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(1413104468u, new RpcReceiveHandler(__rpc_handler_1413104468), "SpawnEggServerRpc"); ((NetworkBehaviour)this).__registerRpc(2661667374u, new RpcReceiveHandler(__rpc_handler_2661667374), "SpawnEggClientRpc"); ((NetworkBehaviour)this).__registerRpc(1224589768u, new RpcReceiveHandler(__rpc_handler_1224589768), "SpawnProjectileServerRpc"); ((NetworkBehaviour)this).__registerRpc(2345419954u, new RpcReceiveHandler(__rpc_handler_2345419954), "SpawnProjectileClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1413104468(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; ((BabyLurkerEgg)(object)target).SpawnEggServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2661667374(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; ((BabyLurkerEgg)(object)target).SpawnEggClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1224589768(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 targetID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetID); target.__rpc_exec_stage = (__RpcExecStage)1; ((BabyLurkerEgg)(object)target).SpawnProjectileServerRpc(targetID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2345419954(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 targetID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetID); target.__rpc_exec_stage = (__RpcExecStage)1; ((BabyLurkerEgg)(object)target).SpawnProjectileClientRpc(targetID); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BabyLurkerEgg"; } } public class EnforcerWeapon : GrabbableObject { public int RemainingRockets; public int RemainingLaserBlasts; public bool isTargetingLaser; public bool isLaunchingRocket; public void TargetLaser(Object target) { } public void LaunchRocket(Object target) { } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EnforcerWeapon"; } } public class EyeSecLaser : MonoBehaviour { public Transform StartPoint; public Transform EndPoint; public LineRenderer Laser; private float timeElapsed; private float LerpDuration = 8f; private Color myColor; public bool IsActive; private void Start() { if ((Object)(object)Laser == (Object)null) { Laser = ((Component)this).GetComponent(); } ((Renderer)Laser).enabled = false; Laser.startWidth = 0.5f; Laser.endWidth = 0.5f; } private void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Laser.SetPosition(0, StartPoint.position); Laser.SetPosition(1, EndPoint.position); if (timeElapsed < LerpDuration) { myColor = Color.Lerp(Color.green, Color.red, timeElapsed / LerpDuration); Laser.startColor = myColor; Laser.endColor = myColor; timeElapsed += Time.deltaTime; } else { timeElapsed = 0f; Laser.startColor = Color.red; Laser.endColor = Color.red; } } public void SetLaserEnabled(bool NewEnabled, float LaserSpeed) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) ((Renderer)Laser).enabled = NewEnabled; if (!NewEnabled) { Laser.startColor = Color.green; Laser.endColor = Color.green; timeElapsed = 0f; } else { timeElapsed = 0f; LerpDuration = LaserSpeed + 1f; } } } internal class EyeSecScanner : MonoBehaviour { public EyeSecAI myAI; private void OnTriggerStay(Collider other) { myAI.ScanOurEnemy(other); } } internal class SprintTotem : GrabbableObject { public AudioClip TotemBreakSound; public AudioSource AudioPlayer; public List TotemPieces = new List(); public MeshRenderer TotemCenter; private float TotemSecondsRemaining = 15f; private float TotemPercentage = 100f; private int DesiredTotemPieces; private int TotemPiecesRemaining = 6; private bool DoOnce; private int StartingScrapValue; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(SprintTotem), LogSourceType.Item); public void Awake() { Random random = new Random(StartOfRound.Instance.randomMapSeed); StartingScrapValue = random.Next(base.itemProperties.minValue, base.itemProperties.maxValue); StartingScrapValue = (int)Mathf.Round((float)StartingScrapValue * 0.4f); ((GrabbableObject)this).SetScrapValue(StartingScrapValue); } public override void Update() { ((GrabbableObject)this).Update(); if (!base.isPocketed && base.isHeld && base.playerHeldBy.isSprinting) { SetPlayerSpeedAndStamina(); ReduceTotemPercentage(); DoOnce = true; } if (DoOnce && base.isPocketed) { if (base.playerHeldBy.isSprinting) { base.playerHeldBy.sprintMultiplier = 2.25f; } else { base.playerHeldBy.sprintMultiplier = 1f; } DoOnce = false; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); SyncSecondsServerRpc(TotemSecondsRemaining); } private void SetPlayerSpeedAndStamina() { if (!((Object)(object)base.playerHeldBy == (Object)null)) { base.playerHeldBy.sprintMultiplier = 3f; base.playerHeldBy.sprintMeter = 1f; } } private void ReduceTotemPercentage() { TotemSecondsRemaining -= Time.deltaTime; TotemPercentage = TotemSecondsRemaining / 15f; DesiredTotemPieces = (int)Math.Ceiling(TotemPercentage * 6f); Log.Debug($"Seconds Remaining: {TotemSecondsRemaining} || Percentage: {TotemPercentage * 100f} || Desired Totem Pieces: {DesiredTotemPieces}"); if (DesiredTotemPieces <= 0) { AudioPlayer.PlayOneShot(TotemBreakSound); DestroyTotemServerRpc(); } else if (DesiredTotemPieces != TotemPiecesRemaining) { TotemPiecesRemaining = DesiredTotemPieces; UpdateTotemServerRpc(MakeNewTotemValue()); } } private int MakeNewTotemValue() { return base.scrapValue - StartingScrapValue / 6; } private void DestroyNextTotemSegment(bool silent) { if (!silent) { AudioPlayer.PlayOneShot(TotemBreakSound); } Object.Destroy((Object)(object)TotemPieces[TotemPieces.Count - 1]); TotemPieces.Remove(TotemPieces[TotemPieces.Count - 1]); } [ServerRpc] private void UpdateTotemServerRpc(int TotemValue) { //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)((NetworkBehaviour)this).__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(4029067965u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, TotemValue); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4029067965u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; UpdateTotemClientRpc(TotemValue); } } [ClientRpc] private void UpdateTotemClientRpc(int TotemValue) { //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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1309320128u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, TotemValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1309320128u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; UpdateTotem(TotemValue); } } } private void UpdateTotem(int TotemValue) { ((GrabbableObject)this).SetScrapValue(TotemValue); DestroyNextTotemSegment(silent: false); } [ServerRpc] private void SyncSecondsServerRpc(float NewSeconds) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 //IL_0122: 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_00dd: 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)((NetworkBehaviour)this).__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(1366449470u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewSeconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1366449470u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncSecondsClientRpc(NewSeconds); } } [ClientRpc] private void SyncSecondsClientRpc(float NewSeconds) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3650864618u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewSeconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3650864618u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncSeconds(NewSeconds); } } } private void SyncSeconds(float NewSeconds) { TotemSecondsRemaining = NewSeconds; } [ServerRpc] private void DestroyTotemServerRpc() { //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)((NetworkBehaviour)this).__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(3253130976u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3253130976u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DestroyTotemClientRpc(); } } [ClientRpc] private void DestroyTotemClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2381363167u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2381363167u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DestroyTotem(); } } } private void DestroyTotem() { ((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy); } protected override void __initializeVariables() { ((GrabbableObject)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(4029067965u, new RpcReceiveHandler(__rpc_handler_4029067965), "UpdateTotemServerRpc"); ((NetworkBehaviour)this).__registerRpc(1309320128u, new RpcReceiveHandler(__rpc_handler_1309320128), "UpdateTotemClientRpc"); ((NetworkBehaviour)this).__registerRpc(1366449470u, new RpcReceiveHandler(__rpc_handler_1366449470), "SyncSecondsServerRpc"); ((NetworkBehaviour)this).__registerRpc(3650864618u, new RpcReceiveHandler(__rpc_handler_3650864618), "SyncSecondsClientRpc"); ((NetworkBehaviour)this).__registerRpc(3253130976u, new RpcReceiveHandler(__rpc_handler_3253130976), "DestroyTotemServerRpc"); ((NetworkBehaviour)this).__registerRpc(2381363167u, new RpcReceiveHandler(__rpc_handler_2381363167), "DestroyTotemClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_4029067965(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 totemValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref totemValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprintTotem)(object)target).UpdateTotemServerRpc(totemValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1309320128(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 totemValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref totemValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprintTotem)(object)target).UpdateTotemClientRpc(totemValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1366449470(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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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 { float newSeconds = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newSeconds, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprintTotem)(object)target).SyncSecondsServerRpc(newSeconds); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3650864618(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float newSeconds = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newSeconds, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SprintTotem)(object)target).SyncSecondsClientRpc(newSeconds); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3253130976(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; ((SprintTotem)(object)target).DestroyTotemServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2381363167(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; ((SprintTotem)(object)target).DestroyTotemClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SprintTotem"; } } public class BatteryRecepticle : NetworkBehaviour { [InspectorName("Defaults")] public InteractTrigger triggerScript; public Transform BatteryTransform; public Transform ScrapShelfTransform; public BoxCollider BatteryHitbox; private WTOBattery? InsertedBattery = null; public Animator MachineAnimator; public AudioSource Noisemaker; public AudioClip FacilityPowerUp; public AudioSource Pistons; public AudioSource MachineAmbience; public MeshRenderer[] WallLights; public Material WallLightMat; public Color LightColor; public Light CenterLight; public GameObject ChargedBatteryPrefab; public GameObject DrainedBatteryPrefab; public GameObject ScrapShelfPrefab; private ScrapShelf? SpawnedScrapShelf = null; public GameObject BatteryRecepticleTransformPrefab; private NetworkObject? SpawnedBatteryRecepticleTransform = null; public Material FrontConsoleMaterial; public Material SideConsoleMaterial; public MeshRenderer MachineMesh; private WideDoorway[] Doorways; private bool sentBatteryIsHeldMessage = false; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(BatteryRecepticle), LogSourceType.Room); public void Start() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) Doorways = Object.FindObjectsByType((FindObjectsSortMode)0); CenterLight.intensity = 0f; MeshRenderer[] wallLights = WallLights; foreach (MeshRenderer val in wallLights) { ((Renderer)val).sharedMaterial = WallLightMat; } foreach (LightComponent item in from x in Object.FindObjectsOfType() where x.SetColorByDistance select x) { item.SetColorRelative(((Component)this).transform.position); } SpawnBatteryObjects(); } private void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && ((NetworkBehaviour)this).IsClient && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { WallLightMat.SetColor("_EmissiveColor", LightColor); UpdateClientBatteryState(); } } private void UpdateClientBatteryState() { if ((Object)(object)InsertedBattery == (Object)null) { ((Collider)BatteryHitbox).enabled = true; ((Behaviour)triggerScript).enabled = true; if (GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer is WTOBattery) { triggerScript.interactable = true; triggerScript.hoverTip = "Insert Battery : [E]"; } else { triggerScript.interactable = false; triggerScript.disabledHoverTip = "[Requires Battery]"; } } else { ((Collider)BatteryHitbox).enabled = false; triggerScript.interactable = false; triggerScript.disabledHoverTip = ""; if (((GrabbableObject)InsertedBattery).isHeld && !sentBatteryIsHeldMessage) { sentBatteryIsHeldMessage = true; SetInsertedBattery(null); } } } private RandomMapObject? FindChargedBatterySpawn() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = new List(); list.AddRange(Object.FindObjectsOfType()); float num = 80f; foreach (RandomMapObject item in list.Where((RandomMapObject x) => x.spawnablePrefabs.Contains(ChargedBatteryPrefab))) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); Log.Debug($"BATTERY DISTANCE: {num2}"); if (num2 > num) { list2.Add(item); } } Log.Debug($"Viable Battery Spawns: {list2.Count}"); if (list2.Count == 0) { Log.Error("NO VIABLE SPAWNS FOR BATTERY FOUND!"); return null; } Random random = new Random(); return list2[random.Next(0, list2.Count)]; } private void SpawnBatteryObjects() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { GameObject val = Object.Instantiate(BatteryRecepticleTransformPrefab, BatteryTransform.position, BatteryTransform.rotation, ((Component)this).transform); RoundManager.Instance.spawnedSyncedObjects.Add(val); SpawnedBatteryRecepticleTransform = val.GetComponent(); SpawnedBatteryRecepticleTransform.Spawn(true); GameObject val2 = Object.Instantiate(DrainedBatteryPrefab, BatteryTransform.position, BatteryTransform.rotation, ((Component)SpawnedBatteryRecepticleTransform).transform); RoundManager.Instance.spawnedSyncedObjects.Add(val2); val2.GetComponent().Spawn(true); SetInsertedBattery(val2.GetComponent()); GameObject val3 = Object.Instantiate(ScrapShelfPrefab, ScrapShelfTransform.position, ScrapShelfTransform.rotation, RoundManager.Instance.mapPropsContainer.transform); RoundManager.Instance.spawnedSyncedObjects.Add(val3); SpawnedScrapShelf = val3.GetComponent(); val3.GetComponent().Spawn(true); RandomMapObject val4 = FindChargedBatterySpawn(); if ((Object)(object)val4 != (Object)null) { GameObject val5 = Object.Instantiate(ChargedBatteryPrefab, ((Component)val4).transform.position, ((Component)val4).transform.rotation, RoundManager.Instance.mapPropsContainer.transform); RoundManager.Instance.spawnedSyncedObjects.Add(val5); val5.GetComponent().Spawn(true); } SyncSpawnedObjectsClientRpc(NetworkObjectReference.op_Implicit(SpawnedBatteryRecepticleTransform), NetworkObjectReference.op_Implicit(((Component)SpawnedScrapShelf).GetComponent())); } } public void TryInsertOrRemoveBattery(PlayerControllerB playerWhoTriggered) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsClient) { Log.Warning("TryInsertOrRemoveBattery must only be called on the client"); return; } Log.Info("Player triggered battery recepticle " + ((Object)((Component)this).gameObject).GetInstanceID()); WTOBattery insertedBattery = default(WTOBattery); if ((Object)(object)InsertedBattery != (Object)null && !InsertedBattery.HasCharge) { playerWhoTriggered.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)InsertedBattery).NetworkObject)); SetInsertedBattery(null); } else if (playerWhoTriggered.isHoldingObject && (Object)(object)playerWhoTriggered.currentlyHeldObjectServer != (Object)null && ((Component)playerWhoTriggered.currentlyHeldObjectServer).TryGetComponent(ref insertedBattery)) { Log.Info("Placing battery in recepticle"); if ((Object)(object)SpawnedBatteryRecepticleTransform == (Object)null) { Log.Error("SpawnedBatteryRecepticleTransform is null in TryInsertOrRemoveBattery. This should never happen."); return; } playerWhoTriggered.DiscardHeldObject(true, SpawnedBatteryRecepticleTransform, default(Vector3), true); SetInsertedBattery(insertedBattery); } } [ClientRpc] private void SyncSpawnedObjectsClientRpc(NetworkObjectReference batteryRecepticleTransformRef, NetworkObjectReference scrapShelfRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1379237444u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref batteryRecepticleTransformRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref scrapShelfRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1379237444u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref batteryRecepticleTransformRef)).TryGet(ref val3, (NetworkManager)null)) { SpawnedBatteryRecepticleTransform = ((Component)val3).GetComponent(); } else { Log.Error("Failed to get NetworkObject from SpawnedBatteryRecepticleTransform in SyncSpawnedObjectsClientRpc. This should never happen."); } NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref scrapShelfRef)).TryGet(ref val4, (NetworkManager)null)) { SpawnedScrapShelf = ((Component)val4).GetComponent(); } else { Log.Error("Failed to get ScrapShelf from SpawnedScrapShelf in SyncSpawnedObjectsClientRpc. This should never happen."); } } } [ServerRpc(RequireOwnership = false)] private void InsertBatteryServerRpc(NetworkObjectReference batteryNetObject, bool isNull, ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2891130335u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref batteryNetObject, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isNull, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2891130335u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; InsertBatteryClientRpc(batteryNetObject, isNull, new ClientRpcParams { Send = WTOBase.AllClientsButSender(rpcParams) }); } } } [ClientRpc] private void InsertBatteryClientRpc(NetworkObjectReference batteryNetObject, bool isNull, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(979752138u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref batteryNetObject, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref isNull, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 979752138u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val2 = default(NetworkObject); WTOBattery battery = default(WTOBattery); if (isNull) { UpdateInsertedBatteryStateOnClient(null); } else if (!((NetworkObjectReference)(ref batteryNetObject)).TryGet(ref val2, (NetworkManager)null)) { Log.Error("Failed to get NetworkObject from NetworkObjectReference in InsertBatteryClientRpc. This should never happen."); } else if (!((Component)val2).TryGetComponent(ref battery)) { Log.Error("NetworkObject passed to InsertBatteryClientRpc did not have a WTOBattery component. This should never happen."); } else { UpdateInsertedBatteryStateOnClient(battery); } } } private void UpdateInsertedBatteryStateOnClient(WTOBattery? battery) { InsertedBattery = battery; if ((Object)(object)InsertedBattery != (Object)null) { sentBatteryIsHeldMessage = false; ((GrabbableObject)InsertedBattery).EnablePhysics(false); if (InsertedBattery.HasCharge) { ((GrabbableObject)InsertedBattery).grabbable = false; TurnOnPower(); } else { ((GrabbableObject)InsertedBattery).grabbable = true; ((Collider)((Component)InsertedBattery).GetComponent()).enabled = true; } } } private void SetInsertedBattery(WTOBattery? battery) { //IL_007c: 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_005b: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = (((Object)(object)battery == (Object)null) ? ((Component)this).GetComponent() : ((Component)battery).GetComponent()); if (((NetworkBehaviour)this).IsClient) { try { UpdateInsertedBatteryStateOnClient(battery); } catch (Exception ex) { Log.Error("Error in SetInsertedBattery when client is calling: " + ex); } InsertBatteryServerRpc(NetworkObjectReference.op_Implicit(val), (Object)(object)battery == (Object)null); } else { InsertBatteryClientRpc(NetworkObjectReference.op_Implicit(val), (Object)(object)battery == (Object)null); } } private void TurnOnPower() { if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { Noisemaker.PlayOneShot(FacilityPowerUp); } SpawnedScrapShelf.OpenShelf(); MachineAmbience.Play(); Pistons.Play(); LightComponent[] array = Object.FindObjectsOfType(); LightComponent[] array2 = array; foreach (LightComponent lightComponent in array2) { lightComponent.SetLightColor(); lightComponent.SetLightBrightness(150); } Material[] materials = ((Renderer)MachineMesh).materials; materials[2] = SideConsoleMaterial; materials[11] = FrontConsoleMaterial; ((Renderer)MachineMesh).materials = materials; MachineAnimator.SetTrigger("PowerOn"); StartRoomLight startRoomLight = Object.FindObjectOfType(); startRoomLight.SetCentralRoomWhite(); ManageEnemies(); WideDoorway[] doorways = Doorways; foreach (WideDoorway wideDoorway in doorways) { wideDoorway.RaiseDoor(); } } private void ManageEnemies() { EyeSecAI.BuffedByMachineOn = true; } 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 ((NetworkBehaviour)this).__registerRpc(1379237444u, new RpcReceiveHandler(__rpc_handler_1379237444), "SyncSpawnedObjectsClientRpc"); ((NetworkBehaviour)this).__registerRpc(2891130335u, new RpcReceiveHandler(__rpc_handler_2891130335), "InsertBatteryServerRpc"); ((NetworkBehaviour)this).__registerRpc(979752138u, new RpcReceiveHandler(__rpc_handler_979752138), "InsertBatteryClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1379237444(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference batteryRecepticleTransformRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref batteryRecepticleTransformRef, default(ForNetworkSerializable)); NetworkObjectReference scrapShelfRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref scrapShelfRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BatteryRecepticle)(object)target).SyncSpawnedObjectsClientRpc(batteryRecepticleTransformRef, scrapShelfRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2891130335(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_0059: 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_005f: 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_0074: 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_008b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference batteryNetObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref batteryNetObject, default(ForNetworkSerializable)); bool isNull = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isNull, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((BatteryRecepticle)(object)target).InsertBatteryServerRpc(batteryNetObject, isNull, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_979752138(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_0059: 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_005f: 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_0074: 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_008b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference batteryNetObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref batteryNetObject, default(ForNetworkSerializable)); bool isNull = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isNull, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((BatteryRecepticle)(object)target).InsertBatteryClientRpc(batteryNetObject, isNull, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BatteryRecepticle"; } } public class FrankensteinBodyPoint : NetworkBehaviour { [InspectorName("Defaults")] public InteractTrigger triggerScript; public NetworkObject TableBodyContainer; public BoxCollider triggerCollider; private float updateInterval; private NetworkObject lastObjectAddedToTable; [HideInInspector] public GrabbableObject BodyGO; public RagdollGrabbableObject PlayerRagdoll; public Transform RespawnPos; public bool HasBody; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FrankensteinBodyPoint), LogSourceType.Room); private void Update() { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return; } if (updateInterval > 1f) { updateInterval = 0f; if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { triggerScript.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer is RagdollGrabbableObject; } } else { updateInterval += Time.deltaTime; } } public void AttachBody(PlayerControllerB player) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0069: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00d1: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (((Component)TableBodyContainer).GetComponentsInChildren().Length == 0 && !((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)player != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { Vector3 val = RoundManager.RandomPointInBounds(((Collider)triggerCollider).bounds); Bounds bounds = ((Collider)triggerCollider).bounds; val.y = ((Bounds)(ref bounds)).min.y; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(new Ray(val + Vector3.up * 3f, Vector3.down), ref val2, 8f, 1048640, (QueryTriggerInteraction)2)) { val = ((RaycastHit)(ref val2)).point; } val.y += player.currentlyHeldObjectServer.itemProperties.verticalOffset; val = ((Component)TableBodyContainer).transform.InverseTransformPoint(val); PutObjectOnTableServerRpc(NetworkObjectReference.op_Implicit(((Component)player.currentlyHeldObjectServer).gameObject.GetComponent())); player.DiscardHeldObject(true, TableBodyContainer, val, false); Log.Info("Body placed on frankenstein point"); } } [ServerRpc(RequireOwnership = false)] public void PutObjectOnTableServerRpc(NetworkObjectReference grabbableObjectNetObject) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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(3430143900u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref grabbableObjectNetObject, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3430143900u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref lastObjectAddedToTable, (NetworkManager)null)) { PutObjectOnTableClientRpc(grabbableObjectNetObject); } else { Log.Error("ServerRpc: Could not find networkobject in the object that was placed on table."); } } } [ClientRpc] public void PutObjectOnTableClientRpc(NetworkObjectReference grabbableObjectNetObject) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2738987581u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref grabbableObjectNetObject, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2738987581u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref lastObjectAddedToTable, (NetworkManager)null)) { ((Component)lastObjectAddedToTable).gameObject.GetComponentInChildren().EnablePhysics(false); BodyGO = ((Component)lastObjectAddedToTable).gameObject.GetComponentInChildren(); try { ref RagdollGrabbableObject playerRagdoll = ref PlayerRagdoll; GrabbableObject bodyGO = BodyGO; playerRagdoll = (RagdollGrabbableObject)(object)((bodyGO is RagdollGrabbableObject) ? bodyGO : null); } catch { Log.Error("Body is not a Ragdoll?!?"); } HasBody = true; if ((Object)(object)PlayerRagdoll != (Object)null) { Log.Debug($"Player Body ID is {PlayerRagdoll.bodyID.Value}"); } } else { Log.Error("ClientRpc: Could not find networkobject in the object that was placed on table."); } } 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 ((NetworkBehaviour)this).__registerRpc(3430143900u, new RpcReceiveHandler(__rpc_handler_3430143900), "PutObjectOnTableServerRpc"); ((NetworkBehaviour)this).__registerRpc(2738987581u, new RpcReceiveHandler(__rpc_handler_2738987581), "PutObjectOnTableClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3430143900(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference grabbableObjectNetObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref grabbableObjectNetObject, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinBodyPoint)(object)target).PutObjectOnTableServerRpc(grabbableObjectNetObject); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2738987581(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference grabbableObjectNetObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref grabbableObjectNetObject, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinBodyPoint)(object)target).PutObjectOnTableClientRpc(grabbableObjectNetObject); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "FrankensteinBodyPoint"; } } public class FrankensteinChemPoint : NetworkBehaviour { [InspectorName("Defaults")] public NetworkObject parentTo; public Collider placeableBounds; public InteractTrigger triggerScript; private int HeldChemicalColorIndex; private Chemical HeldChemical; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FrankensteinChemPoint), LogSourceType.Room); public bool hasChemical { get; private set; } private void Update() { if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { if ((Object)(object)HeldChemical != (Object)null && hasChemical && ((GrabbableObject)HeldChemical).isHeld) { HeldChemical = null; SetChemStateServerRpc(NewState: false, -1); } else if (hasChemical) { triggerScript.interactable = false; triggerScript.disabledHoverTip = "[Chemical Placed]"; } else { triggerScript.interactable = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer is Chemical; triggerScript.disabledHoverTip = "[No Chemicals in Hand]"; } } } public Chemical.ChemColor GetCurrentChemicalColor() { return (Chemical.ChemColor)HeldChemicalColorIndex; } public void ClearChemical() { HeldChemical?.EmptyBeaker(); } public void PlaceObject(PlayerControllerB playerWhoTriggered) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!playerWhoTriggered.isHoldingObject || !((Object)(object)playerWhoTriggered.currentlyHeldObjectServer != (Object)null)) { return; } Log.Info("Placing chem on chempoint"); Vector3 val = itemPlacementPosition(((Component)playerWhoTriggered.gameplayCamera).transform, playerWhoTriggered.currentlyHeldObjectServer); if (!(val == Vector3.zero)) { if ((Object)(object)parentTo != (Object)null) { val = ((Component)parentTo).transform.InverseTransformPoint(val); } HeldChemical = (Chemical)(object)playerWhoTriggered.currentlyHeldObjectServer; playerWhoTriggered.DiscardHeldObject(true, parentTo, val, false); SetChemStateServerRpc(NewState: true, (int)HeldChemical.GetCurrentColor()); } } private Vector3 itemPlacementPosition(Transform gameplayCamera, GrabbableObject heldObject) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0080: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(gameplayCamera.position, gameplayCamera.forward, ref val, 7f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { return Vector3.zero; } Bounds bounds = placeableBounds.bounds; if (((Bounds)(ref bounds)).Contains(((RaycastHit)(ref val)).point)) { return ((RaycastHit)(ref val)).point + Vector3.up * heldObject.itemProperties.verticalOffset; } return placeableBounds.ClosestPoint(((RaycastHit)(ref val)).point); } [ServerRpc(RequireOwnership = false)] private void SetChemStateServerRpc(bool NewState, int NextChemIndex) { //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_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_008c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2999327842u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewState, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, NextChemIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2999327842u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetChemStateClientRpc(NewState, NextChemIndex); } } } [ClientRpc] private void SetChemStateClientRpc(bool NewState, int NextChemIndex) { //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_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_008c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3339412649u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewState, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, NextChemIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3339412649u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetChemState(NewState, NextChemIndex); } } } private void SetChemState(bool NewState, int NextChemIndex) { hasChemical = NewState; HeldChemicalColorIndex = NextChemIndex; } 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 ((NetworkBehaviour)this).__registerRpc(2999327842u, new RpcReceiveHandler(__rpc_handler_2999327842), "SetChemStateServerRpc"); ((NetworkBehaviour)this).__registerRpc(3339412649u, new RpcReceiveHandler(__rpc_handler_3339412649), "SetChemStateClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2999327842(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_003e: 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) { bool newState = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newState, default(ForPrimitives)); int nextChemIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref nextChemIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinChemPoint)(object)target).SetChemStateServerRpc(newState, nextChemIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3339412649(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_003e: 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) { bool newState = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newState, default(ForPrimitives)); int nextChemIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref nextChemIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinChemPoint)(object)target).SetChemStateClientRpc(newState, nextChemIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "FrankensteinChemPoint"; } } public class FrankensteinTerminal : NetworkBehaviour { private enum Correctness { Correct, Partial, Wrong } [CompilerGenerated] private sealed class <>c__DisplayClass50_0 { public float startTime; public NetworkObjectReference netObjectRef; public NetworkObject netObject; public FrankensteinTerminal <>4__this; internal bool b__0() { return Time.realtimeSinceStartup - startTime > 20f || ((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null); } internal bool b__1() { return Time.realtimeSinceStartup - startTime > 20f || (Object)(object)<>4__this.PlayerToRevive.deadBody != (Object)null; } } [CompilerGenerated] private sealed class d__40 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Correctness[] Colorset; public FrankensteinTerminal <>4__this; private int 5__1; private Correctness <>s__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__40(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((Renderer)<>4__this.SwitchMesh).materials[1] = <>4__this.SwitchGreenMat; 5__1 = 0; while (5__1 < 4) { Log.Debug($"SLOT {5__1} is {Colorset[5__1]}"); Correctness correctness = Colorset[5__1]; <>s__2 = correctness; switch (<>s__2) { case Correctness.Correct: ((Renderer)<>4__this.LightMeshes[5__1]).materials[1].SetColor("_EmissiveColor", new Color(0f, 1f, 0f, 1f)); break; case Correctness.Partial: ((Renderer)<>4__this.LightMeshes[5__1]).materials[1].SetColor("_EmissiveColor", new Color(1f, 1f, 0f, 1f)); break; case Correctness.Wrong: ((Renderer)<>4__this.LightMeshes[5__1]).materials[1].SetColor("_EmissiveColor", new Color(1f, 0f, 0f, 1f)); break; } 5__1++; } <>2__current = (object)new WaitForSeconds(4f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__3 = 0; while (5__3 < 4) { ((Renderer)<>4__this.LightMeshes[5__3]).materials[1].SetColor("_EmissiveColor", new Color(0f, 0f, 0f, 1f)); 5__3++; } ((Renderer)<>4__this.SwitchMesh).materials[1] = <>4__this.SwitchRedMat; <>4__this.AllowGuesses = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__37 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int Correctness; public FrankensteinTerminal <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00af: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; Log.Debug("Telling Visuals script to start visuals ..."); <>4__this.Visuals.StartVisuals(); <>2__current = (object)new WaitForSeconds(7f); <>1__state = 1; return true; case 1: <>1__state = -1; if (Correctness > 50) { <>4__this.ReviveDeadPlayerServerRpc(<>4__this.PlayerID, <>4__this.SpawnTarget); } else { <>4__this.CreateMimicServerRpc(<>4__this.PlayerID, <>4__this.SpawnTarget); } ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.StartScene(Correctness)); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__50 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int ID; public NetworkObjectReference netObjectRef; public FrankensteinTerminal <>4__this; private <>c__DisplayClass50_0 <>8__1; private MaskedPlayerEnemy 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass50_0(); <>8__1.netObjectRef = netObjectRef; <>8__1.<>4__this = <>4__this; <>4__this.PlayerToRevive = StartOfRound.Instance.allPlayerScripts[ID]; <>8__1.netObject = null; <>8__1.startTime = Time.realtimeSinceStartup; <>2__current = (object)new WaitUntil((Func)(() => Time.realtimeSinceStartup - <>8__1.startTime > 20f || ((NetworkObjectReference)(ref <>8__1.netObjectRef)).TryGet(ref <>8__1.netObject, (NetworkManager)null))); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.PlayerToRevive == (Object)null || (Object)(object)<>4__this.PlayerToRevive.deadBody == (Object)null) { <>8__1.startTime = Time.realtimeSinceStartup; <>2__current = (object)new WaitUntil((Func)(() => Time.realtimeSinceStartup - <>8__1.startTime > 20f || (Object)(object)<>8__1.<>4__this.PlayerToRevive.deadBody != (Object)null)); <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } <>4__this.PlayerToRevive.deadBody.DeactivateBody(false); if ((Object)(object)<>8__1.netObject == (Object)null) { return false; } Log.Debug("Got network object for WTOMimic enemy client"); 5__2 = ((Component)<>8__1.netObject).GetComponent(); 5__2.mimickingPlayer = <>4__this.PlayerToRevive; ((EnemyAI)5__2).SetEnemyOutside(false); 5__2.SetVisibilityOfMaskedEnemy(); if (((NetworkBehaviour)<>4__this).IsServer) { <>4__this.SyncMimicPropertiesServerRpc(<>8__1.netObjectRef, <>4__this.PlayerToRevive.currentSuitID); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const int NumberOfPoints = 4; public FrankensteinChemPoint[] FrankensteinChemPoints = new FrankensteinChemPoint[4]; public FrankensteinBodyPoint BodyPoint; public MeshRenderer[] LightMeshes; public MeshRenderer SwitchMesh; public Material SwitchRedMat; public Material SwitchGreenMat; public AudioClip FailSound; public AudioSource Noisemaker; public InteractTrigger GuessScript; public InteractTrigger ReviveScript; public FrankensteinVisuals Visuals; private bool ReviveStarted = false; private readonly Chemical.ChemColor[] GuessedColorList = new Chemical.ChemColor[4]; private readonly Chemical.ChemColor[] CorrectColors = new Chemical.ChemColor[4]; private PlayerControllerB PlayerToRevive; private Vector3 SpawnTarget; private int PlayerID; private int RemainingGuesses = 3; private bool AllowGuesses = true; private Random MyRandom; private bool IsUsedUp = false; private int PopulatedChemPoints; private static bool MimicSpawned = false; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(FrankensteinTerminal), LogSourceType.Room); private void Start() { MyRandom = new Random(StartOfRound.Instance.randomMapSeed); BodyPoint = Object.FindObjectOfType(); Visuals = Object.FindObjectOfType(); SetColorList(); } private void Update() { if ((Object)(object)BodyPoint == (Object)null) { BodyPoint = Object.FindObjectOfType(); } if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { ManageInteractor(GuessScript); ManageInteractor(ReviveScript); } } private void ManageInteractor(InteractTrigger Target) { if (IsUsedUp) { Target.interactable = false; Target.disabledHoverTip = ""; return; } if ((Object)(object)Target == (Object)(object)ReviveScript && !BodyPoint.HasBody) { Target.disabledHoverTip = "No Body on Bed!"; Target.interactable = false; return; } if ((Object)(object)Target == (Object)(object)GuessScript) { if (RemainingGuesses <= 0) { Target.interactable = false; Target.hoverTip = "No Guesses Remaining!"; return; } Target.hoverTip = $"Check Combination ({RemainingGuesses}) : [E]"; } Target.interactable = CheckAllChemPoints(AssignColors: false); Target.disabledHoverTip = $"[{PopulatedChemPoints}/{4} Chemicals Placed!]"; } public void GuessIfChemsAreCorrect(PlayerControllerB TriggeringPlayer) { if (!IsUsedUp && CheckAllChemPoints(AssignColors: true) && RemainingGuesses > 0 && AllowGuesses) { AllowGuesses = false; Correctness[] lightsServerRpc = CheckCorrectness(); SetLightsServerRpc(lightsServerRpc); } } public void TryRevive() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (IsUsedUp || !CheckAllChemPoints(AssignColors: true)) { return; } if ((Object)(object)BodyPoint == (Object)null || (Object)(object)BodyPoint.PlayerRagdoll == (Object)null) { Log.Error("Problem with body point!!!"); return; } SetVariablesServerRpc(BodyPoint.RespawnPos.position, BodyPoint.PlayerRagdoll.bodyID.Value); StartSceneServerRpc(CalculateCorrectnessPercentage()); FrankensteinChemPoint[] frankensteinChemPoints = FrankensteinChemPoints; foreach (FrankensteinChemPoint frankensteinChemPoint in frankensteinChemPoints) { frankensteinChemPoint.ClearChemical(); } IsUsedUp = true; } private Correctness[] CheckCorrectness() { Correctness[] array = new Correctness[4] { Correctness.Wrong, Correctness.Wrong, Correctness.Wrong, Correctness.Wrong }; Log.Debug("BEGIN PRINT CORRECT COLORS"); Chemical.ChemColor[] correctColors = CorrectColors; for (int i = 0; i < correctColors.Length; i++) { Chemical.ChemColor chemColor = correctColors[i]; Log.Debug(chemColor.ToString()); } Log.Debug("END PRINT CORRECT COLORS ; BEGIN PRINT GUESSED COLORS"); Chemical.ChemColor[] guessedColorList = GuessedColorList; for (int j = 0; j < guessedColorList.Length; j++) { Chemical.ChemColor chemColor2 = guessedColorList[j]; Log.Debug(chemColor2.ToString()); } Log.Debug("END PRINT GUESSED COLORS"); for (int k = 0; k < 4; k++) { if (CorrectColors[k] == GuessedColorList[k]) { array[k] = Correctness.Correct; } } for (int l = 0; l < 4; l++) { Chemical.ChemColor value = GuessedColorList[l]; if (array[l] != 0 && CorrectColors.Contains(value) && array[Array.IndexOf(GuessedColorList, value)] == Correctness.Wrong) { array[l] = Correctness.Partial; } } return array; } private int CalculateCorrectnessPercentage() { int num = 0; Correctness[] array = CheckCorrectness(); for (int i = 0; i < array.Length; i++) { switch (array[i]) { case Correctness.Correct: num += 25; break; case Correctness.Partial: num += 12; break; } } Log.Info($"CORRECTNESS SCORE IS {num}"); return num; } private void SetColorList() { List list = new List((Chemical.ChemColor[])Enum.GetValues(typeof(Chemical.ChemColor))); for (int i = 0; i < 4; i++) { Chemical.ChemColor chemColor = list[MyRandom.Next(0, list.Count - 1)]; CorrectColors[i] = chemColor; list.Remove(chemColor); Log.Debug($"COLOR NUMBER {i} IS {CorrectColors[i]}"); } } private bool CheckAllChemPoints(bool AssignColors) { PopulatedChemPoints = 0; for (int i = 0; i < 4; i++) { FrankensteinChemPoint frankensteinChemPoint = FrankensteinChemPoints[i]; if (!frankensteinChemPoint.hasChemical) { Array.Clear(GuessedColorList, 0, 4); if (AssignColors) { return false; } } else { PopulatedChemPoints++; if (AssignColors) { GuessedColorList[i] = frankensteinChemPoint.GetCurrentChemicalColor(); } } } return PopulatedChemPoints == 4; } [ServerRpc(RequireOwnership = false)] public void StartSceneServerRpc(int Correctness) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(935642341u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, Correctness); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 935642341u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Starting visuals on server..."); StartSceneClientRpc(Correctness); } } } [ClientRpc] public void StartSceneClientRpc(int Correctness) { //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(81816833u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, Correctness); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 81816833u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Starting visuals on client..."); ((MonoBehaviour)this).StartCoroutine(StartScene(Correctness)); } } } [IteratorStateMachine(typeof(d__37))] private IEnumerator StartScene(int Correctness) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__37(0) { <>4__this = this, Correctness = Correctness }; } [ServerRpc(RequireOwnership = false)] private void SetLightsServerRpc(Correctness[] Colorset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1451320865u, val, (RpcDelivery)0); bool flag = Colorset != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(Colorset, default(ForEnums)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1451320865u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetLightsClientRpc(Colorset); } } [ClientRpc] private void SetLightsClientRpc(Correctness[] Colorset) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(557552934u, val, (RpcDelivery)0); bool flag = Colorset != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(Colorset, default(ForEnums)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 557552934u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; RemainingGuesses--; ((MonoBehaviour)this).StartCoroutine(SetLightsAndWait(Colorset)); } } [IteratorStateMachine(typeof(d__40))] private IEnumerator SetLightsAndWait(Correctness[] Colorset) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__40(0) { <>4__this = this, Colorset = Colorset }; } [ServerRpc(RequireOwnership = false)] public void SetVariablesServerRpc(Vector3 TargetLoc, int iD) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: 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_00db: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(759198703u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref TargetLoc); BytePacker.WriteValueBitPacked(val2, iD); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 759198703u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetVariablesClientRpc(TargetLoc, iD); } } } [ClientRpc] public void SetVariablesClientRpc(Vector3 Target, int ID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_007e: 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_00db: 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_00e3: 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(2839149468u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref Target); BytePacker.WriteValueBitPacked(val2, ID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2839149468u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnTarget = Target; PlayerID = ID; PlayerToRevive = StartOfRound.Instance.allPlayerScripts[PlayerID]; } } } [ServerRpc(RequireOwnership = false)] public void ReviveDeadPlayerServerRpc(int ID, Vector3 SpawnLoc) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1233808099u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref SpawnLoc); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1233808099u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Reviving dead player " + StartOfRound.Instance.allPlayerScripts[ID].playerUsername + " on server..."); ReviveDeadPlayerClientRpc(ID, SpawnLoc); } } } [ClientRpc] public void ReviveDeadPlayerClientRpc(int ID, Vector3 SpawnLoc) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2137268098u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref SpawnLoc); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2137268098u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!ReviveStarted) { Log.Debug("Reviving dead player " + StartOfRound.Instance.allPlayerScripts[ID].playerUsername + " on client..."); ReviveDeadPlayer(ID, SpawnLoc); ReviveStarted = true; } } } public void ReviveDeadPlayer(int ID, Vector3 SpawnLoc) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) PlayerToRevive = StartOfRound.Instance.allPlayerScripts[ID]; if (!PlayerToRevive.isPlayerDead) { return; } Log.Debug("DEAD PLAYER INFO:"); Log.Debug("PLAYER Name: " + StartOfRound.Instance.allPlayerScripts[ID].playerUsername); Log.Debug($"PLAYER SCRIPT: {StartOfRound.Instance.allPlayerScripts[ID]}"); Log.Debug("Reviving players A"); PlayerToRevive.ResetPlayerBloodObjects(PlayerToRevive.isPlayerDead); PlayerToRevive.isClimbingLadder = false; PlayerToRevive.ResetZAndXRotation(); ((Collider)PlayerToRevive.thisController).enabled = true; PlayerToRevive.health = 100; PlayerToRevive.disableLookInput = false; Log.Debug("Reviving players B"); if (PlayerToRevive.isPlayerDead) { PlayerToRevive.isPlayerDead = false; PlayerToRevive.isPlayerControlled = true; PlayerToRevive.isInElevator = false; PlayerToRevive.isInHangarShipRoom = false; PlayerToRevive.isInsideFactory = true; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); PlayerToRevive.TeleportPlayer(BodyPoint.RespawnPos.position, false, 0f, false, true); PlayerToRevive.setPositionOfDeadPlayer = false; PlayerToRevive.DisablePlayerModel(StartOfRound.Instance.allPlayerObjects[ID], true, true); ((Behaviour)PlayerToRevive.helmetLight).enabled = false; PlayerToRevive.SetNightVisionEnabled((Object)(object)PlayerToRevive == (Object)(object)StartOfRound.Instance.localPlayerController); Log.Debug("Reviving players C"); PlayerToRevive.Crouch(false); PlayerToRevive.criticallyInjured = false; Animator playerBodyAnimator = PlayerToRevive.playerBodyAnimator; if (playerBodyAnimator != null) { playerBodyAnimator.SetBool("Limp", false); } PlayerToRevive.bleedingHeavily = false; PlayerToRevive.activatingItem = false; PlayerToRevive.twoHanded = false; PlayerToRevive.inSpecialInteractAnimation = false; PlayerToRevive.disableSyncInAnimation = false; PlayerToRevive.inAnimationWithEnemy = null; PlayerToRevive.holdingWalkieTalkie = false; PlayerToRevive.speakingToWalkieTalkie = false; Log.Debug("Reviving players D"); PlayerToRevive.isSinking = false; PlayerToRevive.isUnderwater = false; PlayerToRevive.sinkingValue = 0f; PlayerToRevive.statusEffectAudio.Stop(); PlayerToRevive.DisableJetpackControlsLocally(); PlayerToRevive.health = 100; Log.Debug("Reviving players E"); PlayerToRevive.mapRadarDotAnimator.SetBool("dead", false); if (((NetworkBehaviour)PlayerToRevive).IsOwner) { HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); PlayerToRevive.hasBegunSpectating = false; HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); PlayerToRevive.hinderedMultiplier = 1f; PlayerToRevive.isMovementHindered = 0; PlayerToRevive.sourcesCausingSinking = 0; Log.Debug("Reviving players E2"); } } Log.Debug("Reviving players F"); SoundManager.Instance.earsRingingTimer = 0f; PlayerToRevive.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[PlayerID] = 1f; SoundManager.Instance.SetPlayerPitch(1f, PlayerID); PlayerToRevive.currentVoiceChatAudioSource = null; Log.Debug("Reviving players G"); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)PlayerToRevive) { HUDManager.Instance.HideHUD(false); StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, PlayerToRevive); ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; HUDManager.Instance.UpdateHealthUI(100, false); } PlayerToRevive.bleedingHeavily = false; PlayerToRevive.criticallyInjured = false; PlayerToRevive.playerBodyAnimator.SetBool("Limp", false); PlayerToRevive.health = 100; PlayerToRevive.spectatedPlayerScript = null; Log.Debug("Reviving players H"); if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)BodyPoint.BodyGO).NetworkObject.Despawn(true); } Object.Destroy((Object)(object)BodyPoint.BodyGO); StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; Log.Debug($"New living player count: {StartOfRound.Instance.livingPlayers}"); StartOfRound.Instance.allPlayersDead = false; } [ServerRpc] public void SyncMimicPropertiesServerRpc(NetworkObjectReference MimicNetObject, int SuitID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_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(4004513445u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref MimicNetObject, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, SuitID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4004513445u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SyncMimicPropertiesClientRpc(MimicNetObject, SuitID); } } [ClientRpc] public void SyncMimicPropertiesClientRpc(NetworkObjectReference MimicNetObject, int SuitID) { //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_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_008c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(288134581u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref MimicNetObject, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, SuitID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 288134581u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref MimicNetObject)).TryGet(ref val3, (NetworkManager)null); MaskedPlayerEnemy component = ((Component)val3).GetComponent(); component.maskTypes[0].SetActive(false); component.maskTypes[1].SetActive(false); component.SetSuit(PlayerToRevive.currentSuitID); component.maskTypeIndex = 0; PlayerToRevive.redirectToEnemy = (EnemyAI)(object)component; component.mimickingPlayer = PlayerToRevive; PlayerToRevive.deadBody.DeactivateBody(false); } } } [ServerRpc(RequireOwnership = false)] public void CreateMimicServerRpc(int ID, Vector3 MimicCreationPoint) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_023f: 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_0257: 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_030c: 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(3614957312u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref MimicCreationPoint); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3614957312u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (MimicSpawned) { return; } MimicSpawned = true; PlayerToRevive = StartOfRound.Instance.allPlayerScripts[ID]; Log.Info("Server creating mimic from Frankenstein"); Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(MimicCreationPoint, default(NavMeshHit), 10f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { Log.Error("No nav mesh found; no WTOMimic could be created"); return; } EnemyType enemyType = StartOfRound.Instance.levels.First((SelectableLevel x) => x.PlanetName == "8 Titan").Enemies.First((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "Masked").enemyType; Log.Debug($"Mimic Found: {(Object)(object)enemyType != (Object)null}"); Log.Debug($"NAVMESHPOS: {navMeshPosition}"); Log.Debug("PLAYER: " + PlayerToRevive.playerUsername); Log.Debug($"MIMIC: {enemyType}"); NetworkObjectReference netObjectRef = RoundManager.Instance.SpawnEnemyGameObject(navMeshPosition, ((Component)PlayerToRevive).transform.eulerAngles.y, -1, enemyType); NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val3, (NetworkManager)null)) { Log.Debug("Got network object for WTOMimic"); MaskedPlayerEnemy component = ((Component)val3).GetComponent(); component.SetSuit(PlayerToRevive.currentSuitID); component.mimickingPlayer = PlayerToRevive; ((EnemyAI)component).SetEnemyOutside(false); component.SetVisibilityOfMaskedEnemy(); component.maskTypes[0].SetActive(false); component.maskTypes[1].SetActive(false); component.maskTypeIndex = 0; PlayerToRevive.redirectToEnemy = (EnemyAI)(object)component; DeadBodyInfo deadBody = PlayerToRevive.deadBody; if (deadBody != null) { deadBody.DeactivateBody(false); } } CreateMimicClientRpc(ID, netObjectRef); } [ClientRpc] public void CreateMimicClientRpc(int ID, NetworkObjectReference netObjectRef) { //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) //IL_0102: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1245307339u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, ID); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref netObjectRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1245307339u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitForMimicEnemySpawn(ID, netObjectRef)); } } } [IteratorStateMachine(typeof(d__50))] private IEnumerator WaitForMimicEnemySpawn(int ID, NetworkObjectReference netObjectRef) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__50(0) { <>4__this = this, ID = ID, netObjectRef = netObjectRef }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(935642341u, new RpcReceiveHandler(__rpc_handler_935642341), "StartSceneServerRpc"); ((NetworkBehaviour)this).__registerRpc(81816833u, new RpcReceiveHandler(__rpc_handler_81816833), "StartSceneClientRpc"); ((NetworkBehaviour)this).__registerRpc(1451320865u, new RpcReceiveHandler(__rpc_handler_1451320865), "SetLightsServerRpc"); ((NetworkBehaviour)this).__registerRpc(557552934u, new RpcReceiveHandler(__rpc_handler_557552934), "SetLightsClientRpc"); ((NetworkBehaviour)this).__registerRpc(759198703u, new RpcReceiveHandler(__rpc_handler_759198703), "SetVariablesServerRpc"); ((NetworkBehaviour)this).__registerRpc(2839149468u, new RpcReceiveHandler(__rpc_handler_2839149468), "SetVariablesClientRpc"); ((NetworkBehaviour)this).__registerRpc(1233808099u, new RpcReceiveHandler(__rpc_handler_1233808099), "ReviveDeadPlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(2137268098u, new RpcReceiveHandler(__rpc_handler_2137268098), "ReviveDeadPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(4004513445u, new RpcReceiveHandler(__rpc_handler_4004513445), "SyncMimicPropertiesServerRpc"); ((NetworkBehaviour)this).__registerRpc(288134581u, new RpcReceiveHandler(__rpc_handler_288134581), "SyncMimicPropertiesClientRpc"); ((NetworkBehaviour)this).__registerRpc(3614957312u, new RpcReceiveHandler(__rpc_handler_3614957312), "CreateMimicServerRpc"); ((NetworkBehaviour)this).__registerRpc(1245307339u, new RpcReceiveHandler(__rpc_handler_1245307339), "CreateMimicClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_935642341(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 correctness = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref correctness); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).StartSceneServerRpc(correctness); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_81816833(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 correctness = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref correctness); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).StartSceneClientRpc(correctness); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1451320865(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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); Correctness[] lightsServerRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref lightsServerRpc, default(ForEnums)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).SetLightsServerRpc(lightsServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_557552934(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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); Correctness[] lightsClientRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref lightsClientRpc, default(ForEnums)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).SetLightsClientRpc(lightsClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_759198703(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 targetLoc = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetLoc); int iD = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iD); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).SetVariablesServerRpc(targetLoc, iD); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2839149468(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 target2 = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref target2); int iD = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iD); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).SetVariablesClientRpc(target2, iD); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1233808099(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int iD = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iD); Vector3 spawnLoc = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnLoc); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).ReviveDeadPlayerServerRpc(iD, spawnLoc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2137268098(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int iD = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iD); Vector3 spawnLoc = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnLoc); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).ReviveDeadPlayerClientRpc(iD, spawnLoc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4004513445(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_008b: 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_00a9: 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_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 { NetworkObjectReference mimicNetObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref mimicNetObject, default(ForNetworkSerializable)); int suitID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref suitID); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).SyncMimicPropertiesServerRpc(mimicNetObject, suitID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_288134581(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_003e: 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_005c: 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) { NetworkObjectReference mimicNetObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref mimicNetObject, default(ForNetworkSerializable)); int suitID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref suitID); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).SyncMimicPropertiesClientRpc(mimicNetObject, suitID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3614957312(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int iD = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iD); Vector3 mimicCreationPoint = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref mimicCreationPoint); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).CreateMimicServerRpc(iD, mimicCreationPoint); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1245307339(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_0060: 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 iD = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iD); NetworkObjectReference netObjectRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref netObjectRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((FrankensteinTerminal)(object)target).CreateMimicClientRpc(iD, netObjectRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "FrankensteinTerminal"; } } public class HideSpot : NetworkBehaviour { protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "HideSpot"; } } internal class KitchenCrusher : MonoBehaviour { public Vector3 CrusherStartPos; public Vector3 CrusherEndPos; public AudioSource CrusherSound; public AudioClip SoundToPlay; public AudioClip ClickSound; public GameObject Crusher; private PlayerControllerB victim; private Random CrusherRandom; private bool ActivateCrusher; private readonly bool RetractCrusher = false; private readonly float LerpDuration = 0.3f; private float timeElapsed; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(KitchenCrusher), LogSourceType.Room); private void OnTriggerEnter(Collider other) { if (!((Component)other).gameObject.CompareTag("Player")) { return; } victim = ((Component)other).gameObject.GetComponent(); Log.Debug("Player colliding"); if (CrusherRandom.Next(1, 100) > 45) { if (!ActivateCrusher) { Log.Debug("activate crusher!"); ActivateCrusher = true; CrusherSound.PlayOneShot(SoundToPlay); } } else { CrusherSound.PlayOneShot(ClickSound); } } private void OnTriggerExit(Collider other) { if ((Object)(object)victim == (Object)(object)((Component)other).gameObject.GetComponent()) { victim = null; } } private void Start() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) CrusherRandom = new Random(StartOfRound.Instance.randomMapSeed); CrusherStartPos = Crusher.transform.position; CrusherEndPos = Crusher.transform.position + Vector3.Scale(new Vector3(-6f, 0f, -6f), Crusher.transform.right); } private void Update() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_00ab: Unknown result type (might be due to invalid IL or missing references) if (ActivateCrusher) { if (timeElapsed < LerpDuration) { Crusher.transform.position = Vector3.Lerp(CrusherStartPos, CrusherEndPos, timeElapsed / LerpDuration); timeElapsed += Time.deltaTime; if ((double)(timeElapsed / LerpDuration) > 0.75 && !((Object)(object)victim == (Object)null)) { victim.DamagePlayer(100, true, true, (CauseOfDeath)8, 0, false, default(Vector3)); } return; } ((MonoBehaviour)this).Invoke("SetCrusherRetract", 3f); ActivateCrusher = false; timeElapsed = 0f; } if (RetractCrusher) { Crusher.transform.position = Vector3.Lerp(CrusherEndPos, CrusherStartPos, timeElapsed / LerpDuration); timeElapsed += Time.deltaTime; } } } public class ScrapShelf : NetworkBehaviour { public Transform[] ScrapSpawnPoints; public Animator ShelfOpener; public AudioSource ShelfSFX; public void Start() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } List spawnableScrap = StartOfRound.Instance.currentLevel.spawnableScrap; List list = new List(); List list2 = new List(); foreach (SpawnableItemWithRarity item in spawnableScrap) { (item.spawnableItem.twoHanded ? list2 : list).Add(item); } Random random = new Random(StartOfRound.Instance.randomMapSeed); Transform[] scrapSpawnPoints = ScrapSpawnPoints; foreach (Transform val in scrapSpawnPoints) { SpawnableItemWithRarity val2 = ((random.Next(0, 100) < 80) ? list2[random.Next(0, list2.Count)] : list[random.Next(0, list.Count)]); GameObject val3 = Object.Instantiate(val2.spawnableItem.spawnPrefab, ((Component)val).transform.position, ((Component)val).transform.rotation, RoundManager.Instance.mapPropsContainer.transform); GrabbableObject component = val3.GetComponent(); int num = random.Next(component.itemProperties.minValue, component.itemProperties.maxValue); num = (int)Math.Round((double)num * 0.4); NetworkObject component2 = val3.GetComponent(); component2.Spawn(true); RoundManager.Instance.spawnedSyncedObjects.Add(val3); SetScrapValueClientRpc(NetworkObjectReference.op_Implicit(component2), num); } } public void OpenShelf() { ShelfOpener.SetTrigger("Open"); if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { ShelfSFX.Play(); } } [ClientRpc] public void SetScrapValueClientRpc(NetworkObjectReference ScrapToSet, int ScrapValue) { //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_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_008c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3927799021u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref ScrapToSet, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, ScrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3927799021u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref ScrapToSet)).TryGet(ref val3, (NetworkManager)null); GrabbableObject component = ((Component)val3).GetComponent(); if (component != null) { component.SetScrapValue(ScrapValue); } } } 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(3927799021u, new RpcReceiveHandler(__rpc_handler_3927799021), "SetScrapValueClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3927799021(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_003e: 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_005c: 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) { NetworkObjectReference scrapToSet = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref scrapToSet, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((ScrapShelf)(object)target).SetScrapValueClientRpc(scrapToSet, scrapValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ScrapShelf"; } } internal class TeslaCoil : NetworkBehaviour { public BoxCollider RangeBox; public GameObject SmallRing; public GameObject MediumRing; public GameObject LargeRing; public AudioSource StaticNoiseMaker; public AudioSource RingNoiseMaker; public AudioClip RingsOn; public AudioClip RingsOff; public AudioClip RingsActive; public AudioClip WalkieTalkieDie; public MeshRenderer[] Emissives; public Animator TeslaCoilAnim; private readonly WalkieTalkie NowYoureOnWalkies; [HideInInspector] private bool TeslaCoilOn = true; private bool AttemptedFireShotgun = false; private readonly List PlayerInRangeList = new List(); private readonly List WalkiesToReEnable = new List(); private readonly List FlashLightsToReEnable = new List(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(TeslaCoil), LogSourceType.Room); public void OnTriggerEnter(Collider other) { try { EyeSecAI component = ((Component)other).gameObject.GetComponent(); component.BuffedByTeslaCoil = true; } catch { } try { PlayerControllerB component2 = ((Component)other).gameObject.GetComponent(); if (!PlayerInRangeList.Contains(component2) && (Object)(object)component2 != (Object)null) { Log.Debug($"Adding Player {component2} to player in range list..."); PlayerInRangeList.Add(component2); } } catch { } try { RadarBoosterItem component3 = ((Component)other).gameObject.GetComponent(); component3.EnableRadarBooster(false); } catch { } } public void OnTriggerExit(Collider other) { try { EyeSecAI component = ((Component)other).gameObject.GetComponent(); ((Component)other).gameObject.GetComponent().BuffedByTeslaCoil = false; } catch { } try { PlayerControllerB component2 = ((Component)other).gameObject.GetComponent(); if (PlayerInRangeList.Contains(component2) && (Object)(object)component2 != (Object)null) { Log.Debug($"Removing Player {component2} from player in range list..."); ReEnableEquipment(component2); PlayerInRangeList.Remove(component2); } } catch { } } private void Start() { RecieveToggleTeslaCoil(enabled: false); RecieveToggleTeslaCoil(enabled: true); } private void Update() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!TeslaCoilOn) { return; } SpinRings(); if (PlayerInRangeList.Count <= 0) { return; } foreach (PlayerControllerB playerInRange in PlayerInRangeList) { if (Vector3.Distance(((Component)playerInRange).transform.position, ((Component)this).transform.position) > 30f) { PlayerInRangeList.Remove(playerInRange); } else { if (playerInRange.ItemSlots.Count() <= 0) { continue; } GrabbableObject[] itemSlots = playerInRange.ItemSlots; foreach (GrabbableObject val in itemSlots) { WalkieTalkie val2 = (WalkieTalkie)(object)((val is WalkieTalkie) ? val : null); if (val2 != null) { if (val.isBeingUsed) { if (!WalkiesToReEnable.Contains(val2)) { WalkiesToReEnable.Add(val2); } if (val2.clientIsHoldingAndSpeakingIntoThis) { val2.SwitchWalkieTalkieOn(false); SendDeathSFXServerRpc((int)playerInRange.actualClientId); } else { val2.SwitchWalkieTalkieOn(false); } } continue; } FlashlightItem val3 = (FlashlightItem)(object)((val is FlashlightItem) ? val : null); if (val3 != null) { if (((GrabbableObject)val3).isBeingUsed && !FlashLightsToReEnable.Contains(val3)) { FlashLightsToReEnable.Add(val3); } ((Component)val).GetComponent().SwitchFlashlight(false); continue; } BoomboxItem val4 = (BoomboxItem)(object)((val is BoomboxItem) ? val : null); if (val4 != null) { val4.StartMusic(false, false); continue; } PatcherTool val5 = (PatcherTool)(object)((val is PatcherTool) ? val : null); if (val5 != null) { val5.DisablePatcherGun(); continue; } RadarBoosterItem val6 = (RadarBoosterItem)(object)((val is RadarBoosterItem) ? val : null); if (val6 != null) { val6.EnableRadarBooster(false); continue; } ShotgunItem val7 = (ShotgunItem)(object)((val is ShotgunItem) ? val : null); if (val7 != null && !AttemptedFireShotgun) { ((GrabbableObject)val7).ItemActivate(true, true); AttemptedFireShotgun = true; } } } } } private void SpinRings() { SmallRing.transform.Rotate(0f, 0f, -160f * Time.deltaTime); MediumRing.transform.Rotate(0f, 0f, -160f * Time.deltaTime); LargeRing.transform.Rotate(0f, 0f, -160f * Time.deltaTime); } private void ToggleRings(bool State) { //IL_0031: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) TeslaCoilAnim.SetBool("Powered", State); MeshRenderer[] emissives = Emissives; foreach (MeshRenderer val in emissives) { Color color = ((Renderer)val).materials[0].GetColor("_EmissionColor"); ((Renderer)val).materials[0].SetColor("_EmissiveColor", color * (float)(State ? 1 : 0)); } AttemptedFireShotgun = false; if (!State) { StaticNoiseMaker.Stop(); RingNoiseMaker.clip = RingsOff; RingNoiseMaker.Play(); } else { StaticNoiseMaker.Play(); RingNoiseMaker.clip = RingsOn; RingNoiseMaker.Play(); } } public void RecieveToggleTeslaCoil(bool enabled) { ToggleTeslaCoilServerRpc(enabled); ToggleTeslaCoil(enabled); } private void ReEnableEquipment(PlayerControllerB PlayerToCheck) { GrabbableObject[] itemSlots = PlayerToCheck.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (((IEnumerable)WalkiesToReEnable).Contains(val)) { WalkiesToReEnable.Remove((WalkieTalkie)(object)((val is WalkieTalkie) ? val : null)); ((Component)val).GetComponent().SwitchWalkieTalkieOn(true); } if (((IEnumerable)FlashLightsToReEnable).Contains(val)) { FlashLightsToReEnable.Remove((FlashlightItem)(object)((val is FlashlightItem) ? val : null)); ((Component)val).GetComponent().SwitchFlashlight(true); } } } [ServerRpc(RequireOwnership = false)] public void ToggleTeslaCoilServerRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3244037213u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3244037213u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ToggleTeslaCoilClientRpc(enabled); } } } [ClientRpc] public void ToggleTeslaCoilClientRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2018701398u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2018701398u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TeslaCoilOn != enabled) { ToggleTeslaCoil(enabled); } } } private void ToggleTeslaCoil(bool enabled) { TeslaCoilOn = enabled; ToggleRings(TeslaCoilOn); } [ServerRpc(RequireOwnership = false)] public void SendDeathSFXServerRpc(int PlayerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2351707874u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, PlayerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2351707874u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SendDeathSFXClientRpc(PlayerID); } } } [ClientRpc] public void SendDeathSFXClientRpc(int PlayerID) { //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(1094715219u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, PlayerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1094715219u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SendDeathSFX(PlayerID); } } } private void SendDeathSFX(int PlayerID) { NowYoureOnWalkies.BroadcastSFXFromWalkieTalkie(WalkieTalkieDie, PlayerID); } 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(3244037213u, new RpcReceiveHandler(__rpc_handler_3244037213), "ToggleTeslaCoilServerRpc"); ((NetworkBehaviour)this).__registerRpc(2018701398u, new RpcReceiveHandler(__rpc_handler_2018701398), "ToggleTeslaCoilClientRpc"); ((NetworkBehaviour)this).__registerRpc(2351707874u, new RpcReceiveHandler(__rpc_handler_2351707874), "SendDeathSFXServerRpc"); ((NetworkBehaviour)this).__registerRpc(1094715219u, new RpcReceiveHandler(__rpc_handler_1094715219), "SendDeathSFXClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3244037213(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TeslaCoil)(object)target).ToggleTeslaCoilServerRpc(enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2018701398(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TeslaCoil)(object)target).ToggleTeslaCoilClientRpc(enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2351707874(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 playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((TeslaCoil)(object)target).SendDeathSFXServerRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1094715219(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 playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((TeslaCoil)(object)target).SendDeathSFXClientRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TeslaCoil"; } } public class AcidWater : MonoBehaviour { public int UserSetDamageAmount; private float TimeSincePlayerDamaged = 0f; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(AcidWater), LogSourceType.Thing); private void OnTriggerStay(Collider other) { PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (((Component)other).gameObject.CompareTag("Player")) { DamageOverlappingPlayer(component, 0.5f, ref TimeSincePlayerDamaged, UserSetDamageAmount); } } public static void DamageOverlappingPlayer(PlayerControllerB victim, float TotalDamageTime, ref float TimeSinceDamageTaken, int DamageAmount) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (TimeSinceDamageTaken < TotalDamageTime) { TimeSinceDamageTaken += Time.deltaTime; } else if ((Object)(object)victim != (Object)null) { TimeSinceDamageTaken = 0f; victim.DamagePlayer(DamageAmount, true, true, (CauseOfDeath)9, 0, false, default(Vector3)); Log.Debug("New health amount: " + victim.health); } } } public class BearTrap : MonoBehaviour, IHittable { public int DamageAmount = 5; private float TimeSincePlayerDamaged = 0.5f; private float SecondsUntilNextRiseAttempt = 200f; public Animator BearTrapAnim; public bool IsBearTrapRaised = false; public Random BearTrapRandom; public bool IsBearTrapClosed; private readonly List PlayerInRangeList = new List(); private int BearTrapRiseChance = 70; public AudioClip CloseSound; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(BearTrap), LogSourceType.Thing); public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (!IsBearTrapClosed) { SetBearTrapOpenState(isOpen: false); } if (IsBearTrapRaised) { MoveBearTrap(ShouldRaise: false); } return true; } public void OnTriggerEnter(Collider other) { try { PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (!PlayerInRangeList.Contains(component) && (Object)(object)component != (Object)null) { Log.Debug($"Bear Trap: Adding Player {component} to player in range list..."); PlayerInRangeList.Add(component); SetBearTrapOpenState(isOpen: false); ((Component)this).GetComponent().PlayOneShot(CloseSound); } } catch { } } public void OnTriggerExit(Collider other) { try { PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (PlayerInRangeList.Contains(component) && (Object)(object)component != (Object)null) { Log.Debug($"Bear Trap: Removing Player {component} from player in range list..."); component.movementSpeed = 4.6f; component.jumpForce = 13f; PlayerInRangeList.Remove(component); MoveBearTrap(ShouldRaise: false); SetBearTrapOpenState(isOpen: true); } } catch { } } private void OnTriggerStay(Collider other) { if (!((Component)other).gameObject.CompareTag("Player")) { return; } PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (IsBearTrapClosed) { AcidWater.DamageOverlappingPlayer(component, 0.5f, ref TimeSincePlayerDamaged, 5); if (component.health > 1) { component.movementSpeed = 0.4f; component.jumpForce = 1f; } else { component.jumpForce = 13f; component.movementSpeed = 4.6f; } } } private void Start() { BearTrapRandom = new Random(StartOfRound.Instance.randomMapSeed); } private void Update() { if (!IsBearTrapRaised) { if (SecondsUntilNextRiseAttempt > 0f) { SecondsUntilNextRiseAttempt -= Time.deltaTime; } else { TryBearTrapRise(); } } } private void TryBearTrapRise() { if (BearTrapRandom.Next(0, 100) > 70) { MoveBearTrapServerRpc(ShouldRaise: true); return; } SecondsUntilNextRiseAttempt = BearTrapRandom.Next(15, 50); if (BearTrapRiseChance > 0) { BearTrapRiseChance -= 10; } } [ServerRpc] public void MoveBearTrapServerRpc(bool ShouldRaise) { MoveBearTrap(ShouldRaise); } private void MoveBearTrap(bool ShouldRaise) { IsBearTrapRaised = ShouldRaise; if (ShouldRaise) { SetBearTrapOpenState(isOpen: true); BearTrapAnim.SetBool("IsRaised", true); } else { BearTrapAnim.SetBool("IsRaised", false); SecondsUntilNextRiseAttempt = BearTrapRandom.Next(15, 50); } } private void SetBearTrapOpenState(bool isOpen) { if (isOpen) { BearTrapAnim.SetBool("CloseTrap", false); IsBearTrapClosed = false; } else { BearTrapAnim.SetBool("CloseTrap", true); IsBearTrapClosed = true; } } } internal class BlinkingMonitors : MonoBehaviour { } public class ContourMapRender : MonoBehaviour { [SerializeField] private Vector3 contourMin = new Vector3(-200f, 150f, -150f); [SerializeField] private Vector3 contourMax = new Vector3(100f, 150f, 180f); private const float MapPixelSize = 0.7f; [SerializeField] private LayerMask raycastMask = LayerMask.op_Implicit(-1); [SerializeField] private MeshCollider[] enableColliders = Array.Empty(); [SerializeField] private Collider[] disableColliders = Array.Empty(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(ContourMapRender), LogSourceType.Thing); private void Start() { if (WTOBase.WTOStartupType.Value == StartupType.ContourMapRender) { CaptureDepthMap(); Application.Quit(0); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void CaptureDepthMap() { //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_00b7: 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_0103: 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) PrepareCollidersForRaycast(); try { int num = Mathf.CeilToInt((contourMax.x - contourMin.x) / 0.7f); int num2 = Mathf.CeilToInt((contourMax.z - contourMin.z) / 0.7f); Color[] array = (Color[])(object)new Color[num * num2]; Ray val = default(Ray); RaycastHit val2 = default(RaycastHit); for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { ((Ray)(ref val))..ctor(new Vector3(contourMin.x + (float)j * 0.7f, contourMin.y, contourMin.z + (float)i * 0.7f), Vector3.down); float num3 = 1000f; if (Physics.Raycast(val, ref val2, 1000f, LayerMask.op_Implicit(raycastMask), (QueryTriggerInteraction)1)) { num3 = ((RaycastHit)(ref val2)).distance; } int num4 = (num2 - 1 - i) * num + j; array[num4] = new Color(num3, 0f, 0f, 1f); } if ((i & 0x7F) == 0) { Log.Info($"Contour depth capture progress: {i}/{num2} rows"); } } byte[] bytes = EncodeEXR(array, num, num2); File.WriteAllBytes(WTOBase.WTOContourMapWritePath.Value, bytes); Log.Info("Depth map saved to " + WTOBase.WTOContourMapWritePath.Value); } finally { RestoreColliders(); } } private byte[] EncodeEXR(Color[] pixels, int width, int height) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Texture2D val = new Texture2D(width, height, (TextureFormat)18, false); try { val.SetPixels(pixels); val.Apply(false, false); return ImageConversion.EncodeToEXR(val, (EXRFlags)1); } finally { Object.Destroy((Object)(object)val); } } private void PrepareCollidersForRaycast() { MeshCollider[] array = enableColliders; foreach (MeshCollider val in array) { ((Collider)val).enabled = true; } Collider[] array2 = disableColliders; foreach (Collider val2 in array2) { val2.enabled = false; } Physics.SyncTransforms(); } private void RestoreColliders() { MeshCollider[] array = enableColliders; foreach (MeshCollider val in array) { ((Collider)val).enabled = false; } Collider[] array2 = disableColliders; foreach (Collider val2 in array2) { val2.enabled = true; } Physics.SyncTransforms(); } } [ExecuteAlways] public class LightComponent : MonoBehaviour { [InspectorName("Default")] public Chemical.ChemColor InitLightColor = Chemical.ChemColor.Red; public int LightBrightness = 100; public Light TargetLight; public MeshRenderer ObjectWithMatToChange; public Material StartMat; public int LightMatIndex = 0; public bool CannotBeWhite; public bool SetColorByDistance; public Color CloseColor = Color.green; public Color FarColor = Color.red; public float MaxDistance = 300f; private static Random LightRandom; private static int LightOnChance = -1; private void Start() { if (LightRandom == null) { LightRandom = new Random(StartOfRound.Instance?.randomMapSeed ?? 0); } if (LightOnChance == -1) { int num = LightRandom.Next(4, 8); LightOnChance = num * 10; } if (LightRandom.Next(0, 100) > LightOnChance) { SetLightBrightness(0); SetLightColor(Chemical.ChemColor.Clear); } else { SetLightColor(InitLightColor); SetLightBrightness(LightBrightness); } } private void Update() { if (!Application.IsPlaying((Object)(object)this)) { SetLightColor(InitLightColor); SetLightBrightness(LightBrightness); } } public void SetLightColor() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_002f: 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) if (!CannotBeWhite) { Material val = new Material(StartMat); val.SetColor("_EmissiveColor", new Color(1f, 1f, 1f)); ((Renderer)ObjectWithMatToChange).sharedMaterial = val; TargetLight.color = new Color(1f, 1f, 1f); } } private void SetLightColor(Chemical.ChemColor NextColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(StartMat); val.SetColor("_EmissiveColor", Chemical.GetColorFromEnum(NextColor)); ((Renderer)ObjectWithMatToChange).sharedMaterial = val; TargetLight.color = Chemical.GetColorFromEnum(NextColor); } private void SetLightColor(Color NextColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(StartMat); val.SetColor("_EmissiveColor", NextColor); ((Renderer)ObjectWithMatToChange).sharedMaterial = val; TargetLight.color = NextColor; } public void SetLightBrightness(int Brightness) { TargetLight.intensity = Brightness; } public void SetColorRelative(Vector3 MachineLocation) { } } public class StartRoomLight : MonoBehaviour { public Light[] CentralLights; public MeshRenderer CentralPillar; public void SetCentralRoomWhite() { //IL_0015: 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) Material[] materials = ((Renderer)CentralPillar).materials; materials[6].SetColor("_EmissiveColor", Color.white); ((Renderer)CentralPillar).materials = materials; Light[] centralLights = CentralLights; foreach (Light val in centralLights) { val.color = Color.white; } } } public class TestRoom : NetworkBehaviour { private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(TestRoom), LogSourceType.Thing); [SerializeField] private GameObject returnTeleporterPosition; private GameObject? moonTeleporter; private List spawnedSyncedObjects = new List(); private void Start() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } GameObject val = GameObject.FindGameObjectWithTag("MapPropsContainer"); SpawnSyncedObject[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); NetworkObject val4 = default(NetworkObject); foreach (SpawnSyncedObject val2 in componentsInChildren) { GameObject val3 = Object.Instantiate(val2.spawnPrefab, ((Component)val2).transform.position, ((Component)val2).transform.rotation, val.transform); if ((Object)(object)val3 != (Object)null) { if (val3.TryGetComponent(ref val4)) { val4.Spawn(true); } else { Log.Warning("Spawned object " + ((Object)val3).name + " does not have a NetworkObject component and cannot be synced across the network."); Log.Warning("Spawned from sync object prefab: " + ((Object)val2.spawnPrefab).name); } spawnedSyncedObjects.Add(val3); } } } public Vector3 AttachMoonTeleporter(TestRoomTeleport moonTeleporter) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_003b: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) this.moonTeleporter = ((Component)moonTeleporter).gameObject; return returnTeleporterPosition.transform.position + Vector3.up * 3f + Vector3.forward * 5f; } public Vector3 GetReturnTeleporterTargetPosition() { //IL_0037: 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_0046: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)moonTeleporter == (Object)null) { Log.Error("Attempted to get moon teleporter position before it was attached. This should never happen."); return Vector3.zero; } return moonTeleporter.transform.position + Vector3.up * 3f + Vector3.forward * 5f; } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); if (!((NetworkBehaviour)this).IsServer) { return; } foreach (GameObject spawnedSyncedObject in spawnedSyncedObjects) { Object.Destroy((Object)(object)spawnedSyncedObject); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TestRoom"; } } public class TestRoomTeleport : NetworkBehaviour { public bool IsLevelTeleporter = false; private GameObject? spawnedTestRoom = null; private Vector3 target; private List spawnedSyncedObjects = new List(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(TestRoomTeleport), LogSourceType.Thing); public void OnTriggerEnter(Collider other) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = default(PlayerControllerB); if (((NetworkBehaviour)this).IsClient && ((Component)other).gameObject.TryGetComponent(ref val)) { OnTriggerEnterServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val)); } } private void Start() { if (!WTOBase.WTOTestRoom.Value) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public override void OnNetworkSpawn() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer && !IsLevelTeleporter) { TestRoom testRoom = Object.FindObjectOfType(); if ((Object)(object)testRoom == (Object)null) { Log.Error("Failed to find TestRoom in scene on spawn of TestRoomTeleport. This should never happen."); } else { target = testRoom.GetReturnTeleporterTargetPosition(); } } } [ServerRpc(RequireOwnership = false)] private void OnTriggerEnterServerRpc(NetworkBehaviourReference playerControllerReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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(2635091187u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerControllerReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2635091187u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkBehaviour val3 = default(NetworkBehaviour); if (!((NetworkBehaviourReference)(ref playerControllerReference)).TryGet(ref val3, (NetworkManager)null) || (Object)(object)val3 == (Object)null) { Log.Warning("Failed to get player controller reference in OnTriggerEnterServerRpc"); return; } if (IsLevelTeleporter) { MaybeSpawnTestRoom(); } OnTeleportPlayerClientRpc(target, NetworkBehaviourReference.op_Implicit(val3), new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(val3.OwnerClientId) } }); } [ClientRpc] private void OnTeleportPlayerClientRpc(Vector3 targetPosition, NetworkBehaviourReference playerControllerReference, ClientRpcParams rpcParams = default(ClientRpcParams)) { //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_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) //IL_0124: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4202417827u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref targetPosition); ((FastBufferWriter)(ref val)).WriteValueSafe(ref playerControllerReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4202417827u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkBehaviour val2 = default(NetworkBehaviour); if (!((NetworkBehaviourReference)(ref playerControllerReference)).TryGet(ref val2, (NetworkManager)null) || (Object)(object)val2 == (Object)null) { Log.Warning("Failed to get player controller reference in OnTeleportPlayerClientRpc"); } else { ((PlayerControllerB)((val2 is PlayerControllerB) ? val2 : null)).TeleportPlayer(targetPosition, false, 0f, false, true); } } } private void MaybeSpawnTestRoom() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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) if (!((Object)(object)spawnedTestRoom != (Object)null)) { GameObject val = WTOBase.ContextualLoadAsset("CustomDungeon/TestRoom.prefab", LogLoading: true); spawnedTestRoom = Object.Instantiate(val, new Vector3(500f, 500f, 500f), Quaternion.identity); TestRoom component = spawnedTestRoom.GetComponent(); target = component.AttachMoonTeleporter(this); WTOBase.WTOLogger log = Log; Vector3 position = spawnedTestRoom.transform.position; string? text = ((object)(Vector3)(ref position)).ToString(); position = target; log.Info("Spawned test room at " + text + " and set moon teleport target to " + ((object)(Vector3)(ref position)).ToString()); spawnedTestRoom.GetComponent().Spawn(true); } } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); if (!((Object)(object)spawnedTestRoom != (Object)null)) { return; } Object.Destroy((Object)(object)spawnedTestRoom); foreach (GameObject spawnedSyncedObject in spawnedSyncedObjects) { if ((Object)(object)spawnedSyncedObject != (Object)null) { spawnedSyncedObject.GetComponent().Despawn(true); } } spawnedSyncedObjects.Clear(); } 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 ((NetworkBehaviour)this).__registerRpc(2635091187u, new RpcReceiveHandler(__rpc_handler_2635091187), "OnTriggerEnterServerRpc"); ((NetworkBehaviour)this).__registerRpc(4202417827u, new RpcReceiveHandler(__rpc_handler_4202417827), "OnTeleportPlayerClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2635091187(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerControllerReference = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerControllerReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TestRoomTeleport)(object)target).OnTriggerEnterServerRpc(playerControllerReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4202417827(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 targetPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPosition); NetworkBehaviourReference playerControllerReference = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerControllerReference, default(ForNetworkSerializable)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TestRoomTeleport)(object)target).OnTeleportPlayerClientRpc(targetPosition, playerControllerReference, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "TestRoomTeleport"; } } internal class WideDoorway : NetworkBehaviour { [CompilerGenerated] private sealed class d__23 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public WideDoorway <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.timeElapsed += Time.deltaTime; Log.Debug($"Current Lerp Position: {<>4__this.timeElapsed / 0.2f}"); ((Component)<>4__this.Doorway).transform.position = Vector3.Lerp(<>4__this.CurrentDoorPosition, <>4__this.TargetDoorPosition, <>4__this.timeElapsed / 0.2f); if (<>4__this.timeElapsed / 0.2f >= 1f) { <>4__this.ShouldFall = false; ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.CloseDoor()); } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public BoxCollider OverlapTrigger; public Transform Doorway; public AudioClip CloseSound; public AudioSource CloseSoundSource; private const float TotalDistanceToTravel = -4f; private float DistanceToTravelEachTime; private Vector3 FinalDoorPosition; private float timeElapsed; private const float CloseTime = 0.2f; private Vector3 DoorStartPosition; private Vector3 CurrentDoorPosition; private Vector3 TargetDoorPosition; private readonly List CurrentColliderList = new List(); private bool ShouldFall; private int TotalTimesBeforeClose; private Random MyRandom; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(WideDoorway), LogSourceType.Thing); private void Start() { //IL_0064: 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_007d: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) MyRandom = new Random(StartOfRound.Instance.randomMapSeed); int num = GameObject.FindGameObjectsWithTag("Player").Count(); int num2 = 3 * num - 1 + 6; int maxValue = num2 + 5; TotalTimesBeforeClose = MyRandom.Next(num2, maxValue); DistanceToTravelEachTime = -4f / (float)TotalTimesBeforeClose; FinalDoorPosition = ((Component)Doorway).transform.position + new Vector3(0f, -4f, 0f); DoorStartPosition = ((Component)Doorway).transform.position; } public void RaiseDoor() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((Component)Doorway).transform.position = DoorStartPosition; CloseSoundSource.Play(); } private void Update() { if (ShouldFall) { ((MonoBehaviour)this).StartCoroutine(CloseDoor()); if (!CloseSoundSource.isPlaying) { CloseSoundSource.Play(); } } } private void OnTriggerEnter(Collider other) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!CurrentColliderList.Contains(other) && ((Component)other).gameObject.CompareTag("Player") && !(((Component)Doorway).transform.position.y <= FinalDoorPosition.y)) { CurrentColliderList.Add(other); Log.Debug("Doorway Trigger Entered!"); ((MonoBehaviour)this).StopCoroutine(CloseDoor()); SetDoorVariables(); ShouldFall = true; } } private void OnTriggerExit(Collider other) { CurrentColliderList.Remove(other); } private void SetDoorVariables() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) TargetDoorPosition = ((Component)Doorway).transform.position + new Vector3(0f, DistanceToTravelEachTime, 0f); ShouldFall = false; CurrentDoorPosition = ((Component)Doorway).transform.position; timeElapsed = 0f; } [IteratorStateMachine(typeof(d__23))] private IEnumerator CloseDoor() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__23(0) { <>4__this = this }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WideDoorway"; } } } namespace Welcome_To_Ooblterra.Enemies { public class AdultWandererAI : WTOEnemy { private class Spawn : BehaviorState { private int SpawnTimer; private readonly int SpawnTime = 80; public override List transitions { get; set; } = new List { new EvaluateEnemyState() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { Log.Info("SPAWN WANDERER"); creatureAnimator.SetBool("Spawn", true); ((EnemyAI)AWandList[enemyIndex]).creatureSFX.PlayOneShot(AWandList[enemyIndex].SpawnSound); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if (SpawnTimer > SpawnTime) { AWandList[enemyIndex].spawnFinished = true; } else { SpawnTimer++; } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Spawn", false); } } private class WaitForTargetLook : BehaviorState { private int LookWaitTime = 0; private readonly int LookWaitTimer = 3500; public override List transitions { get; set; } = new List { new EvaluatePlayerLook() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Moving", false); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if (LookWaitTime > LookWaitTimer) { AWandList[enemyIndex].LostPatience = true; } else { LookWaitTime++; } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class Attack : BehaviorState { private bool HasAttacked; public override List transitions { get; set; } = new List { new EnemyKilled(), new EnemyLeftRange(), new EnemyInShipOrFacility() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { AWandList[enemyIndex].AttackCooldownSeconds = 1.5f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if (AWandList[enemyIndex].PlayerWithinRange(AWandList[enemyIndex].AttackRange, IncludeYAxis: false)) { if (AWandList[enemyIndex].AttackCooldownSeconds <= 0f) { AWandList[enemyIndex].AttackCooldownSeconds = 1.5f; HasAttacked = false; return; } if (AWandList[enemyIndex].AttackCooldownSeconds <= 1.2f) { creatureAnimator.SetBool("Attacking", true); } if (AWandList[enemyIndex].AttackCooldownSeconds <= 0.76f && !HasAttacked) { Log.Info($"Attacking Player {((EnemyAI)AWandList[enemyIndex]).targetPlayer}"); AWandList[enemyIndex].MeleeAttackPlayer(((EnemyAI)AWandList[enemyIndex]).targetPlayer); HasAttacked = true; } } else { AWandList[enemyIndex].AttackCooldownSeconds = 0f; } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Attacking", false); } } private class Roam : BehaviorState { public override List transitions { get; set; } = new List { new StartInvestigation(), new NewPlayerNearBy() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)AWandList[enemyIndex]).agent.speed = 7f; ((EnemyAI)AWandList[enemyIndex]).targetPlayer = null; creatureAnimator.SetBool("Moving", true); if (!AWandList[enemyIndex].RoamPlanet.inProgress) { ((EnemyAI)AWandList[enemyIndex]).StartSearch(((Component)AWandList[enemyIndex]).transform.position, AWandList[enemyIndex].RoamPlanet); } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!AWandList[enemyIndex].RoamPlanet.inProgress) { ((EnemyAI)AWandList[enemyIndex]).StartSearch(((Component)AWandList[enemyIndex]).transform.position, AWandList[enemyIndex].RoamPlanet); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Moving", false); } } private class Investigate : BehaviorState { public override List transitions { get; set; } = new List { new DoneInvestigating(), new NewPlayerNearBy() }; public Investigate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) RandomRange = new Vector2(12f, 17f); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { AWandList[enemyIndex].ReachedNextPoint = false; ((EnemyAI)AWandList[enemyIndex]).agent.speed = 0f; AWandList[enemyIndex].TotalInvestigationSeconds = MyRandomInt; ((EnemyAI)AWandList[enemyIndex]).creatureAnimator.speed = 1f; ((EnemyAI)AWandList[enemyIndex]).creatureAnimator.SetBool("Moving", false); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { AWandList[enemyIndex].MoveTimerValue(ref AWandList[enemyIndex].TotalInvestigationSeconds); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { AWandList[enemyIndex].ReachedNextPoint = false; } } private class Chase : BehaviorState { public override List transitions { get; set; } = new List { new EnemyInShipOrFacility(), new EnemyEnteredRange() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Moving", true); ((EnemyAI)AWandList[enemyIndex]).agent.speed = 9f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)AWandList[enemyIndex]).SetDestinationToPosition(((Component)((EnemyAI)AWandList[enemyIndex]).targetPlayer).transform.position, false); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Moving", false); } } private class Stunned : BehaviorState { public override List transitions { get; set; } = new List { new NoLongerStunned() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Stunned", true); ((EnemyAI)AWandList[enemyIndex]).agent.speed = 0f; AWandList[enemyIndex].SetTargetServerRpc((int)((EnemyAI)AWandList[enemyIndex]).stunnedByPlayer.playerClientId); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Stunned", false); ((EnemyAI)AWandList[enemyIndex]).agent.speed = 8f; } } private class EvaluateEnemyState : StateTransition { public override bool CanTransitionBeTaken() { return AWandList[enemyIndex].spawnFinished; } public override BehaviorState NextState() { if ((Object)(object)((EnemyAI)AWandList[enemyIndex]).targetPlayer == (Object)null) { return new Roam(); } return new WaitForTargetLook(); } } private class EvaluatePlayerLook : StateTransition { public override bool CanTransitionBeTaken() { if (AWandList[enemyIndex].CheckForPlayerLOS()) { return true; } return AWandList[enemyIndex].LostPatience; } public override BehaviorState NextState() { return new Attack(); } } private class EnemyInShipOrFacility : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)AWandList[enemyIndex]).targetPlayer == (Object)null) { return false; } return ((EnemyAI)AWandList[enemyIndex]).targetPlayer.isInsideFactory || (AWandList[enemyIndex].PlayerDistanceFromShip() < 10f && StartOfRound.Instance.hangarDoorsClosed); } public override BehaviorState NextState() { return new Investigate(); } } private class EnemyLeftShipOrFacility : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)AWandList[enemyIndex]).targetPlayer == (Object)null) { return false; } return AWandList[enemyIndex].PlayerCanBeTargeted(((EnemyAI)AWandList[enemyIndex]).targetPlayer) && AWandList[enemyIndex].PlayerDistanceFromShip() > 15f; } public override BehaviorState NextState() { return new Chase(); } } private class EnemyLeftRange : StateTransition { public override bool CanTransitionBeTaken() { return AWandList[enemyIndex].PlayerCanBeTargeted(((EnemyAI)AWandList[enemyIndex]).targetPlayer) && !AWandList[enemyIndex].PlayerWithinRange(AWandList[enemyIndex].AttackRange); } public override BehaviorState NextState() { return new Chase(); } } private class EnemyKilled : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)AWandList[enemyIndex]).targetPlayer == (Object)null) { return true; } return ((EnemyAI)AWandList[enemyIndex]).targetPlayer.isPlayerDead; } public override BehaviorState NextState() { AWandList[enemyIndex].SetTargetServerRpc(-1); return new Roam(); } } private class EnemyEnteredRange : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)AWandList[enemyIndex]).targetPlayer == (Object)null) { return false; } return AWandList[enemyIndex].PlayerWithinRange(AWandList[enemyIndex].AttackRange); } public override BehaviorState NextState() { return new Attack(); } } private class HitByStunGun : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)AWandList[enemyIndex]).stunNormalizedTimer > 0f && !(AWandList[enemyIndex].ActiveState is Stunned); } public override BehaviorState NextState() { return new Stunned(); } } private class NoLongerStunned : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)AWandList[enemyIndex]).stunNormalizedTimer <= 0f; } public override BehaviorState NextState() { return new Chase(); } } private class StartInvestigation : StateTransition { public override bool CanTransitionBeTaken() { return AWandList[enemyIndex].ReachedNextPoint; } public override BehaviorState NextState() { return new Investigate(); } } private class DoneInvestigating : StateTransition { public override bool CanTransitionBeTaken() { return AWandList[enemyIndex].TotalInvestigationSeconds <= 0f; } public override BehaviorState NextState() { return new Roam(); } } private class NewPlayerNearBy : StateTransition { public override bool CanTransitionBeTaken() { return (Object)(object)AWandList[enemyIndex].IsAnyPlayerWithinLOS(10, 80f, -1, DoLinecast: true, PrintResults: false, SortByDistance: true) != (Object)null; } public override BehaviorState NextState() { ((EnemyAI)AWandList[enemyIndex]).targetPlayer = AWandList[enemyIndex].IsAnyPlayerWithinLOS(10, 80f, -1, DoLinecast: true, PrintResults: false, SortByDistance: true); return new Chase(); } } private bool spawnFinished = false; private bool LostPatience = false; private float AttackCooldownSeconds = 1.2f; public int AttackRange = 7; public static Dictionary AWandList = new Dictionary(); public static int AWandID; public AudioClip SpawnSound; private float TotalInvestigationSeconds; private bool ReachedNextPoint = false; private readonly AISearchRoutine RoamPlanet = new AISearchRoutine(); public BoxCollider AdultBox; public CapsuleCollider AdultCapsule; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(AdultWandererAI), LogSourceType.Enemy); public override void Start() { base.InitialState = new Spawn(); AWandID++; WTOEnemyID = AWandID; PrintDebugs = true; Log.Info($"Adding Adult Wanderer {this} #{AWandID}"); AWandList.Add(AWandID, this); MyValidState = PlayerState.Outside; ((EnemyAI)this).enemyHP = 10; GlobalTransitions.Add(new HitByStunGun()); base.Start(); } public override void Update() { MoveTimerValue(ref AttackCooldownSeconds); base.Update(); } private void MeleeAttackPlayer(PlayerControllerB Target) { //IL_001d: 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) Log.Info("Attacking player!"); Target.DamagePlayer(40, true, true, (CauseOfDeath)1, 0, false, default(Vector3)); if ((Object)(object)Target == (Object)(object)GameNetworkManager.Instance.localPlayerController) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true); } } public override void ReachedNodeInSearch() { ((EnemyAI)this).ReachedNodeInSearch(); ReachedNextPoint = true; } public bool CheckForPlayerLOS() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return ((EnemyAI)this).targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f); } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (((EnemyAI)this).isEnemyDead) { return; } ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1); ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; Log.Debug("Adult Wanderer HP remaining: " + ((EnemyAI)this).enemyHP); ((EnemyAI)this).creatureAnimator.SetTrigger("Hit"); if (((EnemyAI)this).enemyHP <= 0) { ((EnemyAI)this).isEnemyDead = true; ((EnemyAI)this).creatureAnimator.SetTrigger("Killed"); ((EnemyAI)this).creatureVoice.Stop(); Object.Destroy((Object)(object)AdultBox); Object.Destroy((Object)(object)AdultCapsule); if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } else { SetTargetServerRpc((int)playerWhoHit.playerClientId); OverrideState(new Attack()); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "AdultWandererAI"; } } public class BabyLurkerAI : WTOEnemy { private class Spawn : BehaviorState { public override List transitions { get; set; } = new List { new FoundNearestPlayer() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)BabyLurkerList[enemyIndex]).targetPlayer = BabyLurkerList[enemyIndex].FindNearestPlayer(); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if ((Object)(object)((EnemyAI)BabyLurkerList[enemyIndex]).targetPlayer == (Object)null) { Log.Debug("Attempting to find nearest player..."); ((EnemyAI)BabyLurkerList[enemyIndex]).targetPlayer = BabyLurkerList[enemyIndex].FindNearestPlayer(); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class ChasePlayer : BehaviorState { public override List transitions { get; set; } = new List { new TargetPlayerIsInLOS() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)BabyLurkerList[enemyIndex]).SetDestinationToPosition(((Component)((EnemyAI)BabyLurkerList[enemyIndex]).targetPlayer).transform.position, false); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)BabyLurkerList[enemyIndex]).SetDestinationToPosition(((Component)((EnemyAI)BabyLurkerList[enemyIndex]).targetPlayer).transform.position, false); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class WaitForAttackCooldown : BehaviorState { public override List transitions { get; set; } = new List { new CooldownFinished(), new PlayerLeftRange() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class ThrowSelfAtPlayer : BehaviorState { public override List transitions { get; set; } = new List(); public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { BabyLurkerList[enemyIndex].LaunchProjectile(); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class TargetPlayerIsInLOS : StateTransition { public override bool CanTransitionBeTaken() { return BabyLurkerList[enemyIndex].IsTargetPlayerWithinLOS(AttackRange, 90f); } public override BehaviorState NextState() { return new ThrowSelfAtPlayer(); } } private class PlayerLeftRange : StateTransition { public override bool CanTransitionBeTaken() { return !BabyLurkerList[enemyIndex].IsTargetPlayerWithinLOS(AttackRange, 90f); } public override BehaviorState NextState() { return new ChasePlayer(); } } private class FoundNearestPlayer : StateTransition { public override bool CanTransitionBeTaken() { return (Object)(object)((EnemyAI)BabyLurkerList[enemyIndex]).targetPlayer != (Object)null; } public override BehaviorState NextState() { return new ChasePlayer(); } } private class CooldownFinished : StateTransition { public override bool CanTransitionBeTaken() { return BabyLurkerList[enemyIndex].JumpCooldownSeconds <= 0f; } public override BehaviorState NextState() { return new ThrowSelfAtPlayer(); } } private class CooldownStarted : StateTransition { public override bool CanTransitionBeTaken() { return BabyLurkerList[enemyIndex].JumpCooldownSeconds > 0f; } public override BehaviorState NextState() { return new ChasePlayer(); } } [Header("Defaults")] public bool ThrowProjectile; public int ProjectilesThrown; public GameObject projectileTemplate; private readonly float launchVelocity = 700f; public Transform LaunchTransform; public static int AttackRange = 5; private float JumpCooldownSeconds = 3f; public SkinnedMeshRenderer LurkerMesh; public MeshRenderer ArachnophobiaMesh; private bool IsArachnophobiaMode; private GameObject LiveProjectile; public static Dictionary BabyLurkerList = new Dictionary(); private static int BabyLurkerID; public bool ThrowingSelfAtPlayer; public GameObject LurkerBody; private readonly List LivingPlayers = new List(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(BabyLurkerAI), LogSourceType.Enemy); public override void Start() { MyValidState = PlayerState.Inside; base.InitialState = new Spawn(); PrintDebugs = false; BabyLurkerID++; WTOEnemyID = BabyLurkerID; ((EnemyAI)this).agent.speed = 7f; Log.Info($"Adding BabyLurker {this} #{BabyLurkerID}"); BabyLurkerList.Add(BabyLurkerID, this); base.Start(); } public override void Update() { base.Update(); if (IsArachnophobiaMode != IngamePlayerSettings.Instance.unsavedSettings.spiderSafeMode) { IsArachnophobiaMode = IngamePlayerSettings.Instance.unsavedSettings.spiderSafeMode; ((Renderer)ArachnophobiaMesh).enabled = IsArachnophobiaMode; ((Renderer)LurkerMesh).enabled = !IsArachnophobiaMode; } MoveTimerValue(ref JumpCooldownSeconds); if (!((Object)(object)((EnemyAI)this).targetPlayer != (Object)null) || (!((EnemyAI)this).targetPlayer.isPlayerDead && ((EnemyAI)this).targetPlayer.isInsideFactory)) { return; } LivingPlayers.Clear(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isInsideFactory && val.isPlayerControlled) { LivingPlayers.Add(val); } } if (LivingPlayers.Count > 0) { ((EnemyAI)this).targetPlayer = LivingPlayers[enemyRandom.Next(0, LivingPlayers.Count)]; Log.Debug("setting new baby lurker target! " + ((EnemyAI)this).targetPlayer.playerUsername); } else { Log.Warning("No target for baby lurkers!"); } } public bool CheckIfWeAreFirstToJump() { foreach (BabyLurkerAI value in BabyLurkerList.Values) { if (value.ThrowingSelfAtPlayer) { return false; } } return true; } public void LaunchProjectile() { //IL_007f: 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_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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) ThrowingSelfAtPlayer = true; if (ProjectilesThrown <= 0) { LurkerBody.SetActive(false); ((EnemyAI)this).creatureSFX.volume = 0f; ((EnemyAI)this).creatureVoice.volume = 0f; ProjectilesThrown++; ((EnemyAI)this).agent.speed = 0f; LaunchTransform.LookAt(((Component)((EnemyAI)this).targetPlayer.gameplayCamera).transform.position); Transform launchTransform = LaunchTransform; launchTransform.rotation *= Quaternion.Euler(-3f, (float)enemyRandom.Next(-15, 15), 0f); LiveProjectile = Object.Instantiate(projectileTemplate, LaunchTransform.position, LaunchTransform.rotation); LiveProjectile.GetComponent().OwningLurker = this; LiveProjectile.GetComponent().AddRelativeForce(new Vector3(0f, 0f, launchVelocity)); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BabyLurkerAI"; } } public class EnforcerAI : WTOEnemy { private class GoToHidingSpot : BehaviorState { private bool EnforcerMovingToHidePoint; private Vector3 NextDestination; public override List transitions { get; set; } = new List { new FoundHidingSpot() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EnforcerMovingToHidePoint = false; EnforcerList[enemyIndex].PlayerStareAtTimer = 0f; EnforcerList[enemyIndex].IsBeingSeenByPotentialTarget = false; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); EnforcerList[enemyIndex].EnforcerShouldKeepTrackOfTargetPlayer = false; EnforcerList[enemyIndex].PotentialTarget = null; ((EnemyAI)EnforcerList[enemyIndex]).targetPlayer = null; ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = 8f; EnforcerList[enemyIndex].SetActiveCamoState(SetCamoOn: true); EnforcerList[enemyIndex].DetermineNextHidePoint(); ((EnemyAI)EnforcerList[enemyIndex]).creatureSFX.volume = 1f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0077: Unknown result type (might be due to invalid IL or missing references) if (!EnforcerMovingToHidePoint) { Log.Debug("Current hide point not valid, choosing another..."); EnforcerList[enemyIndex].DetermineNextHidePoint(); NextDestination = RoundManager.Instance.GetRandomNavMeshPositionInRadius(EnforcerList[enemyIndex].NextHidePoint.transform.position, 2f, default(NavMeshHit)); EnforcerMovingToHidePoint = ((EnemyAI)EnforcerList[enemyIndex]).SetDestinationToPosition(NextDestination, true); } if (Vector3.Distance(((Component)EnforcerList[enemyIndex]).transform.position, NextDestination) < 1f) { EnforcerList[enemyIndex].ReachedNextPoint = true; } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); } } private class WaitForPlayerToPass : BehaviorState { public override List transitions { get; set; } = new List { new PlayerPassedBy(), new PlayerStaringAtUs() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) EnforcerList[enemyIndex].ReachedNextPoint = false; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); ((Component)EnforcerList[enemyIndex]).transform.rotation = EnforcerList[enemyIndex].NextHidePoint.transform.rotation; EnforcerList[enemyIndex].ShouldChasePotentialTarget = false; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EnforcerList[enemyIndex].RandomlyPlayIdleSound(SecondsUntilNextSound); if ((Object)(object)EnforcerList[enemyIndex].PotentialTarget != (Object)null) { Log.Debug("Range check for target player: " + EnforcerList[enemyIndex].PotentialTarget.playerUsername + "; " + $"\nin Range/Enforcer LOS? {EnforcerList[enemyIndex].IsTargetPlayerWithinLOS(EnforcerList[enemyIndex].PotentialTarget, (int)RangeForPotentialTarget, 180f)}; " + $"\nPlayer has LOS to Enforcer? {EnforcerList[enemyIndex].CheckPlayerLOSForEnforcer(EnforcerList[enemyIndex].PotentialTarget)}"); if (EnforcerList[enemyIndex].PlayerWithinRange(EnforcerList[enemyIndex].PotentialTarget, RangeForPotentialTarget)) { EnforcerList[enemyIndex].IsBeingSeenByPotentialTarget = EnforcerList[enemyIndex].CheckPlayerLOSForEnforcer(EnforcerList[enemyIndex].PotentialTarget); return; } EnforcerList[enemyIndex].ShouldChasePotentialTarget = !EnforcerList[enemyIndex].IsBeingSeenByPotentialTarget; if (!EnforcerList[enemyIndex].ShouldChasePotentialTarget) { Log.Debug("Player left while looking at us, do not pursue!"); EnforcerList[enemyIndex].PotentialTarget = null; } } else { PlayerControllerB closestPlayer = ((EnemyAI)EnforcerList[enemyIndex]).GetClosestPlayer(true, false, false); if ((Object)(object)closestPlayer != (Object)null && EnforcerList[enemyIndex].PlayerWithinRange(closestPlayer, RangeForPotentialTarget)) { EnforcerList[enemyIndex].PotentialTarget = closestPlayer; Log.Debug("Setting target player: " + EnforcerList[enemyIndex].PotentialTarget.playerUsername); } } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class StalkPlayer : BehaviorState { public override List transitions { get; set; } = new List { new StalkedPlayerSeesUs() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = StalkSpeed; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); EnforcerList[enemyIndex].EnforcerShouldKeepTrackOfTargetPlayer = true; ((EnemyAI)EnforcerList[enemyIndex]).creatureSFX.volume = 0.2f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if (EnforcerList[enemyIndex].PlayerWithinRange(2f)) { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = 0f; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); EnforcerList[enemyIndex].RandomlyPlayIdleSound(SecondsUntilNextSound + 3f); } else { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = StalkSpeed; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); ((EnemyAI)EnforcerList[enemyIndex]).SetMovingTowardsTargetPlayer(((EnemyAI)EnforcerList[enemyIndex]).targetPlayer); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); } } private class ChasePlayer : BehaviorState { public override List transitions { get; set; } = new List { new PlayerEnteredAttackRange(), new LostPlayerDuringChase() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = ChaseSpeed; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)EnforcerList[enemyIndex]).SetMovingTowardsTargetPlayer(((EnemyAI)EnforcerList[enemyIndex]).targetPlayer); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class ScreamAtPlayer : BehaviorState { public override List transitions { get; set; } = new List { new FinishedScream() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = 0f; EnforcerList[enemyIndex].SetAnimTriggerOnServerRpc("Scream"); EnforcerList[enemyIndex].SetActiveCamoState(SetCamoOn: false); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class AttackPlayer : BehaviorState { public override List transitions { get; set; } = new List { new PlayerKilled(), new PlayerLeftAttackRange() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EnforcerList[enemyIndex].AttackCooldownSeconds = 1.5f; EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Attacking", state: true); EnforcerList[enemyIndex].HasAttackedThisCycle = false; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if (!EnforcerList[enemyIndex].PlayerWithinRange(2.9f, IncludeYAxis: false)) { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = 2f; } else { ((EnemyAI)EnforcerList[enemyIndex]).agent.speed = 0f; } EnforcerList[enemyIndex].TryMeleeAttackPlayer(120); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EnforcerList[enemyIndex].SetAnimBoolOnServerRpc("Attacking", state: false); EnforcerList[enemyIndex].HasAttackedThisCycle = false; } } private class SearchForPlayer : BehaviorState { public override List transitions { get; set; } = new List { new PlayerNotFoundDuringSearch(), new PlayerFoundDuringSearch() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((MonoBehaviour)EnforcerList[enemyIndex]).StartCoroutine(EnforcerList[enemyIndex].SearchAreaForPlayer()); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class FoundHidingSpot : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].ReachedNextPoint; } public override BehaviorState NextState() { return new WaitForPlayerToPass(); } } private class PlayerPassedBy : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].ShouldChasePotentialTarget; } public override BehaviorState NextState() { ((EnemyAI)EnforcerList[enemyIndex]).targetPlayer = EnforcerList[enemyIndex].PotentialTarget; return new StalkPlayer(); } } private class StalkedPlayerSeesUs : StateTransition { public override bool CanTransitionBeTaken() { //IL_002b: 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) return ((EnemyAI)EnforcerList[enemyIndex]).targetPlayer.HasLineOfSightToPosition(((EnemyAI)EnforcerList[enemyIndex]).eye.position, 30f, 60, -1f) || ((EnemyAI)EnforcerList[enemyIndex]).targetPlayer.HasLineOfSightToPosition(((Component)EnforcerList[enemyIndex]).transform.position, 30f, 60, -1f); } public override BehaviorState NextState() { return new ScreamAtPlayer(); } } private class PlayerEnteredAttackRange : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].PlayerWithinRange(2f, IncludeYAxis: false); } public override BehaviorState NextState() { return new AttackPlayer(); } } private class PlayerKilled : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)EnforcerList[enemyIndex]).targetPlayer.isPlayerDead; } public override BehaviorState NextState() { return new GoToHidingSpot(); } } private class PlayerLeftAttackRange : StateTransition { public override bool CanTransitionBeTaken() { return !EnforcerList[enemyIndex].PlayerWithinRange(3f, IncludeYAxis: false); } public override BehaviorState NextState() { return new ChasePlayer(); } } private class LostPlayerDuringChase : StateTransition { public override bool CanTransitionBeTaken() { return !EnforcerList[enemyIndex].EnforcerSeesPlayer; } public override BehaviorState NextState() { return new SearchForPlayer(); } } private class PlayerNotFoundDuringSearch : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].EnforcerSearchComplete; } public override BehaviorState NextState() { return new GoToHidingSpot(); } } private class PlayerFoundDuringSearch : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].IsTargetPlayerWithinLOS(((EnemyAI)EnforcerList[enemyIndex]).targetPlayer, 45, 120f); } public override BehaviorState NextState() { ((MonoBehaviour)EnforcerList[enemyIndex]).StopCoroutine("SearchAreaForPlayer"); return new ChasePlayer(); } } private class PlayerStaringAtUs : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].PlayerStareAtTimer > 5f; } public override BehaviorState NextState() { return new GoToHidingSpot(); } } private class FinishedScream : StateTransition { public override bool CanTransitionBeTaken() { return EnforcerList[enemyIndex].EnforcerScreamSeconds <= 0f; } public override BehaviorState NextState() { return new AttackPlayer(); } } [CompilerGenerated] private sealed class d__59 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnforcerAI <>4__this; private int 5__1; private Vector3 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0172: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((EnemyAI)<>4__this).SetDestinationToPosition(<>4__this.LastKnownTargetPlayerPosition, false); goto IL_0073; case 1: <>1__state = -1; goto IL_0073; case 2: <>1__state = -1; goto IL_0114; case 3: <>1__state = -1; 5__1++; goto IL_0195; case 4: { <>1__state = -1; return false; } IL_0073: if (Vector3.Distance(((Component)<>4__this).transform.position, <>4__this.LastKnownTargetPlayerPosition) < 0.02f) { <>2__current = null; <>1__state = 1; return true; } Log.Debug("Reached last player location; picking points nearby and searching"); 5__1 = 0; goto IL_0195; IL_0195: if (5__1 < <>4__this.enemyRandom.Next(1, 3)) { 5__2 = RoundManager.Instance.GetRandomNavMeshPositionInRadius(<>4__this.LastKnownTargetPlayerPosition, 10f, default(NavMeshHit)); ((EnemyAI)<>4__this).SetDestinationToPosition(5__2, false); goto IL_0114; } <>4__this.EnforcerSearchComplete = true; <>2__current = null; <>1__state = 4; return true; IL_0114: if (Vector3.Distance(((Component)<>4__this).transform.position, 5__2) < 0.02f) { <>2__current = null; <>1__state = 2; return true; } Log.Debug($"Reached nearby point #{5__1}"); <>2__current = (object)new WaitForSeconds(<>4__this.EyeSweepAnimSeconds); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Balance Constants")] public static float SecondsUntilBeginStalking = 5f; public static float StalkSpeed = 6f; public static float ChaseSpeed = 10f; public static float RangeForPotentialTarget = 10f; public static int EnforcerAttackDamage = 100; public static float ActiveCamoVisibility = 0.025f; private static readonly float SecondsUntilNextSound = 15f; [Header("Defaults")] public SkinnedMeshRenderer[] Meshes; public Material ActiveCamoMaterial; public float EyeSweepAnimSeconds = 2f; public float ActiveCamoLerpTime = 2f; public AudioClip[] RandomIdleSounds; public BoxCollider ScanNode; private readonly List EnforcerMatList = new List(); public static Dictionary EnforcerList = new Dictionary(); private static int EnforcerID; private List EnforcerHidePoints = new List(); private bool ReachedNextPoint = false; private GameObject NextHidePoint; private PlayerControllerB PotentialTarget; private bool IsBeingSeenByPotentialTarget; private bool ShouldChasePotentialTarget; private bool EnforcerShouldKeepTrackOfTargetPlayer; private Vector3 LastKnownTargetPlayerPosition; private bool EnforcerSearchComplete = false; private bool EnforcerSeesPlayer; private float IdleSoundCooldownSeconds = 7f; private float AttackCooldownSeconds = 0f; private float EnforcerScreamSeconds = 2.5f; private bool HasAttackedThisCycle; private float PlayerStareAtTimer = 0f; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(EnforcerAI), LogSourceType.Enemy); private float activeCamoTarget = 0f; private float activeCamoCurrent = 0f; public override void Start() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown MyValidState = PlayerState.Inside; base.InitialState = new GoToHidingSpot(); EnforcerID++; PrintDebugs = true; WTOEnemyID = EnforcerID; Log.Info($"Adding Enforcer {this} #{EnforcerID}"); EnforcerList.Add(EnforcerID, this); PopulateHidePoints(); SkinnedMeshRenderer[] meshes = Meshes; foreach (SkinnedMeshRenderer val in meshes) { Material[] array = (Material[])(object)new Material[((Renderer)val).materials.Length]; for (int j = 0; j < ((Renderer)val).materials.Length; j++) { Material val2 = new Material(ActiveCamoMaterial); val2.SetTexture("_MainTexture", ((Renderer)val).materials[j].GetTexture("_BaseColorMap")); array[j] = val2; EnforcerMatList.Add(val2); } ((Renderer)val).materials = array; } base.Start(); } public override void Update() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) base.Update(); MoveTimerValue(ref AttackCooldownSeconds); UpdateActiveCamo(); if (IsBeingSeenByPotentialTarget) { PlayerStareAtTimer += Time.deltaTime; } else { PlayerStareAtTimer = 0f; } if (ActiveState is ScreamAtPlayer) { Log.Debug($"SCREAM SECONDS: {EnforcerScreamSeconds}"); MoveTimerValue(ref EnforcerScreamSeconds); } if (EnforcerShouldKeepTrackOfTargetPlayer && !((Object)(object)((EnemyAI)this).targetPlayer == (Object)null)) { if (IsTargetPlayerWithinLOS(45, 250f)) { LastKnownTargetPlayerPosition = ((Component)((EnemyAI)this).targetPlayer.gameplayCamera).transform.position; EnforcerSeesPlayer = true; } else { EnforcerSeesPlayer = false; } } } public void SetActiveCamoState(bool SetCamoOn) { activeCamoTarget = (SetCamoOn ? 0f : 1f); ((Collider)ScanNode).enabled = !SetCamoOn; } private void UpdateActiveCamo() { if (activeCamoCurrent == activeCamoTarget) { return; } activeCamoCurrent = Mathf.MoveTowards(activeCamoCurrent, activeCamoTarget, Time.deltaTime / ActiveCamoLerpTime); Log.Debug($"Active Camo at {activeCamoCurrent * 100f}%..."); foreach (Material enforcerMat in EnforcerMatList) { enforcerMat.SetFloat("_TextureLerp", activeCamoCurrent); } } public void PopulateHidePoints() { EnforcerHidePoint[] array = Object.FindObjectsOfType(); if (array.Length == 0) { EnforcerHidePoints = new List(GameObject.FindGameObjectsWithTag("AINode")); return; } EnforcerHidePoint[] array2 = array; foreach (EnforcerHidePoint enforcerHidePoint in array2) { EnforcerHidePoints.Add(((Component)enforcerHidePoint).gameObject); } } public void DetermineNextHidePoint() { if (EnforcerHidePoints == null) { PopulateHidePoints(); Log.Info($"Hide Point count: {EnforcerHidePoints.Count}"); } NextHidePoint = EnforcerHidePoints[enemyRandom.Next(0, EnforcerHidePoints.Count)]; } private bool CheckPlayerLOSForEnforcer(PlayerControllerB player, int range = 45, float width = 60f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)player).transform.position, ((EnemyAI)this).eye.position); return num < (float)range && Vector3.Angle(((Component)player.playerEye).transform.forward, ((EnemyAI)this).eye.position - ((Component)player.gameplayCamera).transform.position) < width; } [IteratorStateMachine(typeof(d__59))] private IEnumerator SearchAreaForPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__59(0) { <>4__this = this }; } private void RandomlyPlayIdleSound(float newIdleCooldown = 7f) { if (IdleSoundCooldownSeconds > 0f) { MoveTimerValue(ref IdleSoundCooldownSeconds); } else if (enemyRandom.Next(0, 100) < 15) { ((EnemyAI)this).creatureVoice.PlayOneShot(RandomIdleSounds[enemyRandom.Next(0, RandomIdleSounds.Count())]); IdleSoundCooldownSeconds = newIdleCooldown; } } public void TryMeleeAttackPlayer(int damage) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0090: 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_009f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((EnemyAI)this).targetPlayer == (Object)null)) { if (AttackCooldownSeconds <= 0.8f && Vector3.Distance(((Component)((EnemyAI)this).targetPlayer).transform.position, ((Component)this).transform.position) < 3f && !HasAttackedThisCycle) { Log.Debug("Gallenarma Attacking!"); ((EnemyAI)this).targetPlayer.DamagePlayer(damage, true, true, (CauseOfDeath)6, 0, false, (((Component)this).transform.position - ((Component)((EnemyAI)this).targetPlayer).transform.position) * 40f); HasAttackedThisCycle = true; } if (AttackCooldownSeconds <= 0f) { AttackCooldownSeconds = 1f; HasAttackedThisCycle = false; } } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EnforcerAI"; } } public class EyeSecAI : WTOEnemy { private class Patrol : BehaviorState { public override List transitions { get; set; } = new List { new ShouldStartScanTransition() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) creatureAnimator.SetBool("Moving", true); ((EnemyAI)EyeSecList[enemyIndex]).agent.speed = (BuffedByMachineOn ? 12f : 9f); ((EnemyAI)EyeSecList[enemyIndex]).StartSearch(((Component)EyeSecList[enemyIndex]).transform.position, EyeSecList[enemyIndex].SearchLab); EyeSecList[enemyIndex].FoundPlayerHoldingScrap = false; EyeSecList[enemyIndex].SetTargetServerRpc(-1); EyeSecList[enemyIndex].ResetEyesecHeadPos(); EyeSecList[enemyIndex].DoFearEffect = true; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!EyeSecList[enemyIndex].SearchLab.inProgress) { ((EnemyAI)EyeSecList[enemyIndex]).StartSearch(((Component)EyeSecList[enemyIndex]).transform.position, EyeSecList[enemyIndex].SearchLab); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Moving", false); } } private class ScanEnemies : BehaviorState { public float AnimWaiterSeconds = 0f; public float ScanTimerSeconds = 0f; private int SecondsToScan = 4; public override List transitions { get; set; } = new List { new FinishScanShutDown(), new BeginAttack() }; public ScanEnemies() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) RandomRange = new Vector2(7f, 35f); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((Behaviour)((EnemyAI)EyeSecList[enemyIndex]).creatureAnimator).enabled = false; bool flag = MyRandomInt % 2 == 0; EyeSecList[enemyIndex].IsDeepScan = EyeSecList[enemyIndex].BuffedByTeslaCoil || BuffedByMachineOn || flag; SecondsToScan = (EyeSecList[enemyIndex].IsDeepScan ? 4 : 2); EyeSecList[enemyIndex].StartScanVisuals(); ((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 0f; if (!EyeSecList[enemyIndex].IsDeepScan) { } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if ((double)AnimWaiterSeconds < 0.25) { AnimWaiterSeconds += Time.deltaTime; return; } if (ScanTimerSeconds <= (float)SecondsToScan) { EyeSecList[enemyIndex].ScanRoom(SecondsToScan); } else { EyeSecList[enemyIndex].ScanFinished = true; } ScanTimerSeconds += Time.deltaTime; } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].EndScanSFX); EyeSecList[enemyIndex].ScanCooldownSeconds = 30f; EyeSecList[enemyIndex].IsScanning = false; EyeSecList[enemyIndex].ShutdownTimerSeconds = MyRandomInt; } } private class Attack : BehaviorState { private float laserTimer = 0f; public override List transitions { get; set; } = new List { new FinishKill(), new PlayerOutOfRange(), new PlayerLeft(), new Stunned() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EyeSecList[enemyIndex].StopScanVisuals(null); EyeSecList[enemyIndex].StartAttackVisuals(); ((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 0f; if (EyeSecList[enemyIndex].DoFearEffect) { Log.Debug("Eyesec: Setting fear effect on Player " + ((EnemyAI)EyeSecList[enemyIndex]).targetPlayer.playerUsername + "!"); if ((Object)(object)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true); } EyeSecList[enemyIndex].DoFearEffect = false; } laserTimer = 0f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_004d: 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_009f: Unknown result type (might be due to invalid IL or missing references) EyeSecList[enemyIndex].TryFlash(); EyeSecList[enemyIndex].TrackPlayerWithHead(); ((Component)EyeSecList[enemyIndex].PlayerTracker).transform.position = ((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position; laserTimer += Time.deltaTime; if (laserTimer > 5f) { ((EnemyAI)EyeSecList[enemyIndex]).targetPlayer.DamagePlayer(150, true, true, (CauseOfDeath)13, 0, false, default(Vector3)); ((EnemyAI)EyeSecList[enemyIndex]).creatureVoice.PlayOneShot(EyeSecList[enemyIndex].BurnSFX); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EyeSecList[enemyIndex].StopAttackVisuals(); } } private class MoveToAttackPosition : BehaviorState { public override List transitions { get; set; } = new List { new InRangeOfPlayer(), new PlayerLeft(), new Stunned() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0060: 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_00bc: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)EyeSecList[enemyIndex]).agent.speed = (BuffedByMachineOn ? 12f : 9f); EyeSecList[enemyIndex].StopAttackVisuals(); ((Component)EyeSecList[enemyIndex].PlayerTracker).transform.position = ((Component)EyeSecList[enemyIndex]).transform.position; if (((EnemyAI)EyeSecList[enemyIndex]).agent.isOnNavMesh) { ((EnemyAI)EyeSecList[enemyIndex]).SetDestinationToPosition(((EnemyAI)EyeSecList[enemyIndex]).ChooseClosestNodeToPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, true, 0).position, false); } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)EyeSecList[enemyIndex]).SetMovingTowardsTargetPlayer(((EnemyAI)EyeSecList[enemyIndex]).targetPlayer); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class ShutDown : BehaviorState { public override List transitions { get; set; } = new List { new WakeBackUp() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 0f; Log.Debug("Eyesec shut down!"); ((Behaviour)((EnemyAI)EyeSecList[enemyIndex]).creatureAnimator).enabled = true; EyeSecList[enemyIndex].SetAnimBoolOnServerRpc("Shutdown", state: true); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { EyeSecList[enemyIndex].SetAnimBoolOnServerRpc("Shutdown", state: false); } } private class ShouldStartScanTransition : StateTransition { public override bool CanTransitionBeTaken() { bool flag = EyeSecList[enemyIndex].enemyRandom.Next(0, 50) > 35; PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)EyeSecList[enemyIndex]).GetAllPlayersInLineOfSight(180f, 5, (Transform)null, -1f, -1); if (allPlayersInLineOfSight == null || EyeSecList[enemyIndex].ScanCooldownSeconds > 0f) { return false; } if (allPlayersInLineOfSight.Length != 0 && flag) { return true; } return false; } public override BehaviorState NextState() { return new ScanEnemies(); } } private class ReturnToPatrol : StateTransition { public override bool CanTransitionBeTaken() { if (EyeSecList[enemyIndex].ScanFinished) { return !EyeSecList[enemyIndex].FoundPlayerHoldingScrap; } return false; } public override BehaviorState NextState() { return new Patrol(); } } private class BeginAttack : StateTransition { public override bool CanTransitionBeTaken() { return EyeSecList[enemyIndex].FoundPlayerHoldingScrap; } public override BehaviorState NextState() { EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].EndScanSFX); return new Attack(); } } private class FinishKill : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer == (Object)null || ((EnemyAI)EyeSecList[enemyIndex]).targetPlayer.isPlayerDead) { return true; } return false; } public override BehaviorState NextState() { return new Patrol(); } } private class PlayerOutOfRange : StateTransition { public override bool CanTransitionBeTaken() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer == (Object)null) { return true; } return !((EnemyAI)EyeSecList[enemyIndex]).CheckLineOfSightForPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, 360f, 15, -1f, (Transform)null); } public override BehaviorState NextState() { if ((Object)(object)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer == (Object)null) { return new Patrol(); } return new MoveToAttackPosition(); } } private class InRangeOfPlayer : StateTransition { public override bool CanTransitionBeTaken() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) return ((EnemyAI)EyeSecList[enemyIndex]).CheckLineOfSightForPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, 360f, 15, -1f, (Transform)null); } public override BehaviorState NextState() { return new Attack(); } } private class PlayerLeft : StateTransition { public override bool CanTransitionBeTaken() { return !EyeSecList[enemyIndex].PlayerCanBeTargeted(((EnemyAI)EyeSecList[enemyIndex]).targetPlayer); } public override BehaviorState NextState() { return new Patrol(); } } private class Stunned : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)EyeSecList[enemyIndex]).stunNormalizedTimer > 0f; } public override BehaviorState NextState() { EyeSecList[enemyIndex].StopAttackVisuals(); EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].ShutdownSFX); EyeSecList[enemyIndex].ShutdownTimerSeconds = 240f; EyeSecList[enemyIndex].SetTargetServerRpc(-1); return new ShutDown(); } } private class WakeBackUp : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)EyeSecList[enemyIndex]).stunNormalizedTimer <= 0f && EyeSecList[enemyIndex].ShutdownTimerSeconds <= 0f; } public override BehaviorState NextState() { EyeSecList[enemyIndex].ScanCooldownSeconds = 0f; ((EnemyAI)EyeSecList[enemyIndex]).creatureVoice.PlayOneShot(EyeSecList[enemyIndex].StartupSFX); return new Patrol(); } } private class FinishScanShutDown : StateTransition { public override bool CanTransitionBeTaken() { if (EyeSecList[enemyIndex].ScanFinished) { return !EyeSecList[enemyIndex].FoundPlayerHoldingScrap; } return false; } public override BehaviorState NextState() { EyeSecList[enemyIndex].StopAttackVisuals(); EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].ShutdownSFX); EyeSecList[enemyIndex].SetTargetServerRpc(-1); return new ShutDown(); } } private const float ScanCooldownTotal = 30f; private const float EyeSecDefaultSpeed = 9f; private const float EyeSecBuffSpeed = 12f; private const float EyeSecAttackSpeed = 9f; private const float EyeSecLaserSpeed = 5f; private const int EyeSecScanSpeed = 2; [SerializeField] public GameObject Head; public BoxCollider ScannerCollider; public GameObject Wheel; public Animator ScanAnim; public EyeSecLaser MyLaser; public Transform PlayerTracker; public static Dictionary EyeSecList = new Dictionary(); public static int EyeSecID; public MeshRenderer ScannerMesh; public AudioClip flashSFX; public AudioClip StartScanSFX; public AudioClip EndScanSFX; public AudioClip AttackSFX; public AudioClip MoveSFX; public AudioClip ScanSFX; public AudioClip BurnSFX; public AudioClip ShutdownSFX; public AudioClip StartupSFX; [HideInInspector] private static readonly List grabbableObjectsInMap = new List(); private bool FoundPlayerHoldingScrap = false; private bool ScanFinished = false; private bool IsScanning; public bool IsDeepScan; private float ScanCooldownSeconds = 0f; private float FlashCooldownSeconds = 10f; private float ShutdownTimerSeconds = 0f; private bool PlayingMoveSound; private readonly AISearchRoutine SearchLab = new AISearchRoutine(); private bool DoFearEffect = true; public static bool BuffedByMachineOn = false; public bool BuffedByTeslaCoil; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(EyeSecAI), LogSourceType.Enemy); public override void Start() { base.InitialState = new Patrol(); RefreshGrabbableObjectsInMapList(); PrintDebugs = true; EyeSecID++; WTOEnemyID = EyeSecID; Log.Info($"Adding EyeSec {this} at {EyeSecID}"); EyeSecList.Add(EyeSecID, this); base.Start(); ((Behaviour)((EnemyAI)this).creatureAnimator).enabled = false; } public override void Update() { MoveTimerValue(ref ScanCooldownSeconds); MoveTimerValue(ref FlashCooldownSeconds); MoveTimerValue(ref ShutdownTimerSeconds); if (((NetworkBehaviour)this).IsOwner) { SpinWheelServerRpc(); } base.Update(); } public static void RefreshGrabbableObjectsInMapList() { grabbableObjectsInMap.Clear(); GrabbableObject[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if (array[i].scrapValue != 0) { grabbableObjectsInMap.Add(array[i]); } } } private void ScanRoom(int ScanTimeSeconds) { Head.transform.Rotate(0f, (float)(360 / ScanTimeSeconds) * Time.deltaTime, 0f); } public void ScanOurEnemy(Collider other) { if (!IsScanning) { return; } PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null) && PlayerCanBeTargeted(component)) { Log.Debug("Player found, trying to scan him..."); ((EnemyAI)this).ChangeOwnershipOfEnemy(component.actualClientId); if (IsDeepScan) { CheckPlayerDeepScan(component); } else { CheckPlayerWhenScanned(component); } } } private void CheckPlayerWhenScanned(PlayerControllerB Player) { if (grabbableObjectsInMap.Contains(Player.currentlyHeldObjectServer)) { Log.Debug("Player is guilty!"); ScanFinished = true; SetTargetServerRpc((int)Player.playerClientId); FoundPlayerHoldingScrap = true; } } private void CheckPlayerDeepScan(PlayerControllerB Player) { for (int i = 0; i < Player.ItemSlots.Count(); i++) { if (grabbableObjectsInMap.Contains(Player.ItemSlots[i])) { Log.Debug("Player is guilty!"); ScanFinished = true; SetTargetServerRpc((int)Player.playerClientId); FoundPlayerHoldingScrap = true; break; } } } [ServerRpc] private void SpinWheelServerRpc() { //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)((NetworkBehaviour)this).__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(623917746u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 623917746u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SpinWheelClientRpc(); } } [ClientRpc] private void SpinWheelClientRpc() { //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) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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(1080432905u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1080432905u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Vector3 velocity = ((EnemyAI)this).agent.velocity; if (((Vector3)(ref velocity)).magnitude > 0f) { Wheel.transform.Rotate(160f * Time.deltaTime, 0f, 0f); if (!PlayingMoveSound) { ((EnemyAI)this).creatureSFX.clip = MoveSFX; ((EnemyAI)this).creatureSFX.Play(); PlayingMoveSound = true; } } else if (PlayingMoveSound) { ((EnemyAI)this).creatureSFX.Stop(); PlayingMoveSound = false; } } private void TryFlash() { if (FlashCooldownSeconds <= 0f) { ((EnemyAI)this).postStunInvincibilityTimer = 0.07f; Flash(); FlashCooldownSeconds = 10f; } } public void Flash() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).creatureVoice.PlayOneShot(flashSFX); try { WalkieTalkie.TransmitOneShotAudio(((EnemyAI)this).creatureVoice, flashSFX, 1f); StunGrenadeItem.StunExplosion(((Component)this).transform.position, false, 2f, 4f, 2f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f); } catch (Exception arg) { Log.Error($"EyeSec could not stun flash! Error listed: {arg}"); } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1); SetTargetServerRpc((int)playerWhoHit.playerClientId); ((EnemyAI)this).ChangeOwnershipOfEnemy(playerWhoHit.actualClientId); Log.Debug("Player hit us!"); if (!(ActiveState is ShutDown) && !(ActiveState is Attack) && !(ActiveState is MoveToAttackPosition)) { OverrideState(new Attack()); } } [ServerRpc] internal void SetScannerBoolOnServerRpc(string name, bool state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Invalid comparison between Unknown and I4 //IL_0160: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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.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(783733510u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref state, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 783733510u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { Log.Debug("Changing anim!"); ScanAnim.SetBool(name, state); } } } public void StartScanVisuals() { //IL_00b5: 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) ((EnemyAI)this).creatureVoice.PlayOneShot(StartScanSFX); ((EnemyAI)this).creatureVoice.clip = ScanSFX; ((EnemyAI)this).creatureVoice.loop = true; ((EnemyAI)this).creatureVoice.Play(); ((Collider)ScannerCollider).enabled = true; ScanFinished = false; IsScanning = true; if (IsDeepScan) { ((Renderer)ScannerMesh).materials[0].SetColor("_EmissiveColor", new Color(1f, 0f, 0f)); } else { ((Renderer)ScannerMesh).materials[0].SetColor("_EmissiveColor", new Color(0f, 1f, 1f)); } SetScannerBoolOnServerRpc("Scanning", state: true); } public void StopScanVisuals(AudioClip StopSound) { ((EnemyAI)this).creatureVoice.Stop(); ((EnemyAI)this).creatureVoice.loop = false; if ((Object)(object)StopSound != (Object)null) { ((EnemyAI)this).creatureVoice.PlayOneShot(StopSound); } SetScannerBoolOnServerRpc("Scanning", state: false); ((Collider)ScannerCollider).enabled = false; IsScanning = false; ScanCooldownSeconds = 30f; } public void StartAttackVisuals() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) MyLaser.SetLaserEnabled(NewEnabled: true, 5f); ((EnemyAI)this).creatureVoice.PlayOneShot(AttackSFX); ((Component)PlayerTracker).transform.position = ((Component)((EnemyAI)this).targetPlayer).transform.position; } public void StopAttackVisuals() { MyLaser.SetLaserEnabled(NewEnabled: false, -1f); } public void TrackPlayerWithHead() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = default(Quaternion); ((Quaternion)(ref rotation)).SetLookRotation((((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)this).transform.position) * -1f); Head.transform.rotation = rotation; } private void ResetEyesecHeadPos() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Head.transform.rotation = Quaternion.identity; } 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 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(623917746u, new RpcReceiveHandler(__rpc_handler_623917746), "SpinWheelServerRpc"); ((NetworkBehaviour)this).__registerRpc(1080432905u, new RpcReceiveHandler(__rpc_handler_1080432905), "SpinWheelClientRpc"); ((NetworkBehaviour)this).__registerRpc(783733510u, new RpcReceiveHandler(__rpc_handler_783733510), "SetScannerBoolOnServerRpc"); base.__initializeRpcs(); } private static void __rpc_handler_623917746(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; ((EyeSecAI)(object)target).SpinWheelServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1080432905(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; ((EyeSecAI)(object)target).SpinWheelClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_783733510(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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) 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; } bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string name = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false); } bool state = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref state, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EyeSecAI)(object)target).SetScannerBoolOnServerRpc(name, state); target.__rpc_exec_stage = (__RpcExecStage)0; } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EyeSecAI"; } } public class GallenarmaAI : WTOEnemy, INoiseListener { private class Asleep : BehaviorState { public override List transitions { get; set; } = new List { new HeardNoise() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].TryRandomAwake(); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimTriggerOnServerRpc("WakeUp"); } } private class WakingUp : BehaviorState { public override List transitions { get; set; } = new List { new WakeTimerDone() }; public WakingUp() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) RandomRange = new Vector2(15f, 35f); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimTriggerOnServerRpc("WakeUp"); GallenarmaList[enemyIndex].Awakening = true; GallenarmaList[enemyIndex].SecondsUntilChainsBroken = MyRandomInt; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].MoveTimerValue(ref GallenarmaList[enemyIndex].SecondsUntilChainsBroken); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class Patrol : BehaviorState { public override List transitions { get; set; } = new List { new HeardNoise(), new Boombox() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) GallenarmaList[enemyIndex].Awakening = false; ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.clip = null; GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Breaking", state: true); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Attack", state: false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 5f; ((EnemyAI)GallenarmaList[enemyIndex]).StartSearch(((Component)GallenarmaList[enemyIndex]).transform.position, GallenarmaList[enemyIndex].RoamLab); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!GallenarmaList[enemyIndex].RoamLab.inProgress) { ((EnemyAI)GallenarmaList[enemyIndex]).StartSearch(((Component)GallenarmaList[enemyIndex]).transform.position, GallenarmaList[enemyIndex].RoamLab); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)GallenarmaList[enemyIndex]).StopSearch(GallenarmaList[enemyIndex].RoamLab, false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); } } private class GoToNoise : BehaviorState { private bool OnRouteToNextPoint; private Vector3 RangeOfTargetNoise; private Vector3 TargetNoisePosition; private NoiseInfo CurrentNoise; private Vector3 NextPoint; public override List transitions { get; set; } = new List { new ReachedNoise(), new Boombox() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0085: 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_0097: 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_009d: 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) GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); if (GallenarmaList[enemyIndex].LatestNoise.Loudness != -1f) { CurrentNoise = GallenarmaList[enemyIndex].LatestNoise; if (((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { TargetNoisePosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(GallenarmaList[enemyIndex].LatestNoise.Location, 5f, default(NavMeshHit)); OnRouteToNextPoint = ((EnemyAI)GallenarmaList[enemyIndex]).SetDestinationToPosition(TargetNoisePosition, true); } ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 7f; } else { Log.Debug("Noise does not have any loudness!"); } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0087: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) if (GallenarmaList[enemyIndex].LatestNoise.Location != CurrentNoise.Location) { CurrentNoise = GallenarmaList[enemyIndex].LatestNoise; if (((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { RangeOfTargetNoise = RoundManager.Instance.GetRandomNavMeshPositionInRadius(GallenarmaList[enemyIndex].LatestNoise.Location, 2f, default(NavMeshHit)); OnRouteToNextPoint = ((EnemyAI)GallenarmaList[enemyIndex]).SetDestinationToPosition(RangeOfTargetNoise, true); } ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 7.5f; } if (!OnRouteToNextPoint && ((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { Log.Debug("Noise was unreachable!"); if (GallenarmaList[enemyIndex].LatestNoise.Loudness != -1f) { NextPoint = GallenarmaList[enemyIndex].LatestNoise.Location; } else { NextPoint = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((EnemyAI)GallenarmaList[enemyIndex]).allAINodes[MyRandomInt].transform.position, 15f, default(NavMeshHit)); Log.Debug("Gallenarma off to random point!"); } if (((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { OnRouteToNextPoint = ((EnemyAI)GallenarmaList[enemyIndex]).SetDestinationToPosition(((EnemyAI)GallenarmaList[enemyIndex]).ChooseClosestNodeToPosition(NextPoint, false, 0).position, false); } } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); } } private class Investigate : BehaviorState { public override List transitions { get; set; } = new List { new FoundEnemy(), new NothingFoundAtNoise(), new Boombox(), new HeardNoise() }; public Investigate() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) RandomRange = new Vector2(5f, 9f); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].LatestNoise.Invalidate(); ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.PlayOneShot(GallenarmaList[enemyIndex].Search[enemyRandom.Next(0, GallenarmaList[enemyIndex].Search.Count)]); GallenarmaList[enemyIndex].TotalInvestigateSeconds = MyRandomInt; GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: true); ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 0f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { if ((double)GallenarmaList[enemyIndex].TotalInvestigateSeconds < 0.8) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: false); } if (GallenarmaList[enemyIndex].TotalInvestigateSeconds > 0f) { GallenarmaList[enemyIndex].MoveTimerValue(ref GallenarmaList[enemyIndex].TotalInvestigateSeconds); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: false); } } private class Attack : BehaviorState { public override List transitions { get; set; } = new List { new KilledVictim(), new VictimEscaped() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.clip = GallenarmaList[enemyIndex].Growl; ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.Play(); ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.loop = true; GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Attack", state: true); GallenarmaList[enemyIndex].HasAttackedThisCycle = false; GallenarmaList[enemyIndex].AttackTimerSeconds = 1.667f; if (((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { ((EnemyAI)GallenarmaList[enemyIndex]).SetMovingTowardsTargetPlayer(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer); } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: false); if (!GallenarmaList[enemyIndex].PlayerWithinRange(GallenarmaList[enemyIndex].AttackRange, IncludeYAxis: false)) { ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 9.1f; } else { ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 2f; } GallenarmaList[enemyIndex].TryMeleeAttackPlayer(120); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Attack", state: false); GallenarmaList[enemyIndex].HasAttackedThisCycle = false; } } private class Chase : BehaviorState { public override List transitions { get; set; } = new List { new ReachedChasedEnemy(), new LostTrackOfPlayer() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Investigating", state: false); GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); if (((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { ((EnemyAI)GallenarmaList[enemyIndex]).SetMovingTowardsTargetPlayer(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer); } ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 9.1f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.loop = false; GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: false); } } private class Dance : BehaviorState { private bool MovingToBoombox; public override List transitions { get; set; } = new List { new BoredOfDancing() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) GallenarmaList[enemyIndex].SecondsUntilBored = 150f; if (((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { ((EnemyAI)GallenarmaList[enemyIndex]).SetDestinationToPosition(GallenarmaList[enemyIndex].myBoomboxPos, false); } GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Moving", state: true); ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 5f; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(GallenarmaList[enemyIndex].myBoomboxPos, ((Component)GallenarmaList[enemyIndex]).transform.position) < 5f) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Dancing", state: true); ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 0f; GallenarmaList[enemyIndex].IsDancing = true; GallenarmaList[enemyIndex].MoveTimerValue(ref GallenarmaList[enemyIndex].SecondsUntilBored); } else if (!MovingToBoombox && ((EnemyAI)GallenarmaList[enemyIndex]).agent.isOnNavMesh) { ((EnemyAI)GallenarmaList[enemyIndex]).SetDestinationToPosition(GallenarmaList[enemyIndex].myBoomboxPos, false); MovingToBoombox = true; } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Dancing", state: false); } } private class Enraged : BehaviorState { public override List transitions { get; set; } = new List { new EnrageAnimFinished() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].SetAnimTriggerOnServerRpc("Stunned"); ((EnemyAI)GallenarmaList[enemyIndex]).agent.speed = 0f; ((EnemyAI)GallenarmaList[enemyIndex]).ChangeOwnershipOfEnemy(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.actualClientId); GallenarmaList[enemyIndex].StunTimeSeconds = 3.15f; ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.clip = GallenarmaList[enemyIndex].Growl; ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.Play(); ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.loop = true; ((EnemyAI)GallenarmaList[enemyIndex]).creatureSFX.clip = GallenarmaList[enemyIndex].GallenarmaBeatChest; ((EnemyAI)GallenarmaList[enemyIndex]).creatureSFX.Play(); Log.Debug("Gallenarma: Setting fear effect on Player " + ((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.playerUsername + "!"); if ((Object)(object)((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true); } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GallenarmaList[enemyIndex].MoveTimerValue(ref GallenarmaList[enemyIndex].StunTimeSeconds); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class HeardNoise : StateTransition { public override bool CanTransitionBeTaken() { return GallenarmaList[enemyIndex].LatestNoise.Loudness != -1f; } public override BehaviorState NextState() { //IL_0070: 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_00a4: Unknown result type (might be due to invalid IL or missing references) if (GallenarmaList[enemyIndex].asleep) { return new WakingUp(); } if (GallenarmaList[enemyIndex].ActiveState is Investigate) { PlayerControllerB closestPlayerToPosition = GallenarmaList[enemyIndex].GetClosestPlayerToPosition(GallenarmaList[enemyIndex].LatestNoise.Location); if ((Object)(object)closestPlayerToPosition == (Object)null || Vector3.Distance(((Component)GallenarmaList[enemyIndex]).transform.position, ((Component)closestPlayerToPosition).transform.position) > 15f) { return new GoToNoise(); } GallenarmaList[enemyIndex].SetTargetServerRpc((int)closestPlayerToPosition.playerClientId); ((EnemyAI)GallenarmaList[enemyIndex]).ChangeOwnershipOfEnemy(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.actualClientId); return new Enraged(); } return new GoToNoise(); } } private class WakeTimerDone : StateTransition { public override bool CanTransitionBeTaken() { if (GallenarmaList[enemyIndex].SecondsUntilChainsBroken > 0f) { GallenarmaList[enemyIndex].SetAnimBoolOnServerRpc("Breaking", GallenarmaList[enemyIndex].SecondsUntilChainsBroken <= 2f); return false; } return GallenarmaList[enemyIndex].AnimationIsFinished("Gallenarma Break"); } public override BehaviorState NextState() { GallenarmaList[enemyIndex].asleep = false; GallenarmaList[enemyIndex].LatestNoise.Loudness = -1f; return new Patrol(); } } private class NothingFoundAtNoise : StateTransition { public override bool CanTransitionBeTaken() { return GallenarmaList[enemyIndex].TotalInvestigateSeconds <= 0f; } public override BehaviorState NextState() { return new Patrol(); } } private class FoundEnemy : StateTransition { public override bool CanTransitionBeTaken() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB closestPlayerToPosition = GallenarmaList[enemyIndex].GetClosestPlayerToPosition(((Component)GallenarmaList[enemyIndex]).transform.position); if (Vector3.Distance(((Component)GallenarmaList[enemyIndex]).transform.position, ((Component)closestPlayerToPosition).transform.position) < 5f) { GallenarmaList[enemyIndex].SetTargetServerRpc((int)closestPlayerToPosition.playerClientId); ((EnemyAI)GallenarmaList[enemyIndex]).ChangeOwnershipOfEnemy(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.actualClientId); return true; } if (GallenarmaList[enemyIndex].LatestNoise.Loudness == -1f) { return false; } PlayerControllerB closestPlayerToPosition2 = GallenarmaList[enemyIndex].GetClosestPlayerToPosition(((Component)GallenarmaList[enemyIndex]).transform.position); if ((Object)(object)closestPlayerToPosition2 == (Object)null || Vector3.Distance(((Component)GallenarmaList[enemyIndex]).transform.position, ((Component)closestPlayerToPosition2).transform.position) > 7f) { return false; } GallenarmaList[enemyIndex].SetTargetServerRpc((int)closestPlayerToPosition2.playerClientId); ((EnemyAI)GallenarmaList[enemyIndex]).ChangeOwnershipOfEnemy(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.actualClientId); return true; } public override BehaviorState NextState() { return new Enraged(); } } private class ReachedChasedEnemy : StateTransition { public override bool CanTransitionBeTaken() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((EnemyAI)GallenarmaList[enemyIndex]).CheckLineOfSightForClosestPlayer(180f, 7, -1, 0f); if ((Object)(object)val == (Object)null) { return false; } if (Vector3.Distance(((Component)val).transform.position, ((Component)GallenarmaList[enemyIndex]).transform.position) < 4f) { GallenarmaList[enemyIndex].SetTargetServerRpc((int)val.actualClientId); ((EnemyAI)GallenarmaList[enemyIndex]).ChangeOwnershipOfEnemy(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.actualClientId); return true; } return false; } public override BehaviorState NextState() { return new Attack(); } } private class EnemyBackInRange : StateTransition { public override bool CanTransitionBeTaken() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((EnemyAI)GallenarmaList[enemyIndex]).CheckLineOfSightForClosestPlayer(180f, 7, -1, 0f); if ((Object)(object)val == (Object)null) { return false; } if (Vector3.Distance(((Component)val).transform.position, ((Component)GallenarmaList[enemyIndex]).transform.position) < 7f) { GallenarmaList[enemyIndex].SetTargetServerRpc((int)val.actualClientId); ((EnemyAI)GallenarmaList[enemyIndex]).ChangeOwnershipOfEnemy(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.actualClientId); return true; } return false; } public override BehaviorState NextState() { return new Attack(); } } private class KilledVictim : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer != (Object)null) { return ((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer.health <= 0; } return false; } public override BehaviorState NextState() { ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.Stop(); ((EnemyAI)GallenarmaList[enemyIndex]).creatureVoice.loop = false; GallenarmaList[enemyIndex].SetTargetServerRpc(-1); return new Patrol(); } } private class Boombox : StateTransition { public override bool CanTransitionBeTaken() { return GallenarmaList[enemyIndex].TameTimerSeconds > 0f; } public override BehaviorState NextState() { return new Dance(); } } private class BoredOfDancing : StateTransition { public override bool CanTransitionBeTaken() { if (GallenarmaList[enemyIndex].IsDancing) { return GallenarmaList[enemyIndex].SecondsUntilBored <= 0f; } return GallenarmaList[enemyIndex].TameTimerSeconds <= 0f; } public override BehaviorState NextState() { return new Patrol(); } } private class VictimEscaped : StateTransition { public override bool CanTransitionBeTaken() { if ((Object)(object)((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer == (Object)null) { return true; } if (!GallenarmaList[enemyIndex].IsPlayerReachable()) { return true; } if (!GallenarmaList[enemyIndex].PlayerWithinRange(GallenarmaList[enemyIndex].AttackRange + 1, IncludeYAxis: false)) { GallenarmaList[enemyIndex].AttackTimerSeconds = 0f; return true; } return false; } public override BehaviorState NextState() { if (!GallenarmaList[enemyIndex].IsPlayerReachable()) { return new Patrol(); } return new Chase(); } } private class LostTrackOfPlayer : StateTransition { public override bool CanTransitionBeTaken() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) if ((Object)(object)((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer == (Object)null || !GallenarmaList[enemyIndex].PlayerCanBeTargeted(((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer) || !GallenarmaList[enemyIndex].IsPlayerReachable()) { GallenarmaList[enemyIndex].SetTargetServerRpc(-1); return true; } float val = Vector3.Distance(((Component)GallenarmaList[enemyIndex]).transform.position, ((Component)((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer).transform.position); float val2 = Vector3.Distance(GallenarmaList[enemyIndex].LatestNoise.Location, ((Component)((EnemyAI)GallenarmaList[enemyIndex]).targetPlayer).transform.position); float num = Math.Min(val2, val); return num > 15f; } public override BehaviorState NextState() { return new Patrol(); } } private class EnrageAnimFinished : StateTransition { public override bool CanTransitionBeTaken() { return (double)GallenarmaList[enemyIndex].StunTimeSeconds < 0.1; } public override BehaviorState NextState() { return new Chase(); } } private class ReachedNoise : StateTransition { public override bool CanTransitionBeTaken() { //IL_0016: 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) return Vector3.Distance(((Component)GallenarmaList[enemyIndex]).transform.position, ((EnemyAI)GallenarmaList[enemyIndex]).destination) < 3f; } public override BehaviorState NextState() { return new Investigate(); } } private class HitByStunGun : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)GallenarmaList[enemyIndex]).stunNormalizedTimer > 0f && !(GallenarmaList[enemyIndex].ActiveState is Chase); } public override BehaviorState NextState() { return new Enraged(); } } private struct NoiseInfo { private Vector3 position; private float loudness; public Vector3 Location { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return position; } private set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) position = value; } } public float Loudness { get { return loudness; } set { loudness = value; } } public NoiseInfo(Vector3 position, float loudness) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) this.position = position; this.loudness = loudness; } public void Invalidate() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) Location = new Vector3(-1f, -1f, -1f); Loudness = -1f; } } public float TotalInvestigateSeconds; public float RandomAwakeTimerSeconds = 60f; private bool asleep = true; private bool Awakening = false; private float SecondsUntilChainsBroken; private float hearNoiseCooldown; private float SecondsUntilBored; private float TameTimerSeconds = 0f; private Vector3 myBoomboxPos; private float AttackTimerSeconds = 0f; private readonly int AttackRange = 3; private float StunTimeSeconds; private bool IsDancing; private bool HasAttackedThisCycle; private readonly float AttackTime = 1.92f; public static Dictionary GallenarmaList = new Dictionary(); public static int GallenarmaID; private readonly AISearchRoutine RoamLab = new AISearchRoutine(); public BoxCollider GallenarmaHitbox; public CapsuleCollider GallenarmaCapsule; public AudioClip Growl; public AudioClip GallenarmaScream; public AudioClip GallenarmaBeatChest; public List Search = new List(); private float FlinchTimerSeconds = 0f; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(GallenarmaAI), LogSourceType.Enemy); private NoiseInfo LatestNoise = new NoiseInfo(new Vector3(-1f, -1f, -1f), -1f); public override void Start() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) base.InitialState = new Asleep(); ((EnemyAI)this).enemyHP = 20; PrintDebugs = true; GallenarmaID++; WTOEnemyID = GallenarmaID; Log.Info($"Adding Gallenarma {this} at {GallenarmaID}"); GallenarmaList.Add(GallenarmaID, this); GlobalTransitions.Add(new HitByStunGun()); base.Start(); if (enemyRandom.Next(1, 10) > 8) { LatestNoise = new NoiseInfo(((Component)this).transform.position, 2f); } } public override void Update() { MoveTimerValue(ref AttackTimerSeconds); MoveTimerValue(ref TameTimerSeconds); MoveTimerValue(ref FlinchTimerSeconds); if (TameTimerSeconds <= 0f) { IsDancing = false; } MoveTimerValue(ref hearNoiseCooldown); MoveTimerValue(ref RandomAwakeTimerSeconds); base.Update(); } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (((EnemyAI)this).isEnemyDead) { return; } ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1); ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; if (FlinchTimerSeconds <= 0f) { SetAnimTriggerOnServerRpc("Hit"); FlinchTimerSeconds = 4f; } if (((EnemyAI)this).enemyHP <= 0) { SetAnimTriggerOnServerRpc("Killed"); Object.Destroy((Object)(object)GallenarmaHitbox); Object.Destroy((Object)(object)GallenarmaCapsule); ((EnemyAI)this).isEnemyDead = true; ((EnemyAI)this).creatureVoice.Stop(); if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } else { SetTargetServerRpc((int)playerWhoHit.playerClientId); ((EnemyAI)this).ChangeOwnershipOfEnemy(playerWhoHit.actualClientId); if (!(ActiveState is Attack) && !(ActiveState is Chase) && !(ActiveState is Enraged)) { OverrideState(new Attack()); } } } public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesNoisePlayedInOneSpot = 0, int noiseID = 0) { //IL_0002: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesNoisePlayedInOneSpot, noiseID); if (noiseID == 5) { TameTimerSeconds = 2f; myBoomboxPos = noisePosition; } else if (((EnemyAI)this).stunNormalizedTimer > 0f || noiseID == 7 || noiseID == 546 || hearNoiseCooldown > 0f || timesNoisePlayedInOneSpot > 15 || ((EnemyAI)this).isEnemyDead) { return; } if (TotalInvestigateSeconds > 0f) { noiseLoudness *= 3f; } if (Awakening) { float val = (float)((double)SecondsUntilChainsBroken - 0.01 * (double)enemyRandom.Next(50, 250)); SecondsUntilChainsBroken = Math.Max(val, 0.8f); } hearNoiseCooldown = 0.03f; float num = Vector3.Distance(((Component)this).transform.position, noisePosition); Log.Debug($"Gallenarma '{((Object)((Component)this).gameObject).name}': Heard noise! Distance: {num} meters. Location: {noisePosition}"); if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256)) { noiseLoudness /= 2f; } if (!(noiseLoudness < 0.1f)) { if (!(ActiveState is Attack) && !(ActiveState is Chase)) { ((EnemyAI)this).ChangeOwnershipOfEnemy(NetworkManager.Singleton.LocalClientId); } LatestNoise = new NoiseInfo(noisePosition, noiseLoudness); } } public void TryMeleeAttackPlayer(int damage) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0092: 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_00a1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((EnemyAI)this).targetPlayer == (Object)null)) { if (AttackTimerSeconds <= 0.8f && Vector3.Distance(((Component)((EnemyAI)this).targetPlayer).transform.position, ((Component)this).transform.position) < (float)AttackRange && !HasAttackedThisCycle) { Log.Debug("Gallenarma Attacking!"); ((EnemyAI)this).targetPlayer.DamagePlayer(damage, true, true, (CauseOfDeath)6, 0, false, (((Component)this).transform.position - ((Component)((EnemyAI)this).targetPlayer).transform.position) * 40f); HasAttackedThisCycle = true; } if (AttackTimerSeconds <= 0f) { AttackTimerSeconds = AttackTime; HasAttackedThisCycle = false; } } } public void TryRandomAwake() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!(RandomAwakeTimerSeconds > 0f)) { if (enemyRandom.Next(0, 100) < 50) { LatestNoise = new NoiseInfo(((Component)this).transform.position, 2f); } RandomAwakeTimerSeconds = 60f; } } public PlayerControllerB GetClosestPlayerToPosition(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (position == new Vector3(-1f, -1f, -1f)) { return null; } PlayerControllerB result = null; float num = 20000f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { float num2 = Vector3.Distance(position, ((Component)val).transform.position); if (num2 < num) { result = val; num = num2; } } return result; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GallenarmaAI"; } } public class LurkerAI : WTOEnemy { protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LurkerAI"; } } internal class OoblGhostAI : WTOEnemy { private class WaitForNextAttack : BehaviorState { public override List transitions { get; set; } = new List { new AttackTimerDone() }; public WaitForNextAttack() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) int num = GetNumberOfGhosts() * 8 + 3; int num2 = GetNumberOfGhosts() * 10 + 5; RandomRange = new Vector2((float)num, (float)num2); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GhostList[enemyIndex].SecondsUntilGhostWillAttack = MyRandomInt * 10; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class ChooseTarget : BehaviorState { public override List transitions { get; set; } = new List { new TargetChosen() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } } private class GoTowardTarget : BehaviorState { public override List transitions { get; set; } = new List { new KilledPlayer(), new PlayerHasFoughtBack() }; public GoTowardTarget() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) RandomRange = new Vector2(-300f, 300f); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_00b5: 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) GhostList[enemyIndex].StopGhostFade(); GhostList[enemyIndex].AttemptScanOoblGhost(); if ((Object)(object)((EnemyAI)GhostList[enemyIndex]).targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((EnemyAI)GhostList[enemyIndex]).targetPlayer.statusEffectAudio.PlayOneShot(GhostList[enemyIndex].StartupSound); } ((EnemyAI)GhostList[enemyIndex]).creatureVoice.Play(); ((Component)GhostList[enemyIndex]).transform.position = new Vector3((float)MyRandomInt, ((Component)((EnemyAI)GhostList[enemyIndex]).targetPlayer).transform.position.y, (float)MyRandomInt); GhostList[enemyIndex].GhostPickedUpInterference = false; } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { GhostList[enemyIndex].StopGhostFade(); GhostList[enemyIndex].MoveGhostTowardTarget(); if (GhostList[enemyIndex].PlayerWithinRange(GhostList[enemyIndex].GhostInterferenceRange)) { GhostList[enemyIndex]?.SinglePlayerEvaluateWalkie(); } else { GhostList[enemyIndex].ShouldListenForWalkie = false; } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)GhostList[enemyIndex]).targetPlayer = null; } } private class AttackTimerDone : StateTransition { public override bool CanTransitionBeTaken() { return GhostList[enemyIndex].SecondsUntilGhostWillAttack <= 0f; } public override BehaviorState NextState() { return new ChooseTarget(); } } private class TargetChosen : StateTransition { public override bool CanTransitionBeTaken() { return (Object)(object)((EnemyAI)GhostList[enemyIndex]).targetPlayer != (Object)null; } public override BehaviorState NextState() { return new GoTowardTarget(); } } private class KilledPlayer : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)GhostList[enemyIndex]).targetPlayer.isPlayerDead; } public override BehaviorState NextState() { GhostList[enemyIndex].ShouldFadeGhost = true; GhostList[enemyIndex].timeElapsed = 0f; ((EnemyAI)GhostList[enemyIndex]).creatureVoice.PlayOneShot(((EnemyAI)GhostList[enemyIndex]).enemyType.deathSFX); return new WaitForNextAttack(); } } private class PlayerHasFoughtBack : StateTransition { public override bool CanTransitionBeTaken() { return GhostList[enemyIndex].GhostPickedUpInterference; } public override BehaviorState NextState() { GhostList[enemyIndex].ShouldFadeGhost = true; GhostList[enemyIndex].timeElapsed = 0f; ((EnemyAI)GhostList[enemyIndex]).creatureVoice.PlayOneShot(((EnemyAI)GhostList[enemyIndex]).enemyType.deathSFX); return new WaitForNextAttack(); } } [CompilerGenerated] private sealed class d__46 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool DestroyGhostAfterFade; public OoblGhostAI <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__46(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.timeElapsed += Time.deltaTime; Log.Debug($"Ghost Lerp Position: {<>4__this.timeElapsed / 3f}"); <>4__this.TargetFade = Mathf.Lerp(0.6f, 0f, <>4__this.timeElapsed / 3f); if (<>4__this.timeElapsed / 3f >= 1f) { Log.Debug("Ghost Lerp Finished"); HDMaterial.SetAlphaClipping(<>4__this.GhostMat, true); HDMaterial.SetAlphaClipping(<>4__this.GhostTeethMat, true); <>4__this.ShouldFadeGhost = false; ((Component)<>4__this).transform.position = new Vector3(0f, -1000f, 0f); <>4__this.timeElapsed = 0f; if (DestroyGhostAfterFade) { Log.Debug("Corpse part removed; killing enemy!"); ((EnemyAI)<>4__this).KillEnemyOnOwnerClient(true); } ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.FadeGhostCoroutine(DestroyGhostAfterFade)); <>2__current = null; <>1__state = 1; return true; } goto IL_019f; case 1: <>1__state = -1; goto IL_019f; case 2: { <>1__state = -1; return false; } IL_019f: <>4__this.GhostMat.SetFloat("_AlphaRemapMax", <>4__this.TargetFade); <>4__this.GhostMat.SetFloat("_AlphaRemapMin", <>4__this.TargetFade); <>4__this.GhostTeethMat.SetFloat("_AlphaRemapMax", <>4__this.TargetFade); <>4__this.GhostTeethMat.SetFloat("_AlphaRemapMin", <>4__this.TargetFade); <>2__current = null; <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__45 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OoblGhostAI <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__45(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.GhostInterferenceSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; Log.Debug("Listen Coroutine finished!"); <>4__this.GhostPickedUpInterference = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Balance Constants")] public float GhostInterferenceRange = 10f; public float OoblGhostSpeed = 7f; public float GhostDamagePerTick = 10f; public float GhostInterferenceSeconds = 1.5f; [Header("Defaults")] public Material GhostMat; public Material GhostTeethMat; public SkinnedMeshRenderer GhostRenderer; public SkinnedMeshRenderer GhostArmsRenderer; public AudioClip StartupSound; public static Dictionary GhostList = new Dictionary(); private static int GhostID; private float SecondsUntilGhostWillAttack; public bool GhostPickedUpInterference = false; private bool ShouldFadeGhost = false; private bool ShouldListenForWalkie; private const float FadeTimeSeconds = 3f; private float TargetFade; private float timeElapsed; private bool ListenForWalkieCrActive; private static int OoblGhostTerminalInt; public OoblCorpsePart LinkedCorpsePart; public bool IsMovingTowardPlayer = true; private bool KillGhost = false; private static readonly Dictionary PlayersTimesHaunted = new Dictionary(); private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(OoblGhostAI), LogSourceType.Enemy); internal override bool RequiresNavMesh => false; private void Awake() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) MyValidState = PlayerState.Inside; base.InitialState = new ChooseTarget(); PrintDebugs = true; GhostID++; WTOEnemyID = GhostID; Log.Info($"Adding Oobl Ghost {this} #{GhostID}: Awake"); GhostList.Add(GhostID, this); ((Component)this).transform.position = new Vector3(0f, -1000f, 0f); ((Renderer)GhostRenderer).materials = (Material[])(object)new Material[3] { GhostMat, GhostMat, GhostTeethMat }; ((Renderer)GhostArmsRenderer).materials = (Material[])(object)new Material[1] { GhostMat }; } public override void Start() { OoblGhostTerminalInt = ((IEnumerable)Enemies.spawnableEnemies).FirstOrDefault((Func)((SpawnableEnemy x) => x.enemy.enemyName == "Oobl Ghost")).terminalNode.creatureFileID; base.Start(); StopGhostFade(); } public override void Update() { MoveTimerValue(ref SecondsUntilGhostWillAttack); base.Update(); if (((Behaviour)((EnemyAI)this).agent).enabled) { ((Behaviour)((EnemyAI)this).agent).enabled = false; } if (ShouldFadeGhost) { ((MonoBehaviour)this).StartCoroutine(FadeGhostCoroutine(KillGhost)); } if ((Object)(object)((EnemyAI)this).targetPlayer == (Object)null || !(ActiveState is GoTowardTarget)) { return; } if (ShouldListenForWalkie) { Log.Info($"HEARING OTHERS THROUGH WALKIE TALKIE: {((EnemyAI)this).targetPlayer.PlayerIsHearingOthersThroughWalkieTalkie(((EnemyAI)this).targetPlayer)}"); if (((EnemyAI)this).targetPlayer.PlayerIsHearingOthersThroughWalkieTalkie(((EnemyAI)this).targetPlayer) && !ListenForWalkieCrActive) { ((MonoBehaviour)this).StartCoroutine("ListenForWalkie"); ListenForWalkieCrActive = true; return; } if (ListenForWalkieCrActive) { return; } } ((MonoBehaviour)this).StopCoroutine("ListenForWalkie"); ListenForWalkieCrActive = false; } public PlayerControllerB FindMostHauntedPlayer(Random EnemyRandom, List PlayersToCheck) { float num = 0f; float num2 = 0f; int num3 = 0; int num4 = 0; for (int i = 0; i < PlayersToCheck.Count; i++) { if (StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount > num3) { num3 = StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount; num4 = i; } if (StartOfRound.Instance.allPlayerScripts[i].insanityLevel > num) { num = StartOfRound.Instance.allPlayerScripts[i].insanityLevel; num2 = i; } } int[] array = new int[PlayersToCheck.Count]; for (int j = 0; j < PlayersToCheck.Count; j++) { if (!StartOfRound.Instance.allPlayerScripts[j].isPlayerControlled) { array[j] = 0; continue; } array[j] += 80; if (num2 == (float)j && num > 1f) { array[j] += 50; } if (num4 == j) { array[j] += 30; } if (!StartOfRound.Instance.allPlayerScripts[j].hasBeenCriticallyInjured) { array[j] += 10; } if (!StartOfRound.Instance.allPlayerScripts[j].isPlayerAlone) { array[j] += 60; } if ((Object)(object)StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer != (Object)null && StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer.scrapValue > 150) { array[j] += 30; } if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory) { array[j] += 70; } if (PlayersTimesHaunted.ContainsKey(StartOfRound.Instance.allPlayerScripts[j])) { array[j] -= 50 * PlayersTimesHaunted[StartOfRound.Instance.allPlayerScripts[j]]; } Mathf.Clamp(array[j], 0, 10000); } PlayerControllerB val = PlayersToCheck[RoundManager.Instance.GetRandomWeightedIndex(array, EnemyRandom)]; ((EnemyAI)this).ChangeOwnershipOfEnemy(val.actualClientId); return val; } private void MoveGhostTowardTarget() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0118: 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_0071: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_00a7: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsHost) { return; } if (((GrabbableObject)LinkedCorpsePart).isInShipRoom) { Log.Debug("Corpse dropped in ship!"); LinkedCorpsePart = null; GhostPickedUpInterference = true; KillGhost = true; return; } Vector3 val; if (IsMovingTowardPlayer) { val = ((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (!PlayerWithinRange(0.5f)) { Transform transform = ((Component)this).transform; transform.position += normalized * OoblGhostSpeed * Time.deltaTime; CalculateGhostRotation(); } return; } val = ((Component)LinkedCorpsePart).transform.position - ((Component)this).transform.position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; if (Vector3.Distance(((Component)this).transform.position, ((Component)LinkedCorpsePart).transform.position) > 0.5f) { Transform transform2 = ((Component)this).transform; transform2.position += normalized2 * OoblGhostSpeed * Time.deltaTime; CalculateGhostRotation(); } else { LinkedCorpsePart.DestroyCorpsePart(); LinkedCorpsePart = null; GhostPickedUpInterference = true; } } private void CalculateGhostRotation() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0030: 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_0036: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; ((Component)this).transform.rotation = Quaternion.LookRotation(normalized, Vector3.up); } private void SinglePlayerEvaluateWalkie() { PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if ((Object)(object)closestPlayer != (Object)null && closestPlayer.speakingToWalkieTalkie) { GhostPickedUpInterference = true; } } public void EvalulateSignalTranslatorUse() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Log.Debug("Ghost Recieved Signal Translator use!"); if (!((Object)(object)((EnemyAI)this).targetPlayer == (Object)null) && ActiveState is GoTowardTarget && Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) < GhostInterferenceRange + 10f) { GhostPickedUpInterference = true; } } [ServerRpc(RequireOwnership = false)] public void SetGhostTargetServerRpc(int TargetClientID) { //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(3342947580u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, TargetClientID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3342947580u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetGhostTargetClientRpc(TargetClientID); } } } [ClientRpc] public void SetGhostTargetClientRpc(int TargetClientID) { //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(3271245035u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, TargetClientID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3271245035u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((EnemyAI)this).targetPlayer = StartOfRound.Instance.allPlayerScripts[TargetClientID]; Log.Debug($"GHOST #{WTOEnemyID}: HAUNTING {((EnemyAI)this).targetPlayer.playerUsername}"); if (PlayersTimesHaunted.ContainsKey(((EnemyAI)this).targetPlayer)) { PlayersTimesHaunted[((EnemyAI)this).targetPlayer]++; } else { PlayersTimesHaunted.Add(((EnemyAI)this).targetPlayer, 1); } } } internal static int GetNumberOfGhosts() { int num = 0; foreach (OoblGhostAI value in GhostList.Values) { if ((Object)(object)value != (Object)null) { num++; } } return num; } [IteratorStateMachine(typeof(d__45))] private IEnumerator ListenForWalkie() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__45(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__46))] private IEnumerator FadeGhostCoroutine(bool DestroyGhostAfterFade) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__46(0) { <>4__this = this, DestroyGhostAfterFade = DestroyGhostAfterFade }; } private void StopGhostFade() { ShouldFadeGhost = false; HDMaterial.SetAlphaClipping(GhostMat, false); HDMaterial.SetAlphaClipping(GhostTeethMat, false); GhostMat.SetFloat("_AlphaRemapMax", 0.6f); GhostTeethMat.SetFloat("_AlphaRemapMax", 0.6f); } private void AttemptScanOoblGhost() { ScanOoblGhostServerRpc(); } [ServerRpc(RequireOwnership = false)] private void ScanOoblGhostServerRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2668882864u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2668882864u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ScanOoblGhostClientRpc(); } } } [ClientRpc] private void ScanOoblGhostClientRpc() { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1270826830u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1270826830u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Log.Debug("Scanning Oobl Ghost"); if (!HUDManager.Instance.terminalScript.scannedEnemyIDs.Contains(OoblGhostTerminalInt)) { HUDManager.Instance.terminalScript.scannedEnemyIDs.Add(OoblGhostTerminalInt); HUDManager.Instance.terminalScript.newlyScannedEnemyIDs.Add(OoblGhostTerminalInt); HUDManager.Instance.DisplayGlobalNotification("Check your terminal."); } } } 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 //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(3342947580u, new RpcReceiveHandler(__rpc_handler_3342947580), "SetGhostTargetServerRpc"); ((NetworkBehaviour)this).__registerRpc(3271245035u, new RpcReceiveHandler(__rpc_handler_3271245035), "SetGhostTargetClientRpc"); ((NetworkBehaviour)this).__registerRpc(2668882864u, new RpcReceiveHandler(__rpc_handler_2668882864), "ScanOoblGhostServerRpc"); ((NetworkBehaviour)this).__registerRpc(1270826830u, new RpcReceiveHandler(__rpc_handler_1270826830), "ScanOoblGhostClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3342947580(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 ghostTargetServerRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref ghostTargetServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((OoblGhostAI)(object)target).SetGhostTargetServerRpc(ghostTargetServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3271245035(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 ghostTargetClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref ghostTargetClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((OoblGhostAI)(object)target).SetGhostTargetClientRpc(ghostTargetClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2668882864(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; ((OoblGhostAI)(object)target).ScanOoblGhostServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1270826830(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; ((OoblGhostAI)(object)target).ScanOoblGhostClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "OoblGhostAI"; } } public class SecBotAI : EnemyAI { protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyAI)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SecBotAI"; } } public class WandererAI : WTOEnemy { private class Investigate : BehaviorState { public override List transitions { get; set; } = new List { new DoneInvestigating(), new InDanger() }; public Investigate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) RandomRange = new Vector2(12f, 17f); } public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { WandererList[enemyIndex].ReachedNextPoint = false; ((EnemyAI)WandererList[enemyIndex]).agent.speed = 0f; WandererList[enemyIndex].TotalInvestigationSeconds = MyRandomInt; Log.Debug("Investigating for: " + WandererList[enemyIndex].TotalInvestigationSeconds + "s"); ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.speed = 1f; ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Investigating", true); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { WandererList[enemyIndex].MoveTimerValue(ref WandererList[enemyIndex].TotalInvestigationSeconds); if ((double)WandererList[enemyIndex].TotalInvestigationSeconds < 0.2) { ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Investigating", false); } ((EnemyAI)WandererList[enemyIndex]).targetPlayer = ((EnemyAI)WandererList[enemyIndex]).GetClosestPlayer(false, false, false); if (!((Object)(object)((EnemyAI)WandererList[enemyIndex]).targetPlayer == (Object)null)) { } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Investigating", false); WandererList[enemyIndex].ReachedNextPoint = false; } } private class Roam : BehaviorState { public override List transitions { get; set; } = new List { new FoundNextPoint(), new InDanger() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)WandererList[enemyIndex]).agent.speed = 7f; ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Moving", true); if (!WandererList[enemyIndex].RoamPlanet.inProgress) { ((EnemyAI)WandererList[enemyIndex]).StartSearch(((Component)WandererList[enemyIndex]).transform.position, WandererList[enemyIndex].RoamPlanet); } } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!WandererList[enemyIndex].RoamPlanet.inProgress) { ((EnemyAI)WandererList[enemyIndex]).StartSearch(((Component)WandererList[enemyIndex]).transform.position, WandererList[enemyIndex].RoamPlanet); } } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Moving", false); } } private class Flee : BehaviorState { public override List transitions { get; set; } = new List { new NoLongerInDanger() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.speed = 2f; ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Moving", true); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)WandererList[enemyIndex]).agent.speed = 10f; ((EnemyAI)WandererList[enemyIndex]).SetDestinationToPosition(((EnemyAI)WandererList[enemyIndex]).ChooseFarthestNodeFromPosition(((Component)WandererList[enemyIndex].NearestPlayer(WandererList[enemyIndex].RegisteredThreats)).transform.position, false, 0, false, 50, false).position, false); } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.SetBool("Moving", false); ((EnemyAI)WandererList[enemyIndex]).creatureAnimator.speed = 1f; } } private class Stunned : BehaviorState { public override List transitions { get; set; } = new List { new InDanger() }; public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Stunned", true); ((EnemyAI)WandererList[enemyIndex]).agent.speed = 0f; WandererList[enemyIndex].RegisteredThreats.Add(((EnemyAI)WandererList[enemyIndex]).stunnedByPlayer); } public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { } public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator) { creatureAnimator.SetBool("Stunned", false); ((EnemyAI)WandererList[enemyIndex]).agent.speed = 10f; } } private class DoneInvestigating : StateTransition { public override bool CanTransitionBeTaken() { return WandererList[enemyIndex].TotalInvestigationSeconds <= 0f; } public override BehaviorState NextState() { return new Roam(); } } private class FoundNextPoint : StateTransition { public override bool CanTransitionBeTaken() { return WandererList[enemyIndex].ReachedNextPoint; } public override BehaviorState NextState() { return new Investigate(); } } private class InDanger : StateTransition { public override bool CanTransitionBeTaken() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (WandererList[enemyIndex].RegisteredThreats.Count <= 0 || ((EnemyAI)WandererList[enemyIndex]).stunNormalizedTimer > 0f) { return false; } return Vector3.Distance(((Component)WandererList[enemyIndex]).transform.position, ((Component)WandererList[enemyIndex].NearestPlayer(WandererList[enemyIndex].RegisteredThreats)).transform.position) < 5f; } public override BehaviorState NextState() { return new Flee(); } } private class NoLongerInDanger : StateTransition { public override bool CanTransitionBeTaken() { //IL_0016: 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) return !(Vector3.Distance(((Component)WandererList[enemyIndex]).transform.position, ((Component)WandererList[enemyIndex].NearestPlayer(WandererList[enemyIndex].RegisteredThreats)).transform.position) < 5f); } public override BehaviorState NextState() { return new Roam(); } } private class HitByStunGun : StateTransition { public override bool CanTransitionBeTaken() { return ((EnemyAI)WandererList[enemyIndex]).stunNormalizedTimer > 0f && !(WandererList[enemyIndex].ActiveState is Stunned); } public override BehaviorState NextState() { return new Stunned(); } } private readonly List RegisteredThreats = new List(); private float TotalInvestigationSeconds; public Transform WandererHead; private readonly bool shouldLookAtPlayer = false; private float HeadTurnTime; public static Dictionary WandererList = new Dictionary(); private static int WandererID; private readonly AISearchRoutine RoamPlanet = new AISearchRoutine(); private bool ReachedNextPoint = false; private bool CalledMom; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(WandererAI), LogSourceType.Enemy); public override void Start() { //IL_0087: 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_00ba: Unknown result type (might be due to invalid IL or missing references) MyValidState = PlayerState.Outside; base.InitialState = new Investigate(); PrintDebugs = false; WandererID++; WTOEnemyID = WandererID; Log.Info($"Adding Wanderer {this} #{WandererID}"); WandererList.Add(WandererID, this); if (!((EnemyAI)this).agent.isOnNavMesh) { RaycastHit val = default(RaycastHit); Physics.Raycast(new Ray(new Vector3(0f, 0f, 0f), Vector3.down), ref val, (float)LayerMask.GetMask(new string[1] { "Terrain" })); ((EnemyAI)this).agent.Warp(((RaycastHit)(ref val)).point); } ((EnemyAI)this).stunNormalizedTimer = -1f; GlobalTransitions.Add(new HitByStunGun()); base.Start(); } public override void Update() { base.Update(); } public void LateUpdate() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0053: 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_0075: 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_007b: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(-0.094f, 0.009f, -7.474f); if (shouldLookAtPlayer) { val = Quaternion.LookRotation(((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)WandererHead).transform.position); val = Quaternion.Euler(2.445f, ((Quaternion)(ref val)).eulerAngles.y + -90f, -10.813f); Transform wandererHead = WandererHead; wandererHead.rotation *= val; HeadTurnTime = 0f; } else if ((double)HeadTurnTime < 0.2) { ((Component)WandererHead).transform.rotation = Quaternion.Slerp(val, Quaternion.Euler(-0.094f, 0.009f, -7.474f), HeadTurnTime / 0.2f); HeadTurnTime += Time.deltaTime; } } private PlayerControllerB NearestPlayer(List List) { //IL_0037: 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) float num = 100000f; PlayerControllerB result = null; if (!List.Any()) { return result; } foreach (PlayerControllerB item in List) { float num2 = Vector3.Distance(((Component)item).transform.position, ((Component)this).transform.position); if (num2 < num) { num = num2; result = item; } } return result; } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1); if (!RegisteredThreats.Contains(playerWhoHit)) { RegisteredThreats.Add(playerWhoHit); } ((EnemyAI)this).creatureAnimator.SetTrigger("Hit"); ((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force; Log.Debug($"NEW WANDERER HEALTH: {((EnemyAI)this).enemyHP}"); if (((EnemyAI)this).enemyHP <= 0 && !((EnemyAI)this).isEnemyDead && !CalledMom) { int killerID = (int)playerWhoHit.playerClientId; AttemptKillServerRpc(killerID); CalledMom = true; } } [ServerRpc(RequireOwnership = false)] public void AttemptKillServerRpc(int KillerID) { //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(3055083293u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, KillerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3055083293u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; AttemptKillClientRpc(KillerID); } } } [ClientRpc] public void AttemptKillClientRpc(int KillerID) { //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(3720642303u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, KillerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3720642303u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsOwner) { KillWandererAndSpawnParent(KillerID); } } } public void KillWandererAndSpawnParent(int KillerID) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) Log.Info($"Spawning Adult Wanderer targeting player ID {KillerID}"); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[KillerID]; Item item = ItemPatch.ItemList[5].GetItem(); GameObject val2 = Object.Instantiate(item.spawnPrefab, ((Component)this).transform.position + new Vector3(0f, 5f, 0f), Quaternion.identity); NetworkObject component = val2.GetComponent(); int corpseValue = (int)((float)RoundManager.Instance.AnomalyRandom.Next(item.minValue, item.maxValue) * RoundManager.Instance.scrapValueMultiplier); if (((NetworkBehaviour)this).IsServer) { component.Spawn(false); } SetCorpseValueServerRpc(NetworkObjectReference.op_Implicit(component), corpseValue); Vector3 val3 = ((Component)val).transform.position - Vector3.Scale(new Vector3(-5f, 0f, -5f), ((Component)val).transform.forward * -1f); Quaternion val4 = default(Quaternion); ((Quaternion)(ref val4))..ctor(0f, Quaternion.LookRotation(((Component)val).transform.position - val3).y, 0f, 1f); GameObject val5 = Object.Instantiate(MonsterPatch.AdultWandererContainer[0].enemyType.enemyPrefab, val3, val4); if (((NetworkBehaviour)this).IsServer) { val5.gameObject.GetComponentInChildren().Spawn(true); val5.gameObject.GetComponentInChildren().SetTargetServerRpc(KillerID); } Log.Debug("Wanderer dying!"); ((EnemyAI)this).KillEnemyOnOwnerClient(false); } public override void ReachedNodeInSearch() { ((EnemyAI)this).ReachedNodeInSearch(); ReachedNextPoint = true; } [ServerRpc] public void SetCorpseValueServerRpc(NetworkObjectReference Corpse, int CorpseValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_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)((NetworkBehaviour)this).__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(4269875500u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref Corpse, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, CorpseValue); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4269875500u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetCorpseValueClientRpc(Corpse, CorpseValue); } } [ClientRpc] public void SetCorpseValueClientRpc(NetworkObjectReference Corpse, int CorpseValue) { //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_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_008c: 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(624129055u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref Corpse, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, CorpseValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 624129055u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ((NetworkObjectReference)(ref Corpse)).TryGet(ref val3, (NetworkManager)null); GrabbableObject component = ((Component)val3).GetComponent(); if (component != null) { component.SetScrapValue(CorpseValue); } } } 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 //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(3055083293u, new RpcReceiveHandler(__rpc_handler_3055083293), "AttemptKillServerRpc"); ((NetworkBehaviour)this).__registerRpc(3720642303u, new RpcReceiveHandler(__rpc_handler_3720642303), "AttemptKillClientRpc"); ((NetworkBehaviour)this).__registerRpc(4269875500u, new RpcReceiveHandler(__rpc_handler_4269875500), "SetCorpseValueServerRpc"); ((NetworkBehaviour)this).__registerRpc(624129055u, new RpcReceiveHandler(__rpc_handler_624129055), "SetCorpseValueClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3055083293(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 killerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref killerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((WandererAI)(object)target).AttemptKillServerRpc(killerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3720642303(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 killerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref killerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((WandererAI)(object)target).AttemptKillClientRpc(killerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4269875500(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_008b: 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_00a9: 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_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 { NetworkObjectReference corpse = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref corpse, default(ForNetworkSerializable)); int corpseValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref corpseValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((WandererAI)(object)target).SetCorpseValueServerRpc(corpse, corpseValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_624129055(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_003e: 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_005c: 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) { NetworkObjectReference corpse = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref corpse, default(ForNetworkSerializable)); int corpseValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref corpseValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((WandererAI)(object)target).SetCorpseValueClientRpc(corpse, corpseValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WandererAI"; } } public class WTOEnemy : EnemyAI { public abstract class BehaviorState { public Vector2 RandomRange = new Vector2(0f, 0f); public int MyRandomInt = 0; public int enemyIndex; public virtual List transitions { get; set; } public abstract void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator); public abstract void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator); public abstract void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator); } public abstract class StateTransition { public int enemyIndex; public abstract bool CanTransitionBeTaken(); public abstract BehaviorState NextState(); } public enum PlayerState { Dead, Outside, Inside, Ship } internal BehaviorState ActiveState = null; internal Random enemyRandom; internal int AITimer; internal RoundManager roundManager; internal bool PrintDebugs = false; internal PlayerState MyValidState = PlayerState.Inside; internal StateTransition nextTransition; internal List GlobalTransitions = new List(); internal List AllTransitions = new List(); internal int WTOEnemyID; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(WTOEnemy), LogSourceType.Enemy); internal BehaviorState InitialState { get; set; } internal virtual bool RequiresNavMesh => true; protected string getTypeName() { return ((object)this).GetType().Name; } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); _ = StartOfRound.Instance.livingPlayers; } public override void Start() { ((EnemyAI)this).Start(); ActiveState = InitialState; roundManager = Object.FindObjectOfType(); enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); if (base.enemyType.isOutsideEnemy) { MyValidState = PlayerState.Outside; } else { MyValidState = PlayerState.Inside; } if (RequiresNavMesh && !base.agent.isOnNavMesh && ((NetworkBehaviour)this).IsOwner) { Log.Error("CREATURE " + getTypeName() + " WAS NOT PLACED ON NAVMESH, DESTROYING..."); ((EnemyAI)this).KillEnemyOnOwnerClient(false); } base.creatureAnimator.Rebind(); ActiveState.enemyIndex = WTOEnemyID; ActiveState.OnStateEntered(WTOEnemyID, enemyRandom, base.creatureAnimator); } public override void Update() { if (base.isEnemyDead) { return; } ((EnemyAI)this).Update(); AITimer++; bool flag = true; AllTransitions.Clear(); AllTransitions.AddRange(GlobalTransitions); AllTransitions.AddRange(ActiveState.transitions); foreach (StateTransition allTransition in AllTransitions) { allTransition.enemyIndex = WTOEnemyID; if (allTransition.CanTransitionBeTaken() && ((NetworkBehaviour)this).IsOwner) { flag = false; nextTransition = allTransition; TransitionStateServerRpc(nextTransition.ToString(), GenerateNextRandomInt()); return; } } if (flag) { ActiveState.UpdateBehavior(WTOEnemyID, enemyRandom, base.creatureAnimator); } } internal bool PlayerCanBeTargeted(PlayerControllerB myPlayer) { return GetPlayerState(myPlayer) == MyValidState; } internal PlayerState GetPlayerState(PlayerControllerB myPlayer) { if (myPlayer.isPlayerDead) { return PlayerState.Dead; } if (myPlayer.isInsideFactory) { return PlayerState.Inside; } if (myPlayer.isInHangarShipRoom) { return PlayerState.Ship; } return PlayerState.Outside; } internal void MoveTimerValue(ref float Timer, bool ShouldRaise = false) { if (ShouldRaise) { Timer += Time.deltaTime; } else if (!(Timer <= 0f)) { Timer -= Time.deltaTime; } } internal void OverrideState(BehaviorState state) { if (!base.isEnemyDead) { ActiveState = state; ActiveState.OnStateEntered(WTOEnemyID, enemyRandom, base.creatureAnimator); } } public PlayerControllerB IsAnyPlayerWithinLOS(int range = 45, float width = 60f, int proximityAwareness = -1, bool DoLinecast = true, bool PrintResults = false, bool SortByDistance = false) { //IL_006f: 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) float num = range; PlayerControllerB result = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && val.isPlayerControlled && IsTargetPlayerWithinLOS(val, range, width, proximityAwareness, DoLinecast, PrintResults)) { if (!SortByDistance) { return val; } float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } public bool IsTargetPlayerWithinLOS(PlayerControllerB player, int range = 45, float width = 60f, int proximityAwareness = -1, bool DoLinecast = true, bool PrintResults = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) float num = Vector3.Distance(((Component)this).transform.position, ((Component)player.gameplayCamera).transform.position); bool flag = num < (float)range; float num2 = Vector3.Angle(((Component)base.eye).transform.forward, ((Component)player.gameplayCamera).transform.position - ((Component)base.eye).transform.position); bool flag2 = num2 < width; bool flag3 = num < (float)proximityAwareness; bool flag4 = DoLinecast && Physics.Linecast(((Component)base.eye).transform.position, ((Component)player).transform.position, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1); if (PrintResults) { Log.Debug($"Target in Distance: {flag} ({num})" + $"Target within view cone: {flag2} ({num2})" + $"LOSBlocked: {flag4}"); } return (flag && flag2) || (flag3 && !flag4); } public bool IsTargetPlayerWithinLOS(int range = 45, float width = 60f, int proximityAwareness = -1, bool DoLinecast = true, bool PrintResults = false) { if ((Object)(object)base.targetPlayer == (Object)null) { Log.Error(getTypeName() + " called Target Player LOS check called with null target player; returning false!"); return false; } return IsTargetPlayerWithinLOS(base.targetPlayer, range, width, proximityAwareness, DoLinecast, PrintResults); } public PlayerControllerB FindNearestPlayer(bool ValidateNav = false) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; float num = 20000f; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[i]; if (!ValidateNav || base.agent.CalculatePath(((Component)val2).transform.position, base.path1)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { val = val2; num = num2; } } } if ((Object)(object)val == (Object)null) { Log.Error("There is somehow no closest player. get fucked"); } return val; } internal bool IsPlayerReachable() { //IL_0039: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00a7: Invalid comparison between Unknown and I4 if ((Object)(object)base.targetPlayer == (Object)null) { WTOBase.WTOLogSource.LogError((object)"Player Reach Test has no target player or passed in argument!"); return false; } Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)base.targetPlayer).transform.position, RoundManager.Instance.navHit, 2.7f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { Log.Error("Player Reach Test: No Navmesh position"); return false; } base.agent.CalculatePath(navMeshPosition, base.agent.path); bool flag = (int)base.agent.path.status == 0; Log.Debug($"Player Reach Test: {flag}"); return flag; } internal float PlayerDistanceFromShip() { //IL_0037: 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) if ((Object)(object)base.targetPlayer == (Object)null) { Log.Error("PlayerNearShip check has no target player or passed in argument!"); return -1f; } float num = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)StartOfRound.Instance.shipBounds).transform.position); Log.Debug($"PlayerNearShip check: {num}"); return num; } internal bool PlayerWithinRange(float Range, bool IncludeYAxis = true) { return DistanceFromTargetPlayer(IncludeYAxis) <= Range; } internal bool PlayerWithinRange(PlayerControllerB player, float Range, bool IncludeYAxis = true) { return DistanceFromTargetPlayer(player, IncludeYAxis) <= Range; } private float DistanceFromTargetPlayer(bool IncludeYAxis) { //IL_006d: 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_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_00b8: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null) { Log.Error($"{this} attempted DistanceFromTargetPlayer with null target; returning -1!"); return -1f; } if (IncludeYAxis) { return Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position); } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Component)base.targetPlayer).transform.position.x, ((Component)base.targetPlayer).transform.position.z); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.z); return Vector2.Distance(val, val2); } private float DistanceFromTargetPlayer(PlayerControllerB player, bool IncludeYAxis) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (IncludeYAxis) { return Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position); } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Component)base.targetPlayer).transform.position.x, ((Component)base.targetPlayer).transform.position.z); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.z); return Vector2.Distance(val, val2); } internal bool AnimationIsFinished(string AnimName) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0082: Unknown result type (might be due to invalid IL or missing references) AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(AnimName)) { Log.Warning(getTypeName() + ": Checking for animation " + AnimName + ", but current animation is " + ((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name); return true; } currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f; } internal int GenerateNextRandomInt() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Vector2 randomRange = nextTransition.NextState().RandomRange; return enemyRandom.Next((int)randomRange.x, (int)randomRange.y); } [ServerRpc(RequireOwnership = false)] internal void SetAnimTriggerOnServerRpc(string name) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(670847578u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 670847578u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { base.creatureAnimator.SetTrigger(name); } } } [ServerRpc(RequireOwnership = false)] internal void SetAnimBoolOnServerRpc(string name, bool state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(754764381u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref state, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 754764381u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { base.creatureAnimator.SetBool(name, state); } } } [ServerRpc] internal void TransitionStateServerRpc(string StateName, int RandomInt) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Invalid comparison between Unknown and I4 //IL_0152: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__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(1493140252u, val, (RpcDelivery)0); bool flag = StateName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(StateName, false); } BytePacker.WriteValueBitPacked(val2, RandomInt); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1493140252u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TransitionStateClientRpc(StateName, RandomInt); } } [ClientRpc] internal void TransitionStateClientRpc(string StateName, int RandomInt) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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) //IL_00c7: 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(3079092172u, val, (RpcDelivery)0); bool flag = StateName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(StateName, false); } BytePacker.WriteValueBitPacked(val2, RandomInt); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3079092172u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TransitionState(StateName, RandomInt); } } internal void TransitionState(string StateName, int RandomInt) { Type type = Type.GetType(StateName); StateTransition stateTransition = (StateTransition)Activator.CreateInstance(type); stateTransition.enemyIndex = WTOEnemyID; if (ActiveState == null || !(stateTransition.NextState().GetType() == ActiveState.GetType())) { string arg = ((ActiveState == null) ? "null" : $"{ActiveState}"); Log.Debug($"{getTypeName()} #{WTOEnemyID} is Exiting: {arg}"); ActiveState?.OnStateExit(WTOEnemyID, enemyRandom, base.creatureAnimator); Log.Debug($"{getTypeName()} #{WTOEnemyID} is Transitioning via: {stateTransition}"); ActiveState = stateTransition.NextState(); ActiveState.MyRandomInt = RandomInt; ActiveState.enemyIndex = WTOEnemyID; Log.Debug($"{getTypeName()} #{WTOEnemyID} is Entering: {ActiveState}"); ActiveState.OnStateEntered(WTOEnemyID, enemyRandom, base.creatureAnimator); StartOfRound.Instance.ClientPlayerList.TryGetValue(NetworkManager.Singleton.LocalClientId, out var value); Log.Debug($"CREATURE: {((Object)base.enemyType).name} #{WTOEnemyID} STATE: {ActiveState} ON PLAYER: #{value} ({StartOfRound.Instance.allPlayerScripts[value].playerUsername})"); } } [ServerRpc] internal void SetTargetServerRpc(int PlayerID) { //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)((NetworkBehaviour)this).__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(3511454886u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, PlayerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3511454886u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetTargetClientRpc(PlayerID); } } [ClientRpc] internal void SetTargetClientRpc(int PlayerID) { //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(4083747979u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, PlayerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4083747979u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (PlayerID == -1) { base.targetPlayer = null; Log.Debug($"Clearing target on {this}"); } else if ((Object)(object)StartOfRound.Instance.allPlayerScripts[PlayerID] == (Object)null) { Log.Debug($"Index invalid! {this}"); } else { base.targetPlayer = StartOfRound.Instance.allPlayerScripts[PlayerID]; Log.Debug($"{this} setting target to: {base.targetPlayer.playerUsername}"); } } } protected override void __initializeVariables() { ((EnemyAI)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(670847578u, new RpcReceiveHandler(__rpc_handler_670847578), "SetAnimTriggerOnServerRpc"); ((NetworkBehaviour)this).__registerRpc(754764381u, new RpcReceiveHandler(__rpc_handler_754764381), "SetAnimBoolOnServerRpc"); ((NetworkBehaviour)this).__registerRpc(1493140252u, new RpcReceiveHandler(__rpc_handler_1493140252), "TransitionStateServerRpc"); ((NetworkBehaviour)this).__registerRpc(3079092172u, new RpcReceiveHandler(__rpc_handler_3079092172), "TransitionStateClientRpc"); ((NetworkBehaviour)this).__registerRpc(3511454886u, new RpcReceiveHandler(__rpc_handler_3511454886), "SetTargetServerRpc"); ((NetworkBehaviour)this).__registerRpc(4083747979u, new RpcReceiveHandler(__rpc_handler_4083747979), "SetTargetClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_670847578(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string animTriggerOnServerRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animTriggerOnServerRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((WTOEnemy)(object)target).SetAnimTriggerOnServerRpc(animTriggerOnServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_754764381(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_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string name = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false); } bool state = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref state, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((WTOEnemy)(object)target).SetAnimBoolOnServerRpc(name, state); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1493140252(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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_00a8: 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_00d9: Unknown result type (might be due to invalid IL or missing references) 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; } bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string stateName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref stateName, false); } int randomInt = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref randomInt); target.__rpc_exec_stage = (__RpcExecStage)1; ((WTOEnemy)(object)target).TransitionStateServerRpc(stateName, randomInt); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_3079092172(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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string stateName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref stateName, false); } int randomInt = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref randomInt); target.__rpc_exec_stage = (__RpcExecStage)1; ((WTOEnemy)(object)target).TransitionStateClientRpc(stateName, randomInt); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3511454886(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 targetServerRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((WTOEnemy)(object)target).SetTargetServerRpc(targetServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4083747979(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 targetClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((WTOEnemy)(object)target).SetTargetClientRpc(targetClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "WTOEnemy"; } } } namespace Welcome_To_Ooblterra.Enemies.EnemyThings { public class BabyLurkerEggProjectile : NetworkBehaviour { [CompilerGenerated] private sealed class d__19 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BabyLurkerEggProjectile <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (<>4__this.iterator < <>4__this.BabiesToSpawn) { RoundManager.Instance.SpawnEnemyGameObject(<>4__this.SpawnPosition, 0f, 1, <>4__this.BabyLurker); <>4__this.iterator++; <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 1; return true; } Object.Destroy((Object)(object)((Component)<>4__this).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BabyLurkerEggProjectile <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (<>4__this.timeElapsed / <>4__this.ExpandTime < 1f) { <>4__this.timeElapsed += Time.deltaTime; <>4__this.LerpValue = Mathf.Lerp(0.5f, 0.8f, <>4__this.timeElapsed / <>4__this.ExpandTime); ((Component)<>4__this.EggMesh).transform.localScale = new Vector3(<>4__this.LerpValue, <>4__this.LerpValue, <>4__this.LerpValue); <>2__current = null; <>1__state = 1; return true; } <>4__this.DestroyEgg(); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SpawnBabyLurkers()); ((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.StartEggExploding()); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public int TargetID = 0; public int BabiesToSpawn = 20; private Vector3 SpawnPosition; private EnemyType BabyLurker; private int iterator = 0; public MeshRenderer EggMesh; public MeshRenderer InnerEggMesh; public AudioClip[] Splat; public AudioClip[] Boom; public ParticleSystem ExplodeParticle; private Random EggRandom; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(BabyLurkerEggProjectile), LogSourceType.Thing); private float timeElapsed = 0f; private readonly float ExpandTime = 3f; private float LerpValue = 0f; private void Start() { EggRandom = new Random(StartOfRound.Instance.randomMapSeed); } private void OnTriggerEnter(Collider other) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) Log.Debug($"Collision registered! Collider: {((Component)other).gameObject}"); if ((Object)(object)((Component)other).GetComponent() != (Object)null || (Object)(object)((Component)other).GetComponent() != (Object)null || (Object)(object)((Component)other).GetComponent() != (Object)null) { return; } BabyLurker = MonsterPatch.InsideEnemies.First((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "Baby Lurker").enemyType; SpawnPosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 1f, default(NavMeshHit)); if (!(SpawnPosition == ((Component)this).transform.position)) { try { ((Component)this).GetComponent().PlayOneShot(Splat[EggRandom.Next(0, Splat.Length - 1)]); } catch { Log.Error("Couldn't play splat sound!"); } ((Component)this).GetComponent().isKinematic = true; ((MonoBehaviour)this).StartCoroutine(StartEggExploding()); } } [IteratorStateMachine(typeof(d__17))] private IEnumerator StartEggExploding() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this }; } private void DestroyEgg() { ((Renderer)EggMesh).enabled = false; ((Renderer)InnerEggMesh).enabled = false; ExplodeParticle.Play(); ((Collider)((Component)this).GetComponent()).enabled = false; ((Component)this).GetComponent().PlayOneShot(Boom[EggRandom.Next(0, Boom.Length)]); } [IteratorStateMachine(typeof(d__19))] private IEnumerator SpawnBabyLurkers() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__19(0) { <>4__this = this }; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BabyLurkerEggProjectile"; } } public class BabyLurkerProjectile : NetworkBehaviour { public AudioSource Noisemaker; public AudioClip[] ExplodeSounds; public ParticleSystem ExplodeParticle; public GameObject self; public SkinnedMeshRenderer LurkerMesh; public MeshRenderer ArachnophobiaMesh; public BabyLurkerAI OwningLurker; private float AutoDestroyTime = 2f; private bool StartAutoDestroy = false; private Random ProjectileRandom; private bool IsDead = false; private bool IsArachnophobiaMode = false; private static readonly WTOBase.WTOLogger Log = new WTOBase.WTOLogger(typeof(BabyLurkerProjectile), LogSourceType.Thing); private void OnTriggerEnter(Collider other) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Log.Debug($"Collision registered! Collider: {((Component)other).gameObject}"); PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (((Component)other).gameObject.CompareTag("Player") && !IsDead) { component.DamagePlayer(15, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } DestroySelf(); IsDead = true; } private void Start() { ProjectileRandom = new Random(StartOfRound.Instance.randomMapSeed); if (IsArachnophobiaMode != IngamePlayerSettings.Instance.unsavedSettings.spiderSafeMode) { IsArachnophobiaMode = IngamePlayerSettings.Instance.unsavedSettings.spiderSafeMode; ((Renderer)ArachnophobiaMesh).enabled = IsArachnophobiaMode; ((Renderer)LurkerMesh).enabled = !IsArachnophobiaMode; } } private void Update() { if (StartAutoDestroy) { AutoDestroyTime -= Time.deltaTime; if (AutoDestroyTime <= 0f) { Object.Destroy((Object)(object)this); } } } private void DestroySelf() { AudioSource noisemaker = Noisemaker; if (noisemaker != null) { noisemaker.PlayOneShot(ExplodeSounds[ProjectileRandom.Next(0, ExplodeSounds.Length)]); } ParticleSystem explodeParticle = ExplodeParticle; if (explodeParticle != null) { explodeParticle.Play(); } ((Component)this).GetComponent().isKinematic = true; ((Renderer)LurkerMesh).enabled = false; ((Renderer)ArachnophobiaMesh).enabled = false; if ((Object)(object)OwningLurker != (Object)null) { OwningLurker.ThrowingSelfAtPlayer = false; ((EnemyAI)OwningLurker).KillEnemyOnOwnerClient(true); } StartAutoDestroy = true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BabyLurkerProjectile"; } } internal class EnforcerHidePoint : MonoBehaviour { } internal class LurkerDamageVolume : MonoBehaviour { public BabyLurkerAI OwningLurker; private bool CanDamagePlayer; private float TimeTillDamage = 3f; private void Update() { if (TimeTillDamage <= 0f) { CanDamagePlayer = true; } else { TimeTillDamage -= Time.deltaTime; } } private void OnTriggerStay(Collider other) { //IL_003d: 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) PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (((Component)other).gameObject.CompareTag("Player") && CanDamagePlayer) { component.DamagePlayer(15, true, true, (CauseOfDeath)9, 0, false, default(Vector3)); ((EnemyAI)OwningLurker).KillEnemyClientRpc(true); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } [CompilerGenerated] internal sealed class <>z__ReadOnlyList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Count; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Count; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Count; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyList(List items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return _items.Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return _items.IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { return !_moveNextCalled && (_moveNextCalled = true); } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { return (!EqualityComparer.Default.Equals(_item, (T)value)) ? (-1) : 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return (!EqualityComparer.Default.Equals(_item, item)) ? (-1) : 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Welcome_To_Ooblterra.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }