Decompiled source of OmniValuables v1.1.1

Omni.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Omni")]
[assembly: AssemblyTitle("Omni")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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;
		}
	}
}
public class ChasingSkullValuable : Trap
{
	[Header("Chase Settings")]
	public float forceStrength = 50f;

	public float maxSpeed = 15f;

	public float detectionRange = 30f;

	public float playerKnockbackForce = 25f;

	[Header("Physics")]
	public Rigidbody rb;

	private PlayerAvatar targetPlayer;

	public override void Start()
	{
		((Trap)this).Start();
		if ((Object)(object)rb == (Object)null)
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
		}
	}

	public override void Update()
	{
		((Trap)this).Update();
		if (!base.physGrabObject.grabbed)
		{
			FindPlayerTarget();
			ChaseTarget();
		}
		else
		{
			targetPlayer = null;
		}
	}

	private void FindPlayerTarget()
	{
		//IL_005f: 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)
		if ((Object)(object)targetPlayer != (Object)null && !targetPlayer.isDisabled)
		{
			return;
		}
		float num = detectionRange;
		PlayerAvatar val = null;
		foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
		{
			if (!item.isDisabled)
			{
				float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position);
				if (num2 < num)
				{
					num = num2;
					val = item;
				}
			}
		}
		targetPlayer = val;
	}

	private void ChaseTarget()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)targetPlayer == (Object)null) && !targetPlayer.isDisabled)
		{
			Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = rb.velocity;
			if (((Vector3)(ref val)).magnitude < maxSpeed)
			{
				rb.AddForce(normalized * forceStrength, (ForceMode)5);
			}
		}
	}

	private void OnCollisionEnter(Collision collision)
	{
		//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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			PlayerAvatar componentInParent = ((Component)collision.collider).GetComponentInParent<PlayerAvatar>();
			if ((Object)(object)componentInParent != (Object)null && !componentInParent.isDisabled)
			{
				componentInParent.tumble.TumbleRequest(true, false);
				Vector3 val = ((Component)componentInParent).transform.position - ((Component)this).transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				componentInParent.tumble.TumbleForce(normalized * playerKnockbackForce);
				componentInParent.tumble.TumbleOverrideTime(1.5f);
			}
		}
	}
}
public class CoasterSeatCarrier : MonoBehaviour
{
	[Tooltip("Child under the cart where the player sits (must be parented)")]
	public Transform seatPoint;

	[Header("Grab & Follow Settings")]
	[Tooltip("How close the player must be to latch on")]
	public float grabDistance = 1f;

	[Tooltip("Spring stiffness for position follow")]
	public float positionStiffness = 10f;

	[Tooltip("Spring stiffness for rotation follow")]
	public float rotationStiffness = 0.2f;

	private PlayerAvatar playerTarget;

	private void FixedUpdate()
	{
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)playerTarget == (Object)null)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance))
				{
					continue;
				}
				playerTarget = item;
				break;
			}
		}
		if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled)
		{
			Rigidbody rb = playerTarget.tumble.rb;
			if (!playerTarget.tumble.isTumbling)
			{
				playerTarget.tumble.TumbleRequest(true, false);
			}
			playerTarget.tumble.TumbleOverrideTime(1f);
			playerTarget.FallDamageResetSet(0.1f);
			Vector3 val = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, rb.velocity, positionStiffness);
			rb.AddForce(val * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1);
			Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, rb, rotationStiffness);
			rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1);
		}
	}
}
public class CursedBlackHoleOrbValuable : Trap
{
	[Header("Black Hole Settings")]
	public float blackHoleRange = 20f;

	public float pullForce = 100f;

	public override void Update()
	{
		((Trap)this).Update();
		if (base.physGrabObject.grabbed && SemiFunc.IsMasterClientOrSingleplayer())
		{
			ApplyContinuousPull();
		}
	}

	private void ApplyContinuousPull()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: 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_010e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = ((Component)this).transform.position;
		foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
		{
			bool flag = false;
			foreach (PhysGrabber item2 in base.physGrabObject.playerGrabbing)
			{
				if ((Object)(object)item2.playerAvatar == (Object)(object)item)
				{
					flag = true;
					break;
				}
			}
			if (!flag && !item.isDisabled)
			{
				float num = Vector3.Distance(position, ((Component)item).transform.position);
				if (num <= blackHoleRange)
				{
					Vector3 val = position - ((Component)item).transform.position;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					item.tumble.TumbleRequest(true, false);
					float num2 = Mathf.Clamp01(1f - num / blackHoleRange);
					float num3 = pullForce * num2;
					item.tumble.TumbleForce(normalized * num3);
					item.tumble.TumbleOverrideTime(0.2f);
				}
			}
		}
	}
}
public class CursedRollerValuable : MonoBehaviour
{
	[Header("Patrol Settings")]
	public float moveForce = 15f;

	public float rotationForce = 5f;

	public float wanderInterval = 5f;

	public float wanderRadius = 10f;

	[Header("Coaster Settings")]
	public Transform seatPoint;

	public float grabDistance = 1f;

	public float positionStiffness = 10f;

	public float rotationStiffness = 0.2f;

	public float latchDuration = 5f;

	public float tossForce = 30f;

	public float regrabCooldown = 5f;

	private PlayerAvatar playerTarget;

	private Rigidbody rb;

	private float wanderTimer = 0f;

	private Vector3 randomWanderTarget;

	private float latchTimer = 0f;

	private float regrabTimer = 0f;

	private void Start()
	{
		rb = ((Component)this).GetComponent<Rigidbody>();
		SetRandomWanderTarget();
	}

	private void FixedUpdate()
	{
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		if (!SemiFunc.IsMasterClientOrSingleplayer())
		{
			return;
		}
		if (regrabTimer > 0f)
		{
			regrabTimer -= Time.fixedDeltaTime;
		}
		if ((Object)(object)playerTarget == (Object)null && regrabTimer <= 0f)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance))
				{
					continue;
				}
				playerTarget = item;
				latchTimer = 0f;
				break;
			}
		}
		if ((Object)(object)playerTarget != (Object)null)
		{
			CarryPlayer();
			latchTimer += Time.fixedDeltaTime;
			if (latchTimer >= latchDuration)
			{
				TossPlayer();
				playerTarget = null;
				latchTimer = 0f;
				regrabTimer = regrabCooldown;
				SetRandomWanderTarget();
			}
		}
		else
		{
			wanderTimer += Time.fixedDeltaTime;
			if (wanderTimer >= wanderInterval)
			{
				wanderTimer = 0f;
				SetRandomWanderTarget();
			}
			MoveToWanderTarget();
		}
	}

	private void CarryPlayer()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		Rigidbody val = playerTarget.tumble.rb;
		if (!playerTarget.tumble.isTumbling)
		{
			playerTarget.tumble.TumbleRequest(true, false);
		}
		playerTarget.tumble.TumbleOverrideTime(1f);
		playerTarget.FallDamageResetSet(0.1f);
		Vector3 val2 = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, val.velocity, positionStiffness);
		val.AddForce(val2 * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1);
		Vector3 val3 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, val, rotationStiffness);
		val.AddTorque(val3 * Time.fixedDeltaTime, (ForceMode)1);
	}

	private void TossPlayer()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//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_0021: 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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)playerTarget).transform.position - ((Component)this).transform.position;
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		playerTarget.tumble.TumbleRequest(true, false);
		playerTarget.tumble.TumbleForce(normalized * tossForce);
		playerTarget.tumble.TumbleOverrideTime(1f);
	}

	private void SetRandomWanderTarget()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = Random.insideUnitCircle * wanderRadius;
		randomWanderTarget = ((Component)this).transform.position + new Vector3(val.x, 0f, val.y);
	}

	private void MoveToWanderTarget()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = SemiFunc.PhysFollowPosition(rb.position, randomWanderTarget, rb.velocity, moveForce);
		rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1);
		Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(randomWanderTarget - ((Component)this).transform.position), rb, rotationForce);
		rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1);
	}
}
[RequireComponent(typeof(Collider))]
public class KinematicCoasterMover : MonoBehaviour
{
	[Header("Waypoints & Timing")]
	public Transform waypointRoot;

	public float speed = 5f;

	public float startDelay = 10f;

	public bool loop = true;

	public float rotationSpeed = 5f;

	[Header("Mesh Import Rotation Correction (tweak in Inspector)")]
	public Vector3 meshEulerOffset = new Vector3(-90f, 180f, -0.085f);

	private Transform[] waypoints;

	private int idx;

	private float delayTimer;

	private bool started;

	private Quaternion originalRotation;

	private Quaternion meshOffsetQuat;

	private static readonly Regex regex = new Regex("Waypoint_(\\d+)$");

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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_0100: Unknown result type (might be due to invalid IL or missing references)
		originalRotation = ((Component)this).transform.rotation;
		waypoints = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true)
			where regex.IsMatch(((Object)t).name)
			select new
			{
				t = t,
				i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value)
			} into x
			orderby x.i
			select x.t).ToArray();
		meshOffsetQuat = Quaternion.Euler(meshEulerOffset);
		idx = 0;
		delayTimer = startDelay;
		started = false;
		if (waypoints.Length != 0)
		{
			((Component)this).transform.position = waypoints[0].position;
		}
	}

	private void Update()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: 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_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		if (waypoints == null || waypoints.Length == 0)
		{
			return;
		}
		if (!started)
		{
			delayTimer -= Time.deltaTime;
			((Component)this).transform.rotation = originalRotation;
			if (delayTimer <= 0f)
			{
				started = true;
			}
			return;
		}
		if (idx == 0 && ((Component)this).transform.rotation == originalRotation && waypoints.Length > 1)
		{
			Vector3 val = waypoints[1].position - waypoints[0].position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Quaternion rotation = Quaternion.LookRotation(normalized, Vector3.up) * meshOffsetQuat;
			((Component)this).transform.rotation = rotation;
		}
		Vector3 position = waypoints[idx].position;
		Vector3 val2 = position - ((Component)this).transform.position;
		float num = speed * Time.deltaTime;
		if (((Vector3)(ref val2)).magnitude <= num)
		{
			((Component)this).transform.position = position;
			AdvanceIndex();
			return;
		}
		Transform transform = ((Component)this).transform;
		transform.position += ((Vector3)(ref val2)).normalized * num;
		Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) * meshOffsetQuat;
		((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, rotationSpeed * Time.deltaTime);
	}

	private void AdvanceIndex()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		idx++;
		if (idx >= waypoints.Length)
		{
			if (loop)
			{
				idx = 0;
				delayTimer = startDelay;
				started = false;
				((Component)this).transform.rotation = originalRotation;
			}
			else
			{
				((Behaviour)this).enabled = false;
			}
		}
	}

	private void OnDrawGizmos()
	{
		//IL_00b8: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)waypointRoot == (Object)null))
		{
			Vector3[] array = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true)
				where regex.IsMatch(((Object)t).name)
				select new
				{
					p = t.position,
					i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value)
				} into x
				orderby x.i
				select x.p).ToArray();
			Gizmos.color = Color.cyan;
			for (int i = 0; i + 1 < array.Length; i++)
			{
				Gizmos.DrawLine(array[i], array[i + 1]);
			}
		}
	}
}
public class CursedMusicBoxValuable : Trap
{
	[Header("Audio")]
	public Sound cursedMusicSound;

	[Header("Spin Settings")]
	public float spinForce = 50f;

	public float tumbleForce = 15f;

	public float spinInterval = 0.2f;

	[Header("Visual Effects")]
	public ParticleSystem curseSparks;

	public Light curseLight;

	[Header("Animator")]
	public Animator cursedAnimator;

	public string holdBoolParameter = "IsHeld";

	[Header("Camera Shake")]
	public float cameraShakeTime = 0.2f;

	public float cameraShakeStrength = 3f;

	public Vector2 cameraShakeBounds = new Vector2(1.5f, 5f);

	private float spinTimer;

	private Rigidbody rb;

	private bool soundPlaying = false;

	public override void Start()
	{
		((Trap)this).Start();
		rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)curseLight != (Object)null)
		{
			((Behaviour)curseLight).enabled = false;
		}
	}

	public override void Update()
	{
		((Trap)this).Update();
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			CheckForGrabTumble();
		}
		HandleGrabAnimation();
	}

	private void CheckForGrabTumble()
	{
		if (!SemiFunc.FPSImpulse15() && base.physGrabObject.grabbed)
		{
			ActivateCurseEffects();
			{
				foreach (PhysGrabber item in base.physGrabObject.playerGrabbing)
				{
					SpinAndTumblePlayer(item.playerAvatar);
				}
				return;
			}
		}
		StopCurseEffects();
	}

	private void ActivateCurseEffects()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if (!soundPlaying)
		{
			cursedMusicSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
			soundPlaying = true;
		}
		if ((Object)(object)curseLight != (Object)null)
		{
			((Behaviour)curseLight).enabled = true;
		}
		if ((Object)(object)curseSparks != (Object)null && !curseSparks.isPlaying)
		{
			curseSparks.Play();
		}
	}

	private void StopCurseEffects()
	{
		if (soundPlaying)
		{
			cursedMusicSound.Stop();
			soundPlaying = false;
		}
		if ((Object)(object)curseLight != (Object)null)
		{
			((Behaviour)curseLight).enabled = false;
		}
		if ((Object)(object)curseSparks != (Object)null && curseSparks.isPlaying)
		{
			curseSparks.Stop();
		}
	}

	private void SpinAndTumblePlayer(PlayerAvatar player)
	{
		//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_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		spinTimer += Time.deltaTime;
		if (spinTimer >= spinInterval)
		{
			spinTimer = 0f;
			player.tumble.TumbleRequest(true, false);
			player.tumble.TumbleForce(((Component)player).transform.forward * tumbleForce);
			player.tumble.TumbleTorque(Vector3.up * spinForce);
			player.tumble.TumbleOverrideTime(2f);
			player.tumble.ImpactHurtSet(1f, 5);
			GameDirector.instance.CameraShake.ShakeDistance(cameraShakeStrength, 3f, 8f, ((Component)this).transform.position, cameraShakeTime);
			GameDirector.instance.CameraImpact.ShakeDistance(cameraShakeStrength, cameraShakeBounds.x, cameraShakeBounds.y, ((Component)this).transform.position, cameraShakeTime);
		}
	}

	private void HandleGrabAnimation()
	{
		if (!((Object)(object)cursedAnimator == (Object)null))
		{
			bool grabbed = base.physGrabObject.grabbed;
			cursedAnimator.SetBool(holdBoolParameter, grabbed);
		}
	}
}
public class PlayerWallBlocker : Trap
{
	[Header("Push Settings")]
	public float blockRange = 2f;

	public float pushForce = 30f;

	public override void Update()
	{
		((Trap)this).Update();
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			PushBackNearbyPlayers();
		}
	}

	private void PushBackNearbyPlayers()
	{
		//IL_0030: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
		{
			if (!item.isDisabled)
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position);
				if (num <= blockRange)
				{
					Vector3 val = ((Component)item).transform.position - ((Component)this).transform.position;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					normalized.y = 0f;
					Rigidbody rb = item.tumble.rb;
					rb.AddForce(normalized * pushForce * Time.deltaTime, (ForceMode)2);
				}
			}
		}
	}
}
public class TeleportGlitchValuable : Trap
{
	[Header("Teleport Settings")]
	public float teleportForce = 150f;

	public float teleportInterval = 2f;

	private float teleportTimer = 0f;

	public override void Update()
	{
		((Trap)this).Update();
		if (SemiFunc.IsMasterClientOrSingleplayer())
		{
			CheckForGrabTeleport();
		}
	}

	private void CheckForGrabTeleport()
	{
		if (base.physGrabObject.grabbed)
		{
			teleportTimer += Time.deltaTime;
			if (!(teleportTimer >= teleportInterval))
			{
				return;
			}
			teleportTimer = 0f;
			{
				foreach (PhysGrabber item in base.physGrabObject.playerGrabbing)
				{
					if ((Object)(object)item != (Object)null && (Object)(object)item.playerAvatar != (Object)null)
					{
						ApplyTeleportEffect(item.playerAvatar);
					}
				}
				return;
			}
		}
		teleportTimer = 0f;
	}

	private void ApplyTeleportEffect(PlayerAvatar player)
	{
		//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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		player.tumble.TumbleRequest(true, false);
		Vector3 up = Vector3.up;
		player.tumble.TumbleForce(up * teleportForce);
		player.tumble.TumbleOverrideTime(1.5f);
	}
}
namespace Omni
{
	[BepInPlugin("Omniscye.Omni", "Omni", "1.0")]
	public class Omni : BaseUnityPlugin
	{
		internal static Omni Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//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_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
	[HarmonyPatch(typeof(PlayerController))]
	internal static class ExamplePlayerControllerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerController __instance)
		{
			Omni.Logger.LogDebug((object)$"{__instance} Start Prefix");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_Postfix(PlayerController __instance)
		{
			Omni.Logger.LogDebug((object)$"{__instance} Start Postfix");
		}
	}
}