Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Maze Runner v1.0.1
Juice.dll
Decompiled 7 months 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Empress.JuiceSynced; using ExitGames.Client.Photon; using HarmonyLib; using Juice; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [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+09619f60ebf794e4dba9d378370cde563bd69fb4")] [assembly: AssemblyProduct("Juice")] [assembly: AssemblyTitle("Juice")] [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; } } } namespace Juice { internal sealed class CursedHostRunner : MonoBehaviour { internal static CursedHostRunner Instance; private void Awake() { ((Object)this).hideFlags = (HideFlags)61; } [RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)] private static void Boot() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("CursedHostRunner"); Object.DontDestroyOnLoad((Object)(object)val); Instance = val.AddComponent<CursedHostRunner>(); } } } internal class Spinner : MonoBehaviour { public Vector3 axis = Vector3.up; public float degPerSecond = 60f; private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Rotate(axis, degPerSecond * Time.deltaTime, (Space)1); } } internal class Bobbing : MonoBehaviour { public float amplitude = 0.15f; public float frequency = 1.2f; private Vector3 baseLocal; private void Start() { //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) baseLocal = ((Component)this).transform.localPosition; } private void Update() { //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_0029: 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) ((Component)this).transform.localPosition = baseLocal + Vector3.up * (Mathf.Sin(Time.time * frequency) * amplitude); } } internal class PulsingWidth : MonoBehaviour { public LineRenderer lr; public float baseWidth = 0.06f; public float amplitude = 0.03f; public float frequency = 2f; public float cellSize = 1f; private void Update() { if (Object.op_Implicit((Object)(object)lr)) { float widthMultiplier = (baseWidth + Mathf.Sin(Time.time * frequency) * amplitude) * cellSize; lr.widthMultiplier = widthMultiplier; } } } internal static class LocalKillUtil { public static void TryKillLocal() { try { Type type = AccessTools.TypeByName("ChatManager"); if (type == null) { return; } object obj = AccessTools.Property(type, "instance")?.GetValue(null); if (obj != null) { MethodInfo methodInfo = AccessTools.Method(type, "PossessSelfDestruction", (Type[])null, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(obj, null); } } } catch (Exception arg) { BeetlejuiceSyncedPlugin.Log.LogWarning((object)$"[Cursed] Local kill failed: {arg}"); } } } public static class CursedBeetlejuice { internal static class CurseManager { private class SlowDrift : MonoBehaviour { public Vector3 boundsCenter; public Vector3 boundsSize; private Vector3 dir; private float speed; private void Start() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) Vector3 insideUnitSphere = Random.insideUnitSphere; Vector3 val = new Vector3(insideUnitSphere.x, 0f, insideUnitSphere.z); dir = ((Vector3)(ref val)).normalized; speed = Random.Range(0.15f, 0.35f); ((Component)this).gameObject.AddComponent<Spinner>().degPerSecond = Random.Range(10f, 30f); Bobbing bobbing = ((Component)this).gameObject.AddComponent<Bobbing>(); bobbing.amplitude = 0.08f; bobbing.frequency = Random.Range(0.8f, 1.6f); } private void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.position += dir * speed * Time.deltaTime; Vector3 val = boundsCenter - boundsSize * 0.5f; Vector3 val2 = boundsCenter + boundsSize * 0.5f; Vector3 position = ((Component)this).transform.position; if (position.x < val.x) { position.x = val2.x; } else if (position.x > val2.x) { position.x = val.x; } if (position.z < val.z) { position.z = val2.z; } else if (position.z > val2.z) { position.z = val.z; } ((Component)this).transform.position = position; } } internal class HazardKiller : MonoBehaviour { private void OnTriggerEnter(Collider other) { try { if (((Component)other).CompareTag("Player") || ((Object)other).name.Contains("Avatar", StringComparison.OrdinalIgnoreCase)) { ChatManager val = ChatManager.instance ?? Object.FindObjectOfType<ChatManager>(true); if ((Object)(object)val != (Object)null) { val.PossessSelfDestruction(); BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[CursedHazard] Player killed by cube."); } else { BeetlejuiceSyncedPlugin.Log.LogWarning((object)"[CursedHazard] ChatManager instance missing; couldn’t kill player."); } } } catch (Exception arg) { BeetlejuiceSyncedPlugin.Log.LogError((object)$"[CursedHazard] Kill trigger error: {arg}"); } } } internal class HazardMover : MonoBehaviour { public MazeGenerator gen; public Vector2Int startCell; public float speed = 2f; private Vector2Int currentCell; private Vector2Int previousCell; private float moveTimer; private Vector2Int targetDir; private Random rng; private void Start() { //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_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_002b: 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) currentCell = startCell; previousCell = startCell; rng = new Random((int)(Time.time * 1000f + ((Component)this).transform.position.x + ((Component)this).transform.position.z)); PickNewDirection(); } private void Update() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d2: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) moveTimer -= Time.deltaTime; if (moveTimer <= 0f) { ((Component)this).transform.position = gen.GetCellCenter(((Vector2Int)(ref currentCell)).x, ((Vector2Int)(ref currentCell)).y) + Vector3.up * 1f; PickNewDirection(); } else { Vector2Int val = currentCell + targetDir; Vector3 val2 = gen.GetCellCenter(((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y) + Vector3.up * 1f; ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val2, speed * Time.deltaTime); } } private void PickNewDirection() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) List<Vector2Int> list = gen.Neighbors4(currentCell).ToList(); if (list.Count != 0) { if (list.Count > 1) { list.Remove(previousCell); } Vector2Int val = list[rng.Next(list.Count)]; targetDir = val - currentCell; moveTimer = gen.CellSize / speed; previousCell = currentCell; currentCell = val; } } } [CompilerGenerated] private sealed class <EndCurseCoroutine>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EndCurseCoroutine>d__20(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) if (<>1__state != 0) { return false; } <>1__state = -1; BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[Cursed] Restoring world (synced)."); CleanupMaze(); RestoreMap(); SafeTeleportLocalPlayer(savedPlayerPos); active = 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 <LoadOggClip>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string fileName; public Action<AudioClip> onLoaded; private string <dllDir>5__1; private string <oggPath>5__2; private string <url>5__3; private UnityWebRequest <req>5__4; private UnityWebRequestAsyncOperation <operation>5__5; private AudioClip <clip>5__6; private Exception <ex>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadOggClip>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <dllDir>5__1 = null; <oggPath>5__2 = null; <url>5__3 = null; <req>5__4 = null; <operation>5__5 = null; <clip>5__6 = null; <ex>5__7 = null; <>1__state = -2; } private bool MoveNext() { bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; if (onLoaded == null) { result = false; break; } <dllDir>5__1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ""; <oggPath>5__2 = Path.Combine(<dllDir>5__1, fileName); if (!File.Exists(<oggPath>5__2)) { BeetlejuiceSyncedPlugin.Log.LogWarning((object)("[Cursed] OGG not found: " + <oggPath>5__2)); onLoaded(null); result = false; break; } <url>5__3 = "file:///" + <oggPath>5__2.Replace("\\", "/"); <req>5__4 = UnityWebRequestMultimedia.GetAudioClip(<url>5__3, (AudioType)14); <>1__state = -3; <operation>5__5 = <req>5__4.SendWebRequest(); <>2__current = <operation>5__5; <>1__state = 1; result = true; break; case 1: <>1__state = -3; if (<req>5__4.isNetworkError || <req>5__4.isHttpError) { BeetlejuiceSyncedPlugin.Log.LogWarning((object)("[Cursed] Failed loading clip '" + fileName + "': " + <req>5__4.error)); onLoaded(null); result = false; <>m__Finally1(); break; } <clip>5__6 = null; try { <clip>5__6 = DownloadHandlerAudioClip.GetContent(<req>5__4); } catch (Exception ex) { <ex>5__7 = ex; BeetlejuiceSyncedPlugin.Log.LogError((object)$"[Cursed] GetContent error: {<ex>5__7}"); } if ((Object)(object)<clip>5__6 != (Object)null) { ((Object)<clip>5__6).name = "CursedClip_" + fileName; } onLoaded(<clip>5__6); <operation>5__5 = null; <clip>5__6 = null; <>m__Finally1(); <req>5__4 = null; result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<req>5__4 != null) { ((IDisposable)<req>5__4).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <StartCurseCoroutine>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int seed; public Vector3 centerFromHost; private Vector3 <mazeCenter>5__1; private MazeGenerator <gen>5__2; private GameObject <floor>5__3; private float <totalW>5__4; private float <totalH>5__5; private float <floorThick>5__6; private Renderer <fr>5__7; private GameObject <roof>5__8; private float <roofThick>5__9; private float <roofY>5__10; private Renderer <rr>5__11; private Vector3 <start>5__12; private Vector3 <tp>5__13; private RaycastHit <hit>5__14; private BoxCollider <bc>5__15; private ExitTrigger <et>5__16; private GameObject <hazardParent>5__17; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartCurseCoroutine>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <gen>5__2 = null; <floor>5__3 = null; <fr>5__7 = null; <roof>5__8 = null; <rr>5__11 = null; <bc>5__15 = null; <et>5__16 = null; <hazardParent>5__17 = null; <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Expected O, but got Unknown //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Expected O, but got Unknown //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Expected O, but got Unknown //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; active = true; savedPlayerPos = centerFromHost; BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[Cursed] Triggered (synced)."); <mazeCenter>5__1 = centerFromHost + Vector3.up * mazeYOffset; mazeParent = new GameObject("CursedMaze_ClientOnly"); <gen>5__2 = mazeParent.AddComponent<MazeGenerator>(); <gen>5__2.width = mazeWidth; <gen>5__2.height = mazeHeight; <gen>5__2.cellSize = cellSize; <gen>5__2.wallHeight = wallHeight; <gen>5__2.wallThickness = wallThickness; <gen>5__2.corridorBias = corridorBias; <gen>5__2.SetDeterministicSeed(seed); <gen>5__2.GenerateMaze(<mazeCenter>5__1); <floor>5__3 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)<floor>5__3).name = "CursedMaze_Floor"; <floor>5__3.transform.SetParent(mazeParent.transform, true); <totalW>5__4 = (float)mazeWidth * cellSize; <totalH>5__5 = (float)mazeHeight * cellSize; <floorThick>5__6 = 0.6f; <floor>5__3.transform.position = new Vector3(<mazeCenter>5__1.x, <mazeCenter>5__1.y - <floorThick>5__6 * 0.5f, <mazeCenter>5__1.z); <floor>5__3.transform.localScale = new Vector3(<totalW>5__4, <floorThick>5__6, <totalH>5__5); <fr>5__7 = <floor>5__3.GetComponent<Renderer>(); if ((Object)(object)<fr>5__7 != (Object)null) { <fr>5__7.material = NewMat("Standard"); <fr>5__7.material.color = Color.gray; <fr>5__7.shadowCastingMode = (ShadowCastingMode)0; <fr>5__7.receiveShadows = false; } <roof>5__8 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)<roof>5__8).name = "CursedMaze_Roof"; <roof>5__8.transform.SetParent(mazeParent.transform, true); <roofThick>5__9 = 0.5f; <roofY>5__10 = <mazeCenter>5__1.y + wallHeight + <roofThick>5__9 * 0.5f; <roof>5__8.transform.position = new Vector3(<mazeCenter>5__1.x, <roofY>5__10, <mazeCenter>5__1.z); <roof>5__8.transform.localScale = new Vector3(<totalW>5__4, <roofThick>5__9, <totalH>5__5); <rr>5__11 = <roof>5__8.GetComponent<Renderer>(); if ((Object)(object)<rr>5__11 != (Object)null) { <rr>5__11.material = NewMat("Unlit/Color", "Sprites/Default", "Standard"); <rr>5__11.material.color = new Color(0.05f, 0.05f, 0.08f, 1f); <rr>5__11.shadowCastingMode = (ShadowCastingMode)0; <rr>5__11.receiveShadows = false; } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; case 2: <>1__state = -1; <start>5__12 = <gen>5__2.GetStartPosition(); <tp>5__13 = <start>5__12 + Vector3.up * 3f; if (Physics.Raycast(<tp>5__13, Vector3.down, ref <hit>5__14, 10f, -1, (QueryTriggerInteraction)1)) { <tp>5__13 = ((RaycastHit)(ref <hit>5__14)).point + Vector3.up * 0.2f; } SafeTeleportLocalPlayer(<tp>5__13); if (hideRealMap) { DisableMap(); } exitTriggerObj = new GameObject("CursedMazeExitTrigger"); exitTriggerObj.transform.position = <gen>5__2.GetExitPosition(); <bc>5__15 = exitTriggerObj.AddComponent<BoxCollider>(); ((Collider)<bc>5__15).isTrigger = true; <bc>5__15.size = new Vector3(cellSize * 0.9f, 2.5f, cellSize * 0.9f); <et>5__16 = exitTriggerObj.AddComponent<ExitTrigger>(); <et>5__16.Setup(delegate { BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[Cursed] Exit reached, asking host to end."); Player localPlayer = PhotonNetwork.LocalPlayer; BeetleEventRouter.Raise(BeetleEventRouter.Ev.PlayerEscaped, (localPlayer != null) ? localPlayer.ActorNumber : (-1), (ReceiverGroup)((!PhotonNetwork.InRoom) ? 1 : 2)); }); exitFxObj = BuildExitPortalFX(<gen>5__2.GetExitPosition(), cellSize); exitFxObj.transform.SetParent(mazeParent.transform, true); ambienceParent = new GameObject("CursedMaze_Ambience"); ambienceParent.transform.SetParent(mazeParent.transform, true); SpawnFloatingCubes(ambienceParent.transform, <mazeCenter>5__1, <totalW>5__4, <totalH>5__5, <roofY>5__10 + 0.35f, 10, seed ^ 0x5EED); <hazardParent>5__17 = new GameObject("CursedMaze_Hazards"); <hazardParent>5__17.transform.SetParent(mazeParent.transform, true); SpawnPatrollingHazards(<hazardParent>5__17.transform, <gen>5__2, seed, 2, 6); 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 bool active; private static Vector3 savedPlayerPos; private static GameObject mazeParent; private static GameObject exitTriggerObj; private static GameObject exitFxObj; private static GameObject ambienceParent; public static int mazeWidth = 13; public static int mazeHeight = 13; public static float cellSize = 3f; public static float wallHeight = 3f; public static float wallThickness = 0.25f; public static float corridorBias = 0.7f; public static float mazeYOffset = 1500f; public static bool hideRealMap = false; private static readonly List<Renderer> disabledRenderers = new List<Renderer>(); private static readonly List<Collider> disabledColliders = new List<Collider>(); private static readonly List<bool> renderersEnabledState = new List<bool>(); private static readonly List<bool> collidersEnabledState = new List<bool>(); public static void StartNetworked(int seed, Vector3 centerFromHost) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (active) { BeetlejuiceSyncedPlugin.Log.LogWarning((object)"[Cursed] Already active, ignoring start."); } else { ((MonoBehaviour)CursedHostRunner.Instance).StartCoroutine(StartCurseCoroutine(seed, centerFromHost)); } } public static void EndNetworked() { if (!active) { CleanupMaze(); RestoreMap(); } else { ((MonoBehaviour)CursedHostRunner.Instance).StartCoroutine(EndCurseCoroutine()); } } private static Shader SafeFindShader(params string[] names) { foreach (string text in names) { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null) { return val; } } return Shader.Find("Standard"); } private static Material NewMat(params string[] preferred) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return new Material(SafeFindShader(preferred)); } [IteratorStateMachine(typeof(<StartCurseCoroutine>d__18))] private static IEnumerator StartCurseCoroutine(int seed, Vector3 centerFromHost) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartCurseCoroutine>d__18(0) { seed = seed, centerFromHost = centerFromHost }; } private static void SpawnPatrollingHazards(Transform parent, MazeGenerator gen, int seed, int min, int max) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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) Random random = new Random(seed ^ 0xDEAD); int num = Mathf.Clamp(random.Next(min, max + 1), 2, 6); Vector2Int startCell = default(Vector2Int); for (int i = 0; i < num; i++) { int num2 = 0; do { ((Vector2Int)(ref startCell))..ctor(random.Next(gen.Width), random.Next(gen.Height)); num2++; } while (num2 <= 500 && !gen.IsOpen(((Vector2Int)(ref startCell)).x, ((Vector2Int)(ref startCell)).y)); Vector3 position = gen.GetCellCenter(((Vector2Int)(ref startCell)).x, ((Vector2Int)(ref startCell)).y) + Vector3.up * 1f; GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = $"CursedHazard_{i}"; val.transform.SetParent(parent, true); val.transform.position = position; val.transform.localScale = Vector3.one * 0.8f; Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.material = NewMat("Unlit/Color", "Standard"); component.material.color = Color.red; component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; } Collider component2 = val.GetComponent<Collider>(); component2.isTrigger = true; val.AddComponent<HazardKiller>(); HazardMover hazardMover = val.AddComponent<HazardMover>(); hazardMover.gen = gen; hazardMover.startCell = startCell; hazardMover.speed = 1.5f + (float)random.NextDouble() * 0.5f; } } [IteratorStateMachine(typeof(<EndCurseCoroutine>d__20))] private static IEnumerator EndCurseCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EndCurseCoroutine>d__20(0); } private static void CleanupMaze() { if (Object.op_Implicit((Object)(object)exitTriggerObj)) { Object.Destroy((Object)(object)exitTriggerObj); } exitTriggerObj = null; if (Object.op_Implicit((Object)(object)exitFxObj)) { Object.Destroy((Object)(object)exitFxObj); } exitFxObj = null; if (Object.op_Implicit((Object)(object)ambienceParent)) { Object.Destroy((Object)(object)ambienceParent); } ambienceParent = null; if (Object.op_Implicit((Object)(object)mazeParent)) { Object.Destroy((Object)(object)mazeParent); } mazeParent = null; } private static void DisableMap() { GameObject val = null; Type type = AccessTools.TypeByName("Map"); if (type != null) { object? obj = AccessTools.Property(type, "Instance")?.GetValue(null, null); Object val2 = (Object)((obj is Object) ? obj : null); Component val3 = (Component)(object)((val2 is Component) ? val2 : null); if (val3 != null) { val = val3.gameObject; } else { GameObject val4 = (GameObject)(object)((val2 is GameObject) ? val2 : null); if (val4 != null) { val = val4; } } } IEnumerable<Renderer> enumerable; IEnumerable<Collider> enumerable2; if ((Object)(object)val != (Object)null) { enumerable = val.GetComponentsInChildren<Renderer>(true); enumerable2 = val.GetComponentsInChildren<Collider>(true); } else { enumerable = from r in Object.FindObjectsOfType<Renderer>(true) where !IsOurTempObject(((Component)r).gameObject) select r; enumerable2 = from c in Object.FindObjectsOfType<Collider>(true) where !IsOurTempObject(((Component)c).gameObject) select c; } disabledRenderers.Clear(); disabledColliders.Clear(); renderersEnabledState.Clear(); collidersEnabledState.Clear(); foreach (Renderer item in enumerable) { disabledRenderers.Add(item); renderersEnabledState.Add(item.enabled); item.enabled = false; } foreach (Collider item2 in enumerable2) { disabledColliders.Add(item2); collidersEnabledState.Add(item2.enabled); item2.enabled = false; } } private static void RestoreMap() { for (int i = 0; i < disabledRenderers.Count; i++) { if (Object.op_Implicit((Object)(object)disabledRenderers[i])) { disabledRenderers[i].enabled = renderersEnabledState[i]; } } for (int j = 0; j < disabledColliders.Count; j++) { if (Object.op_Implicit((Object)(object)disabledColliders[j])) { disabledColliders[j].enabled = collidersEnabledState[j]; } } disabledRenderers.Clear(); disabledColliders.Clear(); renderersEnabledState.Clear(); collidersEnabledState.Clear(); } private static bool IsOurTempObject(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return false; } if (((Object)go).name.StartsWith("CursedMaze_", StringComparison.Ordinal)) { return true; } if (((Object)go).name.StartsWith("CursedWall_", StringComparison.Ordinal)) { return true; } if (((Object)go).name == "CursedMaze_Floor") { return true; } if (((Object)go).name == "CursedMaze_Roof") { return true; } if (((Object)go).name == "CursedMazeExitTrigger") { return true; } if (((Object)go).name == "CursedPortalFX") { return true; } if (((Object)go).name == "CursedMaze_Ambience") { return true; } if (((Object)go).name.StartsWith("CursedHazard_", StringComparison.Ordinal)) { return true; } return false; } public static Component SafeGetLocalPlayerController() { Type type = AccessTools.TypeByName("PlayerController"); if (type == null) { return null; } object? obj = (AccessTools.Field(type, "instance") ?? AccessTools.Field(type, "Instance"))?.GetValue(null); Component val = (Component)((obj is Component) ? obj : null); if (val != null) { return val; } object? obj2 = (AccessTools.Property(type, "instance") ?? AccessTools.Property(type, "Instance"))?.GetValue(null, null); Component val2 = (Component)((obj2 is Component) ? obj2 : null); if (val2 != null) { return val2; } Object obj3 = Object.FindObjectOfType(type); return (Component)(object)((obj3 is Component) ? obj3 : null); } private static void SafeTeleportLocalPlayer(Vector3 pos) { //IL_0037: 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) Component val = SafeGetLocalPlayerController(); if (!((Object)(object)val == (Object)null)) { CharacterController component = val.GetComponent<CharacterController>(); if (Object.op_Implicit((Object)(object)component)) { ((Collider)component).enabled = false; } val.transform.position = pos; object? obj = AccessTools.Field(((object)val).GetType(), "playerAvatar")?.GetValue(val); Component val2 = (Component)((obj is Component) ? obj : null); if (val2 != null) { val2.transform.position = pos; } if (Object.op_Implicit((Object)(object)component)) { ((Collider)component).enabled = true; } } } private static GameObject BuildExitPortalFX(Vector3 position, float cell) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: 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_0041: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Expected O, but got Unknown //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CursedPortalFX"); val.transform.position = position; Bobbing bobbing = val.AddComponent<Bobbing>(); bobbing.amplitude = 0.1f; bobbing.frequency = 1.25f; GameObject val2 = new GameObject("CursedPortalRing"); val2.transform.SetParent(val.transform, false); LineRenderer val3 = val2.AddComponent<LineRenderer>(); val3.useWorldSpace = false; val3.loop = true; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).material = NewMat("Sprites/Default", "Unlit/Color", "Legacy Shaders/Particles/Alpha Blended", "Standard"); Color val4 = default(Color); ((Color)(ref val4))..ctor(0.65f, 0.2f, 0.95f, 0.9f); val3.startColor = val4; val3.endColor = val4; val3.positionCount = 64; float num = cell * 0.45f; for (int i = 0; i < 64; i++) { float num2 = (float)i / 64f * MathF.PI * 2f; val3.SetPosition(i, new Vector3(Mathf.Cos(num2) * num, 0f, Mathf.Sin(num2) * num)); } Spinner spinner = val2.AddComponent<Spinner>(); spinner.axis = Vector3.up; spinner.degPerSecond = 60f; PulsingWidth pulsingWidth = val2.AddComponent<PulsingWidth>(); pulsingWidth.lr = val3; pulsingWidth.baseWidth = 0.06f; pulsingWidth.amplitude = 0.03f; pulsingWidth.frequency = 2f; pulsingWidth.cellSize = cell; GameObject val5 = new GameObject("CursedPortalParticles"); val5.transform.SetParent(val.transform, false); ParticleSystem val6 = val5.AddComponent<ParticleSystem>(); MainModule main = val6.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).duration = 2.5f; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1.5f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.2f); ((MainModule)(ref main)).startSize = new MinMaxCurve(cell * 0.08f, cell * 0.16f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.8f, 0.3f, 1f, 0.75f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val6.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(80f); ShapeModule shape = val6.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)17; ((ShapeModule)(ref shape)).radius = num * 0.9f; ((ShapeModule)(ref shape)).donutRadius = num * 0.15f; GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)val7).name = "CursedPortalFace"; val7.transform.SetParent(val.transform, false); val7.transform.localPosition = Vector3.up * 0.02f; val7.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); val7.transform.localScale = new Vector3(num * 1.6f, num * 1.6f, 1f); Renderer component = val7.GetComponent<Renderer>(); Object.DestroyImmediate((Object)(object)val7.GetComponent<Collider>()); if (Object.op_Implicit((Object)(object)component)) { component.material = NewMat("Unlit/Color", "Sprites/Default", "Legacy Shaders/Particles/Alpha Blended", "Standard"); component.material.color = new Color(0.4f, 0f, 0.6f, 0.6f); component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; } Spinner spinner2 = val7.AddComponent<Spinner>(); spinner2.axis = Vector3.forward; spinner2.degPerSecond = -30f; GameObject val8 = new GameObject("CursedPortalLight"); val8.transform.SetParent(val.transform, false); val8.transform.localPosition = Vector3.up * 0.6f; Light val9 = val8.AddComponent<Light>(); val9.type = (LightType)2; val9.range = num * 2f; val9.intensity = 1.2f; val9.color = new Color(0.8f, 0.4f, 1f); return val; } private static void SpawnFloatingCubes(Transform parent, Vector3 center, float totalW, float totalH, float y, int count, int seed) { //IL_003d: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(seed); for (int i = 0; i < count; i++) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = $"CursedAmbienceCube_{i}"; val.transform.SetParent(parent, true); float num = center.x - totalW * 0.5f + (float)random.NextDouble() * totalW; float num2 = center.z - totalH * 0.5f + (float)random.NextDouble() * totalH; val.transform.position = new Vector3(num, y + 0.5f, num2); val.transform.localScale = Vector3.one * Mathf.Lerp(0.3f, 0.6f, (float)random.NextDouble()); Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.material = NewMat("Unlit/Color", "Sprites/Default", "Standard"); bool flag = random.NextDouble() > 0.5; component.material.color = (flag ? new Color(0.95f, 0.1f, 0.1f, 1f) : new Color(0.1f, 0.95f, 0.1f, 1f)); component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; } Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>()); SlowDrift slowDrift = val.AddComponent<SlowDrift>(); slowDrift.boundsCenter = center; slowDrift.boundsSize = new Vector3(totalW, 0f, totalH); } } [IteratorStateMachine(typeof(<LoadOggClip>d__34))] private static IEnumerator LoadOggClip(string fileName, Action<AudioClip> onLoaded) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadOggClip>d__34(0) { fileName = fileName, onLoaded = onLoaded }; } } internal class MazeGenerator : MonoBehaviour { [CompilerGenerated] private sealed class <Neighbors4>d__27 : IEnumerable<Vector2Int>, IEnumerable, IEnumerator<Vector2Int>, IEnumerator, IDisposable { private int <>1__state; private Vector2Int <>2__current; private int <>l__initialThreadId; private Vector2Int c; public Vector2Int <>3__c; public MazeGenerator <>4__this; private Vector2Int[] <dirs>5__1; private Vector2Int[] <>s__2; private int <>s__3; private Vector2Int <d>5__4; private Vector2Int <n>5__5; Vector2Int IEnumerator<Vector2Int>.Current { [DebuggerHidden] get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <>2__current; } } [DebuggerHidden] public <Neighbors4>d__27(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <dirs>5__1 = null; <>s__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_002e: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0112; } <>1__state = -1; <dirs>5__1 = (Vector2Int[])(object)new Vector2Int[4] { new Vector2Int(1, 0), new Vector2Int(-1, 0), new Vector2Int(0, 1), new Vector2Int(0, -1) }; <>s__2 = <dirs>5__1; <>s__3 = 0; goto IL_0121; IL_0112: <>s__3++; goto IL_0121; IL_0121: if (<>s__3 < <>s__2.Length) { <d>5__4 = <>s__2[<>s__3]; <n>5__5 = new Vector2Int(((Vector2Int)(ref c)).x + ((Vector2Int)(ref <d>5__4)).x, ((Vector2Int)(ref c)).y + ((Vector2Int)(ref <d>5__4)).y); if (<>4__this.IsOpen(((Vector2Int)(ref <n>5__5)).x, ((Vector2Int)(ref <n>5__5)).y)) { <>2__current = <n>5__5; <>1__state = 1; return true; } goto IL_0112; } <>s__2 = null; 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(); } [DebuggerHidden] IEnumerator<Vector2Int> IEnumerable<Vector2Int>.GetEnumerator() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) <Neighbors4>d__27 <Neighbors4>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <Neighbors4>d__ = this; } else { <Neighbors4>d__ = new <Neighbors4>d__27(0) { <>4__this = <>4__this }; } <Neighbors4>d__.c = <>3__c; return <Neighbors4>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Vector2Int>)this).GetEnumerator(); } } public int width = 13; public int height = 13; public float cellSize = 3f; public float wallHeight = 3f; public float wallThickness = 0.25f; public float corridorBias = 0.7f; private bool[,] carved; private Vector2Int startCell; private Vector2Int exitCell; private Random rng; private Vector2Int lastDir = Vector2Int.zero; public int Width => width; public int Height => height; public float CellSize => cellSize; public void SetDeterministicSeed(int seed) { rng = new Random(seed); } public void GenerateMaze(Vector3 center) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (width % 2 == 0) { width++; } if (height % 2 == 0) { height++; } carved = new bool[width, height]; if (rng == null) { rng = new Random(Random.Range(0, int.MaxValue)); } Stack<Vector2Int> stack = new Stack<Vector2Int>(); Vector2Int val = default(Vector2Int); ((Vector2Int)(ref val))..ctor(1, 1); carved[((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y] = true; stack.Push(val); Vector2Int[] baseDirs = (Vector2Int[])(object)new Vector2Int[4] { new Vector2Int(2, 0), new Vector2Int(-2, 0), new Vector2Int(0, 2), new Vector2Int(0, -2) }; Vector2Int val3 = default(Vector2Int); while (stack.Count > 0) { val = stack.Pop(); Vector2Int[] array = BuildBiasedDirs(baseDirs, lastDir, corridorBias); bool flag = false; Vector2Int[] array2 = array; for (int i = 0; i < array2.Length; i++) { Vector2Int val2 = array2[i]; Vector2Int item = val + val2; if (((Vector2Int)(ref item)).x >= 1 && ((Vector2Int)(ref item)).x < width - 1 && ((Vector2Int)(ref item)).y >= 1 && ((Vector2Int)(ref item)).y < height - 1 && !carved[((Vector2Int)(ref item)).x, ((Vector2Int)(ref item)).y]) { ((Vector2Int)(ref val3))..ctor((((Vector2Int)(ref val)).x + ((Vector2Int)(ref item)).x) / 2, (((Vector2Int)(ref val)).y + ((Vector2Int)(ref item)).y) / 2); carved[((Vector2Int)(ref item)).x, ((Vector2Int)(ref item)).y] = true; carved[((Vector2Int)(ref val3)).x, ((Vector2Int)(ref val3)).y] = true; stack.Push(item); stack.Push(val); lastDir = new Vector2Int(Math.Sign(((Vector2Int)(ref val2)).x), Math.Sign(((Vector2Int)(ref val2)).y)); flag = true; break; } } if (!flag) { lastDir = Vector2Int.zero; } } startCell = new Vector2Int(1, 1); exitCell = new Vector2Int(width - 2, height - 2); ((Component)this).transform.position = center; BuildWalls(center); } private Vector2Int[] BuildBiasedDirs(Vector2Int[] baseDirs, Vector2Int last, float bias) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) List<Vector2Int> list = new List<Vector2Int>(baseDirs); for (int i = 0; i < list.Count; i++) { int num = rng.Next(i, list.Count); List<Vector2Int> list2 = list; int index = i; int index2 = num; Vector2Int value = list[num]; Vector2Int value2 = list[i]; list2[index] = value; list[index2] = value2; } if (last != Vector2Int.zero && rng.NextDouble() < (double)bias) { list.Sort(delegate(Vector2Int a, Vector2Int b) { int num2 = (((Mathf.Sign((float)((Vector2Int)(ref a)).x) == (float)((Vector2Int)(ref last)).x && ((Vector2Int)(ref last)).x != 0) || (Mathf.Sign((float)((Vector2Int)(ref a)).y) == (float)((Vector2Int)(ref last)).y && ((Vector2Int)(ref last)).y != 0)) ? (-1) : 0); int value3 = (((Mathf.Sign((float)((Vector2Int)(ref b)).x) == (float)((Vector2Int)(ref last)).x && ((Vector2Int)(ref last)).x != 0) || (Mathf.Sign((float)((Vector2Int)(ref b)).y) == (float)((Vector2Int)(ref last)).y && ((Vector2Int)(ref last)).y != 0)) ? (-1) : 0); return num2.CompareTo(value3); }); } return list.ToArray(); } private void BuildWalls(Vector3 center) { //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_0031: 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_008a: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (!carved[i, j]) { Vector3 val = CellToWorld(i, j, center); GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val2).name = $"CursedWall_{i}_{j}"; val2.transform.SetParent(((Component)this).transform, true); val2.transform.position = val + new Vector3(0f, wallHeight * 0.5f, 0f); val2.transform.localScale = new Vector3(cellSize - wallThickness, wallHeight, cellSize - wallThickness); Renderer component = val2.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { Shader val3 = Shader.Find("Standard"); component.material = new Material(val3); component.material.color = Color.black; component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; } } } } } private Vector3 CellToWorld(int x, int y, Vector3 center) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008d: Unknown result type (might be due to invalid IL or missing references) float num = (float)width * cellSize; float num2 = (float)height * cellSize; Vector3 val = center - new Vector3(num / 2f, 0f, num2 / 2f); float num3 = val.x + (float)x * cellSize + cellSize / 2f; float num4 = val.z + (float)y * cellSize + cellSize / 2f; return new Vector3(num3, center.y, num4); } public Vector3 GetCellCenter(int x, int y) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return CellToWorld(x, y, ((Component)this).transform.position); } public Vector3 GetStartPosition() { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) return GetCellCenter(((Vector2Int)(ref startCell)).x, ((Vector2Int)(ref startCell)).y) + Vector3.up * 0.5f; } public Vector3 GetExitPosition() { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) return GetCellCenter(((Vector2Int)(ref exitCell)).x, ((Vector2Int)(ref exitCell)).y) + Vector3.up * 0.5f; } public Vector2Int WorldToCell(Vector3 world) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) float num = (float)width * cellSize; float num2 = (float)height * cellSize; Vector3 val = ((Component)this).transform.position - new Vector3(num / 2f, 0f, num2 / 2f); int num3 = Mathf.Clamp(Mathf.FloorToInt((world.x - val.x) / cellSize), 0, width - 1); int num4 = Mathf.Clamp(Mathf.FloorToInt((world.z - val.z) / cellSize), 0, height - 1); return new Vector2Int(num3, num4); } public bool IsOpen(int x, int y) { return x >= 0 && x < width && y >= 0 && y < height && carved != null && carved[x, y]; } [IteratorStateMachine(typeof(<Neighbors4>d__27))] public IEnumerable<Vector2Int> Neighbors4(Vector2Int c) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Neighbors4>d__27(-2) { <>4__this = this, <>3__c = c }; } } internal class ExitTrigger : MonoBehaviour { private Action onExit; public void Setup(Action callback) { onExit = callback; } private void OnTriggerEnter(Collider other) { Type type = AccessTools.TypeByName("PlayerController"); if (type == null) { return; } Component val = null; object? obj = (AccessTools.Field(type, "instance") ?? AccessTools.Field(type, "Instance"))?.GetValue(null); Component val2 = (Component)((obj is Component) ? obj : null); if (val2 != null) { val = val2; } else { object? obj2 = (AccessTools.Property(type, "instance") ?? AccessTools.Property(type, "Instance"))?.GetValue(null, null); Component val3 = (Component)((obj2 is Component) ? obj2 : null); if (val3 != null) { val = val3; } } if ((Object)(object)val == (Object)null) { Object obj3 = Object.FindObjectOfType(type); val = (Component)(object)((obj3 is Component) ? obj3 : null); } if (!((Object)(object)val == (Object)null) && ((Object)(object)((Component)other).transform == (Object)(object)val.transform || ((Component)other).transform.IsChildOf(val.transform))) { onExit?.Invoke(); } } } } [BepInPlugin("Omniscye.Juice", "Juice", "1.0")] public class Juice : BaseUnityPlugin { internal static Juice Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace Empress.JuiceSynced { [BepInPlugin("empress.repo.juice.cursed.synced", "Empress Beetlejuice (Host-Synced)", "1.1.3")] public sealed class BeetlejuiceSyncedPlugin : BaseUnityPlugin { public const string PluginGuid = "empress.repo.juice.cursed.synced"; public const string PluginName = "Empress Beetlejuice (Host-Synced)"; public const string PluginVersion = "1.1.3"; internal static ManualLogSource Log; internal static ConfigEntry<float> PortalSpawnChanceCfg; private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PortalSpawnChanceCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Portal", "SpawnChance", 0.5f, new ConfigDescription("Chance that a cursed portal spawns when a level loads (0..1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); GameObject val = new GameObject("Empress_Beetlejuice_Host"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)52; val.AddComponent<BeetleEventRouter>(); val.AddComponent<PortalEventRouter>(); if ((Object)(object)CursedHostRunner.Instance == (Object)null) { GameObject val2 = new GameObject("CursedHostRunner"); Object.DontDestroyOnLoad((Object)(object)val2); CursedHostRunner.Instance = val2.AddComponent<CursedHostRunner>(); ((Object)val2).hideFlags = (HideFlags)61; } Log.LogInfo((object)"[Empress Beetlejuice (Host-Synced)] loaded."); } } public sealed class BeetleEventRouter : MonoBehaviourPunCallbacks, IOnEventCallback { public enum Ev : byte { StartCurse = 91, EndCurse, PlayerEscaped, ForceRestore } private bool _hooked; private void OnEnable() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; Unhook(); } private void OnSceneLoaded(Scene s, LoadSceneMode m) { if (PhotonNetwork.InRoom) { Hook(); } } public override void OnJoinedRoom() { Hook(); BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[BeetleRouter] Joined room, callbacks hooked."); } public override void OnLeftRoom() { Unhook(); BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[BeetleRouter] Left room, callbacks unhooked."); } private void Hook() { if (!_hooked && PhotonNetwork.NetworkingClient != null) { PhotonNetwork.AddCallbackTarget((object)this); _hooked = true; } } private void Unhook() { if (_hooked) { PhotonNetwork.RemoveCallbackTarget((object)this); _hooked = false; } } public static void Raise(Ev code, object payload, ReceiverGroup receivers) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { PhotonNetwork.RaiseEvent((byte)code, payload, new RaiseEventOptions { Receivers = receivers }, SendOptions.SendReliable); return; } try { switch (code) { case Ev.StartCurse: if (payload is object[] array && array.Length >= 2) { int seed = (int)array[0]; Vector3 centerFromHost = (Vector3)array[1]; CursedBeetlejuice.CurseManager.StartNetworked(seed, centerFromHost); } break; case Ev.EndCurse: CursedBeetlejuice.CurseManager.EndNetworked(); break; } } catch { } } public static void SendToActor(Ev code, object payload, int actorNumber) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady && actorNumber > 0) { RaiseEventOptions val = new RaiseEventOptions(); val.TargetActors = new int[1] { actorNumber }; PhotonNetwork.RaiseEvent((byte)code, payload, val, SendOptions.SendReliable); return; } try { if (code == Ev.StartCurse && payload is object[] array && array.Length >= 2) { int seed = (int)array[0]; Vector3 centerFromHost = (Vector3)array[1]; CursedBeetlejuice.CurseManager.StartNetworked(seed, centerFromHost); } } catch { } } public void OnEvent(EventData photonEvent) { //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_0081: Unknown result type (might be due to invalid IL or missing references) try { switch ((Ev)photonEvent.Code) { case Ev.StartCurse: if (photonEvent.CustomData is object[] array && array.Length >= 2) { int num = (int)array[0]; Vector3 centerFromHost = (Vector3)array[1]; BeetlejuiceSyncedPlugin.Log.LogInfo((object)$"[BeetleRouter] Received StartCurse event (seed: {num})"); CursedBeetlejuice.CurseManager.StartNetworked(num, centerFromHost); } break; case Ev.PlayerEscaped: if (PhotonNetwork.IsMasterClient) { BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[BeetleRouter] Player escaped, broadcasting end curse"); Raise(Ev.EndCurse, null, (ReceiverGroup)1); } break; case Ev.EndCurse: BeetlejuiceSyncedPlugin.Log.LogInfo((object)"[BeetleRouter] Received EndCurse event"); CursedBeetlejuice.CurseManager.EndNetworked(); break; case Ev.ForceRestore: if (PhotonNetwork.IsMasterClient) { Raise(Ev.EndCurse, null, (ReceiverGroup)1); } break; } } catch (Exception arg) { BeetlejuiceSyncedPlugin.Log.LogError((object)$"[BeetleRouter] OnEvent error: {arg}"); } } } public sealed class PortalEventRouter : MonoBehaviourPunCallbacks, IOnEventCallback { public enum Ev : byte { PortalCreate = 120, PortalEnter, PortalDestroy, PortalEnterSound } private class PortalState { public bool Closing; public float CloseAt; public int Seed; public HashSet<int> Entrants = new HashSet<int>(); } [CompilerGenerated] private sealed class <CloseAfterDelay>d__30 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string id; public float closeAt; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CloseAfterDelay>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (Time.unscaledTime < closeAt) { <>2__current = null; <>1__state = 1; return true; } LocalDestroy(id); Raise(Ev.PortalDestroy, id, (ReceiverGroup)0); HostStates.Remove(id); BeetlejuiceSyncedPlugin.Log.LogInfo((object)("[Portal] Closed " + id)); 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 <PlayCloseAndDestroy>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string id; public PortalEventRouter <>4__this; private GameObject <go>5__1; private AudioSource <src>5__2; private Exception <ex>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PlayCloseAndDestroy>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <go>5__1 = null; <src>5__2 = null; <ex>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (Active.TryGetValue(id, out <go>5__1) && (Object)(object)<go>5__1 != (Object)null) { <src>5__2 = FindOrCreateAudioSource(<go>5__1); if ((Object)(object)PortalAudioLoader.CloseClip != (Object)null && (Object)(object)<src>5__2 != (Object)null) { try { <src>5__2.PlayOneShot(PortalAudioLoader.CloseClip); } catch (Exception ex) { <ex>5__3 = ex; BeetlejuiceSyncedPlugin.Log.LogError((object)$"[Portal] PlayOneShot error: {<ex>5__3}"); } <>2__current = (object)new WaitForSeconds(PortalAudioLoader.CloseClip.length + 0.02f); <>1__state = 1; return true; } <src>5__2 = null; } LocalDestroy(id); return false; case 1: <>1__state = -1; LocalDestroy(id); 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 <WaitLevelThenSpawn>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PortalEventRouter <>4__this; private float <t>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitLevelThenSpawn>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; _spawnRoutineRunning = true; <t>5__1 = 0f; break; case 1: <>1__state = -1; break; } if (((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) && <t>5__1 < 20f) { <t>5__1 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } if (IsHostOrOffline() && !_spawnedThisScene) { <>4__this.HostSpawnPortal(); _spawnedThisScene = true; } _spawnRoutineRunning = 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 <_DelayedDestroy>d__27 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string id; public float delay; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <_DelayedDestroy>d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; LocalDestroy(id); 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 Dictionary<string, GameObject> Active = new Dictionary<string, GameObject>(); private static bool _spawnRoutineRunning; private static bool _spawnedThisScene; private static string _loadedSceneName; private bool _callbackHooked; private static readonly Dictionary<string, PortalState> HostStates = new Dictionary<string, PortalState>(); private const bool SkipStartRoom = true; private const float RushWindowSeconds = 0.35f; private void OnEnable() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; if (_callbackHooked) { PhotonNetwork.RemoveCallbackTarget((object)this); } _callbackHooked = false; _spawnRoutineRunning = false; _spawnedThisScene = false; Active.Clear(); HostStates.Clear(); } public override void OnJoinedRoom() { EnsureCallbackHooked(); } public override void OnLeftRoom() { if (_callbackHooked) { PhotonNetwork.RemoveCallbackTarget((object)this); _callbackHooked = false; } _spawnRoutineRunning = false; _spawnedThisScene = false; Active.Clear(); HostStates.Clear(); } private void EnsureCallbackHooked() { if (!_callbackHooked) { PhotonNetwork.AddCallbackTarget((object)this); _callbackHooked = true; } } private void OnSceneLoaded(Scene s, LoadSceneMode m) { _loadedSceneName = ((Scene)(ref s)).name ?? string.Empty; _spawnRoutineRunning = false; _spawnedThisScene = false; Active.Clear(); HostStates.Clear(); EnsureCallbackHooked(); if (PhotonNetwork.InRoom) { TrySpawnIfRealLevel(); } } private static bool IsHostOrOffline() { return !PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient; } private static bool IsHost() { return PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient; } private static bool IsOffline() { return !PhotonNetwork.InRoom; } private void TrySpawnIfRealLevel() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string text = ((Scene)(ref activeScene)).name ?? ""; if (text.IndexOf("Lobby", StringComparison.OrdinalIgnoreCase) < 0 && (PhotonNetwork.InRoom || !PhotonNetwork.IsConnected) && !_spawnRoutineRunning && !_spawnedThisScene) { ((MonoBehaviour)this).StartCoroutine(WaitLevelThenSpawn()); } } [IteratorStateMachine(typeof(<WaitLevelThenSpawn>d__20))] private IEnumerator WaitLevelThenSpawn() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitLevelThenSpawn>d__20(0) { <>4__this = this }; } private void HostSpawnPortal() { //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) try { float num = Mathf.Clamp01(BeetlejuiceSyncedPlugin.PortalSpawnChanceCfg?.Value ?? 0.5f); float value = Random.value; if (value > num) { BeetlejuiceSyncedPlugin.Log.LogInfo((object)$"[Portal] Skipping spawn this level (roll {value:F2} > chance {num:F2})."); return; } LevelGenerator instance = LevelGenerator.Instance; if ((Object)(object)instance == (Object)null || !instance.Generated) { return; } List<LevelPoint> list = ((instance.LevelPathPoints != null) ? instance.LevelPathPoints.Where((LevelPoint p) => (Object)(object)p != (Object)null).ToList() : new List<LevelPoint>()); if (list.Count == 0) { return; } if ((Object)(object)instance.LevelPathTruck != (Object)null) { Vector3 truckPos = ((Component)instance.LevelPathTruck).transform.position; list = list.OrderBy((LevelPoint p) => Vector3.Distance(truckPos, ((Component)p).transform.position)).Skip(Mathf.Min(3, list.Count - 1)).ToList(); if (list.Count == 0) { list = instance.LevelPathPoints.Where((LevelPoint p) => (Object)(object)p != (Object)null).ToList(); } } Random random = new Random((int)(DateTime.UtcNow.Ticks & 0x7FFFFFF)); LevelPoint val = list[random.Next(list.Count)]; Vector3 val2 = ((Component)val).transform.position + Vector3.up * 0.25f; Quaternion rotation = ((Component)val).transform.rotation; string text = Guid.NewGuid().ToString("N"); CreateLocalPortal(text, val2, rotation); Raise(Ev.PortalCreate, new object[3] { text, val2, rotation }, (ReceiverGroup)0); BeetlejuiceSyncedPlugin.Log.LogInfo((object)$"[Portal] Spawned portal {text} at {val2}"); } catch (Exception arg) { BeetlejuiceSyncedPlugin.Log.LogError((object)$"[Portal] HostSpawnPortal error: {arg}"); } } public static void Raise(Ev code, object payload, ReceiverGroup receivers) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_014d: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { PhotonNetwork.RaiseEvent((byte)code, payload, new RaiseEventOptions { Receivers = receivers }, SendOptions.SendReliable); return; } try { switch (code) { case Ev.PortalCreate: if (payload is object[] array2 && array2.Length >= 3) { string id3 = array2[0] as string; Vector3 pos = (Vector3)array2[1]; Quaternion rot = (Quaternion)array2[2]; CreateLocalPortal(id3, pos, rot); } break; case Ev.PortalDestroy: { string id2 = payload as string; _LocalPlayCloseAndDestroyOffline(id2); break; } case Ev.PortalEnter: if (payload is object[] array3 && array3.Length >= 3) { string id4 = array3[0] as string; Vector3 at2 = (Vector3)array3[1]; int actor = (int)array3[2]; HostResolveEnter(id4, at2, actor); } break; case Ev.PortalEnterSound: if (payload is object[] array && array.Length >= 2) { string id = array[0] as string; Vector3 at = (Vector3)array[1]; PlayEnterSoundLocal(id, at); } break; } } catch { } } public void OnEvent(EventData photonEvent) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_017f: 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_007d: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) try { switch ((Ev)photonEvent.Code) { case Ev.PortalCreate: if (photonEvent.CustomData is object[] array3 && array3.Length >= 3) { string id3 = array3[0] as string; Vector3 pos = (Vector3)array3[1]; Quaternion rot = (Quaternion)array3[2]; if (!IsHost()) { CreateLocalPortal(id3, pos, rot); } } break; case Ev.PortalEnter: if (IsHostOrOffline() && photonEvent.CustomData is object[] array2 && array2.Length >= 3) { string id2 = array2[0] as string; Vector3 at2 = (Vector3)array2[1]; int actor = ((array2.Length >= 3) ? ((int)array2[2]) : photonEvent.Sender); HostResolveEnter(id2, at2, actor); } break; case Ev.PortalDestroy: { string id4 = photonEvent.CustomData as string; if ((Object)(object)CursedHostRunner.Instance != (Object)null) { ((MonoBehaviour)CursedHostRunner.Instance).StartCoroutine(PlayCloseAndDestroy(id4)); } else { LocalDestroy(id4); } break; } case Ev.PortalEnterSound: if (photonEvent.CustomData is object[] array && array.Length >= 2) { string id = array[0] as string; Vector3 at = (Vector3)array[1]; PlayEnterSoundLocal(id, at); } break; } } catch (Exception arg) { BeetlejuiceSyncedPlugin.Log.LogError((object)$"[Portal] OnEvent error: {arg}"); } } private static void CreateLocalPortal(string id, Vector3 pos, Quaternion rot) { //IL_0018: 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_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_002d: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) try { if (!Active.ContainsKey(id)) { Vector3 val = pos + Vector3.up * 0.8f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 10f, -1, (QueryTriggerInteraction)1)) { val = ((RaycastHit)(ref val2)).point + Vector3.up * 0.05f; rot = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val2)).normal) * rot; } GameObject val3 = new GameObject("EmpressPortal_" + id); val3.transform.position = val; val3.transform.rotation = rot; Rigidbody val4 = val3.AddComponent<Rigidbody>(); val4.useGravity = false; val4.isKinematic = true; val4.collisionDetectionMode = (CollisionDetectionMode)0; val4.interpolation = (RigidbodyInterpolation)0; PortalVisualBinder portalVisualBinder = val3.AddComponent<PortalVisualBinder>(); portalVisualBinder.Id = id; GameObject val5 = new GameObject("EnterTrigger"); val5.transform.SetParent(val3.transform, false); CapsuleCollider val6 = val5.AddComponent<CapsuleCollider>(); val6.direction = 1; val6.radius = 0.7f; val6.height = 2.3f; val6.center = new Vector3(0f, 1.15f, 0f); ((Collider)val6).isTrigger = true; MazePortal mazePortal = val3.AddComponent<MazePortal>(); mazePortal.Id = id; Active[id] = val3; if ((Object)(object)CursedHostRunner.Instance != (Object)null) { ((MonoBehaviour)CursedHostRunner.Instance).StartCoroutine(PortalAudioLoader.EnsureLoadedCoroutine()); } } } catch (Exception arg) { BeetlejuiceSyncedPlugin.Log.LogError((object)$"[Portal] CreateLocalPortal error: {arg}"); } } internal static void LocalDestroy(string id) { try { if (!string.IsNullOrEmpty(id)) { if (Active.TryGetValue(id, out GameObject value) && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } Active.Remove(id); } } catch { } } private static void _LocalPlayCloseAndDestroyOffline(string id) { try { if (!Active.TryGetValue(id, out GameObject value) || !((Object)(object)value != (Object)null)) { return; } AudioSource val = FindOrCreateAudioSource(value); if ((Object)(object)PortalAudioLoader.CloseClip != (Object)null) { val.PlayOneShot(PortalAudioLoader.CloseClip); float length = PortalAudioLoader.CloseClip.length; if ((Object)(object)CursedHostRunner.Instance != (Object)null) { ((MonoBehaviour)CursedHostRunner.Instance).StartCoroutine(_DelayedDestroy(id, length + 0.05f)); } else { Object.Destroy((Object)(object)value); } } else { Object.Destroy((Object)(object)value); } } catch { } } [IteratorStateMachine(typeof(<_DelayedDestroy>d__27))] p