using System; using System.Collections.Generic; 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.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.UnityEngine; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Microsoft.CodeAnalysis; using Mirror; 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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.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 TeleportToPlayer { [BepInPlugin("YonahG0y.bigwalk.teleporttoplayer", "Teleport To Player", "0.2.0")] public class Plugin : BasePlugin { public static Plugin Instance; public static ConfigEntry Cooldown; public static ConfigEntry TeleportKey; public static ConfigEntry DropHeight; public static ConfigEntry DropSpeed; public override void Load() { Instance = this; Cooldown = ((BasePlugin)this).Config.Bind("General", "Cooldown", 900f, "Seconds between teleports."); TeleportKey = ((BasePlugin)this).Config.Bind("General", "TeleportKey", (KeyCode)112, "Key that triggers the teleport."); DropHeight = ((BasePlugin)this).Config.Bind("General", "DropHeight", 3f, "Height above the target to drop in from."); DropSpeed = ((BasePlugin)this).Config.Bind("General", "DropSpeed", 100f, "Downward speed on arrival."); ((BasePlugin)this).AddComponent(); ((BasePlugin)this).Log.LogInfo((object)"[TPF] Loaded."); } } public class TpfBehaviour : MonoBehaviour { private const float ReturnCooldown = 300f; private const float ReturnWindow = 30f; private bool _keyWasHeld; private float _nextAllowedTime; private bool _hasPendingReturn; private float _returnExpiresAt; private Vector3 _returnPosition; private Quaternion _returnRotation; public TpfBehaviour(IntPtr ptr) : base(ptr) { } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) bool keyInt = Input.GetKeyInt((KeyCode)Plugin.TeleportKey.Value); if (keyInt && !_keyWasHeld) { TryTeleport(); } _keyWasHeld = keyInt; } private void TryTeleport() { //IL_00a8: 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_00e3: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Expected O, but got Unknown //IL_02a6: 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_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) Il2CppArrayBase val = Object.FindObjectsByType((FindObjectsSortMode)0); PlayerCharacter val2 = null; foreach (PlayerCharacter item in val) { if (((NetworkBehaviour)item).isLocalPlayer) { val2 = item; break; } } if ((Object)(object)val2 == (Object)null) { ((BasePlugin)Plugin.Instance).Log.LogInfo((object)"[TPF] abort: local player not identified"); return; } bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3; if (_hasPendingReturn) { _hasPendingReturn = false; if (Time.realtimeSinceStartup <= _returnExpiresAt) { val2.grease.Teleport(_returnPosition, _returnRotation, true); _nextAllowedTime = Time.realtimeSinceStartup + 300f; ManualLogSource log = ((BasePlugin)Plugin.Instance).Log; val3 = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[TPF] returned to "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(_returnPosition); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", cooldown 5m"); } log.LogInfo(val3); return; } ((BasePlugin)Plugin.Instance).Log.LogInfo((object)"[TPF] return window expired, falling through to normal teleport"); } if (Time.realtimeSinceStartup < _nextAllowedTime) { int value = Mathf.CeilToInt((_nextAllowedTime - Time.realtimeSinceStartup) / 60f); val2.texter.DisplayMessage($"My teleport is on a {value}m cooldown"); ((BasePlugin)Plugin.Instance).Log.LogInfo((object)"[TPF] abort: cooldown active"); return; } List list = new List(); foreach (PlayerCharacter item2 in val) { if ((Object)(object)item2 != (Object)(object)val2) { list.Add(item2); } } if (list.Count == 0) { ((BasePlugin)Plugin.Instance).Log.LogInfo((object)"[TPF] abort: no other players present"); return; } PlayerCharacter val4 = list[Random.Range(0, list.Count)]; Vector3 position = ((Component)val4).transform.position; float value2 = Plugin.DropHeight.Value; RaycastHit val5 = default(RaycastHit); Vector3 val6; if (Physics.SphereCast(position, 0.5f, Vector3.up, ref val5, value2)) { float num = ((RaycastHit)(ref val5)).distance - 0.6f; val6 = ((num < 0.5f) ? position : (position + Vector3.up * num)); } else { val6 = position + Vector3.up * value2; } _returnPosition = ((Component)val2).transform.position; _returnRotation = ((Component)val2).transform.rotation; _hasPendingReturn = true; _returnExpiresAt = Time.realtimeSinceStartup + 30f; val2.grease.Teleport(val6, ((Component)val2).transform.rotation, true); val2.rb.linearVelocity = Vector3.down * Plugin.DropSpeed.Value; _nextAllowedTime = Time.realtimeSinceStartup + Plugin.Cooldown.Value; ManualLogSource log2 = ((BasePlugin)Plugin.Instance).Log; val3 = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[TPF] teleported above "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(((Object)val4).name); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val6); } log2.LogInfo(val3); ((BasePlugin)Plugin.Instance).Log.LogInfo((object)"[TPF] remote appearance unverified: HouseNetworkTransform exposes no confirmed teleport-snap method, relying on its normal per-frame sync"); } } }