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 GameNetcodeStuff;
using HarmonyLib;
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("BetterInverseTeleporter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Take your items with you while teleporting into the facility.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2931884825f83dc2ab8f3c8bc51e5d16263afaff")]
[assembly: AssemblyProduct("BetterInverseTeleporter")]
[assembly: AssemblyTitle("BetterInverseTeleporter")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace bit
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "BetterInverseTeleporter";
public const string PLUGIN_NAME = "BetterInverseTeleporter";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Bit
{
[BepInPlugin("portable-navi.bit", "BetterInverseTeleporter", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string mod_name = "BetterInverseTeleporter";
public const string mod_guid = "portable-navi.bit";
public const string mod_version = "1.0.0";
private readonly Harmony _patcher = new Harmony("portable-navi.bit");
private static Plugin _instance;
private ManualLogSource _log;
public static Plugin instance => _instance;
public Harmony patcher => _patcher;
public ManualLogSource log => _log;
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
_log = Logger.CreateLogSource("portable-navi.bit");
_patcher.PatchAll();
log.LogInfo((object)"Patch applied!");
}
}
}
namespace Bit.patches
{
[HarmonyPatch]
internal class Bit
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ShipTeleporter), "TeleportPlayerOutWithInverseTeleporter")]
public static bool teleport(int playerObj, ref Vector3 teleportPos, ShipTeleporter __instance)
{
//IL_005a: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
MethodInfo method = typeof(ShipTeleporter).GetMethod("teleportBodyOut", BindingFlags.Instance | BindingFlags.NonPublic);
MethodInfo method2 = typeof(ShipTeleporter).GetMethod("SetPlayerTeleporterId", BindingFlags.Instance | BindingFlags.NonPublic);
if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead)
{
((MonoBehaviour)__instance).StartCoroutine((IEnumerator)method.Invoke(__instance, new object[2] { playerObj, teleportPos }));
return false;
}
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj];
method2.Invoke(__instance, new object[2] { val, -1 });
if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
{
Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val);
}
val.isInElevator = false;
val.isInHangarShipRoom = false;
val.isInsideFactory = true;
val.averageVelocity = 0f;
val.velocityLastFrame = Vector3.zero;
StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true);
StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
__instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
StartOfRound.Instance.allPlayerScripts[playerObj].movementAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
return false;
}
}
}