Decompiled source of Cyberloop v0.0.2

Cyberloop.dll

Decompiled 6 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Nyxpiri.ULTRAKILL.NyxLib;
using Nyxpiri.Unity.Collections;
using ULTRAKILL.Portal;
using ULTRAKILL.Portal.Geometry;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Nyxpiri.ULTRAKILL.Cyberloop;

public static class ArenaInfo
{
	public static Vector3 Center { get; private set; } = new Vector3(0f, 0f, 62.5f);


	public static float Width => 40f;

	public static float InvDeathHeight => 110f;

	public static float DeathHeight => -110f;
}
public static class Assets
{
	public static GameObject InfPortalPrefab;

	internal static void Initialize()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		ScenesEvents.OnSceneWasLoaded += new OnSceneWasLoadedEventHandler(OnSceneLoaded);
	}

	private static void OnSceneLoaded(Scene scene, string levelName, string sceneName)
	{
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Expected O, but got Unknown
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Expected O, but got Unknown
		if (!((Object)(object)InfPortalPrefab == (Object)null))
		{
			return;
		}
		Portal[] array = Object.FindObjectsByType<Portal>((FindObjectsInactive)1, (FindObjectsSortMode)0);
		Portal[] array2 = array;
		foreach (Portal val in array2)
		{
			if (val.supportInfiniteRecursion && !val.mirror)
			{
				InfPortalPrefab = Object.Instantiate<GameObject>(((Component)val).gameObject);
				InfPortalPrefab.SetActive(false);
				Object.DontDestroyOnLoad((Object)(object)InfPortalPrefab);
				GameObject val2 = new GameObject();
				val2.transform.parent = InfPortalPrefab.gameObject.transform;
				GameObject val3 = new GameObject();
				val3.transform.parent = InfPortalPrefab.gameObject.transform;
				InfPortalPrefab.GetComponent<Portal>().exit = val3.transform;
				InfPortalPrefab.GetComponent<Portal>().entry = val2.transform;
				break;
			}
		}
	}
}
public static class Cheats
{
	public const string Cyberloop = "nyxpiri.cyber-loop";
}
[BepInPlugin("nyxpiri.ultrakill.cyber-loop", "Cyberloop", "0.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("ULTRAKILL.exe")]
public class Cyberloop : BaseUnityPlugin
{
	internal static float SmallGapSize = 0.001f;

	private LoopLayout PrevLayout = null;

	private LoopLayout CurrentLayout = null;

	private List<LoopLayout> Layouts = new List<LoopLayout>();

	private int _currentLoop = -1;

	public bool Looping { get; private set; } = false;


	public bool IsCheatActive => Cheats.IsCheatEnabled("nyxpiri.cyber-loop");

	protected void Awake()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		Log.Initialize(((BaseUnityPlugin)this).Logger);
		Options.Initialize((BaseUnityPlugin)(object)this);
		LevelQuickLoader.AddQuickLoadLevel("Level 8-1");
		ScenesEvents.OnSceneWasLoaded += new OnSceneWasLoadedEventHandler(OnSceneLoaded);
		Cheats.ReadyForCheatRegistration += new ReadyForCheatRegistrationEventHandler(RegisterCheats);
		Cybergrind.PostCybergrindNextWave += (CybergrindPostNextWaveEventHandler)delegate(EventMethodCancelInfo cancelInfo, EndlessGrid endlessGrid)
		{
			if (!((EventMethodCancelInfo)(ref cancelInfo)).Cancelled && Looping)
			{
				NextLoop();
			}
		};
		Assets.Initialize();
		Harmony.CreateAndPatchAll(((object)this).GetType().Assembly, (string)null);
	}

	private void NextLoop()
	{
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		if (!IsCheatActive)
		{
			DestroyLoop();
			return;
		}
		if (Layouts.Count == 0)
		{
			DestroyLoop();
			return;
		}
		_currentLoop++;
		_currentLoop %= Layouts.Count;
		DestroyLoop();
		if (_currentLoop == 0)
		{
			for (int i = 0; i < 10; i++)
			{
				CollectionSorting.Shuffle<LoopLayout>((IList<LoopLayout>)Layouts);
				if (Layouts[0] != PrevLayout)
				{
					break;
				}
			}
		}
		if (((Component)MonoSingleton<NewMovement>.Instance).transform.position.y < 0f)
		{
			_currentLoop = Layouts.FindIndex(_currentLoop, (LoopLayout layout) => layout.IsBelowArenaSafe);
			if (_currentLoop == -1)
			{
				CollectionSorting.Shuffle<LoopLayout>((IList<LoopLayout>)Layouts);
				_currentLoop = Layouts.FindIndex(0, (LoopLayout layout) => layout.IsBelowArenaSafe);
			}
		}
		if (_currentLoop != -1)
		{
			CurrentLayout = Layouts[_currentLoop];
			CurrentLayout.Generate();
		}
	}

	private void RegisterCheats(CheatsManager cheatsManager)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		cheatsManager.RegisterCheat((ICheat)new ToggleCheat("Cyberloop", "nyxpiri.cyber-loop", (Action<ToggleCheat>)delegate
		{
			if (Cybergrind.IsInCybergrindLevel)
			{
				DeactivateLooping();
			}
		}, (Action<ToggleCheat, CheatsManager>)delegate
		{
			if (Cybergrind.IsInCybergrindLevel)
			{
				ActivateLooping();
			}
		}), "CYBERGRIND");
	}

	private void DeactivateLooping()
	{
		if (Looping)
		{
			Looping = false;
			DestroyLoop();
		}
	}

	private void DestroyLoop()
	{
		CurrentLayout?.Disable();
		PrevLayout = CurrentLayout;
		CurrentLayout = null;
	}

	private void ActivateLooping()
	{
		if (!Looping && !((Object)(object)Assets.InfPortalPrefab == (Object)null))
		{
			Looping = true;
			LoadLayouts();
		}
	}

	private void LoadLayouts()
	{
		Layouts.Clear();
		if (Options.UseVerticalLoop.Value)
		{
			Layouts.Add(new VerticalLoop());
		}
		if (Options.UseVerticalPongLoop.Value)
		{
			Layouts.Add(new VerticalPongLoop());
		}
		if (Options.UseHorizontalLoop.Value)
		{
			Layouts.Add(new HorizontalLoop());
		}
		if (Options.UseHorizontalPongLoop.Value)
		{
			Layouts.Add(new HorizontalPongLoop());
		}
		if (Options.UseHorizontalRotationLoop.Value)
		{
			Layouts.Add(new HorizontalRotationLoop());
		}
		if (Options.UseFromEverywhereLoop.Value)
		{
			Layouts.Add(new FromEverywhereLoop());
		}
		if (Options.UseCrossingThoseManyIslandsLoop.Value)
		{
			Layouts.Add(new CrossingThoseManyIslandsLoop());
		}
		if (Options.UseCrossingThoseIslandsLoop.Value)
		{
			Layouts.Add(new CrossingThoseIslandsLoop());
		}
		CollectionSorting.Shuffle<LoopLayout>((IList<LoopLayout>)Layouts);
	}

	private void OnSceneLoaded(Scene scene, string levelName, string sceneName)
	{
		CurrentLayout?.Clear();
		CurrentLayout = null;
		Looping = false;
	}

	protected void Start()
	{
	}

	protected void Update()
	{
	}

	protected void LateUpdate()
	{
	}

	protected void FixedUpdate()
	{
		if (Cheats.IsCheatEnabled("nyxpiri.cyber-loop") && Cybergrind.IsInCybergrindLevel)
		{
			ActivateLooping();
		}
		else
		{
			DeactivateLooping();
		}
	}
}
internal static class Log
{
	private static ManualLogSource _logger;

	public static void Initialize(ManualLogSource logger)
	{
		Assert.IsNull((object)_logger, "Log.Initialize called when _logger wasn't null?");
		_logger = logger;
	}

	public static void Fatal(object data)
	{
		_logger.LogFatal(data);
	}

	public static void Error(object data)
	{
		_logger.LogError(data);
	}

	public static void Warning(object data)
	{
		_logger.LogWarning(data);
	}

	public static void Message(object data)
	{
		_logger.LogMessage(data);
	}

	public static void Info(object data)
	{
		_logger.LogInfo(data);
	}

	public static void Debug(object data)
	{
		_logger.LogDebug(data);
	}
}
public abstract class LoopLayout
{
	public abstract bool IsBelowArenaSafe { get; }

	public List<Portal> Portals { get; private set; } = new List<Portal>();


	public List<Portal> PongPortals { get; private set; } = new List<Portal>();


	public abstract void Generate();

	public abstract void FixedUpdate();

	protected abstract void OnDisable();

	protected abstract void OnClear();

	public void Disable()
	{
		OnDisable();
		foreach (Portal portal in Portals)
		{
			if (!((Object)(object)portal == (Object)null) && !((Object)(object)((Component)portal).gameObject == (Object)null))
			{
				Object.Destroy((Object)(object)((Component)portal).gameObject);
			}
		}
		Clear();
	}

	protected Portal CreatePortalAcrossAxis(Vector3 center, float dist, Vector3 axis, float width, float height, int maxRecursions, bool canSeeItself)
	{
		//IL_000c: 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_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_0019: 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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_0022: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: 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_0036: 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_005b: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		GameObject portalGo = Object.Instantiate<GameObject>(Assets.InfPortalPrefab);
		Vector3 entryPosition = center + axis * dist;
		Quaternion entryRotation = Quaternion.LookRotation(axis);
		Vector3 exitPosition = center + axis * (0f - dist);
		Quaternion exitRotation = Quaternion.LookRotation(-axis);
		bool canSeePortalLayer = true;
		bool supportInfiniteRecursion = false;
		float enterOffset = 1.5f;
		float exitOffset = 1.5f;
		return CreatePortal(width, height, maxRecursions, canSeeItself, portalGo, entryPosition, entryRotation, exitPosition, exitRotation, canSeePortalLayer, supportInfiniteRecursion, enterOffset, exitOffset, (PortalSideFlags)6);
	}

	protected Portal CreatePortal(float width, float height, int maxRecursions, bool canSeeItself, GameObject portalGo, Vector3 entryPosition, Quaternion entryRotation, Vector3 exitPosition, Quaternion exitRotation, bool canSeePortalLayer, bool supportInfiniteRecursion, float enterOffset, float exitOffset, PortalSideFlags renderSettings)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: 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_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_005e: 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_009b: Unknown result type (might be due to invalid IL or missing references)
		Portal component = portalGo.GetComponent<Portal>();
		component.entry.position = entryPosition;
		component.entry.rotation = entryRotation;
		component.exit.position = exitPosition;
		component.exit.rotation = exitRotation;
		PlaneShape val = (PlaneShape)(object)component.shape;
		val.width = width;
		val.height = height;
		component.shape = (IPortalShape)(object)val;
		component.enterOffset = enterOffset;
		component.exitOffset = exitOffset;
		component.supportInfiniteRecursion = supportInfiniteRecursion;
		component.maxRecursions = maxRecursions;
		component.canSeeItself = canSeeItself;
		component.canSeePortalLayer = canSeePortalLayer;
		component.renderSettings = renderSettings;
		Portals.Add(component);
		portalGo.SetActive(true);
		return component;
	}

	protected void CreateFallDeathSafetyPortals(float spacing, bool render = true)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0030: 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)
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * (ArenaInfo.DeathHeight + 0.5f + spacing * 0.5f), spacing * 0.5f, Vector3.up, 500f, 500f, 1, canSeeItself: false);
		if (!render)
		{
			val.renderSettings = (PortalSideFlags)0;
		}
	}

	protected Portal CreatePongPortal(Vector3 position, Quaternion rotation, float width, float height, int maxRecursions = 1)
	{
		//IL_0026: 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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Assets.InfPortalPrefab);
		Portal component = val.GetComponent<Portal>();
		Portals.Add(component);
		component.entry.position = position;
		component.entry.rotation = rotation;
		component.exit.position = position;
		component.exit.rotation = rotation;
		PlaneShape val2 = (PlaneShape)(object)component.shape;
		val2.width = width;
		val2.height = height;
		component.shape = (IPortalShape)(object)val2;
		component.enterOffset = 1.5f;
		component.exitOffset = 1.5f;
		component.maxRecursions = maxRecursions;
		component.supportInfiniteRecursion = false;
		component.canSeeItself = false;
		component.renderSettings = (PortalSideFlags)4;
		component.canSeePortalLayer = false;
		val.SetActive(true);
		PongPortals.Add(component);
		return component;
	}

	public void Clear()
	{
		Portals.Clear();
		PongPortals.Clear();
		OnClear();
	}
}
public class CrossingThoseIslandsLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => false;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0008: 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_003a: 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_0091: 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_009d: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		float num = 120f;
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.forward, num, num * 10f, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		Portal val2 = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.right, num, num * 10f, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		val.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		val2.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		Quaternion rotation = val.exit.rotation;
		Vector3 position = val.exit.position;
		Quaternion rotation2 = val2.exit.rotation;
		Vector3 position2 = val2.exit.position;
		val.exit.position = position2;
		val.exit.rotation = rotation2;
		val2.exit.position = position;
		val2.exit.rotation = rotation;
	}

	protected override void OnClear()
	{
	}
}
public class CrossingThoseManyIslandsLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => true;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0008: 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_0034: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		float num = 140f;
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.forward, num, num, (int)(3f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		Portal val2 = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.right, num, num, (int)(3f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		Portal val3 = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.up, num, num, (int)(3f * Options.PortalMaxRecursionScalar.Value), canSeeItself: false);
		CreateFallDeathSafetyPortals(500f, render: false);
		Quaternion rotation = val.exit.rotation;
		Vector3 position = val.exit.position;
		Quaternion rotation2 = val2.exit.rotation;
		Vector3 position2 = val2.exit.position;
		val.exit.position = position2;
		val.exit.rotation = rotation2;
		val2.exit.position = position;
		val2.exit.rotation = rotation;
	}

	protected override void OnClear()
	{
	}
}
public class CybergrindPlanetLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => false;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0016: 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)
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * 200f, ArenaInfo.Width + Cyberloop.SmallGapSize, Vector3.forward, 80f, 500f, 1, canSeeItself: false);
	}

	protected override void OnClear()
	{
	}
}
public class FromEverywhereLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => true;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0008: 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_0034: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: 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_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: 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)
		//IL_0107: 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_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		float num = 150f;
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.forward, num, num, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		Portal val2 = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.right, num, num, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		Portal val3 = CreatePortalAcrossAxis(ArenaInfo.Center, num * 0.5f, Vector3.up, num, num, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		val.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		val2.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		val3.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		CreateFallDeathSafetyPortals(500f, render: false);
		Quaternion rotation = val.exit.rotation;
		Vector3 position = val.exit.position;
		Quaternion rotation2 = val2.exit.rotation;
		Vector3 position2 = val2.exit.position;
		Quaternion rotation3 = val3.exit.rotation;
		Vector3 position3 = val3.exit.position;
		val.exit.position = position3;
		val.exit.rotation = rotation3;
		val2.exit.position = position;
		val2.exit.rotation = rotation;
		val3.exit.position = position2;
		val3.exit.rotation = rotation2;
	}

	protected override void OnClear()
	{
	}
}
public class HorizontalLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => false;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0016: 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_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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)
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * 200f, ArenaInfo.Width + Cyberloop.SmallGapSize, Vector3.forward, 80f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: false);
		Portal val2 = CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * 200f, ArenaInfo.Width + Cyberloop.SmallGapSize, Vector3.right, 80f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: false);
		val.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		val2.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
	}

	protected override void OnClear()
	{
	}
}
public class HorizontalPongLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => false;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0016: 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_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		CreatePongPortal(ArenaInfo.Center + Vector3.up * 200f + Vector3.forward * (ArenaInfo.Width + Cyberloop.SmallGapSize), Quaternion.LookRotation(Vector3.forward), ArenaInfo.Width * 2f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value));
		CreatePongPortal(ArenaInfo.Center + Vector3.up * 200f + Vector3.back * (ArenaInfo.Width + Cyberloop.SmallGapSize), Quaternion.LookRotation(Vector3.back), ArenaInfo.Width * 2f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value));
		CreatePongPortal(ArenaInfo.Center + Vector3.up * 200f + Vector3.left * (ArenaInfo.Width + Cyberloop.SmallGapSize), Quaternion.LookRotation(Vector3.left), ArenaInfo.Width * 2f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value));
		CreatePongPortal(ArenaInfo.Center + Vector3.up * 200f + Vector3.right * (ArenaInfo.Width + Cyberloop.SmallGapSize), Quaternion.LookRotation(Vector3.right), ArenaInfo.Width * 2f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value));
	}

	protected override void OnClear()
	{
	}
}
public class HorizontalRotationLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => false;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0016: 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_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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_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_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		Portal val = CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * 200f, ArenaInfo.Width + Cyberloop.SmallGapSize, Vector3.forward, 80f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		Portal val2 = CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * 200f, ArenaInfo.Width + Cyberloop.SmallGapSize, Vector3.right, 80f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value), canSeeItself: true);
		val.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		val2.supportInfiniteRecursion = Options.PortalPreferSupportInfiniteRecursion.Value;
		Quaternion rotation = val.exit.rotation;
		Vector3 position = val.exit.position;
		Quaternion rotation2 = val2.exit.rotation;
		Vector3 position2 = val2.exit.position;
		val2.exit.rotation = rotation;
		val.exit.rotation = rotation2;
		val2.exit.position = position;
		val.exit.position = position2;
	}

	protected override void OnClear()
	{
	}
}
public class VerticalLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => true;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//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_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: 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)
		float num = 150f;
		CreatePortalAcrossAxis(ArenaInfo.Center + Vector3.up * (ArenaInfo.DeathHeight * 0.4f + 0.5f + num * 0.5f), num * 0.5f, Vector3.up, 500f, 500f, 1, canSeeItself: false);
		CreateFallDeathSafetyPortals(260f, render: false);
	}

	protected override void OnClear()
	{
	}
}
public class VerticalPongLoop : LoopLayout
{
	public override bool IsBelowArenaSafe => true;

	protected override void OnDisable()
	{
	}

	public override void FixedUpdate()
	{
	}

	public override void Generate()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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)
		//IL_0027: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		Portal val = CreatePongPortal(ArenaInfo.Center + Vector3.down * (ArenaInfo.InvDeathHeight * 0.5f - 0.5f), Quaternion.LookRotation(Vector3.down), 500f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value));
		Portal val2 = CreatePongPortal(ArenaInfo.Center + Vector3.up * ArenaInfo.Width * 2.5f, Quaternion.LookRotation(Vector3.up), 500f, 500f, (int)(1f * Options.PortalMaxRecursionScalar.Value));
		CreateFallDeathSafetyPortals(400f, render: false);
	}

	protected override void OnClear()
	{
	}
}
public static class Options
{
	private static ConfigFile _config;

	private static ConfigFileManager _configFileManager;

	public static ConfigEntry<float> PortalMaxRecursionScalar { get; private set; }

	public static ConfigEntry<bool> PortalPreferSupportInfiniteRecursion { get; private set; }

	public static ConfigEntry<bool> UseCrossingThoseIslandsLoop { get; private set; }

	public static ConfigEntry<bool> UseCrossingThoseManyIslandsLoop { get; private set; }

	public static ConfigEntry<bool> UseFromEverywhereLoop { get; private set; }

	public static ConfigEntry<bool> UseHorizontalLoop { get; private set; }

	public static ConfigEntry<bool> UseHorizontalPongLoop { get; private set; }

	public static ConfigEntry<bool> UseHorizontalRotationLoop { get; private set; }

	public static ConfigEntry<bool> UseVerticalLoop { get; private set; }

	public static ConfigEntry<bool> UseVerticalPongLoop { get; private set; }

	internal static void Initialize(BaseUnityPlugin plugin)
	{
		Assert.IsNotNull((Object)(object)plugin, "");
		_config = plugin.Config;
		_configFileManager = ((Component)plugin).gameObject.AddComponent<ConfigFileManager>();
		_configFileManager.Initialize(_config);
		ConfigFileManager configFileManager = _configFileManager;
		configFileManager.OnReload = (Action)Delegate.Combine(configFileManager.OnReload, new Action(Reload));
		PortalMaxRecursionScalar = _config.Bind<float>("Performance", "PortalMaxRecursionScalar", 1f, (ConfigDescription)null);
		PortalPreferSupportInfiniteRecursion = _config.Bind<bool>("Performance", "PortalPreferSupportInfiniteRecursion", false, (ConfigDescription)null);
		UseCrossingThoseIslandsLoop = _config.Bind<bool>("Loops", "UseCrossingThoseIslandsLoop", true, "Toggles the 'Crossing Those Islands' loop. This loop is slow.");
		UseCrossingThoseManyIslandsLoop = _config.Bind<bool>("Loops", "UseCrossingThoseManyIslandsLoop", false, "Toggles the 'Crossing Those Many Islands' loop. This loop is CATACLYSMICALLY slow.");
		UseFromEverywhereLoop = _config.Bind<bool>("Loops", "UseFromEverywhereLoop", false, "Toggles the 'From Everywhere' loop. This loop is very slow.");
		UseHorizontalLoop = _config.Bind<bool>("Loops", "UseHorizontalLoop", true, "Toggles the 'Horizontal' Loop. This loop is slow.");
		UseHorizontalPongLoop = _config.Bind<bool>("Loops", "UseHorizontalPongLoop", true, "Toggles the 'Horizontal Pong' Loop. This loop is slow, slower than 'Horizontal' Loop.");
		UseHorizontalRotationLoop = _config.Bind<bool>("Loops", "UseHorizontalRotationLoop", true, "Toggles the 'Horizontal Rotation' Loop. This loop is slow.");
		UseVerticalLoop = _config.Bind<bool>("Loops", "UseVerticalLoop", true, "Toggles the 'Vertical' Loop. This loop has a moderately high cost to performance.");
		UseVerticalPongLoop = _config.Bind<bool>("Loops", "UseVerticalPongLoop", true, "Toggles the 'Vertical Pong' Loop. This loop has a moderately high-er cost to performance.");
	}

	private static void Reload()
	{
	}
}