using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using ChaosSuite.Core; using ChaosSuite.JobApplication.NetcodePatcher; using ChaosSuite.Runtime; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ChaosSuite.JobApplication")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a3464fa3098fa6be253d588a5b7ca9ba01bef4dd")] [assembly: AssemblyProduct("ChaosSuite.JobApplication")] [assembly: AssemblyTitle("ChaosSuite.JobApplication")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 ChaosSuite.JobApplication { public sealed class ApplicantEnemyAI : EnemyAI { private const double FatalOutcomeRetryInterval = 0.75; private const double FatalOutcomeTimeout = 4.0; private const byte FatalOutcomeMaximumAttempts = 5; private readonly CocoonController cocoon = new CocoonController(); private readonly Dictionary nextRescueHitAt = new Dictionary(); private readonly ulong[] fatalOutcomeTarget = new ulong[1]; private readonly NetworkVariable targetClient = new NetworkVariable(ulong.MaxValue, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable phase = new NetworkVariable((byte)3, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable rescueEndsAt = new NetworkVariable(0.0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable rescueIntegrity = new NetworkVariable((byte)0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private bool localCocoonApplied; private bool localMoveInputPrior; private double nextHudAt; private uint fatalOutcomeSequence; private uint pendingFatalOutcomeRevision; private ulong pendingFatalOutcomeClient = ulong.MaxValue; private Vector3 pendingFatalOutcomePosition; private Quaternion pendingFatalOutcomeRotation = Quaternion.identity; private int pendingFatalOutcomeSuit; private string pendingFatalOutcomeName = "EMPLOYEE"; private double nextFatalOutcomeRetryAt; private double fatalOutcomeExpiresAt; private byte fatalOutcomeAttempts; private bool fatalOutcomeAcknowledged; private ulong cleanupAffectedOwner = ulong.MaxValue; [Header("Authored prefab references")] [SerializeField] private GameObject paperEmployeePrefab; [SerializeField] private GameObject cocoonVisual; [SerializeField] [Min(1f)] private float rescueSeconds = 8f; [SerializeField] [Min(1f)] private int cocoonIntegrity = 4; public void InitializeTarget(ulong clientId) { if (((NetworkBehaviour)this).IsServer) { SetCleanupAffectedOwner(clientId); targetClient.Value = clientId; phase.Value = 3; } } public override void Start() { ((EnemyAI)this).Start(); base.AIIntervalTime = 0.15f; if ((Object)(object)((Component)this).GetComponentInChildren(true) == (Object)null && (Object)(object)JobApplicationPlugin.VisualPrefab != (Object)null) { Object.Instantiate(JobApplicationPlugin.VisualPrefab, ((Component)this).transform, false); } ChaosPresentation.TriggerAction((Component)(object)this); if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)JobApplicationPlugin.HiringClip != (Object)null) { base.creatureVoice.PlayOneShot(JobApplicationPlugin.HiringClip); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); RegisterPersistentCleanup(); NetworkVariable obj = phase; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnCocoonStateChanged)); NetworkVariable obj2 = targetClient; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnTargetChanged)); RefreshLocalCocoon(); } public override void Update() { ((EnemyAI)this).Update(); RefreshLocalCocoon(); ShowCocoonHud(); } public override void DoAIInterval() { //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_00f1: 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_011d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!((NetworkBehaviour)this).IsServer || base.isEnemyDead || (Object)(object)NetworkManager.Singleton == (Object)null) { return; } PlayerControllerB val = FindPlayer(targetClient.Value); NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; if (pendingFatalOutcomeClient != ulong.MaxValue) { AdvanceFatalOutcome(time); return; } if ((Object)(object)val == (Object)null || val.isPlayerDead || val.disconnectedMidGame || val.teleportedLastFrame || val.isInHangarShipRoom || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase) { ReleaseCocoon(); ((EnemyAI)this).KillEnemy(false); return; } if (phase.Value == 4) { if (cocoon.HasExpired(time)) { BeginFatalOutcome(val, time); } return; } base.targetPlayer = val; ((EnemyAI)this).SetMovingTowardsTargetPlayer(val); ((EnemyAI)this).SetDestinationToPosition(((Component)val).transform.position, true); ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.Noise.TryEmit(new EntityId(((NetworkBehaviour)this).NetworkObjectId), ((Component)this).transform.position, 28f, 0.8f, 71002, Time.timeAsDouble, 0.5, false); } } public override void OnCollideWithPlayer(Collider other) { //IL_0077: 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_008d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); if (!((NetworkBehaviour)this).IsServer || phase.Value != 3) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, true, false); if ((Object)(object)val == (Object)null || ((NetworkBehaviour)val).OwnerClientId != targetClient.Value) { return; } ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance == null || !instance.ThreatBudget.TryAcquire(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)0)) { return; } CocoonController cocoonController = cocoon; EntityId target = new EntityId(val.playerClientId + 1); int integrity = cocoonIntegrity; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (!cocoonController.Begin(target, integrity, ((NetworkTime)(ref serverTime)).Time, rescueSeconds)) { ChaosSuiteRuntimePlugin instance2 = ChaosSuiteRuntimePlugin.Instance; if (instance2 != null) { instance2.ThreatBudget.Release(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)0, "applicant cocoon rejected"); } } else { phase.Value = 4; rescueEndsAt.Value = cocoon.State.RescueEndsAt; rescueIntegrity.Value = (byte)Mathf.Clamp(cocoon.State.Integrity, 0, 255); base.agent.isStopped = true; SetCocoonClientRpc(((NetworkBehaviour)val).OwnerClientId, active: true); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || (Object)(object)playerWhoHit == (Object)null) { return; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (!TryAuthorizeRescueHit(playerWhoHit, ((NetworkTime)(ref serverTime)).Time)) { return; } ((EnemyAI)this).HitEnemy(Mathf.Clamp(force, 1, 10), playerWhoHit, playHitSFX, hitID); if (cocoon.Strike(Math.Max(1, force))) { rescueIntegrity.Value = (byte)Mathf.Clamp(cocoon.State.Integrity, 0, 255); if (cocoon.State.Resolved) { ReleaseCocoon(); ((EnemyAI)this).KillEnemy(false); } } } private bool TryAuthorizeRescueHit(PlayerControllerB player, double now) { //IL_0071: 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_0076: 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_0083: 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_00bc: 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_00cb: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (RoundEnding() || pendingFatalOutcomeClient != ulong.MaxValue || phase.Value != 4 || player.isPlayerDead || player.disconnectedMidGame || (!(player.currentlyHeldObjectServer is Shovel) && !(player.currentlyHeldObjectServer is KnifeItem))) { return false; } Vector3 val = (((Object)(object)cocoonVisual != (Object)null) ? cocoonVisual.transform.position : ((Component)this).transform.position); if (Vector3.SqrMagnitude(((Component)player).transform.position - val) > 16f) { return false; } if (nextRescueHitAt.TryGetValue(((NetworkBehaviour)player).OwnerClientId, out var value) && now < value) { return false; } Vector3 val2 = ((Component)player).transform.position + Vector3.up * 1.2f + ((Component)player).transform.forward * 0.35f; int num = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); RaycastHit val3 = default(RaycastHit); if (Physics.Linecast(val2, val, ref val3, num, (QueryTriggerInteraction)1) && (Object)(object)((RaycastHit)(ref val3)).transform != (Object)(object)((Component)this).transform && !((RaycastHit)(ref val3)).transform.IsChildOf(((Component)this).transform)) { return false; } nextRescueHitAt[((NetworkBehaviour)player).OwnerClientId] = now + 0.18; return true; } private void BeginFatalOutcome(PlayerControllerB target, double now) { //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && pendingFatalOutcomeClient == ulong.MaxValue && !((Object)(object)target == (Object)null) && !target.isPlayerDead) { cocoon.Resolve(); fatalOutcomeSequence++; if (fatalOutcomeSequence == 0) { fatalOutcomeSequence = 1u; } pendingFatalOutcomeRevision = fatalOutcomeSequence; pendingFatalOutcomeClient = ((NetworkBehaviour)target).OwnerClientId; pendingFatalOutcomePosition = ((Component)target).transform.position; pendingFatalOutcomeRotation = ((Component)target).transform.rotation; pendingFatalOutcomeSuit = target.currentSuitID; pendingFatalOutcomeName = SanitizeName(target.playerUsername); fatalOutcomeExpiresAt = now + 4.0; nextFatalOutcomeRetryAt = now; fatalOutcomeAttempts = 0; fatalOutcomeAcknowledged = false; HiringFailurePresentationClientRpc(); AdvanceFatalOutcome(now); } } private void AdvanceFatalOutcome(double now) { //IL_014c: 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_0169: 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_016f: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || pendingFatalOutcomeClient == ulong.MaxValue) { return; } PlayerControllerB val = FindPlayer(pendingFatalOutcomeClient); if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)val) && fatalOutcomeAcknowledged && val.isPlayerDead) { CommitFatalOutcome(); } else if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase || (Object)(object)val == (Object)null || !Object.op_Implicit((Object)(object)val) || val.disconnectedMidGame || (!val.isPlayerControlled && !val.isPlayerDead) || val.teleportedLastFrame || val.isInHangarShipRoom) { AbortFatalOutcome("target left the active round"); } else if (now >= fatalOutcomeExpiresAt) { AbortFatalOutcome("owner acknowledgement timed out"); } else if (fatalOutcomeAttempts < 5 && !(now < nextFatalOutcomeRetryAt)) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsListening || !singleton.ConnectedClients.ContainsKey(pendingFatalOutcomeClient)) { AbortFatalOutcome("target owner disconnected"); return; } fatalOutcomeAttempts++; nextFatalOutcomeRetryAt = now + 0.75; fatalOutcomeTarget[0] = pendingFatalOutcomeClient; ApplyHiringFailureClientRpc(pendingFatalOutcomeClient, pendingFatalOutcomeRevision, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = fatalOutcomeTarget } }); } } private void CommitFatalOutcome() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || pendingFatalOutcomeClient == ulong.MaxValue) { return; } Vector3 val = pendingFatalOutcomePosition; Quaternion val2 = pendingFatalOutcomeRotation; int suitId = pendingFatalOutcomeSuit; string sanitizedName = pendingFatalOutcomeName; ClearFatalOutcomeState(); if ((Object)(object)paperEmployeePrefab != (Object)null && PaperEmployeeAI.ActiveCount < 2) { GameObject val3 = Object.Instantiate(paperEmployeePrefab, val, val2); NetworkObject component = val3.GetComponent(); PaperEmployeeAI component2 = val3.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { component.Spawn(true); component2.InitializeSuit(suitId, sanitizedName); } else { Object.Destroy((Object)(object)val3); } } ReleaseCocoon(); ((EnemyAI)this).KillEnemy(false); } private void AbortFatalOutcome(string reason) { if (((NetworkBehaviour)this).IsServer && pendingFatalOutcomeClient != ulong.MaxValue) { Debug.LogWarning((object)("[ChaosSuite.JobApplication] Applicant fatal outcome cancelled: " + reason + ".")); ClearFatalOutcomeState(); ((EnemyAI)this).KillEnemy(false); } } private void ClearFatalOutcomeState() { //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_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) pendingFatalOutcomeClient = ulong.MaxValue; pendingFatalOutcomeRevision = 0u; pendingFatalOutcomePosition = Vector3.zero; pendingFatalOutcomeRotation = Quaternion.identity; pendingFatalOutcomeSuit = 0; pendingFatalOutcomeName = "EMPLOYEE"; nextFatalOutcomeRetryAt = 0.0; fatalOutcomeExpiresAt = 0.0; fatalOutcomeAttempts = 0; fatalOutcomeAcknowledged = false; } private void ReleaseCocoon() { if (targetClient.Value != ulong.MaxValue) { SetCocoonClientRpc(targetClient.Value, active: false); } cocoon.Reset(); rescueEndsAt.Value = 0.0; rescueIntegrity.Value = 0; ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.ThreatBudget.Release(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)0, "applicant cocoon released"); } if ((Object)(object)base.agent != (Object)null && base.agent.isOnNavMesh) { base.agent.isStopped = false; } } private void RegisterPersistentCleanup() { if (((NetworkBehaviour)this).IsServer && !((Object)(object)((NetworkBehaviour)this).NetworkObject == (Object)null) && ((NetworkBehaviour)this).NetworkObject.IsSpawned) { ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.Cleanup.Register(((NetworkBehaviour)this).NetworkObject, (Action)CleanupPersistentEffect); } } } private void CleanupPersistentEffect() { if (((NetworkBehaviour)this).IsServer) { ClearFatalOutcomeState(); ReleaseCocoon(); SetCleanupAffectedOwner(ulong.MaxValue); targetClient.Value = ulong.MaxValue; if (phase.Value != 6) { phase.Value = 0; } ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.ThreatBudget.Release(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)2, "applicant persistent cleanup"); } } } private void SetCleanupAffectedOwner(ulong nextOwner) { //IL_003f: 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) if (((NetworkBehaviour)this).IsServer && cleanupAffectedOwner != nextOwner) { ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; EffectCleanupRegistry val = ((instance != null) ? instance.Cleanup : null); EntityId val2 = default(EntityId); ((EntityId)(ref val2))..ctor(((NetworkBehaviour)this).NetworkObjectId); if (cleanupAffectedOwner != ulong.MaxValue && val != null) { val.DisassociateAffectedOwner(val2, cleanupAffectedOwner); } cleanupAffectedOwner = nextOwner; if (cleanupAffectedOwner != ulong.MaxValue && val != null) { val.AssociateAffectedOwner(val2, cleanupAffectedOwner); } } } [ClientRpc] private void SetCocoonClientRpc(ulong target, bool active) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2027601905u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, target); ((FastBufferWriter)(ref val)).WriteValueSafe(ref active, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2027601905u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)cocoonVisual != (Object)null) { cocoonVisual.SetActive(active); } if (active) { ChaosPresentation.TriggerAction((Component)(object)this); } RefreshLocalCocoon(); } } [ClientRpc] private void HiringFailurePresentationClientRpc() { //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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(26811851u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 26811851u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ChaosPresentation.TriggerAction((Component)(object)this); } } } [ClientRpc] private void ApplyHiringFailureClientRpc(ulong target, uint outcomeRevision, ClientRpcParams clientRpcParams = 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_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_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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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) //IL_0152: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2848090098u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, target); BytePacker.WriteValueBitPacked(val, outcomeRevision); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2848090098u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkManager singleton = NetworkManager.Singleton; if (singleton == null || singleton.LocalClientId != target) { return; } PlayerControllerB val2 = GameNetworkManager.Instance?.localPlayerController; if (!((Object)(object)val2 == (Object)null) && ((NetworkBehaviour)val2).OwnerClientId == target) { if (!val2.isPlayerDead) { val2.DamagePlayer(200, true, true, (CauseOfDeath)5, 0, false, default(Vector3)); } if (val2.isPlayerDead) { AcknowledgeHiringFailureServerRpc(outcomeRevision); } } } [ServerRpc(RequireOwnership = false)] private void AcknowledgeHiringFailureServerRpc(uint outcomeRevision, ServerRpcParams rpc = 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_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_00e5: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2688439296u, rpc, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, outcomeRevision); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2688439296u, rpc, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer && pendingFatalOutcomeClient != ulong.MaxValue && rpc.Receive.SenderClientId == pendingFatalOutcomeClient && outcomeRevision != 0 && outcomeRevision == pendingFatalOutcomeRevision) { fatalOutcomeAcknowledged = true; PlayerControllerB val2 = FindPlayer(pendingFatalOutcomeClient); if ((Object)(object)val2 != (Object)null && val2.isPlayerDead) { CommitFatalOutcome(); } } } public override void KillEnemy(bool destroy = false) { if (((NetworkBehaviour)this).IsServer) { ClearFatalOutcomeState(); } if (!base.isEnemyDead) { ReleaseCocoon(); } if (((NetworkBehaviour)this).IsServer) { SetCleanupAffectedOwner(ulong.MaxValue); ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.ThreatBudget.Release(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)2, "applicant ended"); } } ((EnemyAI)this).KillEnemy(destroy); } public override void OnNetworkDespawn() { RestoreLocalCocoonInput(); if (((NetworkBehaviour)this).IsServer) { ClearFatalOutcomeState(); ReleaseCocoon(); } else { cocoon.Reset(); } NetworkVariable obj = phase; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnCocoonStateChanged)); NetworkVariable obj2 = targetClient; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnTargetChanged)); if (((NetworkBehaviour)this).IsServer) { SetCleanupAffectedOwner(ulong.MaxValue); ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.ThreatBudget.Release(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)2, "applicant despawned"); } } nextRescueHitAt.Clear(); ((NetworkBehaviour)this).OnNetworkDespawn(); } private void OnDisable() { RestoreLocalCocoonInput(); } private void RestoreLocalCocoonInput() { if ((Object)(object)cocoonVisual != (Object)null) { cocoonVisual.SetActive(false); } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if (localCocoonApplied && !((Object)(object)val == (Object)null)) { val.disableMoveInput = localMoveInputPrior; localCocoonApplied = false; } } private void RefreshLocalCocoon() { bool flag = phase.Value == 4; if ((Object)(object)cocoonVisual != (Object)null) { cocoonVisual.SetActive(flag); } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; int num; if ((Object)(object)val != (Object)null) { NetworkManager singleton = NetworkManager.Singleton; num = ((((singleton != null) ? new ulong?(singleton.LocalClientId) : ((ulong?)null)) == targetClient.Value) ? 1 : 0); } else { num = 0; } bool flag2 = (byte)num != 0; if (!flag || !flag2) { RestoreLocalCocoonInput(); return; } if (!localCocoonApplied) { localMoveInputPrior = val.disableMoveInput; } val.disableMoveInput = true; localCocoonApplied = true; } private void ShowCocoonHud() { //IL_0064: 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) //IL_0074: 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_00c4: Unknown result type (might be due to invalid IL or missing references) if (phase.Value != 4 || Time.timeAsDouble < nextHudAt || (Object)(object)HUDManager.Instance == (Object)null) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; PlayerControllerB val2 = FindPlayer(targetClient.Value); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !(Vector3.SqrMagnitude(((Component)val).transform.position - ((Component)val2).transform.position) > 64f)) { nextHudAt = Time.timeAsDouble + 1.0; double value = rescueEndsAt.Value; NetworkManager singleton = NetworkManager.Singleton; double num; if (singleton == null) { num = Time.timeAsDouble; } else { NetworkTime serverTime = singleton.ServerTime; num = ((NetworkTime)(ref serverTime)).Time; } double num2 = Math.Max(0.0, Math.Ceiling(value - num)); NetworkManager singleton2 = NetworkManager.Singleton; string text = ((((singleton2 != null) ? new ulong?(singleton2.LocalClientId) : ((ulong?)null)) == targetClient.Value) ? "PAPER COCOON" : "RESCUE THE APPLICANT"); HUDManager.Instance.DisplayTip(text, $"{num2:0}s remaining - {rescueIntegrity.Value} tear hits", true, false, "ChaosSuite_ApplicantCocoon"); } } private void OnCocoonStateChanged(byte previous, byte current) { RefreshLocalCocoon(); } private void OnTargetChanged(ulong previous, ulong current) { RefreshLocalCocoon(); } private static PlayerControllerB? FindPlayer(ulong clientId) { PlayerControllerB[] array = StartOfRound.Instance?.allPlayerScripts; if (array == null) { return null; } for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((NetworkBehaviour)array[i]).OwnerClientId == clientId) { return array[i]; } } return null; } private static bool RoundEnding() { if (Object.op_Implicit((Object)(object)StartOfRound.Instance) && !StartOfRound.Instance.shipIsLeaving) { return StartOfRound.Instance.inShipPhase; } return true; } private static string SanitizeName(string value) { if (string.IsNullOrWhiteSpace(value)) { return "EMPLOYEE"; } char[] array = new char[Math.Min(value.Length, 24)]; int num = 0; for (int i = 0; i < value.Length; i++) { if (num >= array.Length) { break; } bool flag = char.IsLetterOrDigit(value[i]); if (!flag) { char c = value[i]; bool flag2 = ((c == ' ' || c == '-' || c == '_') ? true : false); flag = flag2; } if (flag) { array[num++] = value[i]; } } if (num != 0) { return new string(array, 0, num); } return "EMPLOYEE"; } protected override void __initializeVariables() { if (targetClient == null) { throw new Exception("ApplicantEnemyAI.targetClient cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)targetClient).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)targetClient, "targetClient"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)targetClient); if (phase == null) { throw new Exception("ApplicantEnemyAI.phase cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)phase).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)phase, "phase"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)phase); if (rescueEndsAt == null) { throw new Exception("ApplicantEnemyAI.rescueEndsAt cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)rescueEndsAt).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)rescueEndsAt, "rescueEndsAt"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)rescueEndsAt); if (rescueIntegrity == null) { throw new Exception("ApplicantEnemyAI.rescueIntegrity cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)rescueIntegrity).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)rescueIntegrity, "rescueIntegrity"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)rescueIntegrity); ((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 ((NetworkBehaviour)this).__registerRpc(2027601905u, new RpcReceiveHandler(__rpc_handler_2027601905), "SetCocoonClientRpc"); ((NetworkBehaviour)this).__registerRpc(26811851u, new RpcReceiveHandler(__rpc_handler_26811851), "HiringFailurePresentationClientRpc"); ((NetworkBehaviour)this).__registerRpc(2848090098u, new RpcReceiveHandler(__rpc_handler_2848090098), "ApplyHiringFailureClientRpc"); ((NetworkBehaviour)this).__registerRpc(2688439296u, new RpcReceiveHandler(__rpc_handler_2688439296), "AcknowledgeHiringFailureServerRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_2027601905(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong target2 = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref target2); bool active = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref active, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ApplicantEnemyAI)(object)target).SetCocoonClientRpc(target2, active); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_26811851(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; ((ApplicantEnemyAI)(object)target).HiringFailurePresentationClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2848090098(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_003d: 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_0043: 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_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) { ulong target2 = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref target2); uint outcomeRevision = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref outcomeRevision); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((ApplicantEnemyAI)(object)target).ApplyHiringFailureClientRpc(target2, outcomeRevision, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2688439296(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0040: 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) { uint outcomeRevision = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref outcomeRevision); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((ApplicantEnemyAI)(object)target).AcknowledgeHiringFailureServerRpc(outcomeRevision, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ApplicantEnemyAI"; } } public sealed class PaperEmployeeAI : EnemyAI { internal const int MaximumActive = 2; private readonly NetworkVariable suit = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable employeeName = new NetworkVariable(default(FixedString32Bytes), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [SerializeField] private GameObject applicationPrefab; private double nextAttachAt; private bool countedActive; internal static int ActiveCount { get; private set; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer && !countedActive) { countedActive = true; ActiveCount++; } } public void InitializeSuit(int suitId, string sanitizedName) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { suit.Value = Mathf.Max(0, suitId); employeeName.Value = FixedString32Bytes.op_Implicit(sanitizedName); } } public override void Start() { ((EnemyAI)this).Start(); base.enemyHP = 1; base.AIIntervalTime = 0.25f; } public override void DoAIInterval() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (((NetworkBehaviour)this).IsServer && !base.isEnemyDead) { if (RoundEnding()) { ((EnemyAI)this).KillEnemy(false); } else if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, true, true) && !((Object)(object)base.targetPlayer == (Object)null) && !base.targetPlayer.isPlayerDead && !base.targetPlayer.disconnectedMidGame && !base.targetPlayer.isInHangarShipRoom) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true); } } } public override void OnCollideWithPlayer(Collider other) { //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) //IL_0065: 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_0097: 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_00eb: 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) ((EnemyAI)this).OnCollideWithPlayer(other); if (!((NetworkBehaviour)this).IsServer || base.isEnemyDead || RoundEnding()) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val == (Object)null || val.isInHangarShipRoom || val.disconnectedMidGame) { return; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (((NetworkTime)(ref serverTime)).Time < nextAttachAt) { return; } serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; nextAttachAt = ((NetworkTime)(ref serverTime)).Time + 8.0; ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.Noise.TryEmit(new EntityId(((NetworkBehaviour)this).NetworkObjectId), ((Component)val).transform.position, 24f, 0.7f, 71003, Time.timeAsDouble, 0.8, val.isInHangarShipRoom); } if (!((Object)(object)applicationPrefab == (Object)null)) { GameObject val2 = Object.Instantiate(applicationPrefab, ((Component)val).transform.position, ((Component)val).transform.rotation); NetworkObject component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.Spawn(true); } else { Object.Destroy((Object)(object)val2); } ((EnemyAI)this).KillEnemy(false); } } public override void KillEnemy(bool destroy = false) { if (((NetworkBehaviour)this).IsServer) { ReleaseActiveSlot(); } ((EnemyAI)this).KillEnemy(destroy); } public override void OnNetworkDespawn() { if (((NetworkBehaviour)this).IsServer) { ReleaseActiveSlot(); } ((NetworkBehaviour)this).OnNetworkDespawn(); } private void ReleaseActiveSlot() { if (countedActive) { countedActive = false; ActiveCount = Math.Max(0, ActiveCount - 1); } } private static bool RoundEnding() { if (Object.op_Implicit((Object)(object)StartOfRound.Instance) && !StartOfRound.Instance.shipIsLeaving) { return StartOfRound.Instance.inShipPhase; } return true; } protected override void __initializeVariables() { if (suit == null) { throw new Exception("PaperEmployeeAI.suit cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)suit).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)suit, "suit"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)suit); if (employeeName == null) { throw new Exception("PaperEmployeeAI.employeeName cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)employeeName).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)employeeName, "employeeName"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)employeeName); ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyAI)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PaperEmployeeAI"; } } public enum ApplicantPhase : byte { Dormant, Attached, Announcing, Hiring, Cocooned, Minion, Destroyed } public enum QualificationEvent : byte { ScrapPickup, ValuableScrap, TwoHandedCarry, SustainedSprint, FacilityOperation, WalkieControl, Teamwork, SurvivedDamage, ReturnedScrap, IdleResponse, PropertyDrop } [Flags] public enum QualificationCategory : byte { None = 0, Productivity = 1, Initiative = 2, Teamwork = 4, All = 7 } public readonly record struct ApplicationState(ApplicantPhase Phase, EntityId Holder, int Score, double NextAnnouncementAt, uint Revision); public sealed class QualificationLedger { private readonly Dictionary<(EntityId, QualificationEvent), double> cooldowns = new Dictionary<(EntityId, QualificationEvent), double>(); public int Threshold => 7; public bool TryScore(ref ApplicationState state, QualificationEvent kind, int delta, double now, double cooldown) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) EntityId holder = state.Holder; bool flag = !((EntityId)(ref holder)).IsValid; if (!flag) { ApplicantPhase phase = state.Phase; bool flag2 = phase - 4 <= ApplicantPhase.Announcing; flag = flag2; } if (flag) { return false; } (EntityId, QualificationEvent) key = (state.Holder, kind); if (cooldowns.TryGetValue(key, out var value) && now < value) { return false; } cooldowns[key] = now + Math.Max(0.0, cooldown); QualificationCategory qualificationCategory = CategoryFor(kind); int num = state.Score; if (delta > 0) { num |= (int)qualificationCategory; } else if (delta < 0) { num &= (int)(~(uint)qualificationCategory); } num &= Threshold; if (num == state.Score) { return false; } state = state with { Score = num, Phase = ((num != Threshold) ? ApplicantPhase.Attached : ApplicantPhase.Hiring), Revision = state.Revision + 1 }; return true; } public bool TryTransfer(ref ApplicationState state, EntityId nextHolder, bool targetIsValid) { //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_0047: Unknown result type (might be due to invalid IL or missing references) bool flag = !targetIsValid || !((EntityId)(ref nextHolder)).IsValid || state.Holder == nextHolder; if (!flag) { ApplicantPhase phase = state.Phase; bool flag2 = ((phase - 3 <= ApplicantPhase.Attached || phase == ApplicantPhase.Destroyed) ? true : false); flag = flag2; } if (flag) { return false; } state = state with { Holder = nextHolder, Phase = ApplicantPhase.Attached, Revision = state.Revision + 1 }; return true; } public void Forget(EntityId holder) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) List<(EntityId, QualificationEvent)> list = new List<(EntityId, QualificationEvent)>(); foreach (KeyValuePair<(EntityId, QualificationEvent), double> cooldown in cooldowns) { if (cooldown.Key.Item1 == holder) { list.Add(cooldown.Key); } } foreach (var item in list) { cooldowns.Remove(item); } } public void Clear() { cooldowns.Clear(); } public static QualificationCategory CategoryFor(QualificationEvent kind) { switch (kind) { case QualificationEvent.ScrapPickup: case QualificationEvent.ValuableScrap: case QualificationEvent.TwoHandedCarry: case QualificationEvent.ReturnedScrap: case QualificationEvent.PropertyDrop: return QualificationCategory.Productivity; case QualificationEvent.SustainedSprint: case QualificationEvent.FacilityOperation: case QualificationEvent.WalkieControl: case QualificationEvent.SurvivedDamage: case QualificationEvent.IdleResponse: return QualificationCategory.Initiative; case QualificationEvent.Teamwork: return QualificationCategory.Teamwork; default: return QualificationCategory.None; } } } public readonly record struct CocoonState(EntityId Target, int Integrity, double RescueEndsAt, bool Resolved, uint Revision); public sealed class CocoonController { public CocoonState State { get; private set; } public bool Begin(EntityId target, int integrity, double now, double rescueSeconds) { //IL_0045: 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_0038: Unknown result type (might be due to invalid IL or missing references) if (((EntityId)(ref target)).IsValid && integrity >= 1 && !(rescueSeconds <= 0.0)) { if (!State.Resolved) { EntityId target2 = State.Target; if (((EntityId)(ref target2)).IsValid) { goto IL_0042; } } State = new CocoonState(target, integrity, now + rescueSeconds, Resolved: false, State.Revision + 1); return true; } goto IL_0042; IL_0042: return false; } public bool Strike(int force) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!State.Resolved) { EntityId target = State.Target; if (((EntityId)(ref target)).IsValid && force > 0) { int num = Math.Max(0, State.Integrity - force); State = State with { Integrity = num, Resolved = (num == 0), Revision = State.Revision + 1 }; return true; } } return false; } public bool HasExpired(double now) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!State.Resolved) { EntityId target = State.Target; if (((EntityId)(ref target)).IsValid) { return now >= State.RescueEndsAt; } } return false; } public void Resolve() { if (!State.Resolved) { State = State with { Resolved = true, Revision = State.Revision + 1 }; } } public void Reset() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) State = new CocoonState(EntityId.None, 0, 0.0, Resolved: true, State.Revision + 1); } } public sealed class JobApplicationItem : GrabbableObject, IHittable { private static readonly Collider[] TransferBuffer = (Collider[])(object)new Collider[32]; private readonly QualificationLedger ledger = new QualificationLedger(); private readonly NetworkVariable holderClient = new NetworkVariable(ulong.MaxValue, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable qualification = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable applicantPhase = new NetworkVariable((byte)0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable entityAnchor = new NetworkVariable(ulong.MaxValue, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable entityAnchorEndsAt = new NetworkVariable(0.0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly Dictionary lastHitSequence = new Dictionary(); private readonly Dictionary lastTransferSequence = new Dictionary(); private readonly Dictionary nextHitAt = new Dictionary(); private readonly Dictionary nextTransferAt = new Dictionary(); private readonly Transform?[] qualificationChecks = (Transform?[])(object)new Transform[3]; private ApplicationState state = new ApplicationState(ApplicantPhase.Dormant, EntityId.None, 0, 0.0, 0u); private ulong lastHeldObjectId = ulong.MaxValue; private float sprintSeconds; private int lastHealth = 100; private int resumeIntegrity = 4; private double nextPoll; private double responseWindowAt; private uint localHitSequence; private uint localTransferSequence; private ulong cleanupAffectedOwner = ulong.MaxValue; [Header("Authored prefab references")] [SerializeField] private GameObject applicantEnemyPrefab; [SerializeField] private Transform resumeSheet; [SerializeField] private AudioSource announcementSource; [SerializeField] private AudioClip[] qualificationAnnouncements = Array.Empty(); [SerializeField] [Min(1f)] private float transferRange = 2.5f; [SerializeField] [Min(1f)] private int valuableThreshold = 80; public override void Start() { ((GrabbableObject)this).Start(); if (qualificationAnnouncements.Length == 0) { qualificationAnnouncements = (AudioClip[])((JobApplicationPlugin.AnnouncementClips.Length != 0) ? JobApplicationPlugin.AnnouncementClips : ((!((Object)(object)JobApplicationPlugin.MechanicClip != (Object)null)) ? ((Array)Array.Empty()) : ((Array)new AudioClip[1] { JobApplicationPlugin.MechanicClip }))); } CacheQualificationChecks(); UpdateQualificationChecks(qualification.Value); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); RegisterPersistentCleanup(); NetworkVariable obj = qualification; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnQualificationChanged)); NetworkVariable obj2 = holderClient; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnPresentationHolderChanged)); NetworkVariable obj3 = applicantPhase; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnPresentationPhaseChanged)); NetworkVariable obj4 = entityAnchor; obj4.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj4.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnPresentationAnchorChanged)); CacheQualificationChecks(); UpdateQualificationChecks(qualification.Value); RefreshAttachedPresentation(); } public override void Update() { //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_003d: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (!((NetworkBehaviour)this).IsServer || (Object)(object)NetworkManager.Singleton == (Object)null) { return; } NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; EntityId holder; if (RoundEnding()) { holder = state.Holder; if (((EntityId)(ref holder)).IsValid || entityAnchor.Value != ulong.MaxValue || state.Phase != ApplicantPhase.Dormant) { ReleaseApplication(((Component)this).transform.position); } return; } if (entityAnchor.Value != ulong.MaxValue) { if (time >= entityAnchorEndsAt.Value || !TryResolveNetworkObject(entityAnchor.Value, out NetworkObject networkObject)) { ReleaseApplication(((Component)this).transform.position); } else { ((Component)this).transform.position = ((Component)networkObject).transform.position + Vector3.up * 0.55f; } return; } holder = state.Holder; if (!((EntityId)(ref holder)).IsValid && (Object)(object)base.playerHeldBy != (Object)null && !base.playerHeldBy.isPlayerDead) { Attach(base.playerHeldBy, time); } if (time < nextPoll) { return; } holder = state.Holder; if (!((EntityId)(ref holder)).IsValid) { return; } nextPoll = time + 0.5; PlayerControllerB val = FindPlayer(holderClient.Value); if ((Object)(object)val == (Object)null || val.isPlayerDead || val.disconnectedMidGame || val.teleportedLastFrame || val.isInHangarShipRoom || StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase) { ReleaseApplication((val != null) ? ((Component)val).transform.position : ((Component)this).transform.position); return; } Observe(val, time); if (state.Phase == ApplicantPhase.Hiring && time >= state.NextAnnouncementAt) { BeginHiring(val); } } public override void LateUpdate() { //IL_0035: 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_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_0054: 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_00a1: 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_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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00e3: 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) ((GrabbableObject)this).LateUpdate(); if (entityAnchor.Value != ulong.MaxValue && TryResolveNetworkObject(entityAnchor.Value, out NetworkObject networkObject)) { ((Component)this).transform.SetPositionAndRotation(((Component)networkObject).transform.position + Vector3.up * 0.55f, ((Component)networkObject).transform.rotation); } else if (holderClient.Value != ulong.MaxValue) { PlayerControllerB val = FindPlayer(holderClient.Value); if (!((Object)(object)val == (Object)null)) { ((Component)this).transform.SetPositionAndRotation(((Component)val).transform.position - ((Component)val).transform.forward * 0.22f + Vector3.up * 1.35f, ((Component)val).transform.rotation * Quaternion.Euler(0f, 180f, 0f)); } } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0053: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner && buttonDown && !((Object)(object)base.playerHeldBy == (Object)null)) { localTransferSequence++; if (localTransferSequence == 0) { localTransferSequence = 1u; } RequestTransferServerRpc(((NetworkBehaviour)base.playerHeldBy).OwnerClientId, localTransferSequence); } } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB? playerWhoHit, bool playHitSFX, int hitID) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerWhoHit == (Object)null) { return false; } if (((NetworkBehaviour)this).IsServer) { NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (TryAuthorizeResumeHit(playerWhoHit, ((NetworkTime)(ref serverTime)).Time)) { ApplyResumeHit(force, playerWhoHit); } } else { localHitSequence++; if (localHitSequence == 0) { localHitSequence = 1u; } ResumeHitServerRpc(((NetworkBehaviour)playerWhoHit).OwnerClientId, localHitSequence); } return true; } [ServerRpc(RequireOwnership = false)] private void RequestTransferServerRpc(ulong claimedHolder, uint sequence, ServerRpcParams rpc = 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_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_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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(686112506u, rpc, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, claimedHolder); BytePacker.WriteValueBitPacked(val, sequence); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 686112506u, rpc, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer || RoundEnding() || rpc.Receive.SenderClientId != claimedHolder || claimedHolder != holderClient.Value || state.Phase != ApplicantPhase.Attached || sequence == 0 || (lastTransferSequence.TryGetValue(claimedHolder, out var value) && sequence <= value)) { return; } lastTransferSequence[claimedHolder] = sequence; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; if (nextTransferAt.TryGetValue(claimedHolder, out var value2) && time < value2) { return; } nextTransferAt[claimedHolder] = time + 0.35; PlayerControllerB val2 = FindPlayer(claimedHolder); if ((Object)(object)val2 == (Object)null || val2.isPlayerDead) { return; } if (TryFindSupportedEntityAnchor(val2, out NetworkObject selected) && (Object)(object)selected != (Object)null) { SetCleanupAffectedOwner(ulong.MaxValue); entityAnchor.Value = selected.NetworkObjectId; entityAnchorEndsAt.Value = time + 15.0; state = state with { Holder = new EntityId(selected.NetworkObjectId + 1), Phase = ApplicantPhase.Attached, Revision = state.Revision + 1 }; holderClient.Value = ulong.MaxValue; Publish(); return; } PlayerControllerB val3 = null; float num = transferRange * transferRange; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val4 == (Object)(object)val2) && !val4.isPlayerDead && val4.isPlayerControlled && val4.isInHangarShipRoom == val2.isInHangarShipRoom) { float num2 = Vector3.SqrMagnitude(((Component)val4).transform.position - ((Component)val2).transform.position); if (!(num2 >= num)) { num = num2; val3 = val4; } } } if (!((Object)(object)val3 == (Object)null) && ledger.TryTransfer(ref state, PlayerId(val3), targetIsValid: true)) { SetCleanupAffectedOwner(((NetworkBehaviour)val3).OwnerClientId); holderClient.Value = ((NetworkBehaviour)val3).OwnerClientId; Publish(); } } [ServerRpc(RequireOwnership = false)] private void ResumeHitServerRpc(ulong claimedPlayer, uint sequence, ServerRpcParams rpc = 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_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_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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3020773868u, rpc, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, claimedPlayer); BytePacker.WriteValueBitPacked(val, sequence); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3020773868u, rpc, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer || RoundEnding() || rpc.Receive.SenderClientId != claimedPlayer || sequence == 0 || (lastHitSequence.TryGetValue(claimedPlayer, out var value) && sequence <= value)) { return; } PlayerControllerB val2 = FindPlayer(claimedPlayer); if (!((Object)(object)val2 == (Object)null)) { NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; if (TryAuthorizeResumeHit(val2, ((NetworkTime)(ref serverTime)).Time)) { lastHitSequence[claimedPlayer] = sequence; ApplyResumeHit(1, val2); } } } private bool TryAuthorizeResumeHit(PlayerControllerB player, double now) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0073: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c7: 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_00f6: Unknown result type (might be due to invalid IL or missing references) if (RoundEnding() || state.Phase == ApplicantPhase.Destroyed || player.isPlayerDead || player.disconnectedMidGame || (!(player.currentlyHeldObjectServer is Shovel) && !(player.currentlyHeldObjectServer is KnifeItem))) { return false; } Vector3 val = (((Object)(object)resumeSheet != (Object)null) ? resumeSheet.position : ((Component)this).transform.position); if (Vector3.SqrMagnitude(((Component)player).transform.position - val) > 16f) { return false; } if (nextHitAt.TryGetValue(((NetworkBehaviour)player).OwnerClientId, out var value) && now < value) { return false; } Vector3 val2 = ((Component)player).transform.position + Vector3.up * 1.2f + ((Component)player).transform.forward * 0.35f; int num = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); RaycastHit val3 = default(RaycastHit); if (Physics.Linecast(val2, val, ref val3, num, (QueryTriggerInteraction)1) && (Object)(object)((RaycastHit)(ref val3)).transform != (Object)(object)((Component)this).transform && !((RaycastHit)(ref val3)).transform.IsChildOf(((Component)this).transform)) { return false; } nextHitAt[((NetworkBehaviour)player).OwnerClientId] = now + 0.18; return true; } private void ApplyResumeHit(int force, PlayerControllerB player) { //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) if (!((NetworkBehaviour)this).IsServer || state.Phase == ApplicantPhase.Destroyed) { return; } resumeIntegrity = Math.Max(0, resumeIntegrity - 1); QualificationLedger qualificationLedger = ledger; ref ApplicationState reference = ref state; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; qualificationLedger.TryScore(ref reference, QualificationEvent.PropertyDrop, -2, ((NetworkTime)(ref serverTime)).Time, 0.5); Publish(); if (resumeIntegrity <= 0) { state = state with { Phase = ApplicantPhase.Destroyed, Revision = state.Revision + 1 }; Publish(); if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.IsSpawned) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } private void Attach(PlayerControllerB holder, double now) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null && instance.ThreatBudget.TryAcquire(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)2)) { state = new ApplicationState(ApplicantPhase.Attached, PlayerId(holder), 0, now + 4.0, state.Revision + 1); SetCleanupAffectedOwner(((NetworkBehaviour)holder).OwnerClientId); holderClient.Value = ((NetworkBehaviour)holder).OwnerClientId; entityAnchor.Value = ulong.MaxValue; entityAnchorEndsAt.Value = 0.0; lastHealth = holder.health; responseWindowAt = now + 18.0; Publish(); AttachPresentationClientRpc(((NetworkBehaviour)holder).OwnerClientId); } } [ClientRpc] private void AttachPresentationClientRpc(ulong targetClient) { //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_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2416355524u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, targetClient); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2416355524u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ApplyAttachedPresentation(attached: true); NetworkManager singleton = NetworkManager.Singleton; if (singleton != null && singleton.LocalClientId == targetClient) { PlayerControllerB val3 = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val3?.currentlyHeldObjectServer == (Object)(object)this) { val3.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } } } private void Observe(PlayerControllerB holder, double now) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) int score = state.Score; GrabbableObject currentlyHeldObjectServer = holder.currentlyHeldObjectServer; ulong num = (((Object)(object)currentlyHeldObjectServer != (Object)null) ? ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObjectId : ulong.MaxValue); if ((Object)(object)currentlyHeldObjectServer != (Object)null && (Object)(object)currentlyHeldObjectServer != (Object)(object)this && num != lastHeldObjectId) { Score(QualificationEvent.ScrapPickup, 1, now, 1.0); if (currentlyHeldObjectServer.scrapValue >= valuableThreshold) { Score(QualificationEvent.ValuableScrap, 2, now, 5.0); } if (currentlyHeldObjectServer.itemProperties.twoHanded) { Score(QualificationEvent.TwoHandedCarry, 2, now, 5.0); } } if (lastHeldObjectId != ulong.MaxValue && (Object)(object)currentlyHeldObjectServer == (Object)null) { Score(QualificationEvent.PropertyDrop, -1, now, 2.0); } lastHeldObjectId = num; Vector3 playerVelocity; if (holder.isSprinting) { playerVelocity = holder.GetPlayerVelocity(); if (((Vector3)(ref playerVelocity)).sqrMagnitude > 4f) { sprintSeconds += 0.5f; if (sprintSeconds >= 3f) { Score(QualificationEvent.SustainedSprint, 2, now, 8.0); sprintSeconds = 0f; } goto IL_0126; } } sprintSeconds = 0f; goto IL_0126; IL_0126: if (holder.speakingToWalkieTalkie) { Score(QualificationEvent.WalkieControl, 1, now, 8.0); } if (CountNearbyTeammates(holder, 5f) >= 2) { Score(QualificationEvent.Teamwork, 1, now, 10.0); } if (holder.health < lastHealth && !holder.isPlayerDead) { Score(QualificationEvent.SurvivedDamage, 1, now, 8.0); } lastHealth = holder.health; if (now >= responseWindowAt) { playerVelocity = holder.GetPlayerVelocity(); if (((Vector3)(ref playerVelocity)).sqrMagnitude < 0.05f) { Score(QualificationEvent.IdleResponse, -2, now, 12.0); } responseWindowAt = now + 18.0; } if (state.Score > score && state.Score < ledger.Threshold && now >= state.NextAnnouncementAt) { state = state with { Phase = ApplicantPhase.Announcing, NextAnnouncementAt = now + 4.0, Revision = state.Revision + 1 }; Publish(); AnnounceClientRpc((byte)(state.Score % Math.Max(1, qualificationAnnouncements.Length))); ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.Noise.TryEmit(new EntityId(((NetworkBehaviour)this).NetworkObjectId), ((Component)holder).transform.position, 32f, 0.85f, 71001, now, 1.0, holder.isInHangarShipRoom && StartOfRound.Instance.hangarDoorsClosed); } state = state with { Phase = ApplicantPhase.Attached, Revision = state.Revision + 1 }; Publish(); } } private void Score(QualificationEvent kind, int amount, double now, double cooldown) { ApplicantPhase phase = state.Phase; if (ledger.TryScore(ref state, kind, amount, now, cooldown)) { if (phase != ApplicantPhase.Hiring && state.Phase == ApplicantPhase.Hiring) { state = state with { NextAnnouncementAt = now + 3.0, Revision = state.Revision + 1 }; FinalWarningClientRpc(); } Publish(); } } [ClientRpc] private void FinalWarningClientRpc() { //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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2102059928u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2102059928u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ChaosPresentation.TriggerAction((Component)(object)this); if ((Object)(object)announcementSource != (Object)null && qualificationAnnouncements.Length != 0) { announcementSource.PlayOneShot(qualificationAnnouncements[qualificationAnnouncements.Length - 1]); } if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip("APPLICATION COMPLETE", "Three qualifications verified. Tear or transfer the resume now.", true, false, "ChaosSuite_ApplicationFinalWarning"); } } } private void BeginHiring(PlayerControllerB holder) { //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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)applicantEnemyPrefab == (Object)null) { Debug.LogError((object)"[ChaosSuite.JobApplication] Hiring threshold reached but ApplicantEnemy prefab is not assigned."); state = state with { Score = ledger.Threshold - 1, Phase = ApplicantPhase.Attached, Revision = state.Revision + 1 }; Publish(); return; } GameObject val = Object.Instantiate(applicantEnemyPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation); NetworkObject component = val.GetComponent(); ApplicantEnemyAI component2 = val.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { Object.Destroy((Object)(object)val); return; } component.Spawn(true); ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance == null || !instance.ThreatBudget.TryTransfer(((NetworkBehaviour)this).NetworkObject, component, (SystemicThreatKind)2)) { component.Despawn(true); ApplicationState applicationState = state; NetworkTime serverTime = ((NetworkBehaviour)this).NetworkManager.ServerTime; applicationState.NextAnnouncementAt = ((NetworkTime)(ref serverTime)).Time + 1.5; applicationState.Revision = state.Revision + 1; state = applicationState; Publish(); return; } component2.InitializeTarget(((NetworkBehaviour)holder).OwnerClientId); state = state with { Phase = ApplicantPhase.Destroyed, Revision = state.Revision + 1 }; Publish(); if (((NetworkBehaviour)this).NetworkObject.IsSpawned) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } private void ReleaseApplication(Vector3 at) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0029: 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_00c4: Unknown result type (might be due to invalid IL or missing references) SetCleanupAffectedOwner(ulong.MaxValue); EntityId holder = state.Holder; if (((EntityId)(ref holder)).IsValid) { ledger.Forget(state.Holder); } state = new ApplicationState(ApplicantPhase.Dormant, EntityId.None, 0, 0.0, state.Revision + 1); holderClient.Value = ulong.MaxValue; entityAnchor.Value = ulong.MaxValue; entityAnchorEndsAt.Value = 0.0; resumeIntegrity = 4; ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.ThreatBudget.Release(((NetworkBehaviour)this).NetworkObject, (SystemicThreatKind)2, "application released"); } ((Component)this).transform.position = at; Publish(); ReleasePresentationClientRpc(at); } private void RegisterPersistentCleanup() { if (((NetworkBehaviour)this).IsServer && !((Object)(object)((NetworkBehaviour)this).NetworkObject == (Object)null) && ((NetworkBehaviour)this).NetworkObject.IsSpawned) { ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; if (instance != null) { instance.Cleanup.Register(((NetworkBehaviour)this).NetworkObject, (Action)CleanupPersistentEffect); } } } private void CleanupPersistentEffect() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { ReleaseApplication(((Component)this).transform.position); } } private void SetCleanupAffectedOwner(ulong nextOwner) { //IL_003f: 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) if (((NetworkBehaviour)this).IsServer && cleanupAffectedOwner != nextOwner) { ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; EffectCleanupRegistry val = ((instance != null) ? instance.Cleanup : null); EntityId val2 = default(EntityId); ((EntityId)(ref val2))..ctor(((NetworkBehaviour)this).NetworkObjectId); if (cleanupAffectedOwner != ulong.MaxValue && val != null) { val.DisassociateAffectedOwner(val2, cleanupAffectedOwner); } cleanupAffectedOwner = nextOwner; if (cleanupAffectedOwner != ulong.MaxValue && val != null) { val.AssociateAffectedOwner(val2, cleanupAffectedOwner); } } } [ClientRpc] private void ReleasePresentationClientRpc(Vector3 at) { //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_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_00d9: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2182354518u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref at); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2182354518u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((Component)this).transform.position = at; ApplyAttachedPresentation(attached: false); } } } [ClientRpc] private void AnnounceClientRpc(byte index) { //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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(723872053u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref index, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 723872053u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)announcementSource == (Object)null) && qualificationAnnouncements.Length != 0) { AudioClip val3 = qualificationAnnouncements[index % qualificationAnnouncements.Length]; if ((Object)(object)val3 != (Object)null) { announcementSource.PlayOneShot(val3); } } } private int CountNearbyTeammates(PlayerControllerB holder, float range) { //IL_0047: 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) int num = 0; float num2 = range * range; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)holder && !val.isPlayerDead && val.isPlayerControlled && Vector3.SqrMagnitude(((Component)val).transform.position - ((Component)holder).transform.position) <= num2) { num++; } } return num; } private bool TryFindSupportedEntityAnchor(PlayerControllerB holder, out NetworkObject? selected) { //IL_0017: 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_00cc: 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) selected = null; float num = transferRange * transferRange; int num2 = Physics.OverlapSphereNonAlloc(((Component)holder).transform.position, transferRange, TransferBuffer, -1, (QueryTriggerInteraction)2); for (int i = 0; i < num2; i++) { NetworkObject val = (((Object)(object)TransferBuffer[i] != (Object)null) ? ((Component)TransferBuffer[i]).GetComponentInParent() : null); if (!((Object)(object)val == (Object)null) && Object.op_Implicit((Object)(object)val) && val.IsSpawned && !((Object)(object)val == (Object)(object)((NetworkBehaviour)this).NetworkObject) && !((Object)(object)val == (Object)(object)((NetworkBehaviour)holder).NetworkObject) && ((Object)(object)((Component)val).GetComponent() != (Object)null || (Object)(object)((Component)val).GetComponent() != (Object)null || (Object)(object)((Component)val).GetComponentInChildren(true) != (Object)null)) { float num3 = Vector3.SqrMagnitude(((Component)val).transform.position - ((Component)holder).transform.position); if (!(num3 >= num)) { num = num3; selected = val; } } } return (Object)(object)selected != (Object)null; } private static bool TryResolveNetworkObject(ulong id, out NetworkObject networkObject) { networkObject = null; NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.SpawnManager.SpawnedObjects.TryGetValue(id, out networkObject) && (Object)(object)networkObject != (Object)null) { return networkObject.IsSpawned; } return false; } private static PlayerControllerB? FindPlayer(ulong clientId) { PlayerControllerB[] array = StartOfRound.Instance?.allPlayerScripts; if (array == null) { return null; } for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && ((NetworkBehaviour)array[i]).OwnerClientId == clientId) { return array[i]; } } return null; } private static EntityId PlayerId(PlayerControllerB player) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) return new EntityId(player.playerClientId + 1); } private static bool RoundEnding() { if (Object.op_Implicit((Object)(object)StartOfRound.Instance) && !StartOfRound.Instance.shipIsLeaving) { return StartOfRound.Instance.inShipPhase; } return true; } private void Publish() { //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_0025: Unknown result type (might be due to invalid IL or missing references) NetworkVariable obj = holderClient; EntityId holder = state.Holder; obj.Value = (((EntityId)(ref holder)).IsValid ? FindClientId(state.Holder) : ulong.MaxValue); qualification.Value = state.Score; applicantPhase.Value = (byte)state.Phase; } private static ulong FindClientId(EntityId id) { //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) PlayerControllerB[] array = StartOfRound.Instance?.allPlayerScripts; if (array == null) { return ulong.MaxValue; } for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && PlayerId(array[i]) == id) { return ((NetworkBehaviour)array[i]).OwnerClientId; } } return ulong.MaxValue; } public override void OnNetworkDespawn() { NetworkVariable obj = qualification; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnQualificationChanged)); NetworkVariable obj2 = holderClient; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnPresentationHolderChanged)); NetworkVariable obj3 = applicantPhase; obj3.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj3.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnPresentationPhaseChanged)); NetworkVariable obj4 = entityAnchor; obj4.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj4.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnPresentationAnchorChanged)); ledger.Clear(); lastHitSequence.Clear(); lastTransferSequence.Clear(); nextHitAt.Clear(); nextTransferAt.Clear(); ((NetworkBehaviour)this).OnNetworkDespawn(); } private void OnQualificationChanged(int previous, int current) { UpdateQualificationChecks(current); } private void OnPresentationHolderChanged(ulong previous, ulong current) { RefreshAttachedPresentation(); } private void OnPresentationPhaseChanged(byte previous, byte current) { RefreshAttachedPresentation(); } private void OnPresentationAnchorChanged(ulong previous, ulong current) { RefreshAttachedPresentation(); } private void RefreshAttachedPresentation() { ApplicantPhase value = (ApplicantPhase)applicantPhase.Value; bool flag = value - 1 <= ApplicantPhase.Announcing; bool attached = flag || holderClient.Value != ulong.MaxValue || entityAnchor.Value != ulong.MaxValue; ApplyAttachedPresentation(attached); } private void ApplyAttachedPresentation(bool attached) { base.grabbable = !attached; ((GrabbableObject)this).EnablePhysics(!attached); if ((Object)(object)resumeSheet != (Object)null) { ((Component)resumeSheet).gameObject.SetActive(attached); } } private void CacheQualificationChecks() { if ((Object)(object)qualificationChecks[0] != (Object)null) { return; } Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { for (int j = 0; j < qualificationChecks.Length; j++) { if (((Object)val).name == $"QualificationCheck{j}") { qualificationChecks[j] = val; } } } } private void UpdateQualificationChecks(int mask) { CacheQualificationChecks(); for (int i = 0; i < qualificationChecks.Length; i++) { if ((Object)(object)qualificationChecks[i] != (Object)null) { ((Component)qualificationChecks[i]).gameObject.SetActive((mask & (1 << i)) != 0); } } } protected override void __initializeVariables() { if (holderClient == null) { throw new Exception("JobApplicationItem.holderClient cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)holderClient).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)holderClient, "holderClient"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)holderClient); if (qualification == null) { throw new Exception("JobApplicationItem.qualification cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)qualification).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)qualification, "qualification"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)qualification); if (applicantPhase == null) { throw new Exception("JobApplicationItem.applicantPhase cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)applicantPhase).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)applicantPhase, "applicantPhase"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)applicantPhase); if (entityAnchor == null) { throw new Exception("JobApplicationItem.entityAnchor cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)entityAnchor).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)entityAnchor, "entityAnchor"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)entityAnchor); if (entityAnchorEndsAt == null) { throw new Exception("JobApplicationItem.entityAnchorEndsAt cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)entityAnchorEndsAt).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)entityAnchorEndsAt, "entityAnchorEndsAt"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)entityAnchorEndsAt); ((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(686112506u, new RpcReceiveHandler(__rpc_handler_686112506), "RequestTransferServerRpc"); ((NetworkBehaviour)this).__registerRpc(3020773868u, new RpcReceiveHandler(__rpc_handler_3020773868), "ResumeHitServerRpc"); ((NetworkBehaviour)this).__registerRpc(2416355524u, new RpcReceiveHandler(__rpc_handler_2416355524), "AttachPresentationClientRpc"); ((NetworkBehaviour)this).__registerRpc(2102059928u, new RpcReceiveHandler(__rpc_handler_2102059928), "FinalWarningClientRpc"); ((NetworkBehaviour)this).__registerRpc(2182354518u, new RpcReceiveHandler(__rpc_handler_2182354518), "ReleasePresentationClientRpc"); ((NetworkBehaviour)this).__registerRpc(723872053u, new RpcReceiveHandler(__rpc_handler_723872053), "AnnounceClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_686112506(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_003d: 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_0043: 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_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) { ulong claimedHolder = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref claimedHolder); uint sequence = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref sequence); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((JobApplicationItem)(object)target).RequestTransferServerRpc(claimedHolder, sequence, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3020773868(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_003d: 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_0043: 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_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) { ulong claimedPlayer = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref claimedPlayer); uint sequence = default(uint); ByteUnpacker.ReadValueBitPacked(reader, ref sequence); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((JobApplicationItem)(object)target).ResumeHitServerRpc(claimedPlayer, sequence, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2416355524(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) { ulong targetClient = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref targetClient); target.__rpc_exec_stage = (__RpcExecStage)1; ((JobApplicationItem)(object)target).AttachPresentationClientRpc(targetClient); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2102059928(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; ((JobApplicationItem)(object)target).FinalWarningClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2182354518(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 at = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref at); target.__rpc_exec_stage = (__RpcExecStage)1; ((JobApplicationItem)(object)target).ReleasePresentationClientRpc(at); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_723872053(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) { byte index = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref index, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((JobApplicationItem)(object)target).AnnounceClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "JobApplicationItem"; } } [BepInPlugin("com.chaossuite.jobapplication", "Job Application", "0.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class JobApplicationPlugin : BaseUnityPlugin { public const string PluginGuid = "com.chaossuite.jobapplication"; public const string PluginName = "Job Application"; public const string PluginVersion = "0.2.0"; private static bool netcodeInitialized; internal static JobApplicationPlugin Instance { get; private set; } = null; internal static GameObject? VisualPrefab { get; private set; } internal static AudioClip? MechanicClip { get; private set; } internal static AudioClip? HiringClip { get; private set; } internal static AudioClip[] AnnouncementClips { get; private set; } = Array.Empty(); private void Awake() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) Instance = this; InitializeGeneratedNetcode(); ChaosSuiteRuntimePlugin instance = ChaosSuiteRuntimePlugin.Instance; AssetBundleRegistry val = ((instance != null) ? instance.Assets : null); string text = ChaosAssetPaths.BundleName("JobApplication"); AssetBundle val2 = default(AssetBundle); if (val != null && val.TryLoadModuleBundle("JobApplication", typeof(JobApplicationPlugin).Assembly, ref val2)) { GameObject visualPrefab = default(GameObject); val.TryLoadAsset(text, ChaosAssetPaths.VisualPrefab("JobApplication"), ref visualPrefab); AudioClip mechanicClip = default(AudioClip); val.TryLoadAsset(text, ChaosAssetPaths.AudioClip("JobApplication", "mechanic.wav"), ref mechanicClip); AudioClip hiringClip = default(AudioClip); val.TryLoadAsset(text, ChaosAssetPaths.AudioClip("JobApplication", "hiring.wav"), ref hiringClip); List list = new List(3); LoadAnnouncement(val, text, "rapid_mobility.wav", list); LoadAnnouncement(val, text, "asset_managed.wav", list); LoadAnnouncement(val, text, "high_pressure.wav", list); VisualPrefab = visualPrefab; MechanicClip = mechanicClip; HiringClip = hiringClip; AnnouncementClips = list.ToArray(); } ChaosSuiteRuntimePlugin instance2 = ChaosSuiteRuntimePlugin.Instance; if (instance2 != null) { instance2.RegisterFeatureContent("JobApplication", typeof(JobApplicationPlugin).Assembly); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Job Application loaded. Qualification observes game state only; microphone content is never accessed or recorded."); } private static void LoadAnnouncement(AssetBundleRegistry assets, string bundleId, string fileName, List destination) { AudioClip val = default(AudioClip); if (assets.TryLoadAsset(bundleId, ChaosAssetPaths.AudioClip("JobApplication", fileName), ref val) && (Object)(object)val != (Object)null) { destination.Add(val); } } private static void InitializeGeneratedNetcode() { if (netcodeInitialized) { return; } netcodeInitialized = true; Type[] types = typeof(JobApplicationPlugin).Assembly.GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_FixedString(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); } } } namespace ChaosSuite.JobApplication.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }