using System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Microsoft.CodeAnalysis; using UnityEngine; [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: AssemblyCompany("PortalMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Portal Mod for Big Walk")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PortalMod")] [assembly: AssemblyTitle("PortalMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PortalMod { [BepInPlugin("com.gogogadgetjustice.portalmod", "Portal Mod", "1.0.0")] public class PortalModBase : BasePlugin { public static ManualLogSource InstanceLogger; public override void Load() { InstanceLogger = ((BasePlugin)this).Log; InstanceLogger.LogInfo((object)"[PortalMod] High-Efficiency Engine Initializing..."); ClassInjector.RegisterTypeInIl2Cpp(); ((BasePlugin)this).AddComponent(); } } public class PortalEcoManager : MonoBehaviour { private GameObject portalOrange; private GameObject portalBlue; private Camera cachedCamera; private float globalCooldown = 0f; private bool isScanning = false; public PortalEcoManager(IntPtr ptr) : base(ptr) { } private void Start() { MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)this, LowFrequencyProximityCheck()); } private void Update() { //IL_0048: 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) if (globalCooldown > 0f) { globalCooldown -= Time.deltaTime; } if (Input.GetKeyDown((KeyCode)53)) { DropPortal(ref portalOrange, new Color(1f, 0.4f, 0f), "Orange_Light"); } if (Input.GetKeyDown((KeyCode)54)) { DropPortal(ref portalBlue, new Color(0f, 0.5f, 1f), "Blue_Light"); } } private IEnumerator LowFrequencyProximityCheck() { while (true) { if (globalCooldown <= 0f && (Object)(object)portalOrange != (Object)null && (Object)(object)portalBlue != (Object)null && Input.GetKey((KeyCode)32)) { Vector3 standingPos = GetFloorPositionBeneathCamera(); if (standingPos != Vector3.zero) { if (Vector3.Distance(standingPos, portalOrange.transform.position) < 1.6f) { TeleportPlayerAndHeldItems(portalOrange.transform.position, portalBlue.transform.position); globalCooldown = 3f; } else if (Vector3.Distance(standingPos, portalBlue.transform.position) < 1.6f) { TeleportPlayerAndHeldItems(portalBlue.transform.position, portalOrange.transform.position); globalCooldown = 3f; } } } yield return (object)new WaitForSeconds(0.1f); } } private Vector3 GetFloorPositionBeneathCamera() { //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_0043: 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_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedCamera == (Object)null) { cachedCamera = Camera.main ?? Camera.current; } if ((Object)(object)cachedCamera != (Object)null) { return ((Component)cachedCamera).transform.position + new Vector3(0f, -1.1f, 0f); } return Vector3.zero; } private void DropPortal(ref GameObject portalRef, Color glowColor, string lightName) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0009: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Vector3 floorPositionBeneathCamera = GetFloorPositionBeneathCamera(); if (!(floorPositionBeneathCamera == Vector3.zero)) { if ((Object)(object)portalRef != (Object)null) { Object.Destroy((Object)(object)portalRef); } portalRef = GameObject.CreatePrimitive((PrimitiveType)2); portalRef.transform.position = floorPositionBeneathCamera; portalRef.transform.localScale = new Vector3(2.2f, 0.04f, 2.2f); portalRef.GetComponent().material.color = glowColor; Object.Destroy((Object)(object)portalRef.GetComponent()); GameObject val = new GameObject(lightName); val.transform.position = floorPositionBeneathCamera + new Vector3(0f, 0.5f, 0f); val.transform.SetParent(portalRef.transform); Light val2 = ((Il2CppObjectBase)val.AddComponent(Il2CppType.Of())).Cast(); val2.type = (LightType)2; val2.color = glowColor; val2.range = 5f; val2.intensity = 2.5f; val2.renderMode = (LightRenderMode)2; } } private void TeleportPlayerAndHeldItems(Vector3 sourcePortalPos, Vector3 targetDestination) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_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_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedCamera == (Object)null) { return; } Vector3 position = ((Component)cachedCamera).transform.position; Collider[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(position, 3f)); GameObject val = null; Collider[] array2 = array; foreach (Collider val2 in array2) { if (((Object)(object)((Component)val2).GetComponent() != (Object)null || (Object)(object)((Component)val2).GetComponent() != (Object)null) && !((Object)((Component)val2).gameObject).name.Contains("Cylinder") && !((Object)((Component)val2).gameObject).name.ToLower().Contains("camera")) { val = ((Component)val2).gameObject; break; } } if ((Object)(object)val == (Object)null) { Transform val3 = ((Component)cachedCamera).transform; while ((Object)(object)val3.parent != (Object)null) { val3 = val3.parent; } val = ((Component)val3).gameObject; } try { Vector3 val4 = targetDestination + new Vector3(0f, 0.8f, 0f); Collider[] array3 = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(sourcePortalPos, 2f)); Collider[] array4 = array3; foreach (Collider val5 in array4) { GameObject gameObject = ((Component)val5).gameObject; if (!((Object)(object)gameObject == (Object)(object)val) && !((Object)gameObject).name.Contains("Cylinder")) { Rigidbody component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.position = val4 + new Vector3(0f, 0.2f, 0f); component.linearVelocity = Vector3.zero; gameObject.transform.position = val4 + new Vector3(0f, 0.2f, 0f); } } } CharacterController val6 = val.GetComponent() ?? val.GetComponentInChildren(); if ((Object)(object)val6 != (Object)null) { ((Collider)val6).enabled = false; } Rigidbody val7 = val.GetComponent() ?? val.GetComponentInChildren(); if ((Object)(object)val7 != (Object)null) { val7.position = val4; val7.linearVelocity = Vector3.zero; val7.angularVelocity = Vector3.zero; } val.transform.position = val4; if ((Object)(object)val6 != (Object)null) { ((Collider)val6).enabled = true; } } catch (Exception ex) { PortalModBase.InstanceLogger.LogError((object)("[PortalMod] Optimization safe-warp bypass: " + ex.Message)); } } } }