Decompiled source of EvilDuck v1.0.0
Omni.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.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Omni")] [assembly: AssemblyTitle("Omni")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class VHSShaderOnItemGrab : MonoBehaviour { [Header("VHS Shader")] public MonoBehaviour vhsShaderPrefab; private bool effectApplied = false; private PhysGrabObject physGrabObject; private void Start() { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); } private void Update() { if (effectApplied || (Object)(object)physGrabObject == (Object)null || !physGrabObject.grabbed) { return; } foreach (PhysGrabber item in physGrabObject.playerGrabbing) { if ((Object)(object)item?.playerAvatar != (Object)null) { AttachVHSShader(item.playerAvatar); } } effectApplied = true; } private void AttachVHSShader(PlayerAvatar player) { CharacterController componentInChildren = ((Component)player).GetComponentInChildren<CharacterController>(true); if ((Object)(object)componentInChildren == (Object)null) { Debug.LogWarning((object)"Character Controller not found under player."); return; } Transform val = ((Component)componentInChildren).transform.Find("Top Camera"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Top Camera not found."); } else if ((Object)(object)((Component)val).GetComponent(((object)vhsShaderPrefab).GetType()) == (Object)null) { ((Component)val).gameObject.AddComponent(((object)vhsShaderPrefab).GetType()); Debug.Log((object)"VHS Shader attached to Top Camera."); } } } [RequireComponent(typeof(Renderer))] public class AudioReactiveMaterial : MonoBehaviour { [Header("Audio Settings")] public AudioSource audioSource; public float sensitivity = 15f; [Header("Materials")] public Material idleMaterial; public Material activeMaterial; private Renderer rend; private float[] samples = new float[64]; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)idleMaterial != (Object)null) { rend.material = idleMaterial; } } private void Update() { float audioVolume = GetAudioVolume(); float num = Mathf.Clamp01(audioVolume * sensitivity); if (num > 0.1f) { if ((Object)(object)activeMaterial != (Object)null) { rend.material = activeMaterial; } } else if ((Object)(object)idleMaterial != (Object)null) { rend.material = idleMaterial; } } private float GetAudioVolume() { if ((Object)(object)audioSource == (Object)null) { return 0f; } audioSource.GetOutputData(samples, 0); float num = 0f; for (int i = 0; i < samples.Length; i++) { num += Mathf.Abs(samples[i]); } return num / (float)samples.Length; } } public class OmniscyeBowlingGameManager : MonoBehaviourPun { [CompilerGenerated] private sealed class <ResetBallAfterDelay>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniscyeBowlingGameManager <>4__this; private int <finalScore>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetBallAfterDelay>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isResetting = true; <finalScore>5__1 = <>4__this.pinsKnockedOver; Debug.Log((object)$"[Omniscye Bowling] Captured final score: {<finalScore>5__1}"); <>2__current = (object)new WaitForSeconds(<>4__this.resetDelay); <>1__state = 1; return true; case 1: <>1__state = -1; if (PhotonNetwork.OfflineMode) { <>4__this.ResetBallRPC(<finalScore>5__1); } else { ((MonoBehaviourPun)<>4__this).photonView.RPC("ResetBallRPC", (RpcTarget)3, new object[1] { <finalScore>5__1 }); } <>4__this.isResetting = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ThrowTimeoutCheck>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniscyeBowlingGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ThrowTimeoutCheck>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.maxThrowTime); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.throwActive) { Debug.Log((object)"[Omniscye Bowling] Throw timed out - auto finishing"); <>4__this.FinishThrow(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Omniscye Pins")] public GameObject[] pins; [Header("Omniscye Score Display")] public TextMeshProUGUI scoreText; public TextMeshProUGUI[] frameScoreTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[10]; [Header("Pin Detection Settings")] public float tippedAngleThreshold = 30f; [Header("Ball Reset Settings")] public Rigidbody ballRb; public Transform resetPosition; public Transform stopPoint; public Transform pinZoneStart; public Transform throwStart; public float resetDelay = 3f; public float maxThrowTime = 10f; public float ballStoppedThreshold = 0.05f; [Header("Death Mechanic")] public int deathScoreThreshold = 50; public HurtCollider playerKillCollider; [Header("Reward")] public GameObject rewardPrefab; public Transform rewardSpawnPoint; private bool isResetting = false; private bool ballInPinZone = false; private bool throwActive = false; private float ballStoppedTime = 0f; private int pinsKnockedOver = 0; private int throwCount = 0; private int currentFrame = 0; private List<int> throws = new List<int>(); private Coroutine throwTimeoutCoroutine; private Dictionary<GameObject, Vector3> originalUpDirections = new Dictionary<GameObject, Vector3>(); private Dictionary<GameObject, Vector3> originalPositions = new Dictionary<GameObject, Vector3>(); private Dictionary<GameObject, Quaternion> originalRotations = new Dictionary<GameObject, Quaternion>(); private void Start() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsConnected) { PhotonNetwork.OfflineMode = true; Debug.Log((object)"[Omniscye Bowling] OfflineMode enabled."); } GameObject[] array = pins; foreach (GameObject val in array) { originalUpDirections[val] = val.transform.up; originalPositions[val] = val.transform.position; originalRotations[val] = val.transform.rotation; } ((TMP_Text)scoreText).text = "Pins Knocked Over: 0"; for (int j = 0; j < frameScoreTexts.Length; j++) { if ((Object)(object)frameScoreTexts[j] != (Object)null) { ((TMP_Text)frameScoreTexts[j]).text = $"Frame {j + 1}: "; } } } private void Update() { if ((PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode) && !isResetting) { CheckBallPosition(); if (throwActive && ballInPinZone) { TrackPins(); } if (throwActive) { CheckIfBallStopped(); } } } private void CheckIfBallStopped() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = ballRb.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; if (magnitude < ballStoppedThreshold) { ballStoppedTime += Time.deltaTime; if (ballStoppedTime >= 2f) { Debug.Log((object)"[Omniscye Bowling] Ball stopped moving - finishing throw"); FinishThrow(); } } else { ballStoppedTime = 0f; } } private void CheckBallPosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) float x = ((Component)ballRb).transform.position.x; float x2 = throwStart.position.x; float x3 = pinZoneStart.position.x; float x4 = stopPoint.position.x; if (!throwActive && x >= x2) { throwActive = true; ballStoppedTime = 0f; Debug.Log((object)"[Omniscye Bowling] Ball passed throw start - throw started"); if (throwTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(throwTimeoutCoroutine); } throwTimeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ThrowTimeoutCheck()); } if (throwActive && !ballInPinZone && x >= x3) { ballInPinZone = true; Debug.Log((object)"[Omniscye Bowling] Ball entered pin zone"); } if (throwActive && x >= x4) { Debug.Log((object)"[Omniscye Bowling] Ball reached stop point - finishing throw"); FinishThrow(); } } [IteratorStateMachine(typeof(<ThrowTimeoutCheck>d__32))] private IEnumerator ThrowTimeoutCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ThrowTimeoutCheck>d__32(0) { <>4__this = this }; } private void FinishThrow() { if (!isResetting) { throwActive = false; ballInPinZone = false; if (throwTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(throwTimeoutCoroutine); throwTimeoutCoroutine = null; } Debug.Log((object)$"[Omniscye Bowling] Throw finished with final score: {pinsKnockedOver}"); ((MonoBehaviour)this).StartCoroutine(ResetBallAfterDelay()); } } private void TrackPins() { int num = 0; GameObject[] array = pins; foreach (GameObject val in array) { Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && component.enabled && IsPinKnockedOver(val)) { num++; } } if (num != pinsKnockedOver) { pinsKnockedOver = num; if (PhotonNetwork.OfflineMode) { UpdateScoreRPC(pinsKnockedOver); return; } ((MonoBehaviourPun)this).photonView.RPC("UpdateScoreRPC", (RpcTarget)3, new object[1] { pinsKnockedOver }); } } private bool IsPinKnockedOver(GameObject pin) { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!originalUpDirections.ContainsKey(pin)) { return false; } Vector3 val = originalUpDirections[pin]; float num = Vector3.Angle(val, pin.transform.up); return num > tippedAngleThreshold; } [IteratorStateMachine(typeof(<ResetBallAfterDelay>d__36))] private IEnumerator ResetBallAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetBallAfterDelay>d__36(0) { <>4__this = this }; } [PunRPC] private void UpdateScoreRPC(int score) { if (throwActive && ballInPinZone) { ((TMP_Text)scoreText).text = "Pins Knocked Over: " + score; } } [PunRPC] private void ResetBallRPC(int finalThrowScore) { //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) throws.Add(finalThrowScore); throwCount++; if (currentFrame < 10 && (Object)(object)frameScoreTexts[currentFrame] != (Object)null) { if (throwCount % 2 == 1) { if (finalThrowScore == 10) { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: STRIKE (10)"; throwCount++; currentFrame++; ResetPins(); Debug.Log((object)"[Omniscye Bowling] Strike! Moving to next frame."); } else { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {finalThrowScore}"; HideKnockedPins(); Debug.Log((object)$"[Omniscye Bowling] First throw: {finalThrowScore} pins. Hiding knocked pins for second throw."); } } else { List<int> list = throws; int num = list[list.Count - 2]; int num2 = num + finalThrowScore; if (num2 == 10) { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {num} / SPARE"; Debug.Log((object)"[Omniscye Bowling] Spare achieved!"); } else { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {num} / {finalThrowScore}"; Debug.Log((object)$"[Omniscye Bowling] Frame complete: {num} + {finalThrowScore} = {num2}"); } ResetPins(); currentFrame++; } } if (currentFrame >= 10) { int num3 = CalculateTotalScore(); Debug.Log((object)$"[Omniscye Bowling] Game complete! Total score: {num3}"); if (num3 < deathScoreThreshold) { Debug.Log((object)$"[Omniscye Bowling] Score {num3} below threshold {deathScoreThreshold} - triggering player death!"); TriggerPlayerDeath(); } else { Debug.Log((object)$"[Omniscye Bowling] Score {num3} meets threshold - rewarding players!"); SpawnRewardPrefab(); } currentFrame = 0; throwCount = 0; throws.Clear(); for (int i = 0; i < frameScoreTexts.Length; i++) { if ((Object)(object)frameScoreTexts[i] != (Object)null) { ((TMP_Text)frameScoreTexts[i]).text = $"Frame {i + 1}: "; } } ResetPins(); } ballRb.velocity = Vector3.zero; ballRb.angularVelocity = Vector3.zero; ballRb.isKinematic = true; ((Component)ballRb).transform.position = resetPosition.position; ((Component)ballRb).transform.rotation = resetPosition.rotation; ballRb.isKinematic = false; pinsKnockedOver = 0; ((TMP_Text)scoreText).text = "Pins Knocked Over: 0"; Debug.Log((object)$"[Omniscye Bowling] Ball reset complete. Frame: {currentFrame + 1}, Throw: {throwCount % 2 + 1}"); } private void SpawnRewardPrefab() { if ((Object)(object)rewardPrefab != (Object)null) { PhotonView component = rewardPrefab.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { ((MonoBehaviourPun)this).photonView.RPC("EnableRewardRPC", (RpcTarget)3, new object[1] { component.ViewID }); Debug.Log((object)"[Omniscye Bowling] Sent RPC to enable reward object."); } else { Debug.LogWarning((object)"[Omniscye Bowling] Reward prefab is missing PhotonView."); } } else { Debug.LogWarning((object)"[Omniscye Bowling] Reward prefab not assigned."); } } [PunRPC] private void EnableRewardRPC(int viewID) { PhotonView val = PhotonView.Find(viewID); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { ((Component)val).gameObject.SetActive(true); Debug.Log((object)"[Omniscye Bowling] Reward activated across all clients."); } else { Debug.LogWarning((object)"[Omniscye Bowling] Could not find reward PhotonView by ViewID."); } } private void ResetPins() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = pins; foreach (GameObject val in array) { val.transform.position = originalPositions[val]; val.transform.rotation = originalRotations[val]; Rigidbody component = val.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } Renderer component2 = val.GetComponent<Renderer>(); Collider component3 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = true; } if (Object.op_Implicit((Object)(object)component3)) { component3.enabled = true; } } pinsKnockedOver = 0; Debug.Log((object)"[Omniscye Bowling] All pins reset and re-enabled"); } private void HideKnockedPins() { int num = 0; GameObject[] array = pins; foreach (GameObject val in array) { if (IsPinKnockedOver(val)) { Renderer component = val.GetComponent<Renderer>(); Collider component2 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; } if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = false; } num++; } } Debug.Log((object)$"[Omniscye Bowling] Hidden {num} knocked pins for second throw"); } private int CalculateTotalScore() { int num = 0; foreach (int @throw in throws) { num += @throw; } return num; } private void TriggerPlayerDeath() { if ((Object)(object)playerKillCollider == (Object)null) { Debug.LogError((object)"[Omniscye Bowling] No HurtCollider assigned for player death!"); return; } PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth != (Object)null) { Debug.Log((object)("[Omniscye Bowling] Killing player: " + ((Object)val).name)); int num = ((!((Object)(object)playerKillCollider.enemyHost != (Object)null)) ? (-1) : 0); val.playerHealth.Hurt(val.playerHealth.health, false, num); } } } } public class ChasingSkullValuable : Trap { [Header("Chase Settings")] public float forceStrength = 50f; public float maxSpeed = 15f; public float detectionRange = 30f; public float playerKnockbackForce = 25f; [Header("Physics")] public Rigidbody rb; private PlayerAvatar targetPlayer; public override void Start() { ((Trap)this).Start(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent<Rigidbody>(); } } public override void Update() { ((Trap)this).Update(); if (!base.physGrabObject.grabbed) { FindPlayerTarget(); ChaseTarget(); } else { targetPlayer = null; } } private void FindPlayerTarget() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer != (Object)null && !targetPlayer.isDisabled) { return; } float num = detectionRange; PlayerAvatar val = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } } targetPlayer = val; } private void ChaseTarget() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)targetPlayer == (Object)null) && !targetPlayer.isDisabled) { Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = rb.velocity; if (((Vector3)(ref val)).magnitude < maxSpeed) { rb.AddForce(normalized * forceStrength, (ForceMode)5); } } } private void OnCollisionEnter(Collision collision) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer()) { PlayerAvatar componentInParent = ((Component)collision.collider).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isDisabled) { componentInParent.tumble.TumbleRequest(true, false); Vector3 val = ((Component)componentInParent).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; componentInParent.tumble.TumbleForce(normalized * playerKnockbackForce); componentInParent.tumble.TumbleOverrideTime(1.5f); } } } } public class CoasterSeatCarrier : MonoBehaviour { [Tooltip("Child under the cart where the player sits (must be parented)")] public Transform seatPoint; [Header("Grab & Follow Settings")] [Tooltip("How close the player must be to latch on")] public float grabDistance = 1f; [Tooltip("Spring stiffness for position follow")] public float positionStiffness = 10f; [Tooltip("Spring stiffness for rotation follow")] public float rotationStiffness = 0.2f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; break; } } if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { Rigidbody rb = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, rb.velocity, positionStiffness); rb.AddForce(val * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, rb, rotationStiffness); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } } [RequireComponent(typeof(Renderer))] public class CubeWalk : MonoBehaviour { [CompilerGenerated] private sealed class <FlipRight>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CubeWalk <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlipRight>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; if (!<>4__this.isFlipping) { <>4__this.isFlipping = true; ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PerformFlip()); } break; } <>2__current = (object)new WaitForSeconds(<>4__this.flipDelay); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PerformFlip>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CubeWalk <>4__this; private float <rotationAmount>5__1; private float <rotationSpeed>5__2; private float <totalRotation>5__3; private Vector3 <rightAngleRotation>5__4; private float <step>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PerformFlip>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <rotationAmount>5__1 = 90f; <rotationSpeed>5__2 = <rotationAmount>5__1 / <>4__this.flipDelay * Time.deltaTime; <totalRotation>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<totalRotation>5__3 < <rotationAmount>5__1) { <step>5__5 = Mathf.Min(<rotationSpeed>5__2, <rotationAmount>5__1 - <totalRotation>5__3); ((Component)<>4__this).transform.RotateAround(<>4__this.pivot, <>4__this.rotationAxis, <step>5__5); <totalRotation>5__3 += <step>5__5; <>2__current = null; <>1__state = 1; return true; } <rightAngleRotation>5__4 = new Vector3(Mathf.Round(((Component)<>4__this).transform.eulerAngles.x / 90f) * 90f, Mathf.Round(((Component)<>4__this).transform.eulerAngles.y / 90f) * 90f, Mathf.Round(((Component)<>4__this).transform.eulerAngles.z / 90f) * 90f); ((Component)<>4__this).transform.eulerAngles = <rightAngleRotation>5__4; <>4__this.pivot = ((Component)<>4__this).transform.position + new Vector3(((Component)<>4__this).transform.localScale.x / 2f, (0f - ((Component)<>4__this).transform.localScale.y) / 2f, ((Component)<>4__this).transform.localScale.z / 2f); <>4__this.isFlipping = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Flip Settings")] public float flipDelay = 0.5f; [Header("Audio Settings")] public AudioSource audioSource; public float sensitivity = 15f; [Header("Materials")] public Material blackMaterial; public Material redMaterial; private Vector3 pivot; private bool isFlipping = false; private Vector3 rotationAxis = new Vector3(0f, 0f, -1f); private Renderer rend; private float[] samples = new float[64]; private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) pivot = ((Component)this).transform.position + new Vector3(((Component)this).transform.localScale.x / 2f, (0f - ((Component)this).transform.localScale.y) / 2f, ((Component)this).transform.localScale.z / 2f); rend = ((Component)this).GetComponent<Renderer>(); rend.material = blackMaterial; ((MonoBehaviour)this).StartCoroutine(FlipRight()); } private void Update() { float audioVolume = GetAudioVolume(); float num = Mathf.Clamp01(audioVolume * sensitivity); if (num > 0.1f) { rend.material = redMaterial; } else { rend.material = blackMaterial; } } private float GetAudioVolume() { if ((Object)(object)audioSource == (Object)null) { return 0f; } audioSource.GetOutputData(samples, 0); float num = 0f; for (int i = 0; i < samples.Length; i++) { num += Mathf.Abs(samples[i]); } return num / (float)samples.Length; } [IteratorStateMachine(typeof(<FlipRight>d__13))] private IEnumerator FlipRight() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlipRight>d__13(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PerformFlip>d__14))] private IEnumerator PerformFlip() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PerformFlip>d__14(0) { <>4__this = this }; } } public class CursedFollowCat : MonoBehaviourPun { public float followDistance = 50f; public float moveForce = 20f; public float rotationForce = 5f; public float toppleAngleThreshold = 45f; public float resetAfterSeconds = 5f; private PlayerAvatar playerTarget; private Rigidbody rb; private float toppleTimer = 0f; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); } private void FixedUpdate() { if (SemiFunc.IsMasterClientOrSingleplayer()) { AcquirePlayerTarget(); if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { FollowPlayer(); } CheckForTopple(); } } private void AcquirePlayerTarget() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) float num = followDistance; playerTarget = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 <= num) { num = num2; playerTarget = item; } } } } private void FollowPlayer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)playerTarget).transform.position; Vector3 val = SemiFunc.PhysFollowPosition(rb.position, position, rb.velocity, moveForce); rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(position - ((Component)this).transform.position), rb, rotationForce); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } private void CheckForTopple() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(((Component)this).transform.up, Vector3.up); if (num > toppleAngleThreshold) { toppleTimer += Time.fixedDeltaTime; if (toppleTimer >= resetAfterSeconds) { ResetUpright(); toppleTimer = 0f; } } else { toppleTimer = 0f; } } private void ResetUpright() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.rotation = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); rb.angularVelocity = Vector3.zero; rb.velocity = Vector3.zero; } } public class CursedBlackHoleOrbValuable : Trap { [Header("Black Hole Settings")] public float blackHoleRange = 20f; public float pullForce = 100f; public override void Update() { ((Trap)this).Update(); if (base.physGrabObject.grabbed && SemiFunc.IsMasterClientOrSingleplayer()) { ApplyContinuousPull(); } } private void ApplyContinuousPull() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00b9: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { bool flag = false; foreach (PhysGrabber item2 in base.physGrabObject.playerGrabbing) { if ((Object)(object)item2.playerAvatar == (Object)(object)item) { flag = true; break; } } if (!flag && !item.isDisabled) { float num = Vector3.Distance(position, ((Component)item).transform.position); if (num <= blackHoleRange) { Vector3 val = position - ((Component)item).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; item.tumble.TumbleRequest(true, false); float num2 = Mathf.Clamp01(1f - num / blackHoleRange); float num3 = pullForce * num2; item.tumble.TumbleForce(normalized * num3); item.tumble.TumbleOverrideTime(0.2f); } } } } } public class CursedRollerValuable : MonoBehaviour { [Header("Patrol Settings")] public float moveForce = 15f; public float rotationForce = 5f; public float wanderInterval = 5f; public float wanderRadius = 10f; [Header("Coaster Settings")] public Transform seatPoint; public float grabDistance = 1f; public float positionStiffness = 10f; public float rotationStiffness = 0.2f; public float latchDuration = 5f; public float tossForce = 30f; public float regrabCooldown = 5f; private PlayerAvatar playerTarget; private Rigidbody rb; private float wanderTimer = 0f; private Vector3 randomWanderTarget; private float latchTimer = 0f; private float regrabTimer = 0f; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); SetRandomWanderTarget(); } private void FixedUpdate() { //IL_008b: 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) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (regrabTimer > 0f) { regrabTimer -= Time.fixedDeltaTime; } if ((Object)(object)playerTarget == (Object)null && regrabTimer <= 0f) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; latchTimer = 0f; break; } } if ((Object)(object)playerTarget != (Object)null) { CarryPlayer(); latchTimer += Time.fixedDeltaTime; if (latchTimer >= latchDuration) { TossPlayer(); playerTarget = null; latchTimer = 0f; regrabTimer = regrabCooldown; SetRandomWanderTarget(); } } else { wanderTimer += Time.fixedDeltaTime; if (wanderTimer >= wanderInterval) { wanderTimer = 0f; SetRandomWanderTarget(); } MoveToWanderTarget(); } } private void CarryPlayer() { //IL_0073: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val2 = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, val.velocity, positionStiffness); val.AddForce(val2 * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val3 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, val, rotationStiffness); val.AddTorque(val3 * Time.fixedDeltaTime, (ForceMode)1); } private void TossPlayer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)playerTarget).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; playerTarget.tumble.TumbleRequest(true, false); playerTarget.tumble.TumbleForce(normalized * tossForce); playerTarget.tumble.TumbleOverrideTime(1f); } private void SetRandomWanderTarget() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Random.insideUnitCircle * wanderRadius; randomWanderTarget = ((Component)this).transform.position + new Vector3(val.x, 0f, val.y); } private void MoveToWanderTarget() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = SemiFunc.PhysFollowPosition(rb.position, randomWanderTarget, rb.velocity, moveForce); rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(randomWanderTarget - ((Component)this).transform.position), rb, rotationForce); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } public class FallTeleportTrigger : MonoBehaviour { public float fallYThreshold = -100f; public Transform teleportTarget; private PlayerAvatar localPlayer; private void Start() { localPlayer = ((IEnumerable<PlayerAvatar>)GameDirector.instance.PlayerList).FirstOrDefault((Func<PlayerAvatar, bool>)((PlayerAvatar p) => p.photonView.IsMine || !PhotonNetwork.InRoom)); } private void Update() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated && Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)teleportTarget) && SemiFunc.IsMasterClientOrSingleplayer() && (int)GameDirector.instance.currentState == 2 && ((Component)localPlayer).transform.position.y < fallYThreshold) { PlayerTumble tumble = localPlayer.tumble; if ((Object)(object)tumble != (Object)null && (Object)(object)tumble.physGrabObject != (Object)null) { tumble.TumbleSet(true, false); tumble.physGrabObject.Teleport(teleportTarget.position, teleportTarget.rotation); tumble.physGrabObject.rb.velocity = Vector3.zero; tumble.physGrabObject.rb.angularVelocity = Vector3.zero; localPlayer.FallDamageResetSet(2f); } } } } public class GreedyVendingTrap : MonoBehaviourPun { [CompilerGenerated] private sealed class <PressCooldown>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GreedyVendingTrap <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PressCooldown>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.recentlyPressed = true; <>2__current = (object)new WaitForSeconds(<>4__this.cooldown); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.recentlyPressed = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ItemToggle itemToggle; private bool warned = false; private bool recentlyPressed = false; public AudioClip warningClip; public AudioSource audioSource; public Animator warningAnimator; public string animationTriggerName = "Warn"; public float cooldown = 0.5f; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } private void Update() { if (!itemToggle.toggleImpulse || recentlyPressed) { return; } ((MonoBehaviour)this).StartCoroutine(PressCooldown()); if (!warned) { warned = true; if ((Object)(object)warningClip != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(warningClip); } if ((Object)(object)warningAnimator != (Object)null) { warningAnimator.SetTrigger(animationTriggerName); } Debug.Log((object)"[Trap] First press - warning issued."); } else { Debug.Log((object)"[Trap] Second press - punishing all players."); KillAllPlayers(); } } [IteratorStateMachine(typeof(<PressCooldown>d__10))] private IEnumerator PressCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PressCooldown>d__10(0) { <>4__this = this }; } private void KillAllPlayers() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth != (Object)null) { int num = -1; val.playerHealth.Hurt(val.playerHealth.health, false, num); } } } } [RequireComponent(typeof(Collider))] public class KinematicCoasterMover : MonoBehaviour { [Header("Waypoints & Timing")] public Transform waypointRoot; public float speed = 5f; public float startDelay = 10f; public bool loop = true; public float rotationSpeed = 5f; [Header("Mesh Import Rotation Correction (tweak in Inspector)")] public Vector3 meshEulerOffset = new Vector3(-90f, 180f, -0.085f); private Transform[] waypoints; private int idx; private float delayTimer; private bool started; private Quaternion originalRotation; private Quaternion meshOffsetQuat; private static readonly Regex regex = new Regex("Waypoint_(\\d+)$"); private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) originalRotation = ((Component)this).transform.rotation; waypoints = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { t = t, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.t).ToArray(); meshOffsetQuat = Quaternion.Euler(meshEulerOffset); idx = 0; delayTimer = startDelay; started = false; if (waypoints.Length != 0) { ((Component)this).transform.position = waypoints[0].position; } } private void Update() { //IL_0048: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if (waypoints == null || waypoints.Length == 0) { return; } if (!started) { delayTimer -= Time.deltaTime; ((Component)this).transform.rotation = originalRotation; if (delayTimer <= 0f) { started = true; } return; } if (idx == 0 && ((Component)this).transform.rotation == originalRotation && waypoints.Length > 1) { Vector3 val = waypoints[1].position - waypoints[0].position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion rotation = Quaternion.LookRotation(normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = rotation; } Vector3 position = waypoints[idx].position; Vector3 val2 = position - ((Component)this).transform.position; float num = speed * Time.deltaTime; if (((Vector3)(ref val2)).magnitude <= num) { ((Component)this).transform.position = position; AdvanceIndex(); return; } Transform transform = ((Component)this).transform; transform.position += ((Vector3)(ref val2)).normalized * num; Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, rotationSpeed * Time.deltaTime); } private void AdvanceIndex() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) idx++; if (idx >= waypoints.Length) { if (loop) { idx = 0; delayTimer = startDelay; started = false; ((Component)this).transform.rotation = originalRotation; } else { ((Behaviour)this).enabled = false; } } } private void OnDrawGizmos() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)waypointRoot == (Object)null)) { Vector3[] array = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { p = t.position, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.p).ToArray(); Gizmos.color = Color.cyan; for (int i = 0; i + 1 < array.Length; i++) { Gizmos.DrawLine(array[i], array[i + 1]); } } } } public class LowGravityValuable : MonoBehaviour { private PhotonView photonView; private bool gravitySet = false; private void Start() { photonView = ((Component)this).GetComponent<PhotonView>(); if (SemiFunc.IsMasterClientOrSingleplayer()) { ApplyLowGravity(); } } private void ApplyLowGravity() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!gravitySet) { Physics.gravity = new Vector3(0f, -1.2f, 0f); gravitySet = true; Debug.Log((object)"[LowGravityValuable] Gravity set to low space mode."); } } } public class CursedMusicBoxValuable : Trap { [Header("Audio")] public Sound cursedMusicSound; [Header("Spin Settings")] public float spinForce = 50f; public float tumbleForce = 15f; public float spinInterval = 0.2f; [Header("Visual Effects")] public ParticleSystem curseSparks; public Light curseLight; [Header("Animator")] public Animator cursedAnimator; public string holdBoolParameter = "IsHeld"; [Header("Camera Shake")] public float cameraShakeTime = 0.2f; public float cameraShakeStrength = 3f; public Vector2 cameraShakeBounds = new Vector2(1.5f, 5f); private float spinTimer; private Rigidbody rb; private bool soundPlaying = false; public override void Start() { ((Trap)this).Start(); rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = false; } } public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { CheckForGrabTumble(); } HandleGrabAnimation(); } private void CheckForGrabTumble() { if (!SemiFunc.FPSImpulse15() && base.physGrabObject.grabbed) { ActivateCurseEffects(); { foreach (PhysGrabber item in base.physGrabObject.playerGrabbing) { SpinAndTumblePlayer(item.playerAvatar); } return; } } StopCurseEffects(); } private void ActivateCurseEffects() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!soundPlaying) { cursedMusicSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f); soundPlaying = true; } if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = true; } if ((Object)(object)curseSparks != (Object)null && !curseSparks.isPlaying) { curseSparks.Play(); } } private void StopCurseEffects() { if (soundPlaying) { cursedMusicSound.Stop(); soundPlaying = false; } if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = false; } if ((Object)(object)curseSparks != (Object)null && curseSparks.isPlaying) { curseSparks.Stop(); } } private void SpinAndTumblePlayer(PlayerAvatar player) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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) spinTimer += Time.deltaTime; if (spinTimer >= spinInterval) { spinTimer = 0f; player.tumble.TumbleRequest(true, false); player.tumble.TumbleForce(((Component)player).transform.forward * tumbleForce); player.tumble.TumbleTorque(Vector3.up * spinForce); player.tumble.TumbleOverrideTime(2f); player.tumble.ImpactHurtSet(1f, 5); GameDirector.instance.CameraShake.ShakeDistance(cameraShakeStrength, 3f, 8f, ((Component)this).transform.position, cameraShakeTime); GameDirector.instance.CameraImpact.ShakeDistance(cameraShakeStrength, cameraShakeBounds.x, cameraShakeBounds.y, ((Component)this).transform.position, cameraShakeTime); } } private void HandleGrabAnimation() { if (!((Object)(object)cursedAnimator == (Object)null)) { bool grabbed = base.physGrabObject.grabbed; cursedAnimator.SetBool(holdBoolParameter, grabbed); } } } public class OmniPlinkoInstaller : MonoBehaviour { [CompilerGenerated] private sealed class <InstallSequence>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniPlinkoInstaller <>4__this; private float <progress>5__1; private int <msgIndex>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InstallSequence>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this.disableOnStart != (Object)null) { <>4__this.disableOnStart.SetActive(false); } ((Component)<>4__this.startButton).gameObject.SetActive(false); <>4__this.bgm.Play(); <progress>5__1 = 0f; <msgIndex>5__2 = 0; goto IL_0164; case 1: <>1__state = -1; goto IL_0164; case 2: { <>1__state = -1; <>4__this.rootCanvas.SetActive(false); Debug.Log((object)"Omni-OS fully initialized. Canvas off."); return false; } IL_0164: if (<progress>5__1 < 100f) { <progress>5__1 += Random.Range(1f, 4f); <>4__this.progressBar.value = <progress>5__1 / 100f; if (<progress>5__1 >= (float)(<msgIndex>5__2 + 1) * (100f / (float)<>4__this.messages.Length) && <msgIndex>5__2 < <>4__this.messages.Length) { ((TMP_Text)<>4__this.statusText).text = <>4__this.messages[<msgIndex>5__2++]; } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; } <>4__this.installerUI.SetActive(false); <>4__this.loadedUI.SetActive(true); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PressCooldown>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniPlinkoInstaller <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PressCooldown>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.recentlyPressed = true; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.recentlyPressed = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("UI Elements")] public GameObject rootCanvas; public GameObject installerUI; public GameObject loadedUI; public Slider progressBar; public TextMeshProUGUI statusText; public Button startButton; public AudioSource bgm; [Header("Setup Control")] public GameObject disableOnStart; private ItemToggle itemToggle; private bool recentlyPressed = false; private readonly string[] messages = new string[6] { "Initializing Installer...", "Decrypting Payload...", "Installing Omni-Kernel...", "Configuring Quantum Drivers...", "Patching BIOS...", "Finalizing Setup..." }; private void Start() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown itemToggle = ((Component)this).GetComponent<ItemToggle>(); installerUI.SetActive(true); loadedUI.SetActive(false); rootCanvas.SetActive(true); ((UnityEvent)startButton.onClick).AddListener((UnityAction)delegate { ((MonoBehaviour)this).StartCoroutine(InstallSequence()); }); } private void Update() { if ((Object)(object)itemToggle != (Object)null && itemToggle.toggleImpulse && !recentlyPressed) { ((MonoBehaviour)this).StartCoroutine(PressCooldown()); Debug.Log((object)"[Installer] Grab press detected - starting installer."); ((UnityEvent)startButton.onClick).Invoke(); } } [IteratorStateMachine(typeof(<PressCooldown>d__13))] private IEnumerator PressCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PressCooldown>d__13(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<InstallSequence>d__14))] private IEnumerator InstallSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InstallSequence>d__14(0) { <>4__this = this }; } } public class NetworkedProximityTrigger : MonoBehaviourPun { [Header("Trigger Settings")] public float triggerDistance = 2f; public float deactivateAfterSeconds = 49f; public bool retriggerable = false; [Header("Actions")] public VideoPlayer videoPlayer; public AudioSource externalAudioSource; [Header("Audio Control")] public bool startAudioOnActivate = false; public bool stopAudioOnDeactivate = false; public GameObject[] objectsToToggle; [Header("Animator Settings")] public Animator targetAnimator; public string triggerParameterName = "Activate"; private bool isActive = false; private bool hasTriggered = false; private float timer = 0f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (hasTriggered) { return; } if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position) <= triggerDistance)) { continue; } playerTarget = item; break; } } if (!((Object)(object)playerTarget != (Object)null) || playerTarget.isDisabled) { return; } if (!isActive) { TriggerActivate(); return; } timer += Time.fixedDeltaTime; if (timer >= deactivateAfterSeconds) { TriggerDeactivate(); hasTriggered = true; } } private void TriggerActivate() { if (PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode) { ((MonoBehaviourPun)this).photonView.RPC("ActivateTrigger", (RpcTarget)3, Array.Empty<object>()); } else { ActivateTrigger(); } } private void TriggerDeactivate() { if (PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode) { ((MonoBehaviourPun)this).photonView.RPC("DeactivateTrigger", (RpcTarget)3, Array.Empty<object>()); } else { DeactivateTrigger(); } } [PunRPC] private void ActivateTrigger() { if (isActive) { return; } isActive = true; timer = 0f; if ((Object)(object)videoPlayer != (Object)null) { videoPlayer.Play(); } if (startAudioOnActivate && (Object)(object)externalAudioSource != (Object)null && !externalAudioSource.isPlaying) { externalAudioSource.Play(); } GameObject[] array = objectsToToggle; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } if ((Object)(object)targetAnimator != (Object)null && !string.IsNullOrEmpty(triggerParameterName)) { targetAnimator.SetTrigger(triggerParameterName); } } [PunRPC] private void DeactivateTrigger() { if (!isActive) { return; } isActive = false; playerTarget = null; if ((Object)(object)videoPlayer != (Object)null) { videoPlayer.Stop(); } if (stopAudioOnDeactivate && (Object)(object)externalAudioSource != (Object)null) { externalAudioSource.Stop(); } GameObject[] array = objectsToToggle; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } } public class PlayerWallBlocker : Trap { [Header("Push Settings")] public float blockRange = 2f; public float pushForce = 30f; public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { PushBackNearbyPlayers(); } } private void PushBackNearbyPlayers() { //IL_0030: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num <= blockRange) { Vector3 val = ((Component)item).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = 0f; Rigidbody rb = item.tumble.rb; rb.AddForce(normalized * pushForce * Time.deltaTime, (ForceMode)2); } } } } } public class PlinkoGameManager : MonoBehaviourPun { [CompilerGenerated] private sealed class <DropTimeoutCheck>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlinkoGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DropTimeoutCheck>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.maxDropTime); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.dropActive) { <>4__this.FinishDrop(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ResetDropAfterDelay>d__26 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlinkoGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetDropAfterDelay>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isResetting = true; <>2__current = (object)new WaitForSeconds(<>4__this.resetDelay); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.isResetting = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Ball")] public Rigidbody ballRb; public Transform dropStart; public float maxDropTime = 10f; [Header("Detection")] public float detectionRadius = 0.5f; public float resetDelay = 3f; [Header("Zones")] public List<Transform> rewardZones = new List<Transform>(); public List<Transform> deathZones = new List<Transform>(); [Header("Reward System")] public GameObject rewardPrefab; public Transform rewardSpawnPoint; public AudioSource rewardAudioSource; public AudioClip rewardClip; [Header("Death")] public HurtCollider playerKillCollider; private PlinkoGrabTracker grabTracker; private bool dropActive = false; private bool isResetting = false; private Coroutine dropTimeoutRoutine; private List<Transform> usedDeathZones = new List<Transform>(); private List<Transform> usedRewardZones = new List<Transform>(); private void Start() { if (!PhotonNetwork.IsConnected) { PhotonNetwork.OfflineMode = true; } if ((Object)(object)ballRb == (Object)null) { Debug.LogError((object)"❌ Ball Rigidbody not assigned!"); } else { Debug.Log((object)("✅ Ball Rigidbody assigned: " + ((Object)ballRb).name)); } grabTracker = ((Component)ballRb).GetComponent<PlinkoGrabTracker>(); Debug.Log((object)$"\ud83c\udfaf Reward zones: {rewardZones.Count}"); Debug.Log((object)$"☠\ufe0f Death zones: {deathZones.Count}"); Debug.Log((object)"✅ Plinko setup complete."); } private void Update() { if ((Object)(object)ballRb == (Object)null) { ((Behaviour)this).enabled = false; } else if ((PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode) && !isResetting) { CheckBallDropStartY(); if (dropActive) { CheckDeathZones(); } } } private void CheckBallDropStartY() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!dropActive && (Object)(object)dropStart != (Object)null && ballRb.position.y <= dropStart.position.y) { dropActive = true; } } [IteratorStateMachine(typeof(<DropTimeoutCheck>d__21))] private IEnumerator DropTimeoutCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DropTimeoutCheck>d__21(0) { <>4__this = this }; } private void CheckDeathZones() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < deathZones.Count; i++) { Transform val = deathZones[i]; if ((Object)(object)val == (Object)null || usedDeathZones.Contains(val)) { continue; } float num = Vector3.Distance(ballRb.position, val.position); if (num <= detectionRadius) { usedDeathZones.Add(val); Debug.Log((object)("☠\ufe0f Death zone hit: " + ((Object)val).name)); FinishDrop(); if (PhotonNetwork.OfflineMode) { RemoteKillRPC(); } else { ((MonoBehaviourPun)this).photonView.RPC("RemoteKillRPC", (RpcTarget)0, Array.Empty<object>()); } break; } } } public void OnRewardZoneTrigger(Transform zone) { if (dropActive && !isResetting && !usedRewardZones.Contains(zone)) { usedRewardZones.Add(zone); Debug.Log((object)("\ud83c\udf81 Reward zone triggered: " + ((Object)zone).name)); SpawnReward(); FinishDrop(); } } private void SpawnReward() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rewardPrefab == (Object)null) && !((Object)(object)rewardSpawnPoint == (Object)null)) { Vector3 position = rewardSpawnPoint.position; if (PhotonNetwork.OfflineMode) { Object.Instantiate<GameObject>(rewardPrefab, position, Quaternion.identity); } else { PhotonNetwork.Instantiate("RewardThing", position, Quaternion.identity, (byte)0, (object[])null); } if (Object.op_Implicit((Object)(object)rewardAudioSource) && Object.op_Implicit((Object)(object)rewardClip)) { rewardAudioSource.PlayOneShot(rewardClip); } } } private void FinishDrop() { dropActive = false; if (dropTimeoutRoutine != null) { ((MonoBehaviour)this).StopCoroutine(dropTimeoutRoutine); dropTimeoutRoutine = null; } ((MonoBehaviour)this).StartCoroutine(ResetDropAfterDelay()); } [IteratorStateMachine(typeof(<ResetDropAfterDelay>d__26))] private IEnumerator ResetDropAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetDropAfterDelay>d__26(0) { <>4__this = this }; } [PunRPC] private void RemoteKillRPC() { if ((Object)(object)grabTracker?.lastGrabber?.playerHealth != (Object)null) { Debug.Log((object)("☠\ufe0f Killing player: " + ((Object)grabTracker.lastGrabber).name)); grabTracker.lastGrabber.playerHealth.Hurt(grabTracker.lastGrabber.playerHealth.health, false, -1); } } } public class PlinkoGrabTracker : MonoBehaviour { [Header("Grab Tracking")] public PlayerAvatar lastGrabber; public PlinkoGameManager gameManager; private PhysGrabObject physGrab; private void Awake() { physGrab = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)gameManager == (Object)null) { gameManager = Object.FindObjectOfType<PlinkoGameManager>(); } } private void Update() { if ((Object)(object)physGrab != (Object)null && physGrab.playerGrabbing != null && physGrab.playerGrabbing.Count > 0) { PhysGrabber val = physGrab.playerGrabbing[physGrab.playerGrabbing.Count - 1]; if ((Object)(object)val != (Object)null && (Object)(object)val.playerAvatar != (Object)null) { lastGrabber = val.playerAvatar; } } } private void OnTriggerEnter(Collider other) { if (((Component)other).CompareTag("RewardZone")) { gameManager.OnRewardZoneTrigger(((Component)other).transform); } } } public class RewardZone : MonoBehaviour { } public class TeleportGlitchValuable : Trap { [Header("Teleport Settings")] public float teleportForce = 150f; public float teleportInterval = 2f; private float teleportTimer = 0f; public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { CheckForGrabTeleport(); } } private void CheckForGrabTeleport() { if (base.physGrabObject.grabbed) { teleportTimer += Time.deltaTime; if (!(teleportTimer >= teleportInterval)) { return; } teleportTimer = 0f; { foreach (PhysGrabber item in base.physGrabObject.playerGrabbing) { if ((Object)(object)item != (Object)null && (Object)(object)item.playerAvatar != (Object)null) { ApplyTeleportEffect(item.playerAvatar); } } return; } } teleportTimer = 0f; } private void ApplyTeleportEffect(PlayerAvatar player) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) player.tumble.TumbleRequest(true, false); Vector3 up = Vector3.up; player.tumble.TumbleForce(up * teleportForce); player.tumble.TumbleOverrideTime(1.5f); } } namespace NWH.DWP2.DefaultWater { [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class Displace : MonoBehaviour { public void Awake() { if (((Behaviour)this).enabled) { OnEnable(); } else { OnDisable(); } } public void OnEnable() { Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_ON"); Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_OFF"); } public void OnDisable() { Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_OFF"); Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_ON"); } } [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class GerstnerDisplace : Displace { } public class MeshContainer { public Mesh mesh; public Vector3[] vertices; public Vector3[] normals; public MeshContainer(Mesh m) { mesh = m; vertices = m.vertices; normals = m.normals; } public void Update() { mesh.vertices = vertices; mesh.normals = normals; } } [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class PlanarReflection : MonoBehaviour { public LayerMask reflectionMask; public bool reflectSkybox; public Color clearColor = Color.grey; public string reflectionSampler = "_ReflectionTex"; public float clipPlaneOffset = 0.07f; private Vector3 m_Oldpos; private Camera m_ReflectionCamera; private Material m_SharedMaterial; private Dictionary<Camera, bool> m_HelperCameras; public void Start() { m_SharedMaterial = ((WaterBase)(object)((Component)this).gameObject.GetComponent(typeof(WaterBase))).sharedMaterial; } public void LateUpdate() { if (m_HelperCameras != null) { m_HelperCameras.Clear(); } } private Camera CreateReflectionCameraFor(Camera cam) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)((Component)this).gameObject).name + "Reflection" + ((Object)cam).name; GameObject val = GameObject.Find(text); if (!Object.op_Implicit((Object)(object)val)) { val = new GameObject(text, new Type[1] { typeof(Camera) }); } if (!Object.op_Implicit((Object)(object)val.GetComponent(typeof(Camera)))) { val.AddComponent(typeof(Camera)); } Camera component = val.GetComponent<Camera>(); component.backgroundColor = clearColor; component.clearFlags = (CameraClearFlags)(reflectSkybox ? 1 : 2); SetStandardCameraParameter(component, reflectionMask); if (!Object.op_Implicit((Object)(object)component.targetTexture)) { component.targetTexture = CreateTextureFor(cam); } return component; } private void SetStandardCameraParameter(Camera cam, LayerMask mask) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) cam.cullingMask = LayerMask.op_Implicit(mask) & ~(1 << LayerMask.NameToLayer("Water")); cam.backgroundColor = Color.black; ((Behaviour)cam).enabled = false; } private RenderTexture CreateTextureFor(Camera cam) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown RenderTexture val = new RenderTexture(Mathf.FloorToInt((float)cam.pixelWidth * 0.5f), Mathf.FloorToInt((float)cam.pixelHeight * 0.5f), 24); ((Object)val).hideFlags = (HideFlags)52; return val; } public void RenderHelpCameras(Camera currentCam) { if (m_HelperCameras == null) { m_HelperCameras = new Dictionary<Camera, bool>(); } if (!m_HelperCameras.ContainsKey(currentCam)) { m_HelperCameras.Add(currentCam, value: false); } if (!m_HelperCameras[currentCam]) { if (!Object.op_Implicit((Object)(object)m_ReflectionCamera)) { m_ReflectionCamera = CreateReflectionCameraFor(currentCam); } RenderReflectionFor(currentCam, m_ReflectionCamera); m_HelperCameras[currentCam] = true; } } public void WaterTileBeingRendered(Transform tr, Camera currentCam) { RenderHelpCameras(currentCam); if (Object.op_Implicit((Object)(object)m_ReflectionCamera) && Object.op_Implicit((Object)(object)m_SharedMaterial)) { m_SharedMaterial.SetTexture(reflectionSampler, (Texture)(object)m_ReflectionCamera.targetTexture); } } public void OnEnable() { Shader.EnableKeyword("WATER_REFLECTIVE"); Shader.DisableKeyword("WATER_SIMPLE"); } public void OnDisable() { Shader.EnableKeyword("WATER_SIMPLE"); Shader.DisableKeyword("WATER_REFLECTIVE"); } private void RenderReflectionFor(Camera cam, Camera reflectCamera) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)reflectCamera) || (Object.op_Implicit((Object)(object)m_SharedMaterial) && !m_SharedMaterial.HasProperty(reflectionSampler))) { return; } reflectCamera.cullingMask = LayerMask.op_Implicit(reflectionMask) & ~(1 << LayerMask.NameToLayer("Water")); SaneCameraSettings(reflectCamera); reflectCamera.backgroundColor = clearColor; reflectCamera.clearFlags = (CameraClearFlags)(reflectSkybox ? 1 : 2); if (reflectSkybox && Object.op_Implicit((Object)(object)((Component)cam).gameObject.GetComponent(typeof(Skybox)))) { Skybox val = (Skybox)((Component)reflectCamera).gameObject.GetComponent(typeof(Skybox)); if (!Object.op_Implicit((Object)(object)val)) { val = (Skybox)((Component)reflectCamera).gameObject.AddComponent(typeof(Skybox)); } val.material = ((Skybox)((Component)cam).GetComponent(typeof(Skybox))).material; } GL.invertCulling = true; Transform transform = ((Component)this).transform; Vector3 eulerAngles = ((Component)cam).transform.eulerAngles; ((Component)reflectCamera).transform.eulerAngles = new Vector3(0f - eulerAngles.x, eulerAngles.y, eulerAngles.z); ((Component)reflectCamera).transform.position = ((Component)cam).transform.position; Vector3 position = ((Component)transform).transform.position; position.y = transform.position.y; Vector3 up = ((Component)transform).transform.up; float num = 0f - Vector3.Dot(up, position) - clipPlaneOffset; Vector4 plane = default(Vector4); ((Vector4)(ref plane))..ctor(up.x, up.y, up.z, num); Matrix4x4 val2 = Matrix4x4.zero; val2 = CalculateReflectionMatrix(val2, plane); m_Oldpos = ((Component)cam).transform.position; Vector3 position2 = ((Matrix4x4)(ref val2)).MultiplyPoint(m_Oldpos); reflectCamera.worldToCameraMatrix = cam.worldToCameraMatrix * val2; Vector4 clipPlane = CameraSpacePlane(reflectCamera, position, up, 1f); Matrix4x4 projectionMatrix = cam.projectionMatrix; projectionMatrix = CalculateObliqueMatrix(projectionMatrix, clipPlane); reflectCamera.projectionMatrix = projectionMatrix; ((Component)reflectCamera).transform.position = position2; Vector3 eulerAngles2 = ((Component)cam).transform.eulerAngles; ((Component)reflectCamera).transform.eulerAngles = new Vector3(0f - eulerAngles2.x, eulerAngles2.y, eulerAngles2.z); reflectCamera.Render(); GL.invertCulling = false; } private void SaneCameraSettings(Camera helperCam) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) helperCam.depthTextureMode = (DepthTextureMode)0; helperCam.backgroundColor = Color.black; helperCam.clearFlags = (CameraClearFlags)2; helperCam.renderingPath = (RenderingPath)1; } private static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00af: Unknown result type (might be due to invalid IL or missing references) Vector4 val = ((Matrix4x4)(ref projection)).inverse * new Vector4(Sgn(clipPlane.x), Sgn(clipPlane.y), 1f, 1f); Vector4 val2 = clipPlane * (2f / Vector4.Dot(clipPlane, val)); ((Matrix4x4)(ref projection))[2] = val2.x - ((Matrix4x4)(ref projection))[3]; ((Matrix4x4)(ref projection))[6] = val2.y - ((Matrix4x4)(ref projection))[7]; ((Matrix4x4)(ref projection))[10] = val2.z - ((Matrix4x4)(ref projection))[11]; ((Matrix4x4)(ref projection))[14] = val2.w - ((Matrix4x4)(ref projection))[15]; return projection; } private static Matrix4x4 CalculateReflectionMatrix(Matrix4x4 reflectionMat, Vector4 plane) { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) reflectionMat.m00 = 1f - 2f * ((
REPOLib.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.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Commands; using REPOLib.Extensions; using REPOLib.Modules; using REPOLib.Objects; using REPOLib.Objects.Sdk; using REPOLib.Patches; using Steamworks; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Zehs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2025 Zehs")] [assembly: AssemblyDescription("Library for adding content to R.E.P.O.")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+2a3919a7a0497d73c37672c768f840403b3beb8d")] [assembly: AssemblyProduct("REPOLib")] [assembly: AssemblyTitle("REPOLib")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ZehsTeam/REPOLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOLib { public static class BundleLoader { private class LoadOperation { public enum State { LoadingBundle, LoadingContent } public string Path { get; } public DateTime StartTime { get; } public State CurrentState { get; set; } public bool LoadContents { get; } public Func<AssetBundle, IEnumerator>? OnBundleLoaded { get; } public AssetBundleCreateRequest BundleRequest { get; } public TimeSpan ElapsedTime => DateTime.Now - StartTime; public string FileName => System.IO.Path.GetFileNameWithoutExtension(Path); public LoadOperation(string path, Func<AssetBundle, IEnumerator>? onBundleLoaded = null, bool loadContents = true) { Path = path; StartTime = DateTime.Now; LoadContents = loadContents; OnBundleLoaded = onBundleLoaded; BundleRequest = AssetBundle.LoadFromFileAsync(path); base..ctor(); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass11_0 { public LoadOperation operation; } [CompilerGenerated] private sealed class <>c__DisplayClass6_0 { public Action<AssetBundle> onLoaded; } [CompilerGenerated] private sealed class <FinishLoadOperation>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadOperation operation; private <>c__DisplayClass11_0 <>8__1; private AssetBundle <bundle>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinishLoadOperation>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = default(<>c__DisplayClass11_0); <bundle>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1.operation = operation; <>2__current = <>8__1.operation.BundleRequest; <>1__state = 1; return true; case 1: <>1__state = -1; <bundle>5__2 = <>8__1.operation.BundleRequest.assetBundle; if ((Object)(object)<bundle>5__2 == (Object)null) { Logger.LogError("Failed to load bundle " + <>8__1.operation.FileName + "!"); <FinishLoadOperation>g__Finish|11_0(ref <>8__1); return false; } if (<>8__1.operation.LoadContents) { <>2__current = LoadBundleContent(<>8__1.operation, <bundle>5__2); <>1__state = 2; return true; } goto IL_00f6; case 2: <>1__state = -1; goto IL_00f6; case 3: { <>1__state = -1; break; } IL_00f6: if (<>8__1.operation.OnBundleLoaded != null) { <>2__current = <>8__1.operation.OnBundleLoaded(<bundle>5__2); <>1__state = 3; return true; } break; } if (ConfigManager.ExtendedLogging.Value) { Logger.LogInfo($"Loaded bundle {<>8__1.operation.FileName} in {<>8__1.operation.ElapsedTime.TotalSeconds:N1}s"); } <FinishLoadOperation>g__Finish|11_0(ref <>8__1); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FinishLoadOperationsRoutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MonoBehaviour behaviour; private TMP_Text <text>5__2; private Action <disableLoadingUI>5__3; private float <lastUpdate>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinishLoadOperationsRoutine>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <text>5__2 = null; <disableLoadingUI>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: { <>1__state = -1; LoadOperation[] array = _operations.ToArray(); foreach (LoadOperation operation in array) { behaviour.StartCoroutine(FinishLoadOperation(operation)); } (TMP_Text, Action) tuple = SetupLoadingUI(); <text>5__2 = tuple.Item1; <disableLoadingUI>5__3 = tuple.Item2; <lastUpdate>5__4 = Time.time; break; } case 2: <>1__state = -1; break; } while (_operations.Count > 0) { if (Time.time - <lastUpdate>5__4 > 1f) { <lastUpdate>5__4 = Time.time; string arg = ((_operations.Count == 1) ? "bundle" : "bundles"); <text>5__2.text = $"REPOLib: Waiting for {_operations.Count} {arg} to load..."; if (!ConfigManager.ExtendedLogging.Value) { continue; } foreach (LoadOperation operation2 in _operations) { string text = $"Loading {operation2.FileName}: {operation2.CurrentState}"; float? num = ((operation2.CurrentState != 0) ? null : new float?(((AsyncOperation)operation2.BundleRequest).progress)); float? num2 = num; if (num2.HasValue) { text += $" {num2.Value:P0}"; } Logger.LogDebug(text); } } <>2__current = null; <>1__state = 2; return true; } Logger.LogInfo("Finished loading bundles."); <disableLoadingUI>5__3(); Utilities.SafeInvokeEvent(BundleLoader.OnAllBundlesLoaded); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadBundleContent>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadOperation operation; public AssetBundle bundle; private AssetBundleRequest <assetRequest>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadBundleContent>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <assetRequest>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; operation.CurrentState = LoadOperation.State.LoadingContent; <assetRequest>5__2 = bundle.LoadAllAssetsAsync<ScriptableObject>(); <>2__current = <assetRequest>5__2; <>1__state = 1; return true; case 1: { <>1__state = -1; Object[] allAssets = <assetRequest>5__2.allAssets; Mod[] array = allAssets.OfType<Mod>().ToArray(); int num = array.Length; if (num <= 1) { if (num == 0) { Logger.LogError("Bundle " + operation.FileName + " contains no mods!"); return false; } Mod mod = array[0]; foreach (Content item in allAssets.OfType<Content>()) { try { item.Initialize(mod); } catch (Exception ex) { Logger.LogError($"Failed to load {item.Name} ({((object)item).GetType().Name}) from bundle {operation.FileName} ({mod.Identifier}): {ex}"); } } return false; } Logger.LogError("Bundle " + operation.FileName + " contains more than one mod!"); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly List<LoadOperation> _operations = new List<LoadOperation>(); public static event Action? OnAllBundlesLoaded; internal static void LoadAllBundles(string root, string withExtension) { Logger.LogInfo("Loading all bundles with extension " + withExtension + " from root " + root, extended: true); string[] files = Directory.GetFiles(root, "*" + withExtension, SearchOption.AllDirectories); string[] array = files; foreach (string path in array) { LoadBundleAndContent(path); } } public static void LoadBundleAndContent(string path) { LoadBundle(path, (Func<AssetBundle, IEnumerator>?)null, loadContents: true); } public static void LoadBundle(string path, Action<AssetBundle> onLoaded, bool loadContents = false) { <>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0(); CS$<>8__locals0.onLoaded = onLoaded; LoadBundle(path, (Func<AssetBundle, IEnumerator>?)OnLoaded, loadContents); [IteratorStateMachine(typeof(<>c__DisplayClass6_0.<<LoadBundle>g__OnLoaded|0>d))] IEnumerator OnLoaded(AssetBundle bundle) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass6_0.<<LoadBundle>g__OnLoaded|0>d(0) { <>4__this = CS$<>8__locals0, bundle = bundle }; } } public static void LoadBundle(string path, Func<AssetBundle, IEnumerator>? onLoaded = null, bool loadContents = false) { Logger.LogInfo("Loading bundle at " + path + "..."); _operations.Add(new LoadOperation(path, onLoaded, loadContents)); } internal static void FinishLoadOperations(MonoBehaviour behaviour) { behaviour.StartCoroutine(FinishLoadOperationsRoutine(behaviour)); } [IteratorStateMachine(typeof(<FinishLoadOperationsRoutine>d__9))] private static IEnumerator FinishLoadOperationsRoutine(MonoBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinishLoadOperationsRoutine>d__9(0) { behaviour = behaviour }; } private static (TMP_Text, Action) SetupLoadingUI() { //IL_008c: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("HUD Canvas"); Transform hud = val.transform.Find("HUD"); ((Component)hud).gameObject.SetActive(false); TMP_Text val2 = Object.FindObjectOfType<TMP_Text>(); TMP_Text text = Object.Instantiate<TMP_Text>(val2, val.transform); ((Object)((Component)text).gameObject).name = "REPOLibText"; ((Component)text).gameObject.SetActive(true); text.text = "REPOLib is loading bundles... Hang tight!"; ((Graphic)text).color = Color.white; text.alignment = (TextAlignmentOptions)514; RectTransform component = ((Component)text).GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; return (text, delegate { ((Component)text).gameObject.SetActive(false); ((Component)hud).gameObject.SetActive(true); }); } [IteratorStateMachine(typeof(<FinishLoadOperation>d__11))] private static IEnumerator FinishLoadOperation(LoadOperation operation) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinishLoadOperation>d__11(0) { operation = operation }; } [IteratorStateMachine(typeof(<LoadBundleContent>d__12))] private static IEnumerator LoadBundleContent(LoadOperation operation, AssetBundle bundle) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadBundleContent>d__12(0) { operation = operation, bundle = bundle }; } [Obsolete("Use LoadBundleAndContent instead")] public static void LoadBundle(string path, string relativePath) { LoadBundleAndContent(path); } [CompilerGenerated] internal static void <FinishLoadOperation>g__Finish|11_0(ref <>c__DisplayClass11_0 P_0) { _operations.Remove(P_0.operation); } } internal static class ConfigManager { public static ConfigFile ConfigFile { get; private set; } public static ConfigEntry<bool> ExtendedLogging { get; private set; } public static ConfigEntry<bool> DeveloperMode { get; private set; } public static ConfigEntry<bool> VanillaDeveloperMode { get; private set; } public static void Initialize(ConfigFile configFile) { ConfigFile = configFile; BindConfigs(); } private static void BindConfigs() { ExtendedLogging = ConfigFile.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging."); DeveloperMode = ConfigFile.Bind<bool>("General", "DeveloperMode", false, "Enable developer mode cheats for testing."); VanillaDeveloperMode = ConfigFile.Bind<bool>("General", "VanillaDeveloperMode", false, "Enable vanilla developer mode cheats for testing."); VanillaDeveloperMode.SettingChanged += delegate { SteamManagerPatch.UpdateDeveloperMode(); }; } } internal static class Logger { public static ManualLogSource ManualLogSource { get; private set; } public static void Initialize(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; } public static void LogDebug(object data) { Log((LogLevel)32, data); } public static void LogInfo(object data, bool extended = false) { Log((LogLevel)16, data, extended); } public static void LogWarning(object data, bool extended = false) { Log((LogLevel)4, data, extended); } public static void LogError(object data, bool extended = false) { Log((LogLevel)2, data, extended); } public static void LogFatal(object data, bool extended = false) { Log((LogLevel)1, data, extended); } public static void Log(LogLevel logLevel, object data, bool extended = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!extended || IsExtendedLoggingEnabled()) { ManualLogSource manualLogSource = ManualLogSource; if (manualLogSource != null) { manualLogSource.Log(logLevel, data); } } } public static bool IsExtendedLoggingEnabled() { if (ConfigManager.ExtendedLogging == null) { return false; } return ConfigManager.ExtendedLogging.Value; } } [BepInPlugin("REPOLib", "REPOLib", "2.1.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("REPOLib"); public static Plugin Instance { get; private set; } private void Awake() { Instance = this; Logger.Initialize(Logger.CreateLogSource("REPOLib")); Logger.LogInfo("REPOLib has awoken!"); _harmony.PatchAll(typeof(RunManagerPatch)); _harmony.PatchAll(typeof(EnemyDirectorPatch)); _harmony.PatchAll(typeof(StatsManagerPatch)); _harmony.PatchAll(typeof(SemiFuncPatch)); _harmony.PatchAll(typeof(AudioManagerPatch)); _harmony.PatchAll(typeof(SteamManagerPatch)); _harmony.PatchAll(typeof(EnemyGnomeDirectorPatch)); _harmony.PatchAll(typeof(EnemyBangDirectorPatch)); _harmony.PatchAll(typeof(PlayerControllerPatch)); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); Upgrades.Initialize(); BundleLoader.LoadAllBundles(Paths.PluginPath, ".repobundle"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "REPOLib"; public const string PLUGIN_NAME = "REPOLib"; public const string PLUGIN_VERSION = "2.1.0"; } } namespace REPOLib.Patches { [HarmonyPatch(typeof(AudioManager))] internal static class AudioManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { Utilities.FixAudioMixerGroupsOnPrefabs(); } } [HarmonyPatch(typeof(EnemyBangDirector))] internal static class EnemyBangDirectorPatch { [CompilerGenerated] private sealed class <PreSetup>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemyBangDirector instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreSetup>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (LevelGenerator.Instance.Generated) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_004e; case 1: <>1__state = -1; goto IL_004e; case 2: { <>1__state = -1; return false; } IL_004e: <>2__current = instance.Setup(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Awake")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AwakeTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(EnemyBangDirector), "Setup", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EnemyBangDirectorPatch), "PreSetup", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Logger.LogError("EnemyBangDirectorPatch: failed to find required methods for AwakeTranspiler."); return instructions; } List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && instruction.operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo) { list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); Logger.LogDebug("EnemyBangDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + "."); } else { list.Add(instruction); } } return list.AsEnumerable(); } [IteratorStateMachine(typeof(<PreSetup>d__1))] private static IEnumerator PreSetup(EnemyBangDirector instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreSetup>d__1(0) { instance = instance }; } } [HarmonyPatch(typeof(EnemyDirector))] internal static class EnemyDirectorPatch { private static bool _alreadyRegistered; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch() { if (_alreadyRegistered) { foreach (EnemySetup registeredEnemy in Enemies.RegisteredEnemies) { EnemyDirector.instance.AddEnemy(registeredEnemy); } return; } Enemies.RegisterInitialEnemies(); _alreadyRegistered = true; } } [HarmonyPatch(typeof(EnemyGnomeDirector))] internal static class EnemyGnomeDirectorPatch { [CompilerGenerated] private sealed class <PreSetup>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemyGnomeDirector instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreSetup>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (LevelGenerator.Instance.Generated) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_004e; case 1: <>1__state = -1; goto IL_004e; case 2: { <>1__state = -1; return false; } IL_004e: <>2__current = instance.Setup(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Awake")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AwakeTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(EnemyGnomeDirector), "Setup", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EnemyGnomeDirectorPatch), "PreSetup", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Logger.LogError("EnemyGnomeDirectorPatch: failed to find required methods for AwakeTranspiler."); return instructions; } List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && instruction.operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo) { list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); Logger.LogDebug("EnemyGnomeDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + "."); } else { list.Add(instruction); } } return list.AsEnumerable(); } [IteratorStateMachine(typeof(<PreSetup>d__1))] private static IEnumerator PreSetup(EnemyGnomeDirector instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreSetup>d__1(0) { instance = instance }; } } [HarmonyPatch(typeof(PlayerController))] internal static class PlayerControllerPatch { [CompilerGenerated] private sealed class <LateStartTranspiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private bool <found>5__2; private List<CodeInstruction>.Enumerator <>7__wrap2; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LateStartTranspiler>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap2 = default(List<CodeInstruction>.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerController), "playerAvatarScript"); MethodInfo methodInfo = AccessTools.Method(typeof(SemiFunc), "PlayerGetSteamID", new Type[1] { typeof(PlayerAvatar) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Upgrades), "InvokeStartActions", new Type[1] { typeof(string) }, (Type[])null); <found>5__2 = false; int num = 0; List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { list.Add(instruction); if (num switch { 0 => instruction.opcode == OpCodes.Ldloc_1, 1 => instruction.opcode == OpCodes.Ldfld && CodeInstructionExtensions.LoadsField(instruction, fieldInfo, false), 2 => instruction.opcode == OpCodes.Call && CodeInstructionExtensions.Calls(instruction, methodInfo), 3 => instruction.opcode == OpCodes.Stloc_2, _ => false, }) { num++; if (num > 3) { <found>5__2 = true; num = 0; list.Add(new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); } } else { num = 0; } } <>7__wrap2 = list.GetEnumerator(); <>1__state = -3; break; } case 1: <>1__state = -3; break; } if (<>7__wrap2.MoveNext()) { CodeInstruction current2 = <>7__wrap2.Current; <>2__current = current2; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap2 = default(List<CodeInstruction>.Enumerator); if (!<found>5__2) { Logger.LogWarning("Failed to patch PlayerController.LateStart!"); } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <LateStartTranspiler>d__0 <LateStartTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <LateStartTranspiler>d__ = this; } else { <LateStartTranspiler>d__ = new <LateStartTranspiler>d__0(0); } <LateStartTranspiler>d__.instructions = <>3__instructions; return <LateStartTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<LateStartTranspiler>d__0))] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> LateStartTranspiler(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LateStartTranspiler>d__0(-2) { <>3__instructions = instructions }; } } [HarmonyPatch(typeof(RunManager))] internal static class RunManagerPatch { private static bool _patchedAwake; [HarmonyPatch("Awake")] [HarmonyPostfix] [HarmonyPriority(0)] private static void AwakePatch(RunManager __instance) { if (!_patchedAwake) { _patchedAwake = true; NetworkPrefabs.Initialize(); NetworkingEvents.Initialize(); Levels.RegisterInitialLevels(); Valuables.RegisterInitialValuables(); BundleLoader.OnAllBundlesLoaded += CommandManager.Initialize; BundleLoader.FinishLoadOperations((MonoBehaviour)(object)__instance); } } } [HarmonyPatch(typeof(SemiFunc))] internal static class SemiFuncPatch { [HarmonyPatch("Command")] [HarmonyPrefix] private static bool CommandPatch(string _command) { if (_command.StartsWith("/")) { return Command(_command); } return true; } private static bool Command(string message) { string text = message.ToLower(); string text2 = text.Split(' ')[0].Substring(1); string text3 = ""; if (text.Length > text2.Length) { text3 = text.Substring(text2.Length + 1).Trim(); } CommandManager.CommandExecutionMethods.TryGetValue(text2, out MethodInfo value); if (value != null) { CommandExecutionAttribute customAttribute = value.GetCustomAttribute<CommandExecutionAttribute>(); if (CommandManager.CommandsEnabled.TryGetValue(customAttribute.Name, out var value2) && !value2) { return false; } if (customAttribute != null && customAttribute.RequiresDeveloperMode && !ConfigManager.DeveloperMode.Value) { Logger.LogWarning("Command " + text2 + " requires developer mode to be enabled. Enable it in REPOLib.cfg"); return false; } try { ParameterInfo[] parameters = value.GetParameters(); if (parameters.Length == 0) { value.Invoke(null, null); } else { value.Invoke(null, new object[1] { text3 }); } } catch (Exception arg) { Logger.LogError($"Error executing command: {arg}"); } return false; } return true; } [HarmonyPatch("EnemySpawn")] [HarmonyPrefix] private static bool EnemySpawnPatch(ref bool __result) { if (Enemies.SpawnNextEnemiesNotDespawned > 0) { Enemies.SpawnNextEnemiesNotDespawned--; __result = true; return false; } return true; } } [HarmonyPatch(typeof(StatsManager))] internal static class StatsManagerPatch { [HarmonyPatch("RunStartStats")] [HarmonyPostfix] private static void RunStartStatsPatch() { Items.RegisterItems(); Upgrades.RegisterUpgrades(); } } [HarmonyPatch(typeof(SteamManager))] internal static class SteamManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] public static void AwakePatch(SteamManager __instance) { UpdateDeveloperMode(); } public static void UpdateDeveloperMode() { if (ConfigManager.VanillaDeveloperMode == null || (Object)(object)SteamManager.instance == (Object)null) { return; } bool value = ConfigManager.VanillaDeveloperMode.Value; if (SteamManager.instance.developerMode != value) { if (value) { Logger.LogInfo("Enabling vanilla developer mode."); } else { Logger.LogInfo("Disabling vanilla developer mode."); } } SteamManager.instance.developerMode = value; } } } namespace REPOLib.Objects { internal class CustomPrefabPool : IPunPrefabPool { public readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); private DefaultPool? _defaultPool; public DefaultPool DefaultPool { get { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (_defaultPool == null) { _defaultPool = new DefaultPool(); } return _defaultPool; } set { if (value != null) { _defaultPool = value; } } } public bool RegisterPrefab(string prefabId, GameObject prefab) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null) { throw new ArgumentException("CustomPrefabPool: failed to register network prefab. Prefab is null."); } if (string.IsNullOrWhiteSpace(prefabId)) { throw new ArgumentException("CustomPrefabPool: failed to register network prefab. PrefabId is invalid."); } if (ResourcesHelper.HasPrefab(prefabId)) { Logger.LogError("CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". Prefab already exists in Resources with the same prefab id."); return false; } if (Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true)) { LogLevel logLevel = (LogLevel)(((Object)(object)value == (Object)(object)prefab) ? 4 : 2); Logger.Log(logLevel, "CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". There is already a prefab registered with the same prefab id."); return false; } Prefabs[prefabId] = prefab; Logger.LogDebug("CustomPrefabPool: registered network prefab \"" + prefabId + "\""); return true; } public bool HasPrefab(GameObject prefab) { if (Prefabs.ContainsValue(prefab)) { return true; } if (ResourcesHelper.HasPrefab(prefab)) { return true; } return false; } public bool HasPrefab(string prefabId) { return (Object)(object)GetPrefab(prefabId) != (Object)null; } public string? GetPrefabId(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to get prefab id. GameObject is null."); return string.Empty; } return Prefabs.GetKeyOrDefault(prefab); } public GameObject? GetPrefab(string prefabId) { if (Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true)) { return value; } return Resources.Load<GameObject>(prefabId); } public GameObject? Instantiate(string prefabId, Vector3 position, Quaternion rotation) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(prefabId)) { throw new ArgumentException("CustomPrefabPool: failed to spawn network prefab. PrefabId is null."); } GameObject val; if (!Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true)) { val = DefaultPool.Instantiate(prefabId, position, rotation); if ((Object)(object)val == (Object)null) { Logger.LogError("CustomPrefabPool: failed to spawn network prefab \"" + prefabId + "\". GameObject is null."); } return val; } bool activeSelf = value.activeSelf; if (activeSelf) { value.SetActive(false); } val = Object.Instantiate<GameObject>(value, position, rotation); if (activeSelf) { value.SetActive(true); } Logger.LogInfo($"CustomPrefabPool: spawned network prefab \"{prefabId}\" at position {position}, rotation {((Quaternion)(ref rotation)).eulerAngles}", extended: true); return val; } public void Destroy(GameObject gameObject) { Object.Destroy((Object)(object)gameObject); } } internal class UnityObjectNameComparer<T> : IEqualityComparer<T> where T : Object { public StringComparison ComparisonType { get; private set; } public UnityObjectNameComparer(StringComparison comparisonType = StringComparison.OrdinalIgnoreCase) { ComparisonType = comparisonType; } public bool Equals(T x, T y) { if ((Object)(object)x == (Object)(object)y) { return true; } if ((Object)(object)x == (Object)null || (Object)(object)y == (Object)null) { return false; } return ((Object)x).name.Equals(((Object)y).name, ComparisonType); } public int GetHashCode(T obj) { if (!((Object)(object)obj != (Object)null)) { return 0; } return ((Object)obj).name.GetHashCode(); } } } namespace REPOLib.Objects.Sdk { public abstract class Content : ScriptableObject { public abstract string Name { get; } public abstract void Initialize(Mod mod); } [CreateAssetMenu(menuName = "REPOLib/Enemy", order = 3, fileName = "New Enemy")] public class EnemyContent : Content { [SerializeField] private EnemySetup _setup; public EnemySetup Setup => _setup; public override string Name { get { EnemySetup setup = Setup; return ((setup != null) ? ((Object)setup).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { Enemies.RegisterEnemy(Setup); } } [CreateAssetMenu(menuName = "REPOLib/Item", order = 2, fileName = "New Item")] public class ItemContent : Content { [SerializeField] private ItemAttributes _prefab; public ItemAttributes Prefab => _prefab; public override string Name { get { ItemAttributes prefab = Prefab; return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { _prefab.item.prefab = ((Component)_prefab).gameObject; Items.RegisterItem(Prefab.item); } } [CreateAssetMenu(menuName = "REPOLib/Level", order = 4, fileName = "New Level")] public class LevelContent : Content { [SerializeField] private Level _level; public Level Level => _level; public override string Name { get { Level level = Level; return ((level != null) ? ((Object)level).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { Levels.RegisterLevel(Level); } } [CreateAssetMenu(menuName = "REPOLib/Mod", order = 0, fileName = "New Mod")] public class Mod : ScriptableObject { [SerializeField] private string _name; [SerializeField] private string _author; [SerializeField] private string _version = "1.0.0"; [SerializeField] private string _description; [SerializeField] private string _websiteUrl; [SerializeField] private string[] _dependencies = new string[1] { "Zehs-REPOLib-2.1.0" }; [SerializeField] private Sprite _icon; [SerializeField] private TextAsset _readme; public string Name => _name; public string Author => _author; public string Version => _version; public string Description => _description; public string WebsiteUrl => _websiteUrl; public IReadOnlyList<string> Dependencies => _dependencies; public Sprite Icon => _icon; public TextAsset Readme => _readme; public string FullName => Author + "-" + Name; public string Identifier => Author + "-" + Name + "-" + Version; } [CreateAssetMenu(menuName = "REPOLib/Valuable", order = 1, fileName = "New Valuable")] public class ValuableContent : Content { [SerializeField] private ValuableObject _prefab; [SerializeField] private string[] _valuablePresets = new string[1] { "Valuables - Generic" }; public ValuableObject Prefab => _prefab; public IReadOnlyList<string> ValuablePresets => _valuablePresets; public override string Name { get { ValuableObject prefab = Prefab; return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { Valuables.RegisterValuable(((Component)Prefab).gameObject, ValuablePresets.ToList()); } } } namespace REPOLib.Modules { public static class Enemies { internal static int SpawnNextEnemiesNotDespawned = 0; private static readonly List<EnemySetup> _enemiesToRegister = new List<EnemySetup>(); private static readonly List<EnemySetup> _enemiesRegistered = new List<EnemySetup>(); private static bool _initialEnemiesRegistered; public static IReadOnlyList<EnemySetup> AllEnemies => GetEnemies(); public static IReadOnlyList<EnemySetup> RegisteredEnemies => _enemiesRegistered; internal static void RegisterInitialEnemies() { if (_initialEnemiesRegistered) { return; } foreach (EnemySetup item in _enemiesToRegister) { RegisterEnemyWithGame(item); } _enemiesToRegister.Clear(); _initialEnemiesRegistered = true; } private static void RegisterEnemyWithGame(EnemySetup enemy) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!_enemiesRegistered.Contains(enemy) && enemy.TryGetEnemyParent(out EnemyParent enemyParent)) { if (EnemyDirector.instance.AddEnemy(enemy)) { _enemiesRegistered.Add(enemy); Logger.LogInfo($"Added enemy \"{enemyParent.enemyName}\" to difficulty {enemyParent.difficulty}", extended: true); } else { Logger.LogWarning($"Failed to add enemy \"{enemyParent.enemyName}\" to difficulty {enemyParent.difficulty}", extended: true); } } } public static void RegisterEnemy(EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null || enemySetup.spawnObjects.Count == 0) { throw new ArgumentException("Failed to register enemy. EnemySetup or spawnObjects list is empty."); } EnemyParent enemyParent = enemySetup.GetEnemyParent(); if ((Object)(object)enemyParent == (Object)null) { Logger.LogError("Failed to register enemy \"" + ((Object)enemySetup).name + "\". No enemy prefab found in spawnObjects list."); return; } if (ResourcesHelper.HasEnemyPrefab(enemySetup)) { Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy prefab already exists in Resources with the same name."); return; } if (_enemiesToRegister.Contains(enemySetup)) { Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy is already registered!"); return; } foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects()) { foreach (EnemySetup item in _enemiesToRegister) { if (item.AnySpawnObjectsNameEqualsThatIsNotTheSameObject(distinctSpawnObject)) { Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy \"" + ((Object)item).name + "\" already has a spawn object called \"" + ((Object)distinctSpawnObject).name + "\""); return; } } } foreach (GameObject distinctSpawnObject2 in enemySetup.GetDistinctSpawnObjects()) { string enemyPrefabPath = ResourcesHelper.GetEnemyPrefabPath(distinctSpawnObject2); if (!NetworkPrefabs.HasNetworkPrefab(enemyPrefabPath)) { NetworkPrefabs.RegisterNetworkPrefab(enemyPrefabPath, distinctSpawnObject2); } Utilities.FixAudioMixerGroups(distinctSpawnObject2); } if (_initialEnemiesRegistered) { RegisterEnemyWithGame(enemySetup); } else { _enemiesToRegister.Add(enemySetup); } } public static List<EnemyParent>? SpawnEnemy(EnemySetup enemySetup, Vector3 position, Quaternion rotation, bool spawnDespawned = true) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemySetup == (Object)null) { Logger.LogError("Failed to spawn enemy. EnemySetup is null."); return null; } if (!enemySetup.TryGetEnemyParent(out EnemyParent enemyParent)) { Logger.LogError("Failed to spawn enemy. EnemyParent is null."); return null; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". EnemySetup instance is null."); return null; } if ((Object)(object)RunManager.instance == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". RunManager instance is null."); return null; } if ((Object)(object)EnemyDirector.instance == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". EnemyDirector instance is null."); return null; } List<EnemyParent> list = new List<EnemyParent>(); EnemyParent val2 = default(EnemyParent); foreach (GameObject sortedSpawnObject in enemySetup.GetSortedSpawnObjects()) { if ((Object)(object)sortedSpawnObject == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\" spawn object. GameObject is null."); continue; } string enemyPrefabPath = ResourcesHelper.GetEnemyPrefabPath(sortedSpawnObject); GameObject val = NetworkPrefabs.SpawnNetworkPrefab(enemyPrefabPath, position, rotation, 0); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\" spawn object \"" + ((Object)sortedSpawnObject).name + "\""); } else if (val.TryGetComponent<EnemyParent>(ref val2)) { list.Add(val2); if (!spawnDespawned) { SpawnNextEnemiesNotDespawned++; } val2.SetupDone = true; Enemy componentInChildren = val.GetComponentInChildren<Enemy>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.EnemyTeleported(position); } else { Logger.LogError("Enemy \"" + enemyParent.enemyName + "\" spawn object \"" + ((Object)sortedSpawnObject).name + "\" does not have an enemy component."); } LevelGenerator instance = LevelGenerator.Instance; instance.EnemiesSpawnTarget++; EnemyDirector.instance.FirstSpawnPointAdd(val2); } } if (list.Count == 0) { Logger.LogInfo("Failed to spawn enemy \"" + enemyParent.enemyName + "\". No spawn objects where spawned."); return list; } Logger.LogInfo($"Spawned enemy \"{enemyParent.enemyName}\" at position {position}", extended: true); RunManager.instance.EnemiesSpawnedRemoveEnd(); return list; } public static IReadOnlyList<EnemySetup> GetEnemies() { if ((Object)(object)EnemyDirector.instance == (Object)null) { return Array.Empty<EnemySetup>(); } return EnemyDirector.instance.GetEnemies(); } public static bool TryGetEnemyByName(string name, [NotNullWhen(true)] out EnemySetup? enemySetup) { enemySetup = GetEnemyByName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup? GetEnemyByName(string name) { return EnemyDirector.instance?.GetEnemyByName(name); } public static bool TryGetEnemyThatContainsName(string name, [NotNullWhen(true)] out EnemySetup? enemySetup) { enemySetup = GetEnemyThatContainsName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup? GetEnemyThatContainsName(string name) { return EnemyDirector.instance?.GetEnemyThatContainsName(name); } } public static class Items { private static readonly List<Item> _itemsToRegister = new List<Item>(); private static readonly List<Item> _itemsRegistered = new List<Item>(); private static bool _initialItemsRegistered; public static IReadOnlyList<Item> AllItems => GetItems(); public static IReadOnlyList<Item> RegisteredItems => _itemsRegistered; internal static void RegisterItems() { if ((Object)(object)StatsManager.instance == (Object)null) { Logger.LogError("Failed to register items. StatsManager instance is null."); return; } Logger.LogInfo("Adding items."); foreach (Item item in _itemsToRegister) { RegisterItemWithGame(item); } _initialItemsRegistered = true; } private static void RegisterItemWithGame(Item item) { Utilities.FixAudioMixerGroups(item.prefab); if (StatsManager.instance.AddItem(item)) { if (!_itemsRegistered.Contains(item)) { _itemsRegistered.Add(item); } Logger.LogInfo("Added item \"" + item.itemName + "\"", extended: true); } else { Logger.LogWarning("Failed to add item \"" + item.itemName + "\"", extended: true); } } public static void RegisterItem(Item item) { Item item2 = item; if ((Object)(object)item2 == (Object)null) { throw new ArgumentException("Failed to register item. Item is null."); } if ((Object)(object)item2.prefab == (Object)null) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab is null."); return; } if (item2.itemAssetName != ((Object)item2.prefab).name) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item itemAssetName does not match the prefab name."); return; } if (ResourcesHelper.HasItemPrefab(item2)) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab already exists in Resources with the same name."); return; } if (_itemsToRegister.Any((Item x) => x.itemAssetName == item2.itemAssetName)) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab already exists with the same name."); return; } if (_itemsToRegister.Contains(item2)) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item is already registered!"); return; } string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item2); NetworkPrefabs.RegisterNetworkPrefab(itemPrefabPath, item2.prefab); _itemsToRegister.Add(item2); if (_initialItemsRegistered) { RegisterItemWithGame(item2); } } public static GameObject? SpawnItem(Item item, Vector3 position, Quaternion rotation) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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)item == (Object)null) { Logger.LogError("Failed to spawn item. Item is null."); return null; } if ((Object)(object)item.prefab == (Object)null) { Logger.LogError("Failed to spawn item. Prefab is null."); return null; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogError("Failed to spawn item \"" + item.itemName + "\". You are not the host."); return null; } string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item); GameObject val = NetworkPrefabs.SpawnNetworkPrefab(itemPrefabPath, position, rotation, 0); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn item \"" + item.itemName + "\""); return null; } Logger.LogInfo($"Spawned item \"{item.itemName}\" at position {position}, rotation: {((Quaternion)(ref rotation)).eulerAngles}", extended: true); return val; } public static IReadOnlyList<Item> GetItems() { if ((Object)(object)StatsManager.instance == (Object)null) { return Array.Empty<Item>(); } return StatsManager.instance.GetItems(); } public static bool TryGetItemByName(string name, [NotNullWhen(true)] out Item? item) { item = GetItemByName(name); return (Object)(object)item != (Object)null; } public static Item? GetItemByName(string name) { return StatsManager.instance?.GetItemByName(name); } public static bool TryGetItemThatContainsName(string name, [NotNullWhen(true)] out Item? item) { item = GetItemThatContainsName(name); return (Object)(object)item != (Object)null; } public static Item? GetItemThatContainsName(string name) { return StatsManager.instance?.GetItemThatContainsName(name); } } public static class Levels { private static readonly List<Level> _levelsToRegister = new List<Level>(); private static readonly List<Level> _levelsRegistered = new List<Level>(); private static bool _initialLevelsRegistered; public static IReadOnlyList<Level> AllLevels => GetLevels(); public static IReadOnlyList<Level> RegisteredLevels => _levelsRegistered; internal static void RegisterInitialLevels() { if (_initialLevelsRegistered) { return; } ValuablePresets.CacheValuablePresets(); Logger.LogInfo("Adding levels."); foreach (Level item in _levelsToRegister) { RegisterLevelWithGame(item); } _levelsToRegister.Clear(); _initialLevelsRegistered = true; } private static void RegisterLevelWithGame(Level level) { if (_levelsRegistered.Contains(level)) { return; } if (level.ValuablePresets.Count == 0) { Logger.LogWarning("Level \"" + ((Object)level).name + "\" does not have any valuable presets! Adding generic preset."); level.ValuablePresets.Add(ValuablePresets.GenericPreset); } for (int i = 0; i < level.ValuablePresets.Count; i++) { LevelValuables val = level.ValuablePresets[i]; if (ValuablePresets.AllValuablePresets.Values.Contains(val)) { continue; } if (ValuablePresets.AllValuablePresets.TryGetValue(((Object)val).name, out LevelValuables value)) { if (val.GetCombinedList().Count > 0) { Logger.LogWarning("Proxy preset \"" + ((Object)val).name + "\" in level \"" + ((Object)level).name + "\" contains valuables! This likely caused duplicate valuables to load!"); } level.ValuablePresets[i] = value; Logger.LogInfo("Replaced proxy preset \"" + ((Object)val).name + "\" in level \"" + ((Object)level).name + "\".", extended: true); } else { ValuablePresets.RegisterValuablePreset(val); Logger.LogInfo("Registered valuable preset \"" + ((Object)val).name + "\" from \"" + ((Object)level).name + "\".", extended: true); } } RunManager.instance.levels.Add(level); Logger.LogInfo("Added level \"" + ((Object)level).name + "\"", extended: true); _levelsRegistered.Add(level); } public static void RegisterLevel(Level level) { Level level2 = level; if ((Object)(object)level2 == (Object)null) { Logger.LogError("Failed to register level. Level is null."); return; } if (_levelsToRegister.Any((Level x) => ((Object)x).name.Equals(((Object)level2).name, StringComparison.OrdinalIgnoreCase))) { Logger.LogError("Failed to register level \"" + ((Object)level2).name + "\". Level already exists with the same name."); return; } if (_levelsToRegister.Contains(level2)) { Logger.LogWarning("Failed to register level \"" + ((Object)level2).name + "\". Level is already registered!"); return; } List<(GameObject, ResourcesHelper.LevelPrefabType)> list2 = (from prefab in new List<GameObject>[12] { level2.ModulesExtraction1, level2.ModulesExtraction2, level2.ModulesExtraction3, level2.ModulesNormal1, level2.ModulesNormal2, level2.ModulesNormal3, level2.ModulesPassage1, level2.ModulesPassage2, level2.ModulesPassage3, level2.ModulesDeadEnd1, level2.ModulesDeadEnd2, level2.ModulesDeadEnd3 }.SelectMany((List<GameObject> list) => list) select (prefab, ResourcesHelper.LevelPrefabType.Module)).ToList(); foreach (GameObject startRoom in level2.StartRooms) { list2.Add((startRoom, ResourcesHelper.LevelPrefabType.StartRoom)); } if ((Object)(object)level2.ConnectObject != (Object)null) { list2.Add((level2.ConnectObject, ResourcesHelper.LevelPrefabType.Other)); } if ((Object)(object)level2.BlockObject != (Object)null) { list2.Add((level2.BlockObject, ResourcesHelper.LevelPrefabType.Other)); } foreach (var item3 in list2) { GameObject item = item3.Item1; ResourcesHelper.LevelPrefabType item2 = item3.Item2; string levelPrefabPath = ResourcesHelper.GetLevelPrefabPath(level2, item, item2); if (!ResourcesHelper.HasPrefab(levelPrefabPath)) { NetworkPrefabs.RegisterNetworkPrefab(levelPrefabPath, item); Utilities.FixAudioMixerGroups(item); } } if (_initialLevelsRegistered) { RegisterLevelWithGame(level2); } else { _levelsToRegister.Add(level2); } } public static IReadOnlyList<Level> GetLevels() { if ((Object)(object)RunManager.instance == (Object)null) { return Array.Empty<Level>(); } return RunManager.instance.levels; } public static bool TryGetLevelByName(string name, [NotNullWhen(true)] out Level? level) { level = GetLevelByName(name); return (Object)(object)level != (Object)null; } public static Level? GetLevelByName(string name) { foreach (Level level in GetLevels()) { if (((Object)level).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Level - " + name }), StringComparison.OrdinalIgnoreCase)) { return level; } } return null; } public static bool TryGetLevelThatContainsName(string name, [NotNullWhen(true)] out Level? level) { level = GetLevelThatContainsName(name); return (Object)(object)level != (Object)null; } public static Level? GetLevelThatContainsName(string name) { foreach (Level level in GetLevels()) { if (((Object)level).name.Contains(name, StringComparison.OrdinalIgnoreCase)) { return level; } } return null; } } public static class NetworkingEvents { public static readonly byte[] ReservedEventCodes = new byte[3] { 0, 1, 2 }; private static readonly List<NetworkedEvent> _customEvents = new List<NetworkedEvent>(); public static readonly RaiseEventOptions RaiseAll = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; public static readonly RaiseEventOptions RaiseOthers = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; public static readonly RaiseEventOptions RaiseMasterClient = new RaiseEventOptions { Receivers = (ReceiverGroup)2 }; public static IReadOnlyList<NetworkedEvent> CustomEvents => _customEvents; internal static void Initialize() { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; Application.quitting += delegate { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; }; } internal static void AddCustomEvent(NetworkedEvent networkedEvent) { if (!_customEvents.Contains(networkedEvent)) { _customEvents.Add(networkedEvent); } } private static void OnEvent(EventData photonEvent) { EventData photonEvent2 = photonEvent; _customEvents.FirstOrDefault((NetworkedEvent e) => e.EventCode == photonEvent2.Code)?.EventAction?.Invoke(photonEvent2); } internal static bool TryGetUniqueEventCode(out byte eventCode) { eventCode = 0; while (IsEventCodeTaken(eventCode) && eventCode < 200) { eventCode++; } if (eventCode > 200 || (eventCode == 200 && IsEventCodeTaken(eventCode))) { eventCode = 0; return false; } return true; } public static bool IsEventCodeTaken(byte eventCode) { if (ReservedEventCodes.Any((byte x) => x == eventCode)) { return true; } if (_customEvents.Any((NetworkedEvent x) => x.EventCode == eventCode)) { return true; } return false; } } public class NetworkedEvent { public string Name { get; private set; } public byte EventCode { get; private set; } public Action<EventData> EventAction { get; private set; } public NetworkedEvent(string name, Action<EventData> eventAction) { Name = name; EventAction = eventAction; if (NetworkingEvents.TryGetUniqueEventCode(out var eventCode)) { EventCode = eventCode; NetworkingEvents.AddCustomEvent(this); Logger.LogInfo($"Registered NetworkedEvent \"{Name}\" with event code: {EventCode}", extended: true); } else { Logger.LogError("Failed to register NetworkedEvent \"" + Name + "\". Could not get unique event code."); } } public void RaiseEvent(object eventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions) { //IL_0018: 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) if (SemiFunc.IsMultiplayer()) { PhotonNetwork.RaiseEvent(EventCode, eventContent, raiseEventOptions, sendOptions); } else if ((int)raiseEventOptions.Receivers != 0) { RaiseEventSingleplayer(eventContent); } } private void RaiseEventSingleplayer(object eventContent) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (!SemiFunc.IsMultiplayer()) { EventData val = new EventData { Code = EventCode }; val.Parameters[val.CustomDataKey] = eventContent; val.Parameters[val.SenderKey] = 1; EventAction?.Invoke(val); } } } public static class NetworkPrefabs { private static CustomPrefabPool? _customPrefabPool; internal static CustomPrefabPool CustomPrefabPool { get { if (_customPrefabPool == null) { _customPrefabPool = new CustomPrefabPool(); } return _customPrefabPool; } private set { _customPrefabPool = value; } } internal static void Initialize() { if (PhotonNetwork.PrefabPool is CustomPrefabPool) { Logger.LogWarning("NetworkPrefabs failed to initialize. PhotonNetwork.PrefabPool is already a CustomPrefabPool."); return; } Logger.LogInfo("Initializing NetworkPrefabs."); Logger.LogDebug($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool; DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null); if (val != null) { CustomPrefabPool.DefaultPool = val; } else if (!(PhotonNetwork.PrefabPool is CustomPrefabPool)) { Logger.LogWarning($"PhotonNetwork has an unknown prefab pool assigned. PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); } PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)CustomPrefabPool; Logger.LogInfo("Replaced PhotonNetwork.PrefabPool with CustomPrefabPool."); Logger.LogDebug($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); Logger.LogInfo("Finished initializing NetworkPrefabs."); } public static void RegisterNetworkPrefab(GameObject prefab) { RegisterNetworkPrefab((prefab != null) ? ((Object)prefab).name : null, prefab); } public static void RegisterNetworkPrefab(string prefabId, GameObject prefab) { CustomPrefabPool.RegisterPrefab(prefabId, prefab); } public static bool HasNetworkPrefab(string prefabId) { return CustomPrefabPool.HasPrefab(prefabId); } public static GameObject? GetNetworkPrefab(string prefabId) { return CustomPrefabPool.GetPrefab(prefabId); } public static bool TryGetNetworkPrefab(string prefabId, [NotNullWhen(true)] out GameObject? prefab) { prefab = GetNetworkPrefab(prefabId); return (Object)(object)prefab != (Object)null; } public static GameObject? SpawnNetworkPrefab(string prefabId, Vector3 position, Quaternion rotation, byte group = 0, object[]? data = null) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(prefabId)) { Logger.LogError("Failed to spawn network prefab. PrefabId is null."); return null; } if (!HasNetworkPrefab(prefabId)) { Logger.LogError("Failed to spawn network prefab \"" + prefabId + "\". PrefabId is not registered as a network prefab."); return null; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogError("Failed to spawn network prefab \"" + prefabId + "\". You are not the host."); return null; } if (SemiFunc.IsMultiplayer()) { return PhotonNetwork.InstantiateRoomObject(prefabId, position, rotation, group, data); } return Object.Instantiate<GameObject>(CustomPrefabPool.GetPrefab(prefabId), position, rotation); } } public static class ResourcesHelper { public enum LevelPrefabType { Module, Other, StartRoom } public static string GetValuablesFolderPath(Type volumeType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown return "Valuables/" + (int)volumeType switch { 0 => "01 Tiny", 1 => "02 Small", 2 => "03 Medium", 3 => "04 Big", 4 => "05 Wide", 5 => "06 Tall", 6 => "07 Very Tall", _ => string.Empty, }; } public static string GetItemsFolderPath() { return "Items"; } public static string GetEnemiesFolderPath() { return "Enemies"; } public static string GetLevelPrefabsFolderPath(Level level, LevelPrefabType type) { string text = type switch { LevelPrefabType.Module => "Modules", LevelPrefabType.Other => "Other", LevelPrefabType.StartRoom => "Start Room", _ => string.Empty, }; return "Level/" + level.ResourcePath + "/" + text; } public static string GetValuablePrefabPath(ValuableObject valuableObject) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)valuableObject == (Object)null) { return string.Empty; } string valuablesFolderPath = GetValuablesFolderPath(valuableObject.volumeType); return valuablesFolderPath + "/" + ((Object)((Component)valuableObject).gameObject).name; } public static string GetValuablePrefabPath(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } ValuableObject valuableObject = default(ValuableObject); if (prefab.TryGetComponent<ValuableObject>(ref valuableObject)) { return GetValuablePrefabPath(valuableObject); } return string.Empty; } public static string GetItemPrefabPath(Item item) { if ((Object)(object)item == (Object)null) { return string.Empty; } return GetItemPrefabPath(item.prefab); } public static string GetItemPrefabPath(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } string itemsFolderPath = GetItemsFolderPath(); return itemsFolderPath + "/" + ((Object)prefab).name; } public static string GetEnemyPrefabPath(EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null) { return string.Empty; } GameObject mainSpawnObject = enemySetup.GetMainSpawnObject(); if ((Object)(object)mainSpawnObject == (Object)null) { return string.Empty; } string enemiesFolderPath = GetEnemiesFolderPath(); return enemiesFolderPath + "/" + ((Object)mainSpawnObject).name; } public static string GetEnemyPrefabPath(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } string enemiesFolderPath = GetEnemiesFolderPath(); return enemiesFolderPath + "/" + ((Object)prefab).name; } public static string GetLevelPrefabPath(Level level, GameObject prefab, LevelPrefabType type) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } string levelPrefabsFolderPath = GetLevelPrefabsFolderPath(level, type); return levelPrefabsFolderPath + "/" + ((Object)prefab).name; } public static bool HasValuablePrefab(ValuableObject valuableObject) { if ((Object)(object)valuableObject == (Object)null) { return false; } string valuablePrefabPath = GetValuablePrefabPath(valuableObject); return (Object)(object)Resources.Load<GameObject>(valuablePrefabPath) != (Object)null; } public static bool HasItemPrefab(Item item) { if ((Object)(object)item == (Object)null) { return false; } string itemPrefabPath = GetItemPrefabPath(item); return (Object)(object)Resources.Load<GameObject>(itemPrefabPath) != (Object)null; } public static bool HasEnemyPrefab(EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null) { return false; } foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects()) { string enemyPrefabPath = GetEnemyPrefabPath(distinctSpawnObject); if ((Object)(object)Resources.Load<GameObject>(enemyPrefabPath) != (Object)null) { return true; } } return false; } public static bool HasPrefab(GameObject prefab) { return (Object)(object)Resources.Load<GameObject>((prefab != null) ? ((Object)prefab).name : null) != (Object)null; } public static bool HasPrefab(string prefabId) { return (Object)(object)Resources.Load<GameObject>(prefabId) != (Object)null; } } public static class Upgrades { private static readonly Dictionary<string, PlayerUpgrade> _playerUpgrades = new Dictionary<string, PlayerUpgrade>(); private static NetworkedEvent? _upgradeEvent; public static IReadOnlyList<PlayerUpgrade> PlayerUpgrades => _playerUpgrades.Values.ToList(); internal static void Initialize() { _upgradeEvent = new NetworkedEvent("REPOLib Upgrade", HandleUpgradeEvent); } internal static void RegisterUpgrades() { if ((Object)(object)StatsManager.instance == (Object)null) { Logger.LogError("Upgrades: Failed to register upgrades. StatsManager instance is null."); return; } foreach (KeyValuePair<string, PlayerUpgrade> playerUpgrade in _playerUpgrades) { string text = "playerUpgrade" + playerUpgrade.Key; Dictionary<string, int> playerDictionary = playerUpgrade.Value.PlayerDictionary; if (StatsManager.instance.dictionaryOfDictionaries.TryGetValue(text, out var value)) { playerDictionary = value; Logger.LogInfo("Upgrades: Loaded upgrade \"" + text + "\" from StatsManager.", extended: true); } else { playerDictionary.Clear(); StatsManager.instance.dictionaryOfDictionaries.Add(text, playerDictionary); Logger.LogInfo("Upgrades: Added upgrade \"" + text + "\" to StatsManager.", extended: true); } } } internal static void InvokeStartActions(string steamId) { PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(steamId); if ((Object)(object)val == (Object)null) { return; } string arg = SemiFunc.PlayerGetName(val); foreach (PlayerUpgrade playerUpgrade in PlayerUpgrades) { if (playerUpgrade.StartAction != null) { try { int level = playerUpgrade.GetLevel(steamId); playerUpgrade.StartAction(val, level); Logger.LogDebug($"Upgrades: Invoked start action for upgrade \"{playerUpgrade.UpgradeId}\" on player \"{arg}\" at level {level}"); } catch (Exception arg2) { Logger.LogError($"Upgrades: Failed to invoke start action for upgrade \"{playerUpgrade.UpgradeId}\" on player \"{arg}\". {arg2}"); } } } } internal static void RaiseUpgradeEvent(string upgradeId, string steamId, int level) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (_upgradeEvent != null) { Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"UpgradeId", (object)upgradeId); ((Dictionary<object, object>)val).Add((object)"SteamId", (object)steamId); ((Dictionary<object, object>)val).Add((object)"Level", (object)level); Hashtable eventContent = val; _upgradeEvent.RaiseEvent(eventContent, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } private static void HandleUpgradeEvent(EventData eventData) { object customData = eventData.CustomData; Hashtable val = (Hashtable)((customData is Hashtable) ? customData : null); if (val != null) { string upgradeId = (string)val[(object)"UpgradeId"]; string steamId = (string)val[(object)"SteamId"]; int level = (int)val[(object)"Level"]; if (TryGetUpgrade(upgradeId, out PlayerUpgrade playerUpgrade)) { playerUpgrade.ApplyUpgrade(steamId, level); } } } public static PlayerUpgrade? RegisterUpgrade(string upgradeId, Item? item, Action<PlayerAvatar, int>? startAction, Action<PlayerAvatar, int>? upgradeAction) { if (_playerUpgrades.ContainsKey(upgradeId)) { Logger.LogError("Failed to register upgrade \"" + upgradeId + "\". An upgrade with this UpgradeId has already been registered."); return null; } PlayerUpgrade playerUpgrade = new PlayerUpgrade(upgradeId, item, startAction, upgradeAction); _playerUpgrades.Add(upgradeId, playerUpgrade); return playerUpgrade; } public static PlayerUpgrade? GetUpgrade(string upgradeId) { if (_playerUpgrades.TryGetValue(upgradeId, out PlayerUpgrade value)) { return value; } return null; } public static bool TryGetUpgrade(string upgradeId, [NotNullWhen(true)] out PlayerUpgrade? playerUpgrade) { playerUpgrade = GetUpgrade(upgradeId); return playerUpgrade != null; } } public class PlayerUpgrade { public readonly string UpgradeId; public readonly Item? Item; public Dictionary<string, int> PlayerDictionary = new Dictionary<string, int>(); internal readonly Action<PlayerAvatar, int>? StartAction; private readonly Action<PlayerAvatar, int>? _upgradeAction; internal PlayerUpgrade(string upgradeId, Item? item, Action<PlayerAvatar, int>? startAction, Action<PlayerAvatar, int>? upgradeAction) { UpgradeId = upgradeId; Item = item; StartAction = startAction; _upgradeAction = upgradeAction; } public int GetLevel(PlayerAvatar playerAvatar) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return GetLevel(playerAvatar.steamID); } public int GetLevel(string steamId) { if (PlayerDictionary.TryGetValue(steamId, out var value)) { return value; } return 0; } public int AddLevel(PlayerAvatar playerAvatar, int amount = 1) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return AddLevel(playerAvatar.steamID, amount); } public int AddLevel(string steamId, int amount = 1) { return ChangeLevelBy(steamId, amount); } public int RemoveLevel(PlayerAvatar playerAvatar, int amount = 1) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return RemoveLevel(playerAvatar.steamID, amount); } public int RemoveLevel(string steamId, int amount = 1) { return ChangeLevelBy(steamId, -amount); } public int SetLevel(PlayerAvatar playerAvatar, int level) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return SetLevel(playerAvatar.steamID, level); } public int SetLevel(string steamId, int level) { level = Mathf.Max(level, 0); PlayerDictionary[steamId] = level; ApplyUpgrade(steamId, level); Upgrades.RaiseUpgradeEvent(UpgradeId, steamId, level); return level; } private int ChangeLevelBy(string steamId, int amount) { int level = GetLevel(steamId); level += amount; return SetLevel(steamId, level); } internal void ApplyUpgrade(string steamId, int level) { PlayerDictionary[steamId] = level; if (_upgradeAction == null) { return; } PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(steamId); if ((Object)(object)val == (Object)null) { return; } string arg = SemiFunc.PlayerGetName(val); try { _upgradeAction(val, GetLevel(steamId)); Logger.LogDebug($"PlayerUpgrade: Invoked upgrade action for upgrade \"{UpgradeId}\" on player \"{arg}\" at level {level}"); } catch (Exception arg2) { Logger.LogError($"PlayerUpgrade: Failed to invoke upgrade action for upgrade \"{UpgradeId}\" on player \"{arg}\". {arg2}"); } } } public class REPOLibItemUpgrade : MonoBehaviour { [SerializeField] private string _upgradeId; private ItemToggle _itemToggle; public string UpgradeId => _upgradeId; private void Start() { _itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if ((Object)(object)_itemToggle == (Object)null) { Logger.LogError("REPOLibItemUpgrade: Failed to upgrade \"" + UpgradeId + "\". ItemToggle is null."); return; } int playerTogglePhotonID = _itemToggle.playerTogglePhotonID; PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(playerTogglePhotonID); if ((Object)(object)val == (Object)null) { Logger.LogError($"REPOLibItemUpgrade: Failed to upgrade \"{UpgradeId}\". Could not find PlayerAvatar from ItemToggle's playerTogglePhotonID {playerTogglePhotonID}."); } else if (val.isLocal) { if (!Upgrades.TryGetUpgrade(UpgradeId, out PlayerUpgrade playerUpgrade)) { Logger.LogError("REPOLibItemUpgrade: Failed to upgrade \"" + UpgradeId + "\". Could not find PlayerUpgrade from UpgradeId."); } else { playerUpgrade.AddLevel(val); } } } } public static class Utilities { private static readonly List<GameObject> _prefabsToFix = new List<GameObject>(); private static readonly List<GameObject> _fixedPrefabs = new List<GameObject>(); internal static void FixAudioMixerGroupsOnPrefabs() { foreach (GameObject item in _prefabsToFix) { item.FixAudioMixerGroups(); _fixedPrefabs.Add(item); } _prefabsToFix.Clear(); } public static void FixAudioMixerGroups(GameObject prefab) { if (!((Object)(object)prefab == (Object)null) && !_prefabsToFix.Contains(prefab) && !_fixedPrefabs.Contains(prefab)) { if ((Object)(object)AudioManager.instance == (Object)null) { _prefabsToFix.Add(prefab); return; } prefab.FixAudioMixerGroups(); _fixedPrefabs.Add(prefab); } } internal static void SafeInvokeEvent(Action? action) { try { action?.Invoke(); } catch (Exception arg) { Logger.LogError($"Exception occured while invoking event: {arg}"); } } } public static class ValuablePresets { private static readonly Dictionary<string, LevelValuables> _valuablePresets = new Dictionary<string, LevelValuables>(); public const string GenericValuablePresetName = "Valuables - Generic"; public static IReadOnlyDictionary<string, LevelValuables> AllValuablePresets => _valuablePresets; public static LevelValuables GenericPreset => AllValuablePresets["Valuables - Generic"]; public static void CacheValuablePresets() { if ((Object)(object)RunManager.instance == (Object)null) { Logger.LogError("Failed to cache LevelValuables. RunManager instance is null."); return; } foreach (Level level in RunManager.instance.levels) { foreach (LevelValuables valuablePreset in level.ValuablePresets) { _valuablePresets.TryAdd(((Object)valuablePreset).name, valuablePreset); } } } internal static void RegisterValuablePreset(LevelValuables valuablePreset) { _valuablePresets.Add(((Object)valuablePreset).name, valuablePreset); } } public static class Valuables { private static readonly Dictionary<GameObject, List<string>> _valuablesToRegister = new Dictionary<GameObject, List<string>>(); private static readonly List<GameObject> _valuablesRegistered = new List<GameObject>(); private static bool _initialValuablesRegistered; public static IReadOnlyList<GameObject> AllValuables => GetValuables(); public static IReadOnlyList<GameObject> RegisteredValuables => _valuablesRegistered; private static IEnumerable<GameObject> PendingAndRegisteredValuables => _valuablesToRegister.Keys.Concat(_valuablesRegistered); internal static void RegisterInitialValuables() { if (_initialValuablesRegistered) { return; } Logger.LogInfo("Adding valuables to valuable presets."); foreach (GameObject key in _valuablesToRegister.Keys) { RegisterValuableWithGame(key); } _valuablesToRegister.Clear(); _initialValuablesRegistered = true; } private static void RegisterValuableWithGame(GameObject valuable) { if (_valuablesRegistered.Contains(valuable)) { return; } List<string> list = _valuablesToRegister[valuable]; if (!list.Any((string x) => ValuablePresets.AllValuablePresets.Keys.Any((string y) => x == y))) { Logger.LogWarning("Valuable \"" + ((Object)valuable).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name."); list.Add("Valuables - Generic"); } foreach (string item in list) { if (item == null || !ValuablePresets.AllValuablePresets.ContainsKey(item)) { Logger.LogWarning("Failed to add valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\". The valuable preset does not exist."); } else if (ValuablePresets.AllValuablePresets[item].AddValuable(valuable)) { _valuablesRegistered.Add(valuable); Logger.LogDebug("Added valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\""); } else { Logger.LogWarning("Failed to add valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\"", extended: true); } } } public static void RegisterValuable(GameObject prefab) { RegisterValuable(prefab, new List<string>()); } public static void RegisterValuable(GameObject prefab, List<LevelValuables> presets) { RegisterValuable(prefab, presets.Select((LevelValuables preset) => ((Object)preset).name).ToList()); } public static void RegisterValuable(GameObject prefab, List<string> presetNames) { ValuableObject valuableObject = default(ValuableObject); if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to register valuable. Prefab is null."); } else if (!prefab.TryGetComponent<ValuableObject>(ref valuableObject)) { Logger.LogError("Failed to register valuable. Prefab does not have a ValuableObject component."); } else { RegisterValuable(valuableObject, presetNames); } } public static void RegisterValuable(ValuableObject valuableObject) { RegisterValuable(valuableObject, new List<string>()); } public static void RegisterValuable(ValuableObject valuableObject, List<LevelValuables> presets) { RegisterValuable(valuableObject, presets.Select((LevelValuables preset) => ((Object)preset).name).ToList()); } public static void RegisterValuable(ValuableObject valuableObject, List<string> presetNames) { if ((Object)(object)valuableObject == (Object)null) { Logger.LogError("Failed to register valuable. ValuableObject is null."); return; } GameObject prefab = ((Component)valuableObject).gameObject; if (presetNames == null || presetNames.Count == 0) { Logger.LogWarning("Valuable \"" + ((Object)valuableObject).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name.", extended: true); presetNames = new List<string>(1) { "Valuables - Generic" }; } if (ResourcesHelper.HasValuablePrefab(valuableObject)) { Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable prefab already exists in Resources with the same name."); return; } if (PendingAndRegisteredValuables.Any((GameObject x) => ((Object)x).name.Equals(((Object)prefab).name, StringComparison.OrdinalIgnoreCase))) { Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable prefab already exists with the same name."); return; } if (PendingAndRegisteredValuables.Contains(prefab)) { Logger.LogWarning("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable is already registered!"); return; } string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(valuableObject); NetworkPrefabs.RegisterNetworkPrefab(valuablePrefabPath, prefab); Utilities.FixAudioMixerGroups(prefab); _valuablesToRegister.Add(prefab, presetNames); if (_initialValuablesRegistered) { RegisterValuableWithGame(((Component)valuableObject).gameObject); } } public static GameObject? SpawnValuable(ValuableObject valuableObject, Vector3 position, Quaternion rotation) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)valuableObject == (Object)null) { Logger.LogError("Failed to spawn valuable. ValuableObject is null."); return null; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogError("Failed to spawn valuable \"" + ((Object)((Component)valuableObject).gameObject).name + "\". You are not the host."); return null; } string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(valuableObject); GameObject val = NetworkPrefabs.SpawnNetworkPrefab(valuablePrefabPath, position, rotation, 0); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn valuable \"" + ((Object)((Component)valuableObject).gameObject).name + "\""); return null; } Logger.LogInfo($"Spawned valuable \"{((Object)val).name}\" at position {position}, rotation: {((Quaternion)(ref rotation)).eulerAngles}", extended: true); return val; } public static IReadOnlyList<GameObject> GetValuables() { if ((Object)(object)RunManager.instance == (Object)null) { return Array.Empty<GameObject>(); } return ValuablePresets.AllValuablePresets.Values.Select((LevelValuables levelValuables) => levelValuables.GetCombinedList()).SelectMany((List<GameObject> list) => list).Distinct() .ToList(); } public static bool TryGetValuableByName(string name, [NotNullWhen(true)] out ValuableObject? valuableObject) { valuableObject = GetValuableByName(name); return (Object)(object)valuableObject != (Object)null; } public static ValuableObject? GetValuableByName(string name) { string name2 = name; GameObject val = ((IEnumerable<GameObject>)GetValuables()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name.Equals(name2, StringComparison.OrdinalIgnoreCase))); return ((val != null) ? val.GetComponent<ValuableObject>() : null) ?? null; } public static bool TryGetValuableThatContainsName(string name, [NotNullWhen(true)] out ValuableObject? valuableObject) { valuableObject = GetValuableThatContainsName(name); return (Object)(object)valuableObject != (Object)null; } public static ValuableObject? GetValuableThatContainsName(string name) { string name2 = name; GameObject val = GetValuables().SortByStringLength((GameObject x) => ((Object)x).name, ListExtensions.StringSortMode.Shortest).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name.Contains(name2, StringComparison.OrdinalIgnoreCase))); return ((val != null) ? val.GetComponent<ValuableObject>() : null) ?? null; } [Obsolete("prefabId is no longer supported", true)] public static void RegisterValuable(string prefabId, GameObject prefab) { RegisterValuable(prefab); } [Obsolete("prefabId is no longer supported", true)] public static void RegisterValuable(string prefabId, GameObject prefab, List<LevelValuables> presets) { RegisterValuable(prefab, presets); } [Obsolete("prefabId is no longer supported", true)] public static void RegisterValuable(string prefabId, GameObject prefab, List<string> presetNames) { RegisterValuable(prefab, presetNames); } } } namespace REPOLib.Extensions { internal static class AudioSourceExtensions { public static void FixAudioMixerGroup(this AudioSource audioSource) { audioSource.FixAudioMixerGroup(((Component)audioSource).gameObject); } public static void FixAudioMixerGroup(this AudioSource audioSource, GameObject rootObject) { if ((Object)(object)audioSource == (Object)null) { return; } string text = ((!((Object)(object)rootObject == (Object)(object)((Component)audioSource).gameObject)) ? (((Object)rootObject).name + "/" + ((Object)((Component)audioSource).gameObject).name) : ((Object)((Component)audioSource).gameObject).name); if ((Object)(object)AudioManager.instance == (Object)null) { Logger.LogWarning("Failed to fix AudioMixerGroup on GameObject \"" + text + "\". AudioManager instance is null."); return; } if ((Object)(object)audioSource.outputAudioMixerGroup == (Object)null) { Logger.LogWarning("Failed to fix AudioMixerGroup on GameObject \"" + text + "\". No AudioMixerGroup is assigned."); return; } AudioMixer val = (AudioMixer)(((Object)audioSource.outputAudioMixerGroup.audioMixer).name switch { "Master" => AudioManager.instance.MasterMixer, "Music" => AudioManager.instance.MusicMasterGroup.audioMixer, "Sound" => AudioManager.instance.SoundMasterGroup.audioMixer, "Spectate" => AudioManager.instance.MicrophoneSpectateGroup.audioMixer, _ => AudioManager.instance.SoundMasterGroup.audioMixer, }); AudioMixerGroup[] array = val.FindMatchingGroups(((Object)audioSource.outputAudioMixerGroup).name); AudioMixerGroup val2; if (array.Length >= 1) { val2 = array[0]; } else { val = AudioManager.instance.SoundMasterGroup.audioMixer; val2 = val.FindMatchingGroups("Sound Effects")[0]; Logger.LogWarning("Could not find matching AudioMixerGroup for GameObject \"" + text + "\". Using default AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\"", extended: true); } audioSource.outputAudioMixerGroup = val2; Logger.LogDebug("Fixed AudioMixerGroup on GameObject \"" + text + "\". AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\""); } } internal static class DictionaryExtensions { public static bool TryGetKey<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, [NotNullWhen(true)] out TKey? key) { foreach (KeyValuePair<TKey, TValue> item in dictionary) { if (object.Equals(item.Value, value)) { key = item.Key; return true; } } key = default(TKey); return false; } public static TKey? GetKeyOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value) { if (dictionary.TryGetKey(value, out TKey key)) { return key; } return default(TKey); } public static TKey? GetKeyOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, TKey defaultKey) { if (dictionary.TryGetKey(value, out TKey key)) { return key; } return defaultKey; } public static bool ContainsKey<T>(this Dictionary<string, T> dictionary, string key, bool ignoreKeyCase) { if (!ignoreKeyCase) { return dictionary.ContainsKey(key); } foreach (KeyValuePair<string, T> item in dictionary) { if (string.Equals(item.Key, key, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } public static bool TryGetValue<T>(this Dictionary<string, T> dictionary, string key, [NotNullWhen(true)] out T? value, bool ignoreKeyCase) { if (!ignoreKeyCase) { return dictionary.TryGetValue(key, out value); } foreach (KeyValuePair<string, T> item in dictionary) { if (string.Equals(item.Key, key, StringComparison.OrdinalIgnoreCase)) { value = item.Value; return true; } } value = default(T); return false; } public static T? GetValueOrDefault<T>(this Dictionary<string, T> dictionary, string key, bool ignoreKeyCase) { if (dictionary.TryGetValue(key, out T value, ignoreKeyCase)) { return value; } return default(T); } public static T? GetValueOrDefault<T>(this Dictionary<string, T> dictionary, string key, T defaultValue, bool ignoreKeyCase) { if (dictionary.TryGetValue(key, out T value, ignoreKeyCase)) { return value; } return defaultValue; } } internal static class EnemyDirectorExtensions { public static bool HasEnemy(this EnemyDirector enemyDirector, EnemySetup enemySetup) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects.Count == 0) { return false; } EnemyParent val = default(EnemyParent); foreach (GameObject spawnObject in enemySetup.spawnObjects) { if (spawnObject.TryGetComponent<EnemyParent>(ref val) && enemyDirector.TryGetList(val.difficulty, out List<EnemySetup> list)) { return list.Contains(enemySetup); } } return false; } internal static bool AddEnemy(this EnemyDirector enemyDirector, EnemySetup enemySetup) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemySetup == (Object)null) { return false; } EnemyParent val = default(EnemyParent); foreach (GameObject spawnObject in enemySetup.spawnObjects) { if (spawnObject.TryGetComponent<EnemyParent>(ref val) && enemyDirector.TryGetList(val.difficulty, out List<EnemySetup> list) && !list.Contains(enemySetup)) { list.Add(enemySetup); return true; } } return false; } public static bool TryGetList(this EnemyDirector enemyDirector, Difficulty difficultyType, [NotNullWhen(true)] out List<EnemySetup>? list) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected I4, but got Unknown list = (int)difficultyType switch { 0 => enemyDirector.enemiesDifficulty1, 1 => enemyDirector.enemiesDifficulty2, 2 => enemyDirector.enemiesDifficulty3, _ => null, }; return list != null; } public static List<EnemySetup> GetEnemies(this EnemyDirector enemyDirector) { List<EnemySetup> enemiesDifficulty = enemyDirector.enemiesDifficulty1; List<EnemySetup> enemiesDifficulty2 = enemyDirector.enemiesDifficulty2; List<EnemySetup> enemiesDifficulty3 = enemyDirector.enemiesDifficulty3; List<EnemySetup> list = new List<EnemySetup>(enemiesDifficulty.Count + enemiesDifficulty2.Count + enemiesDifficulty3.Count); list.AddRange(enemiesDifficulty); list.AddRange(enemiesDifficulty2); list.AddRange(enemiesDifficulty3); return list; } public static bool TryGetEnemyByName(this EnemyDirector enemyDirector, string name, [NotNullWhen(true)] out EnemySetup? enemySetup) { enemySetup = enemyDirector.GetEnemyByName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup? GetEnemyByName(this EnemyDirector enemyDirector, string name) { string name2 = name; return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameEquals(name2))); } public static bool TryGetEnemyThatContainsName(this EnemyDirector enemyDirector, string name, out EnemySetup enemySetup) { enemySetup = enemyDirector.GetEnemyThatContainsName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup GetEnemyThatContainsName(this EnemyDirector enemyDirector, string name) { string name2 = name; return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameContains(name2))); } } internal static class EnemySetupExtensions { public static List<GameObject> GetDistinctSpawnObjects(this EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null) { return new List<GameObject>(); } return enemySetup.spawnObjects.Where((GameObject x) => (Object)(object)x != (Object)null).Distinct(new UnityObjectNameComparer<GameObject>()).ToList(); } public static List<GameObject> GetSortedSpawnObjects(this EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null) { return new List<GameObject>(); } EnemyParent val = default(EnemyParent); return (from x in enemySetup.spawnObjects where (Object)(object)x != (Object)null orderby x.TryGetComponent<EnemyParent>(ref val) descending select x).ToList(); } public static GameObject? GetMainSpawnObject(this EnemySetup enemySetup) { EnemyParent? enemyParent = enemySetup.GetEnemyParent(); if (enemyParent == null) { return null; } return ((Component)enemyParent).gameObject; } public static EnemyParent? GetEnemyParent(this EnemySetup enemySetup) { EnemyParent result = default(EnemyParent); foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects()) { if (distinctSpawnObject.TryGetComponent<EnemyParent>(ref result)) { return result; } } return null; } public static bool TryGetEnemyParent(this EnemySetup enemySetup, [NotNullWhen(true)] out EnemyParent? enemyParent) { enemyParent = enemySetup.GetEnemyParent(); return (Object)(object)enemyParent != (Object)null; } public static bool AnySpawnObjectsNameEquals(this EnemySetup enemySetup, string name) { string name2 = name; if ((Object)(object)enemySetup == (Object)null) { return false; } return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(na