Decompiled source of Teleport v1.0.3

Teleport.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Teleport")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Teleport")]
[assembly: AssemblyTitle("Teleport")]
[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 Teleport
{
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("HLin-Teleport", "Teleport", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0015: 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_0058: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Teleport Successfully!");
			Harmony val = new Harmony("HLin-Teleport");
			MethodInfo methodInfo = AccessTools.Method(typeof(FVRMovementManager), "FindValidPointCurved", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Plugin), "FindValidPointCurved_MyPatch", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static bool FindValidPointCurved_MyPatch(FVRMovementManager __instance, ref Vector3 __result, Vector3 castOrigin, Vector3 castDir, float initialVel)
		{
			//IL_000e: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			//IL_0036: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_00b6: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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)
			float num = 5000f;
			__instance.m_hasValidPoint = false;
			__result = Vector3.zero;
			Vector3 val = castDir * initialVel * num;
			float num2 = 1f / ((Component)GM.CurrentPlayerBody).transform.localScale.x;
			if (Physics.Raycast(castOrigin, val, ref __instance.m_hit_ray, num, LayerMask.op_Implicit(__instance.LM_TeleCast)) && !((Component)((RaycastHit)(ref __instance.m_hit_ray)).transform).gameObject.CompareTag("NoTeleport"))
			{
				__instance.m_hasValidPoint = true;
				__result = ((RaycastHit)(ref __instance.m_hit_ray)).point;
				for (int i = 0; i < 3; i++)
				{
					((Component)__instance.Cylinders[i]).gameObject.SetActive(true);
					__instance.Cylinders[i].position = castOrigin;
					__instance.Cylinders[i].rotation = Quaternion.LookRotation(val);
					__instance.Cylinders[i].localScale = new Vector3(0.1f, 0.1f, ((RaycastHit)(ref __instance.m_hit_ray)).distance) * num2;
				}
			}
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Teleport";

		public const string PLUGIN_NAME = "Teleport";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}