Decompiled source of Woodz Warper v1.0.0

woodzwarper.dll

Decompiled 11 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Reptile;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("woodzwarper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Seamless Teleport")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("woodzwarper")]
[assembly: AssemblyTitle("woodzwarper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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 woodzwarper
{
	[BepInPlugin("info.mariobluegloves.warperp", "Warper", "0.0.1")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	public class WarperPlugin : BaseUnityPlugin
	{
		private class PlayerTriggerHandler : MonoBehaviour
		{
			private WarperPlugin plugin;

			private Transform warpto;

			private Transform warpfrom;

			private Vector3 positionDifference;

			private Quaternion rotationDifference;

			public void Initialize(WarperPlugin plugin, Transform warpto, Transform warpfrom)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: 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_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: 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_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_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				this.plugin = plugin;
				this.warpto = warpto;
				this.warpfrom = warpfrom;
				Vector3 position = warpto.position;
				Quaternion rotation = warpto.rotation;
				Vector3 position2 = warpfrom.position;
				Quaternion rotation2 = warpfrom.rotation;
				positionDifference = position - position2;
				rotationDifference = rotation * Quaternion.Inverse(rotation2);
				Vector3 val = positionDifference;
				Debug.Log((object)("Position Difference: " + ((object)(Vector3)(ref val)).ToString()));
				Quaternion val2 = rotationDifference;
				Debug.Log((object)("Rotation Difference: " + ((object)(Quaternion)(ref val2)).ToString()));
			}

			private void OnTriggerEnter(Collider other)
			{
				if (((Object)((Component)other).gameObject).name == "seamlesswarp")
				{
					ApplyWarp();
				}
				if (((Object)((Component)other).gameObject).name == "seamlesswarp2")
				{
					ApplyWarp2();
				}
			}

			private void ApplyWarp()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: 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_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: 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)
				Player componentInParent = ((Component)((Component)this).transform).GetComponentInParent<Player>();
				componentInParent.SetRotation(rotationDifference * ((Component)this).transform.rotation);
				((Component)this).transform.position = warpto.position + rotationDifference * (((Component)this).transform.position - warpfrom.position);
			}

			private void ApplyWarp2()
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: 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_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				Player componentInParent = ((Component)((Component)this).transform).GetComponentInParent<Player>();
				componentInParent.SetRotation(Quaternion.Inverse(rotationDifference) * ((Component)this).transform.rotation);
				((Component)this).transform.position = warpfrom.position + Quaternion.Inverse(rotationDifference) * (((Component)this).transform.position - warpto.position);
			}
		}

		private Transform warpto;

		private Transform warpfrom;

		private bool sceneLoaded = false;

		private Vector3 positionDifference;

		private Quaternion rotationDifference;

		private Vector3 positionDifference2;

		private Quaternion rotationDifference2;

		private void Awake()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			sceneLoaded = true;
		}

		private void Update()
		{
			if (sceneLoaded)
			{
				GameObject val = GameObject.Find("Player_HUMAN0");
				GameObject obj = GameObject.Find("WarpTo");
				warpto = ((obj != null) ? obj.transform : null);
				GameObject obj2 = GameObject.Find("WarpFrom");
				warpfrom = ((obj2 != null) ? obj2.transform : null);
				if ((Object)(object)warpto != (Object)null && (Object)(object)warpfrom != (Object)null && (Object)(object)val != (Object)null)
				{
					PlayerTriggerHandler playerTriggerHandler = val.AddComponent<PlayerTriggerHandler>();
					playerTriggerHandler.Initialize(this, warpto, warpfrom);
					sceneLoaded = false;
				}
			}
		}
	}
}