using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using ExitGames.Client.Photon; using Photon.Pun; using Photon.Realtime; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("sonic")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("sonic")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("98f6da0c-f28e-4d99-a81d-92f0e99ae946")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.feralelf.freecam.hybrid", "UniversalFreeCam", "1.4.0")] public class FreeCamPlugin : BaseUnityPlugin { private GameObject ghostCamObj; private Camera ghostCam; private Camera originalCam; private bool isFreeCamActive = false; private float moveSpeed = 15f; private float lookSensitivity = 2f; private float rotX = 0f; private float rotY = 0f; private const string STASIS_KEY = "GlobalStasis"; private void Update() { if (Input.GetKeyDown((KeyCode)283)) { if (IsInRoom() && !PhotonNetwork.IsMasterClient) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"You are not the Host."); return; } isFreeCamActive = !isFreeCamActive; if (IsInRoom()) { SetNetworkStasis(isFreeCamActive); } if (isFreeCamActive) { StartFreeCam(); } else { StopFreeCam(); } } if (IsInRoom()) { ApplyNetworkTime(); } else { Time.timeScale = (isFreeCamActive ? 0f : 1f); } if (isFreeCamActive && (Object)(object)ghostCamObj != (Object)null) { HandleFreeCam(); } } private bool IsInRoom() { return PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null && ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties != null; } private void SetNetworkStasis(bool active) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Hashtable val = new Hashtable(); val[(object)"GlobalStasis"] = active; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } private void ApplyNetworkTime() { if (!((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"GlobalStasis", out object value) || !(value is bool)) { return; } bool flag = (bool)value; if (true) { float num = (flag ? 0.0001f : 1f); if (Time.timeScale != num) { Time.timeScale = num; } } } private void StartFreeCam() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) originalCam = Camera.main; if (!((Object)(object)originalCam == (Object)null)) { ghostCamObj = new GameObject("GhostCameraObj"); ghostCam = ghostCamObj.AddComponent(); ghostCam.CopyFrom(originalCam); ghostCam.depth = originalCam.depth + 1f; ghostCamObj.transform.position = ((Component)originalCam).transform.position; ghostCamObj.transform.rotation = ((Component)originalCam).transform.rotation; Vector3 eulerAngles = ((Component)originalCam).transform.eulerAngles; rotX = eulerAngles.y; rotY = 0f - eulerAngles.x; ((Behaviour)originalCam).enabled = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Stasis Active."); } } private void HandleFreeCam() { //IL_0075: 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_0091: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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) rotX += Input.GetAxisRaw("Mouse X") * lookSensitivity; rotY += Input.GetAxisRaw("Mouse Y") * lookSensitivity; rotY = Mathf.Clamp(rotY, -90f, 90f); ghostCamObj.transform.rotation = Quaternion.Euler(0f - rotY, rotX, 0f); Vector3 val = Vector3.zero; if (Input.GetKey((KeyCode)119)) { val += ghostCamObj.transform.forward; } if (Input.GetKey((KeyCode)115)) { val -= ghostCamObj.transform.forward; } if (Input.GetKey((KeyCode)97)) { val -= ghostCamObj.transform.right; } if (Input.GetKey((KeyCode)100)) { val += ghostCamObj.transform.right; } if (Input.GetKey((KeyCode)32)) { val += Vector3.up; } if (Input.GetKey((KeyCode)306)) { val -= Vector3.up; } Transform transform = ghostCamObj.transform; transform.position += ((Vector3)(ref val)).normalized * moveSpeed * Time.unscaledDeltaTime; } private void StopFreeCam() { if ((Object)(object)originalCam != (Object)null) { ((Behaviour)originalCam).enabled = true; } if ((Object)(object)ghostCamObj != (Object)null) { Object.Destroy((Object)(object)ghostCamObj); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Stasis Deactivated."); } private void OnDisable() { if (IsInRoom() && PhotonNetwork.IsMasterClient) { SetNetworkStasis(active: false); } Time.timeScale = 1f; } }