Decompiled source of LCCrashBandicootCratesMod v1.0.1
LCCrashBandicootCratesMod.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Steamworks; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] public class BowlingBombProp : GrabbableObject, IHittable, IProjectileAmmo { private static ManualLogSource Logger; public AudioClip explodeSFX; bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if (((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit == (Object)(object)StartOfRound.Instance.localPlayerController) || ((Object)(object)playerWhoHit == (Object)null && ((NetworkBehaviour)this).IsOwner)) { Logger.LogDebug((object)$"IHittable.Hit() called on {this} #{((NetworkBehaviour)this).NetworkObjectId} by {GameNetworkManager.Instance.localPlayerController}"); DestroyBombLocal(); DestroyBombServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } return true; } [ServerRpc(RequireOwnership = false)] private void DestroyBombServerRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4117872948u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4117872948u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DestroyBombClientRpc(playerID); } } } [ClientRpc] private void DestroyBombClientRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1666011554u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1666011554u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { DestroyBombLocal(); } } } private void DestroyBombLocal() { //IL_0026: 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) Logger.LogDebug((object)$"DestroyBombLocal(): {this} #{((NetworkBehaviour)this).NetworkObjectId}"); Landmine.SpawnExplosion(((Component)this).transform.position, (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null, 3f, 6f, 25, 4f, (GameObject)null, false); ManagerScript.PlayNoiseAtLocation(((Component)this).transform.position, explodeSFX, audibleNoise: true, 25f, 1f); ManagerScript.DestroyItem((GrabbableObject)(object)this); } int IProjectileAmmo.GetProjectileIndex() { return 1; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4117872948u, new RpcReceiveHandler(__rpc_handler_4117872948), "DestroyBombServerRpc"); ((NetworkBehaviour)this).__registerRpc(1666011554u, new RpcReceiveHandler(__rpc_handler_1666011554), "DestroyBombClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_4117872948(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((BowlingBombProp)(object)target).DestroyBombServerRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1666011554(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((BowlingBombProp)(object)target).DestroyBombClientRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BowlingBombProp"; } } public class ColorGemProp : GrabbableObject, IInventoryMergeable { private static ManualLogSource Logger; public AudioSource audioSource; public AudioClip mergeSFX; public Material[] gemMaterials; public override void Start() { ((GrabbableObject)this).Start(); SetRandomGemMaterial(); } private void SetRandomGemMaterial() { if (!((Object)(object)base.mainObjectRenderer == (Object)null)) { ((Renderer)base.mainObjectRenderer).material = gemMaterials[new Random(ManagerScript.GetRandomSeed(2025125)).Next(0, gemMaterials.Length)]; } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if (((NetworkBehaviour)this).IsOwner) { ManagerScript.MergeItem((GrabbableObject)(object)this, removeDestroyedScrapValue: true, muteDestroyedItem: false); } } bool IInventoryMergeable.CanOtherMergeWithThis(GrabbableObject itemRequestingMerge) { return false; } GrabbableObject IInventoryMergeable.GetMergeItemToDestroy(GrabbableObject itemRequestingMerge, GrabbableObject mergeWith) { if (mergeWith.scrapValue > base.scrapValue) { return itemRequestingMerge; } return mergeWith; } GrabbableObject IInventoryMergeable.GetMergeItemThatInvokesEvent(GrabbableObject itemRequestingMerge, GrabbableObject mergeWith) { if (mergeWith.scrapValue > base.scrapValue) { return mergeWith; } return itemRequestingMerge; } bool IInventoryMergeable.CanThisMergeWithOther(GrabbableObject mergeWith) { if ((Object)(object)mergeWith == (Object)null || (Object)(object)mergeWith.itemProperties == (Object)null) { return false; } if ((Object)(object)mergeWith.itemProperties == (Object)(object)base.itemProperties) { return true; } return false; } void IInventoryMergeable.MergeWithOther(GrabbableObject mergeWith, PlayerControllerB playerMerging, int otherInSlot) { if (!((Object)(object)mergeWith == (Object)null) && !((Object)(object)mergeWith.itemProperties != (Object)(object)base.itemProperties)) { ColorGemProp component = ((Component)mergeWith).GetComponent<ColorGemProp>(); if (!((Object)(object)component == (Object)null)) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} executing merge code with {component} #{((NetworkBehaviour)component).NetworkObjectId}"); OnMergeWithGem(component); } } } private void OnMergeWithGem(ColorGemProp other) { int num = 1; if ((Object)(object)other != (Object)null && ((GrabbableObject)other).scrapValue > 20) { if (ManagerScript.logDetail) { Logger.LogWarning((object)$"scrapValue = {base.scrapValue} && other.scrapValue = {((GrabbableObject)other).scrapValue}"); } int num2 = 0; int num3 = ((GrabbableObject)other).scrapValue; while (num3 > 20) { num3 /= 2; num2++; if (ManagerScript.logDetail) { Logger.LogDebug((object)$"dividedValue: {num3} // stackOf: {num2}"); } } Logger.LogDebug((object)$"scrapValue = {((GrabbableObject)other).scrapValue} translated to stackOf = {num2}"); num = num2; } int num4 = 0; while (num4 < num) { ((GrabbableObject)this).SetScrapValue(base.scrapValue *= 2); num4++; if (ManagerScript.logDetail) { Logger.LogDebug((object)$"timesMultiplied: {num4} // scrapValue: {base.scrapValue}"); } } Logger.LogDebug((object)$"set own value to {base.scrapValue}"); ManagerScript.PlayNoise(audioSource, mergeSFX, audibleNoise: true, 5f, 0.25f); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "ColorGemProp"; } } public class CrateGrabbableObject : GrabbableObject, IHittable { private static ManualLogSource Logger; [Space(3f)] [Header("LCCrashBandicootCratesMod")] [Tooltip("The static data every instance of this crate determines its data from at runtime.")] public CrateData crateData; [Space(3f)] [Header("Audiovisual")] [Tooltip("The main AudioSource that all AudioClips from this crate get played from.")] public AudioSource audioSource; private float noiseTimer; private int nextRandomSpecialSFX; [Space] [Tooltip("Particles that are played upon destroying this crate.")] public ParticleSystem particlesBreak; [Tooltip("The static color the particlesBreak will have.\nIf left empty, will automatically use the default crate-breaking particles.")] public Color particlesBreakColor = Color.white; [Tooltip("Particles that are played on walking into, bouncing off of, attacking, or on destroying this crate, based on the particlesPlayBy booleans in this crate's crateData.")] public ParticleSystem particlesSpecial; [Tooltip("The static color the particlesSpecial will have.")] public Color particlesSpecialColor = Color.white; [Space(3f)] [Header("Colliders")] [Tooltip("Whether this crate's collider will block player movement and some sounds and enemy vision.")] public bool collideWithCrate = true; [Tooltip("A value to override collideWithCrate at runtime to enable or disable collisions that block player movement.\nIf empty, this value will be ignored. If \"true\" or as long as this value starts with \"t\", collision will be enabled. If not empty but also not starting with \"t\", collision will be disabled.")] public string collideOverrideCrate; [Tooltip("A value to override at runtime whether to enable or disable the check that lets players bounce off this crate.\nIf empty, this value will be ignored. If \"true\" or as long as this value starts with \"t\", bouncing will be enabled. If not empty but also not starting with \"t\", bouncing will be disabled.")] public string collideOverrideBounce; [Tooltip("The Collider that blocks player movement that's affected by collideWithCrate and collideOverrideCrate.")] public BoxCollider colliderCrate; [Tooltip("Blocks enemy movement if colliderCrate blocks player movement as well.")] public NavMeshObstacle colliderEnemies; [Tooltip("The Collider that checks whether players are bouncing off of this crate.")] public BoxCollider colliderBounce; [Tooltip("The top of the crate that players need to be above to bounce off this crate, and where to spawn items from.")] public Transform topOfCrate; private Coroutine checkDistanceCoroutine; [Space(3f)] [Header("Interactions")] [Tooltip("How strong players bounce off this crate, and how strong it will try to bounce other crates off of itself.")] public float bounceForce = 20f; private bool bouncedOffCrate; private float bounceCeiling = -1f; [Space] [Tooltip("A sort of HP for this crate that determines how many hits it has taken so far by being walked into, jumped off of, and attacked.\nUpdated by this crate's own changeSpecialIntPer integers.")] public int specialInt; [Tooltip("This crate will be destroyed if this is not -1 and specialInt has met or surpassed this number.")] public int destroyUponSpecialInt = 1; [HideInInspector] public bool destroyed; [Space] [Tooltip("If true, adds the specified interaction's changeSpecialInt to specialInt.\nIf false, snaps specialInt to whatever changeSpecialInt is set to for that interaction.")] public bool changeSpecialIntAddOrSnap = true; [Tooltip("How much to change this crate's specialInt, or what value to snap this crate's specialInt to, per time walking into the crate.\nIf addOrSnap is true and this is 0, or false and this is -99, walking into this crate will not change specialInt.")] public int changeSpecialIntPerWalkInto; [Tooltip("How much to change this crate's specialInt, or what value to snap this crate's specialInt to, per time the crate is bounced off of.\nIf addOrSnap is true and this is 0, or false and this is -99, bouncing off of this crate will not change specialInt.")] public int changeSpecialIntPerJumpOnto = 1; [Tooltip("How much to change this crate's specialInt, or what value to snap this crate's specialInt to, per time the crate is attacked.\nIf addOrSnap is true and this is 0, or false and this is -99, attacking this crate will not change specialInt.")] public int changeSpecialIntPerAttack = 99; [Space(3f)] [Header("Events")] [Tooltip("Custom events to call on Start(), for example if this crate has special functionality that should determine the rest of its lifetime.")] public InteractEvent invokeEventOnStart; [Tooltip("Custom events to call when this crate is walked into, for example if the player who walks into this crate's collision is affected.")] public InteractEvent invokeEventByWalkingInto; [Tooltip("Custom events to call when this crate is bounced off of, for example if this crate affects the player who bounced off of it.")] public InteractEvent invokeEventByJumpingOnto; [Tooltip("Custom events to call when this crate is attacked, for example if attacking this crate uniquely changes its own state.")] public InteractEvent invokeEventByAttacking; [Tooltip("Custom events to call when this crate's timer runs out, for example if this crate should switch to different materials or spawnPrefabs.")] public InteractEvent invokeEventOnTimerEnd; [Tooltip("Custom events to call when this crate is destroyed, for example if this crate has custom data that should be removed.")] public InteractEvent invokeEventOnDestroy; [Space(3f)] [Header("Contents")] [Tooltip("What GameObject to spawn at the time of walking into, bouncing off of, or attacking this crate.")] public GameObject spawnPrefab; [Tooltip("How many of the spawnPrefab are left to spawn, based on this crate's crateData's spawnPer integers.")] public int spawnAmountLeft = 1; public Coroutine spawnContentsCoroutine; private Coroutine queuedSpawnCoroutine; [Space(3f)] [Header("Timers")] [Tooltip("A timer that will count down in real-time seconds, regardless of the game's in-game time.\nKeep at -1 to disable this timer.")] public float timerStartTime = -1f; private float timer; private bool timerActive; private float timerCooldown; private int timersEnded; [Tooltip("The text component that this crate's timer value will be printed to, if this crate's crateData's timerVisible is true.\nIf left empty, the default timer object will be used.")] public TextMeshPro timerText; private float timerPrintInterval; public override void Start() { ((GrabbableObject)this).Start(); ManagerScript.AddCrate(this); EnableColliders(setEnabledTo: true); InitializeValues(); } public void InitializeValues() { ((MonoBehaviour)this).StartCoroutine(WaitForLocalPlayerToCallOnStart()); } private IEnumerator WaitForLocalPlayerToCallOnStart() { bool foundLocalPlayer = false; float waitTime = 0f; float waitIntervals = 0.5f; while (!foundLocalPlayer && waitTime < 20f && (!((Object)(object)GameNetworkManager.Instance != (Object)null) || !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null))) { yield return (object)new WaitForSeconds(waitIntervals); waitTime += waitIntervals; } InitializeOnStartFunctionality(); } private void InitializeOnStartFunctionality() { if (destroyed) { return; } if ((Object)(object)crateData == (Object)null) { crateData = ScriptableObject.CreateInstance<CrateData>(); } if (((NetworkBehaviour)this).IsServer) { StartInteractionCooldown(); if (crateData.audioPlayRandomized) { RandomizeNextRandomSpecialSFX(StartOfRound.Instance.localPlayerController, 0, crateData.audioSpecialSFX.Length); } } if ((Object)(object)audioSource != (Object)null) { audioSource.loop = !crateData.audioPlayOneShot; } if ((Object)(object)particlesBreak == (Object)null) { particlesBreak = Object.Instantiate<GameObject>(ManagerScript.allAssets.allParticles[0], ((Component)this).transform, false).GetComponent<ParticleSystem>(); } if ((Object)(object)timerText == (Object)null && crateData.timerVisible) { GameObject val = Object.Instantiate<GameObject>(ManagerScript.allAssets.timerObject, ((Component)this).transform, false); timerText = val.GetComponentInChildren<TextMeshPro>(); } if (((UnityEventBase)invokeEventOnStart).GetPersistentEventCount() != 0 && (crateData.canInvokeBeforeGameStart || ((Object)(object)GameNetworkManager.Instance != (Object)null && GameNetworkManager.Instance.gameHasStarted))) { ((UnityEvent<PlayerControllerB>)(object)invokeEventOnStart).Invoke(GameNetworkManager.Instance.localPlayerController); } } public override void Update() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (destroyed) { return; } if (!crateData.audioPlayOneShot && crateData.noiseAudible) { if ((Object)(object)audioSource != (Object)null && audioSource.isPlaying) { noiseTimer += Time.deltaTime; if (noiseTimer >= crateData.noiseInterval) { noiseTimer = 0f; RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, crateData.noiseRange, crateData.noiseLoudness, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0); } } else { noiseTimer = 0f; } } if (timerCooldown > 0f) { timerCooldown -= Time.deltaTime; } else if (timerStartTime != -1f && timerActive) { if (timer > 0f) { timer -= Time.deltaTime; } else { TimerEnd(); } } if (!crateData.timerVisible) { return; } if (timer > 0f) { timerPrintInterval -= Time.deltaTime; if (timerPrintInterval <= 0f) { timerPrintInterval = 0.04f; TimerPrint(); } } else if ((Object)(object)timerText != (Object)null && ((Behaviour)timerText).enabled) { TimerVisibility(setTo: false); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId}: EquipItem()"); GrabCrate(); } public void GrabCrate() { StopCheckDistanceCoroutine(); EnableColliders(setEnabledTo: false); bouncedOffCrate = false; } public override void PlayDropSFX() { //IL_008b: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) if (base.deactivated || destroyed || !base.hasBeenHeld || (bouncedOffCrate && base.fallTime < 0.5f)) { return; } if (StartOfRound.Instance.currentLevelID == 3 && (Object)(object)((Component)this).GetComponentInParent<DepositItemsDesk>() != (Object)null) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} likely placed on company desk, overriding colliders"); collideOverrideCrate = "false"; collideOverrideBounce = "false"; } StartCheckDistanceCoroutine(); RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 0.25f, Vector3.down, ref val, 0.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { CrateGrabbableObject componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<CrateGrabbableObject>(); if ((Object)(object)componentInParent != (Object)null && (componentInParent.crateData.crateType == CrateType.Arrow || (bounceForce > 0f && componentInParent.bounceForce >= bounceForce * crateData.bounceMultiplierThreshold))) { Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId} hit #{((NetworkBehaviour)componentInParent).NetworkObjectId} with force {componentInParent.bounceForce}"); StartBounceOffCrate(componentInParent); return; } } base.hasHitGround = true; bouncedOffCrate = false; PlaySFX(base.itemProperties.dropSFX, overrideOneShot: true); float num; if (bounceCeiling != -1f) { num = bounceCeiling; bounceCeiling = -1f; } else { num = Mathf.Abs(((Component)this).transform.parent.TransformPoint(base.startFallingPosition).y - ((Component)this).transform.parent.TransformPoint(base.targetFloorPosition).y); } Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} | fallDistance: {num}"); if (ThisFallToTriggerIsLargestPassedOne(num, crateData.fallToTriggerWalkInto, crateData.fallToTriggerJumpOnto, crateData.fallToTriggerAttack)) { WalkIntoCrate(); } else if (ThisFallToTriggerIsLargestPassedOne(num, crateData.fallToTriggerJumpOnto, crateData.fallToTriggerWalkInto, crateData.fallToTriggerAttack)) { JumpOntoCrate(); } else if (ThisFallToTriggerIsLargestPassedOne(num, crateData.fallToTriggerAttack, crateData.fallToTriggerWalkInto, crateData.fallToTriggerJumpOnto)) { AttackCrate(); } } private bool ThisFallToTriggerIsLargestPassedOne(float fallDistance, float thisTrigger, float firstOtherTrigger, float secondOtherTrigger) { if (thisTrigger == -1f) { return false; } if (fallDistance < thisTrigger) { return false; } if (firstOtherTrigger == -1f || firstOtherTrigger <= thisTrigger || fallDistance <= firstOtherTrigger) { if (secondOtherTrigger != -1f && !(secondOtherTrigger <= thisTrigger)) { return fallDistance <= secondOtherTrigger; } return true; } return false; } private void StartCheckDistanceCoroutine() { if (checkDistanceCoroutine == null) { checkDistanceCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckDistance()); } } private void StopCheckDistanceCoroutine() { if (checkDistanceCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(checkDistanceCoroutine); checkDistanceCoroutine = null; } } private IEnumerator CheckDistance() { bool playerInRange = true; PlayerControllerB player = StartOfRound.Instance.localPlayerController; while (playerInRange) { yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)((Component)this).GetComponentInParent<VehicleController>() != (Object)null || (Object)(object)((Component)this).GetComponentInParent<MineshaftElevatorController>() != (Object)null) { Logger.LogDebug((object)$"WARNING!!! {this} #{((NetworkBehaviour)this).NetworkObjectId} dropped inside vehicle or elevator! breaking"); break; } if ((Object)(object)player == (Object)null || !player.isPlayerControlled) { playerInRange = false; } if (Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position) >= 0.75f) { playerInRange = false; } } checkDistanceCoroutine = null; EnableColliders(setEnabledTo: true); } private void StartBounceOffCrate(CrateGrabbableObject hitCrate) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)hitCrate == (Object)null) && !((Object)(object)hitCrate.crateData == (Object)null)) { ManagerScript.PlayNoise(hitCrate.audioSource, hitCrate.crateData.audioBounceSFX, hitCrate.crateData.noiseAudible, hitCrate.crateData.noiseRange, hitCrate.crateData.noiseLoudness); bouncedOffCrate = true; base.hasHitGround = false; base.reachedFloorTarget = false; base.fallTime = 0f; base.startFallingPosition = base.targetFloorPosition - Vector3.down; ((Component)this).transform.localEulerAngles = new Vector3(0f, (float)base.floorYRot, 0f); RaycastHit val = default(RaycastHit); if (Physics.Raycast(topOfCrate.position, Vector3.up, ref val, hitCrate.bounceForce / crateData.bounceDividerStrength, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { bounceCeiling = ((RaycastHit)(ref val)).distance; } else { bounceCeiling = hitCrate.bounceForce / crateData.bounceDividerStrength; } Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} bounceOffCrate {bouncedOffCrate} // bounceCeiling {bounceCeiling}"); } } public override void FallWithCurve() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!bouncedOffCrate) { ((GrabbableObject)this).FallWithCurve(); return; } base.fallTime += Time.deltaTime / crateData.bounceTime; ((Component)this).transform.localPosition = Vector3.Lerp(base.targetFloorPosition, new Vector3(base.targetFloorPosition.x, base.targetFloorPosition.y + bounceCeiling, base.targetFloorPosition.z), crateData.bounceCurve.Evaluate(base.fallTime)); } public void WalkIntoCrate(PlayerControllerB playerWalkedInto = null) { if (((Component)this).gameObject.layer != 5 && !(base.currentUseCooldown >= 0f) && ManagerScript.CanInteractionOnCrateHappenLocally(playerWalkedInto, this)) { StartInteractionCooldown(); Logger.LogDebug((object)$"WalkIntoCrate({playerWalkedInto})"); if (((UnityEventBase)invokeEventByWalkingInto).GetPersistentEventCount() != 0) { ((UnityEvent<PlayerControllerB>)(object)invokeEventByWalkingInto).Invoke(playerWalkedInto); } if (crateData.audioPlayByWalkingInto) { PlayAudioSpecialSFX(overrideForcePlay: false, 0); } if (crateData.particlesPlayByWalkingInto) { PlayParticles(particlesSpecial, 0); } UpdateSpecialInt(changeSpecialIntPerWalkInto, ((Object)(object)playerWalkedInto != (Object)null && crateData.contentLostByWalkingInto) || ((Object)(object)playerWalkedInto == (Object)null && crateData.contentLostByNonPlayer), (Object)(object)playerWalkedInto == (Object)null); DoSpawnCheck(crateData.spawnPerWalkingInto, playerWalkedInto); } } public void JumpOntoCrate(PlayerControllerB playerJumpedOnto = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerJumpedOnto == (Object)null || ((Component)playerJumpedOnto).transform.position.y >= topOfCrate.position.y) { PerformJumpOntoLogic(playerJumpedOnto); } } private void PerformJumpOntoLogic(PlayerControllerB playerJumpedOnto = null) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).gameObject.layer != 5 && !(base.currentUseCooldown >= 0f) && ManagerScript.CanInteractionOnCrateHappenLocally(playerJumpedOnto, this)) { StartInteractionCooldown(); Logger.LogDebug((object)$"PerformJumpOntoLogic({playerJumpedOnto})"); if (((UnityEventBase)invokeEventByJumpingOnto).GetPersistentEventCount() != 0) { ((UnityEvent<PlayerControllerB>)(object)invokeEventByJumpingOnto).Invoke(playerJumpedOnto); } if (crateData.audioPlayByJumpingOnto) { PlayAudioSpecialSFX(overrideForcePlay: false, 1); } if (crateData.particlesPlayByJumpingOnto) { PlayParticles(particlesSpecial, 1); } if (bounceForce > 0f && (Object)(object)playerJumpedOnto != (Object)null) { playerJumpedOnto.ResetFallGravity(); playerJumpedOnto.externalForceAutoFade += Vector3.up * bounceForce; PlaySFX(crateData.audioBounceSFX, overrideOneShot: true, overrideForcePlay: false, 3); } UpdateSpecialInt(changeSpecialIntPerJumpOnto, ((Object)(object)playerJumpedOnto != (Object)null && crateData.contentLostByJumpingOnto) || ((Object)(object)playerJumpedOnto == (Object)null && crateData.contentLostByNonPlayer), (Object)(object)playerJumpedOnto == (Object)null); DoSpawnCheck(crateData.spawnPerJumpingOnto, playerJumpedOnto); } } public void AttackCrate(PlayerControllerB playerAttacked = null) { if (((Component)this).gameObject.layer != 5 && !(base.currentUseCooldown >= 0f) && ManagerScript.CanInteractionOnCrateHappenLocally(playerAttacked, this)) { StartInteractionCooldown(); Logger.LogDebug((object)$"AttackCrate({playerAttacked})"); if (((UnityEventBase)invokeEventByAttacking).GetPersistentEventCount() != 0) { ((UnityEvent<PlayerControllerB>)(object)invokeEventByAttacking).Invoke(playerAttacked); } if (crateData.audioPlayByAttacking) { PlayAudioSpecialSFX(overrideForcePlay: false, 2); } if (crateData.particlesPlayByAttacking) { PlayParticles(particlesSpecial, 2); } UpdateSpecialInt(changeSpecialIntPerAttack, ((Object)(object)playerAttacked != (Object)null && crateData.contentLostByAttacking) || ((Object)(object)playerAttacked == (Object)null && crateData.contentLostByNonPlayer), (Object)(object)playerAttacked == (Object)null); DoSpawnCheck(crateData.spawnPerAttacking, playerAttacked); } } private void StartInteractionCooldown() { base.currentUseCooldown = base.useCooldown; if (base.useCooldown >= 1f) { ((MonoBehaviour)this).StartCoroutine(SyncUseCooldownOnDelay()); } } private IEnumerator SyncUseCooldownOnDelay() { yield return null; SyncUseCooldownServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } [ServerRpc(RequireOwnership = false)] private void SyncUseCooldownServerRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2775958166u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2775958166u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncUseCooldownClientRpc(playerID); } } } [ClientRpc] private void SyncUseCooldownClientRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(248081063u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 248081063u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { base.currentUseCooldown = base.useCooldown; } } } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if (base.deactivated || destroyed) { return false; } AttackCrate(playerWhoHit); return true; } public void TimerStart(bool sync = false) { if (!destroyed && timerStartTime != -1f && (!(timer > timerStartTime * 0.025f) || !(timer < timerStartTime * 0.975f))) { timer = timerStartTime; timerActive = true; if (sync) { TimerStartServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } } } [ServerRpc(RequireOwnership = false)] private void TimerStartServerRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1280396780u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1280396780u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TimerStartClientRpc(playerID); } } } [ClientRpc] private void TimerStartClientRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2860483368u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2860483368u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { TimerStart(); } } } public void TimerVisibility(bool setTo) { if (!((Object)(object)timerText == (Object)null) && !((Object)(object)crateData == (Object)null) && (!setTo || (!destroyed && crateData.timerVisible))) { ((Behaviour)timerText).enabled = setTo; } } public void TimerSetCooldown(float cooldown, bool addOrSnap = true) { if (addOrSnap) { timerCooldown += cooldown; } else { timerCooldown = cooldown; } } private void TimerPrint() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)timerText == (Object)null) && !((Object)(object)crateData == (Object)null) && crateData.timerVisible) { if (!((Behaviour)timerText).enabled) { TimerVisibility(setTo: true); } ((TMP_Text)timerText).text = TimeSpan.FromSeconds(timer).ToString("m\\:ss\\:ff"); if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.audioListener != (Object)null) { timerText.transform.parent.LookAt(((Component)StartOfRound.Instance.audioListener).transform.position); } else { timerText.transform.localEulerAngles = Vector3.zero; } } } public void TimerEnd() { if (!destroyed && !((Object)(object)crateData == (Object)null) && !(timer > 0f)) { timerActive = false; if (crateData.timerRepeats != -1) { timersEnded++; } if (ManagerScript.logDetail) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId}: TimerEnd() // timersEnded? {timersEnded}"); } TimerVisibility(setTo: false); if (((UnityEventBase)invokeEventOnTimerEnd).GetPersistentEventCount() != 0) { ((UnityEvent<PlayerControllerB>)(object)invokeEventOnTimerEnd).Invoke((PlayerControllerB)null); } if (crateData.audioPlayOnTimerEnd) { PlayAudioSpecialSFX(); } if (crateData.particlesPlayOnTimerEnd) { PlayParticles(particlesSpecial); } if (crateData.timerRepeats == -1 || timersEnded <= crateData.timerRepeats) { TimerStart(); } else { timerStartTime = -1f; } } } public void EnableColliders(bool setEnabledTo) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId}: EnableColliders({setEnabledTo})"); if (setEnabledTo && ((Object)(object)base.playerHeldBy != (Object)null || destroyed)) { Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId} trying to turn colliders on while held {(Object)(object)base.playerHeldBy != (Object)null} or destroyed {destroyed}, returning;"); return; } if ((Object)(object)colliderCrate != (Object)null) { if (!string.IsNullOrEmpty(collideOverrideCrate)) { bool enabled = collideOverrideCrate[0].ToString().ToLower() == "t"; ((Collider)colliderCrate).enabled = enabled; Logger.LogDebug((object)$"{colliderCrate} enabled overriden by {collideOverrideCrate} to {((Collider)colliderCrate).enabled}"); } else { ((Collider)colliderCrate).enabled = setEnabledTo; } ((Collider)colliderCrate).isTrigger = !collideWithCrate; } if ((Object)(object)colliderEnemies != (Object)null) { ((Behaviour)colliderEnemies).enabled = (Object)(object)colliderCrate != (Object)null && ((Collider)colliderCrate).enabled && !((Collider)colliderCrate).isTrigger; } base.grabbableToEnemies = ((Object)(object)colliderEnemies == (Object)null || !((Behaviour)colliderEnemies).enabled) && !base.isHeld; if ((Object)(object)colliderBounce != (Object)null) { if (!string.IsNullOrEmpty(collideOverrideBounce)) { bool enabled2 = collideOverrideBounce[0].ToString().ToLower() == "t"; ((Collider)colliderBounce).enabled = enabled2; Logger.LogDebug((object)$"{colliderBounce} enabled overriden by {collideOverrideBounce} to {((Collider)colliderBounce).enabled}"); } else { ((Collider)colliderBounce).enabled = setEnabledTo; } } } public void PlayAudioSpecialSFX(bool overrideForcePlay = false, int interactionType = -1) { if (!((Object)(object)crateData == (Object)null) && crateData.audioSpecialSFX != null && crateData.audioSpecialSFX.Length != 0) { AudioClip clipToPlay = crateData.audioSpecialSFX[0]; if (crateData.audioPlayRandomized && nextRandomSpecialSFX >= 0 && nextRandomSpecialSFX < crateData.audioSpecialSFX.Length) { clipToPlay = crateData.audioSpecialSFX[nextRandomSpecialSFX]; } PlaySFX(clipToPlay, overrideOneShot: false, overrideForcePlay, interactionType); } } public void PlaySFX(AudioClip clipToPlay, bool overrideOneShot = false, bool overrideForcePlay = false, int interactionType = -1) { if ((Object)(object)clipToPlay == (Object)null) { return; } AudioSource component = audioSource; if ((Object)(object)component == (Object)null) { component = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)component == (Object)null) { return; } } if (crateData.audioPlayOneShot || overrideOneShot) { ManagerScript.PlayNoise(component, clipToPlay, ((NetworkBehaviour)this).IsOwner && crateData.noiseAudible, crateData.noiseRange, crateData.noiseLoudness); } else if (!crateData.audioPlayToggle || overrideForcePlay) { component.clip = clipToPlay; component.time = 0f; component.Play(); } else if (!component.isPlaying) { component.clip = clipToPlay; component.time = 0f; component.Play(); } else if (component.isPlaying) { component.Stop(); } if (interactionType != -1) { int nextSpecialSFX = -1; if (component.isPlaying && crateData.audioPlayRandomized && interactionType >= 0 && interactionType <= 2) { nextSpecialSFX = (nextRandomSpecialSFX = Random.Range(0, crateData.audioSpecialSFX.Length)); Logger.LogDebug((object)$"SENDER set nextRandomSpecialSFX to {nextRandomSpecialSFX}"); } SyncSFXOrParticlesServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, interactionType, isSFX: true, nextSpecialSFX); } } public void PlayParticles(ParticleSystem particlesToPlay, int interactionType = -1) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)particlesToPlay == (Object)null)) { Color white = Color.white; if ((Object)(object)particlesToPlay == (Object)(object)particlesBreak) { white = particlesBreakColor; } else if ((Object)(object)particlesToPlay == (Object)(object)particlesSpecial) { white = particlesSpecialColor; } ParticleSystemRenderer component = ((Component)particlesToPlay).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material.color = white; } particlesToPlay.Play(); if (interactionType != -1) { SyncSFXOrParticlesServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, interactionType, isSFX: false); } } } public void StopSFX(bool sync = false) { audioSource.Stop(); if (sync) { SyncSFXOrParticlesServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, 4); } } public void StopParticles(bool sync = false) { particlesSpecial.Stop(); if (sync) { SyncSFXOrParticlesServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, 5); } } [ServerRpc(RequireOwnership = false)] private void SyncSFXOrParticlesServerRpc(int playerID, int interactionType, bool isSFX = true, int nextSpecialSFX = -1) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1924210047u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, interactionType); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isSFX, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, nextSpecialSFX); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1924210047u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (interactionType != -1) { SyncSFXOrParticlesClientRpc(playerID, interactionType, isSFX, nextSpecialSFX); } } } [ClientRpc] private void SyncSFXOrParticlesClientRpc(int playerID, int interactionType, bool isSFX = true, int nextSpecialSFX = -1) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(957576429u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, interactionType); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isSFX, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, nextSpecialSFX); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 957576429u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { return; } switch (interactionType) { case 0: if (isSFX && crateData.audioPlayByWalkingInto) { PlayAudioSpecialSFX(); } else if (!isSFX && crateData.particlesPlayByWalkingInto) { PlayParticles(particlesSpecial); } break; case 1: if (isSFX && crateData.audioPlayByJumpingOnto) { PlayAudioSpecialSFX(); } else if (!isSFX && crateData.particlesPlayByJumpingOnto) { PlayParticles(particlesSpecial); } break; case 2: if (isSFX && crateData.audioPlayByAttacking) { PlayAudioSpecialSFX(); } else if (!isSFX && crateData.particlesPlayByAttacking) { PlayParticles(particlesSpecial); } break; case 3: PlaySFX(crateData.audioBounceSFX, overrideOneShot: true); break; case 4: StopSFX(); break; case 5: StopParticles(); break; } if (crateData.audioPlayRandomized && nextSpecialSFX != -1) { nextRandomSpecialSFX = nextSpecialSFX; Logger.LogDebug((object)$"RECEIVER set nextRandomSpecialSFX to {nextRandomSpecialSFX}"); } } public void SetCrateOnMapRadar(bool add) { if (add) { ManagerScript.AddCrateToMapRadar(this, base.itemProperties.itemName); } else { ManagerScript.EraseCrateFromMapRadar(this); } for (int i = 0; i < ((Component)this).transform.childCount; i++) { Transform child = ((Component)this).transform.GetChild(i); if ((Object)(object)child != (Object)null && ((Component)child).gameObject.layer == LayerMask.NameToLayer("MapRadar")) { ((Component)child).gameObject.SetActive(add); } } } public void RandomizeSpecialInt(int maxExclusive) { if (ManagerScript.CanInteractionOnCrateHappenLocallyUnsafe(this)) { RandomizeNumber(0f, maxExclusive, 0); } } public void RandomizeSpecialInt(PlayerControllerB interactingPlayer, int minInclusive, int maxExclusive, int useRandomSeed = -1) { if (ManagerScript.CanInteractionOnCrateHappenLocally(interactingPlayer, this)) { RandomizeNumber(minInclusive, maxExclusive, 0, interactingPlayer, useRandomSeed); } } public void RandomizeTimerStartTime(float offset) { if (ManagerScript.CanInteractionOnCrateHappenLocallyUnsafe(this)) { RandomizeNumber(crateData.timerRandomMedian - offset, crateData.timerRandomMedian + offset, 1); } } public void RandomizeTimerStartTime(PlayerControllerB interactingPlayer, float minInclusive, float maxExclusive, int useRandomSeed = -1) { if (ManagerScript.CanInteractionOnCrateHappenLocally(interactingPlayer, this)) { RandomizeNumber(minInclusive, maxExclusive, 1, interactingPlayer, useRandomSeed); } } public void RandomizeNextRandomSpecialSFX() { if (ManagerScript.CanInteractionOnCrateHappenLocallyUnsafe(this)) { RandomizeNumber(0f, crateData.audioSpecialSFX.Length, 2); } } public void RandomizeNextRandomSpecialSFX(PlayerControllerB interactingPlayer, int minInclusive, int maxExclusive, int useRandomSeed = -1) { if (ManagerScript.CanInteractionOnCrateHappenLocally(interactingPlayer, this)) { RandomizeNumber(minInclusive, maxExclusive, 2, interactingPlayer, useRandomSeed); } } private void RandomizeNumber(float minInclusive, float maxExclusive, int switchCase, PlayerControllerB interactingPlayer = null, int useRandomSeed = -1) { float num = 0f; num = ((useRandomSeed != -1) ? Mathf.Lerp(minInclusive, maxExclusive, (float)new Random(useRandomSeed).NextDouble()) : Random.Range(minInclusive, maxExclusive)); if ((Object)(object)interactingPlayer == (Object)null) { interactingPlayer = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)interactingPlayer == (Object)null) { interactingPlayer = StartOfRound.Instance.allPlayerScripts[0]; } } RandomizeNumberLocal(num, switchCase); RandomizeNumberServerRpc(num, (int)interactingPlayer.playerClientId, switchCase); } [ServerRpc(RequireOwnership = false)] private void RandomizeNumberServerRpc(float randomNr, int playerID, int switchCase) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2287666682u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref randomNr, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, switchCase); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2287666682u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; RandomizeNumberClientRpc(randomNr, playerID, switchCase); } } } [ClientRpc] private void RandomizeNumberClientRpc(float randomNr, int playerID, int switchCase) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(861825487u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref randomNr, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, switchCase); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 861825487u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { RandomizeNumberLocal(randomNr, switchCase); } } } private void RandomizeNumberLocal(float randomNr, int switchCase) { switch (switchCase) { case 0: UpdateSpecialIntLocal((int)randomNr, destroyLosesContent: false, null, overrideSnapToChange: true); break; case 1: timerStartTime = randomNr; TimerStart(); break; case 2: nextRandomSpecialSFX = (int)randomNr; break; } Logger.LogDebug((object)$"RandomizeIntLocal(): randomNr {randomNr} | switchCase {switchCase}"); } public void UpdateSpecialInt(int change, bool destroyLosesContent, bool syncRequiresOwnerShip = false) { if ((!changeSpecialIntAddOrSnap || (change != 0 && (specialInt != 0 || change >= 0))) && (changeSpecialIntAddOrSnap || change != -99) && (!syncRequiresOwnerShip || ((NetworkBehaviour)this).IsOwner)) { UpdateSpecialIntLocal(change, destroyLosesContent, GameNetworkManager.Instance.localPlayerController); UpdateSpecialIntServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, change, destroyLosesContent); } } [ServerRpc(RequireOwnership = false)] private void UpdateSpecialIntServerRpc(int playerID, int change, bool destroyLosesContent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1635305508u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, change); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyLosesContent, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1635305508u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; UpdateSpecialIntClientRpc(playerID, change, destroyLosesContent); } } } [ClientRpc] private void UpdateSpecialIntClientRpc(int playerID, int change, bool destroyLosesContent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(118164457u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, change); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyLosesContent, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 118164457u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { UpdateSpecialIntLocal(change, destroyLosesContent, ManagerScript.GetPlayerByID(playerID)); } } } public void UpdateSpecialIntLocalDirect(int change) { UpdateSpecialIntLocal(change, crateData.contentLostByNonPlayer); } public void UpdateSpecialIntLocalSwitchCase(int switchCase) { switch (switchCase) { case 1: UpdateSpecialIntLocal(changeSpecialIntPerWalkInto, crateData.contentLostByNonPlayer); break; case 2: UpdateSpecialIntLocal(changeSpecialIntPerJumpOnto, crateData.contentLostByNonPlayer); break; case 3: UpdateSpecialIntLocal(changeSpecialIntPerAttack, crateData.contentLostByNonPlayer); break; } } public void UpdateSpecialIntLocal(int change, bool destroyLosesContent, PlayerControllerB interactingPlayer = null, bool overrideSnapToChange = false) { if (crateData.changeCountInBetween) { int num = ((overrideSnapToChange || !changeSpecialIntAddOrSnap) ? change : (specialInt + change)); while (specialInt != num) { if (num > specialInt) { specialInt++; } else if (num < specialInt) { specialInt--; } if (specialInt < 0) { specialInt = 0; } if (ManagerScript.logDetail) { Logger.LogDebug((object)$"moved to: {specialInt}"); } CheckMaterialSwitch(); CheckSpawnPrefabSwitch(); } } else { if (overrideSnapToChange || !changeSpecialIntAddOrSnap) { specialInt = change; } else { specialInt += change; } if (specialInt < 0) { specialInt = 0; } if (ManagerScript.logDetail) { Logger.LogDebug((object)$"snapped to: {specialInt}"); } CheckMaterialSwitch(); CheckSpawnPrefabSwitch(); } if (ManagerScript.logDetail) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} specialInt: {specialInt} / destroyLosesContent? {destroyLosesContent}"); } if (destroyUponSpecialInt != -1 && specialInt >= destroyUponSpecialInt) { ((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyLosesContent, overrideEffects: false, shouldDoEffects: false, interactingPlayer)); } } private void CheckMaterialSwitch() { if (crateData.switchMatOnSpecialInt != null && crateData.switchMatOnSpecialInt.Length != 0 && specialInt >= 0 && specialInt < crateData.switchMatOnSpecialInt.Length) { for (int i = 0; i < crateData.switchMatIndex.Length; i++) { SwitchMatTo(crateData.switchMatOnSpecialInt[specialInt], crateData.switchMatIndex[i]); } } } private void SwitchMatTo(Material changeToMat, int matIndex = 2) { Material[] materials = ((Renderer)base.mainObjectRenderer).materials; if (matIndex >= materials.Length) { Logger.LogDebug((object)$"SwitchMatTo() out of bounds: length = {materials.Length} | index = {matIndex}"); return; } materials[matIndex] = changeToMat; if (!((Object)(object)materials[matIndex] == (Object)null) || crateData.changeSwitchToNull) { ((Renderer)base.mainObjectRenderer).materials = materials; } } private void CheckSpawnPrefabSwitch() { if (crateData.switchSpawnPrefabOnSpecialInt != null && crateData.switchSpawnPrefabOnSpecialInt.Length != 0 && specialInt >= 0 && specialInt < crateData.switchSpawnPrefabOnSpecialInt.Length && ((Object)(object)crateData.switchSpawnPrefabOnSpecialInt[specialInt] != (Object)null || crateData.changeSwitchToNull)) { spawnPrefab = crateData.switchSpawnPrefabOnSpecialInt[specialInt]; if ((Object)(object)spawnPrefab != (Object)null && spawnAmountLeft <= 0) { spawnAmountLeft = 1; } if (ManagerScript.logDetail) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId}: spawnPrefab on specialInt {specialInt} = {spawnPrefab} (spawnAmountLeft? {spawnAmountLeft})"); } } } public void DestroyCrate(bool destroyContents, bool overrideEffects = false, bool shouldDoEffects = false, PlayerControllerB interactingPlayer = null) { if (ManagerScript.CanInteractionOnCrateHappenLocally(interactingPlayer, this)) { ((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyContents, overrideEffects, shouldDoEffects, GameNetworkManager.Instance.localPlayerController)); DestroyCrateServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, destroyContents, overrideEffects, shouldDoEffects); } } [ServerRpc(RequireOwnership = false)] private void DestroyCrateServerRpc(int playerID, bool destroyContents, bool overrideEffects, bool shouldDoEffects) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00da: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2919731071u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyContents, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref overrideEffects, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref shouldDoEffects, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2919731071u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DestroyCrateClientRpc(playerID, destroyContents, overrideEffects, shouldDoEffects); } } } [ClientRpc] private void DestroyCrateClientRpc(int playerID, bool destroyContents, bool overrideEffects, bool shouldDoEffects) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00da: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2644684432u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroyContents, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref overrideEffects, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref shouldDoEffects, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2644684432u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { ((MonoBehaviour)this).StartCoroutine(DestroyCrateLocal(destroyContents, overrideEffects, shouldDoEffects, ManagerScript.GetPlayerByID(playerID))); } } } private IEnumerator DestroyCrateLocal(bool destroyContent, bool overrideEffects = false, bool shouldDoEffects = false, PlayerControllerB interactingPlayer = null) { if (destroyed) { yield break; } destroyed = true; base.itemUsedUp = true; if (destroyContent) { spawnAmountLeft = -1; } if (((NetworkBehaviour)this).IsServer) { DoSpawnCheck(crateData.spawnOnDestroy, interactingPlayer); } yield return (object)new WaitForEndOfFrame(); EnableColliders(setEnabledTo: false); if (overrideEffects) { if (shouldDoEffects) { PlaySFX(crateData.audioBreakSFX, overrideOneShot: true); PlayParticles(particlesBreak); if (crateData.audioPlayOnDestroy) { PlayAudioSpecialSFX(overrideForcePlay: true); } if (crateData.particlesPlayOnDestroy) { PlayParticles(particlesSpecial); } } } else { PlaySFX(crateData.audioBreakSFX, overrideOneShot: true); PlayParticles(particlesBreak); if (crateData.audioPlayOnDestroy) { PlayAudioSpecialSFX(overrideForcePlay: true); } if (crateData.particlesPlayOnDestroy) { PlayParticles(particlesSpecial); } } timerStartTime = -1f; TimerVisibility(setTo: false); audioSource.loop = false; if (((UnityEventBase)invokeEventOnDestroy).GetPersistentEventCount() != 0) { ((UnityEvent<PlayerControllerB>)(object)invokeEventOnDestroy).Invoke(interactingPlayer); } ManagerScript.RemoveCrate(this); } public void QueueSpawnCheck(PlayerControllerB interactingPlayer, GameObject queueSpawnPrefab, int queueSpawnAmountLeft = 1, int spawnAmountPerThisInteraction = -1) { if (!((NetworkBehaviour)this).IsServer) { bool flag = true; int num = ManagerScript.GetIndexOfChildTransform(spawnPrefab, ((Component)this).gameObject); if (num == -1) { flag = false; num = ManagerScript.GetIndexOfBonusObject(spawnPrefab); } Logger.LogDebug((object)$"CLIENT sending QueueSpawnCheck() from player {interactingPlayer} with indexToSend {num}, isChildTransform {flag}, queueSpawnAmountLeft {queueSpawnAmountLeft}, and spawnAmountPerThisInteraction {spawnAmountPerThisInteraction}"); SendQueueToHostServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, num, flag, queueSpawnAmountLeft, spawnAmountPerThisInteraction); } else { if (queuedSpawnCoroutine != null) { Logger.LogInfo((object)$"!!!stopping queuedSpawnCoroutine!!! ({this} #{((NetworkBehaviour)this).NetworkObjectId})"); ((MonoBehaviour)this).StopCoroutine(queuedSpawnCoroutine); } queuedSpawnCoroutine = ((MonoBehaviour)this).StartCoroutine(DoSpawnCheckOnceComplete(interactingPlayer, queueSpawnPrefab, queueSpawnAmountLeft, spawnAmountPerThisInteraction)); } } private IEnumerator DoSpawnCheckOnceComplete(PlayerControllerB interactingPlayer, GameObject queueSpawnPrefab, int queueSpawnAmountLeft = 1, int spawnAmountPerThisInteraction = -1) { Logger.LogDebug((object)$"queueing up new DoSpawnCheck({interactingPlayer}, {queueSpawnPrefab}, {queueSpawnAmountLeft}, {spawnAmountPerThisInteraction})"); yield return (object)new WaitForEndOfFrame(); if (spawnContentsCoroutine != null) { if (ManagerScript.logDetail) { Logger.LogInfo((object)"queue waiting"); } yield return (object)new WaitUntil((Func<bool>)(() => spawnContentsCoroutine == null)); if (ManagerScript.logDetail) { Logger.LogInfo((object)"queue continuing"); } } spawnPrefab = queueSpawnPrefab; spawnAmountLeft = queueSpawnAmountLeft; DoSpawnCheck(spawnAmountPerThisInteraction, interactingPlayer); queuedSpawnCoroutine = null; } [ServerRpc(RequireOwnership = false)] private void SendQueueToHostServerRpc(int playerID, int prefabID, bool isChild, int spawnTotal, int spawnAmount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3863705522u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); BytePacker.WriteValueBitPacked(val2, prefabID); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isChild, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, spawnTotal); BytePacker.WriteValueBitPacked(val2, spawnAmount); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3863705522u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB playerByID = ManagerScript.GetPlayerByID(playerID); GameObject val3 = (isChild ? ((Component)((Component)this).transform.GetChild(prefabID)).gameObject : ManagerScript.allAssets.allBonusObjects[prefabID]); Logger.LogDebug((object)$"SERVER receiving queue for DoSpawnCheck() from client [{playerID}] {playerByID} with objectToSpawn {val3}, spawnTotal {spawnTotal}, and spawnAmount {spawnAmount}"); QueueSpawnCheck(playerByID, val3, spawnTotal, spawnAmount); } } } public void DoSpawnCheck(int switchCase) { switch (switchCase) { case 1: DoSpawnCheck(crateData.spawnPerWalkingInto, GameNetworkManager.Instance.localPlayerController); break; case 2: DoSpawnCheck(changeSpecialIntPerJumpOnto, GameNetworkManager.Instance.localPlayerController); break; case 3: DoSpawnCheck(changeSpecialIntPerAttack, GameNetworkManager.Instance.localPlayerController); break; } } public void DoSpawnCheck(int spawnPerThisInteraction, PlayerControllerB interactingPlayer) { if (spawnAmountLeft > 0 && (Object)(object)spawnPrefab != (Object)null && spawnPerThisInteraction != 0) { int spawnedByID = -1; if ((Object)(object)interactingPlayer != (Object)null) { spawnedByID = (int)interactingPlayer.playerClientId; } Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} spawning {spawnPrefab}"); SpawnContentsServerRpc(spawnPerThisInteraction, spawnedByID); } } [ServerRpc(RequireOwnership = false)] private void SpawnContentsServerRpc(int amountToSpawnRequested, int spawnedByID) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2306729523u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amountToSpawnRequested); BytePacker.WriteValueBitPacked(val2, spawnedByID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2306729523u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)spawnPrefab == (Object)null) { Logger.LogWarning((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} SERVER tried spawning null spawnPrefab"); return; } if (spawnAmountLeft <= 0) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} SERVER-side tried spawning from empty crate, returning"); return; } if (amountToSpawnRequested == -1) { amountToSpawnRequested = spawnAmountLeft; } Logger.LogDebug((object)$"spawnContentsCoroutine AMOUNT {amountToSpawnRequested}"); if (spawnContentsCoroutine != null) { Logger.LogDebug((object)"spawnContentsCoroutine INTERRUPT"); ((MonoBehaviour)this).StopCoroutine(spawnContentsCoroutine); } Logger.LogDebug((object)"spawnContentsCoroutine START"); spawnContentsCoroutine = ((MonoBehaviour)this).StartCoroutine(SpawnContentOnServer(amountToSpawnRequested, spawnedByID)); } private IEnumerator SpawnContentOnServer(int amountToSpawnRequested, int spawnedByID) { for (int i = 0; i < amountToSpawnRequested; i++) { if (spawnAmountLeft <= 0) { break; } spawnAmountLeft--; Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} spawnPrefab: {spawnPrefab} & spawnAmountLeft: {spawnAmountLeft}"); Vector3 spawnPoint = topOfCrate.position + Vector3.up * 0.5f; GameObject spawnObject = Object.Instantiate<GameObject>(spawnPrefab, spawnPoint, Quaternion.identity); NetworkObject netObj = spawnObject.GetComponent<NetworkObject>(); GrabbableObject itemScript = spawnObject.GetComponent<GrabbableObject>(); PlayerControllerB spawnedBy = ManagerScript.GetPlayerByID(spawnedByID); ICrateSpawnableObject crateObject = spawnObject.GetComponent<ICrateSpawnableObject>(); int intValue = 0; if ((Object)(object)itemScript != (Object)null && (Object)(object)itemScript.itemProperties != (Object)null && itemScript.itemProperties.isScrap && itemScript.itemProperties.minValue != -1 && itemScript.itemProperties.maxValue != -1) { intValue = (int)((float)Random.Range(itemScript.itemProperties.minValue, itemScript.itemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier); } if ((Object)(object)netObj != (Object)null) { netObj.Spawn(false); } yield return (object)new WaitForEndOfFrame(); if (ManagerScript.logDetail) { Logger.LogDebug((object)$"netObj == null? {(Object)(object)netObj == (Object)null}"); } if ((Object)(object)netObj == (Object)null) { bool flag = true; int num = ManagerScript.GetIndexOfChildTransform(spawnPrefab, ((Component)this).gameObject); if (num == -1) { flag = false; num = ManagerScript.GetIndexOfBonusObject(spawnPrefab); } if (num != -1) { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId}: SERVER instantiating indexToSend [{num}] isChildTransform? {flag}"); SpawnContentLocalClientRpc(num, flag, spawnedByID, spawnAmountLeft); } DestroyGameObjectOnCondition destroyGameObjectOnCondition = spawnObject.AddComponent<DestroyGameObjectOnCondition>(); destroyGameObjectOnCondition.destroyAfterTime = 10f; destroyGameObjectOnCondition.destroyGameObject = spawnObject; } else { Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId}: SERVER spawning {netObj}"); SpawnContentNetworkObjectClientRpc(NetworkObjectReference.op_Implicit(netObj), spawnedByID, intValue, spawnAmountLeft); } crateObject?.OnSpawnObject(this, spawnedBy); if ((Object)(object)itemScript != (Object)null) { ManagerScript.SpawnGrabbableObjectFromCrate(itemScript, this, intValue, spawnedBy, spawnPoint); } yield return (object)new WaitForSeconds(0.1f); } Logger.LogDebug((object)"spawnContentsCoroutine FINISH"); spawnContentsCoroutine = null; } [ClientRpc] private void SpawnContentLocalClientRpc(int prefabID, bool isChild, int spawnedByID, int hostSpawnAmount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1610815108u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, prefabID); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isChild, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, spawnedByID); BytePacker.WriteValueBitPacked(val2, hostSpawnAmount); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1610815108u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { if ((Object)(object)spawnPrefab == (Object)null) { Logger.LogWarning((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} CLIENT tried spawning null spawnPrefab"); return; } spawnAmountLeft = hostSpawnAmount; Logger.LogDebug((object)$"Spawn LOCAL: {this} #{((NetworkBehaviour)this).NetworkObjectId} spawnAmountLeft: {spawnAmountLeft}"); PlayerControllerB playerByID = ManagerScript.GetPlayerByID(spawnedByID); GameObject val3 = (isChild ? ((Component)((Component)this).transform.GetChild(prefabID)).gameObject : ManagerScript.allAssets.allBonusObjects[prefabID]); Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId}: CLIENT instantiating prefabID [{prefabID}] isChild? {isChild}"); GameObject val4 = Object.Instantiate<GameObject>(val3, topOfCrate.position + Vector3.up * 0.5f, Quaternion.identity); val4.GetComponent<ICrateSpawnableObject>()?.OnSpawnObject(this, playerByID); DestroyGameObjectOnCondition destroyGameObjectOnCondition = val4.AddComponent<DestroyGameObjectOnCondition>(); destroyGameObjectOnCondition.destroyAfterTime = 10f; destroyGameObjectOnCondition.destroyGameObject = val4; } } [ClientRpc] private void SpawnContentNetworkObjectClientRpc(NetworkObjectReference prefabNOR, int spawnedByID, int intValue, int hostSpawnAmount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(367611882u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref prefabNOR, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, spawnedByID); BytePacker.WriteValueBitPacked(val2, intValue); BytePacker.WriteValueBitPacked(val2, hostSpawnAmount); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 367611882u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { spawnAmountLeft = hostSpawnAmount; Logger.LogDebug((object)$"Spawn NETWORK: {this} #{((NetworkBehaviour)this).NetworkObjectId} spawnAmountLeft: {spawnAmountLeft}"); ((MonoBehaviour)this).StartCoroutine(SpawnContentOnClient(prefabNOR, spawnedByID, intValue)); } } } private IEnumerator SpawnContentOnClient(NetworkObjectReference prefabNOR, int spawnedByID, int intValue) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) NetworkObject netObj = null; float startTime = Time.realtimeSinceStartup; while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref prefabNOR)).TryGet(ref netObj, (NetworkManager)null)) { yield return (object)new WaitForSeconds(0.03f); } if (!((Object)(object)netObj == (Object)null)) { yield return (object)new WaitForEndOfFrame(); Vector3 spawnPos = topOfCrate.position + Vector3.up * 0.5f; PlayerControllerB playerByID = ManagerScript.GetPlayerByID(spawnedByID); ((Component)netObj).GetComponent<ICrateSpawnableObject>()?.OnSpawnObject(this, playerByID); GrabbableObject componentInChildren = ((Component)netObj).GetComponentInChildren<GrabbableObject>(); if ((Object)(object)componentInChildren != (Object)null) { ManagerScript.SpawnGrabbableObjectFromCrate(componentInChildren, this, intValue, playerByID, spawnPos); } } } [ServerRpc(RequireOwnership = false)] public void SyncUponJoinServerRpc(int playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1293327924u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1293327924u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Logger.LogDebug((object)$"syncing crate {this} #{((NetworkBehaviour)this).NetworkObjectId} at {((Component)this).transform.position}"); int indexOfBonusObject = ManagerScript.GetIndexOfBonusObject(spawnPrefab); int hostMatLength = -1; if ((Object)(object)base.mainObjectRenderer != (Object)null && ((Renderer)base.mainObjectRenderer).materials != null) { hostMatLength = ((Renderer)base.mainObjectRenderer).materials.Length; } int hostModdedIndex = -1; if ((Object)(object)crateData != (Object)null && crateData.crateType == CrateType.Modded) { hostModdedIndex = CreateACrate.GetRuntimeParametersIndex(base.itemProperties); } int hostAudioIndex = -1; bool hostAudioPlaying = false; float hostAudioTime = 0f; if ((Object)(object)audioSource != (Object)null && !crateData.audioPlayOneShot && audioSource.isPlaying) { hostAudioPlaying = true; hostAudioTime = audioSource.time; for (int i = 0; i < crateData.audioSpecialSFX.Length; i++) { AudioClip val3 = crateData.audioSpecialSFX[i]; if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)audioSource.clip) { hostAudioIndex = i; break; } } } bool flag = false; float hostParticlesTime = 0f; if ((Object)(object)particlesSpecial != (Object)null) { MainModule main = particlesSpecial.main; if (((MainModule)(ref main)).loop && particlesSpecial.isPlaying) { flag = true; if (flag) { hostParticlesTime = particlesSpecial.time; } } } float hostInteractionCooldown = 0f; if (base.useCooldown >= 1f) { hostInteractionCooldown = base.currentUseCooldown; } SyncUponJoinClientRpc(playerID, destroyed, specialInt, spawnAmountLeft, indexOfBonusObject, hostInteractionCooldown, collideOverrideCrate, collideOverrideBounce, hostMatLength, bounceForce, destroyUponSpecialInt, timer, timerActive, timerStartTime, timerCooldown, timersEnded, hostAudioPlayi