Decompiled source of FlatLand v1.8.2

Mods/FlatLand.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using FlatLand;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Audio;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.MoveSystem;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Utilities;
using Il2CppTMPro;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.Events;
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: MelonInfo(typeof(main), "FlatLand", "1.8.2", "UlvakSkillz", "https://thunderstore.io/c/rumble/p/UlvakSkillz/FlatLand/")]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("FlatLand")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FlatLand")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2815acf9-0270-46d3-a435-9c8bd2031c27")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FlatLand;

public class main : MelonMod
{
	[CompilerGenerated]
	private sealed class <AutoLoad>d__29 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public string scene;

		public main <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <AutoLoad>d__29(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (scene == <>4__this.currentScene)
				{
					((Component)<>4__this.buttonToSwaptoFlatLand.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().RPC_OnPressed();
				}
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ReLoadFlatLand>d__31 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ReLoadFlatLand>d__31(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>().ResetPlayerController();
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				Object.DestroyImmediate((Object)(object)<>4__this.landParent);
				Object.DestroyImmediate((Object)(object)<>4__this.measureParent);
				Object.DestroyImmediate((Object)(object)<>4__this.flatLandParent2);
				<>4__this.LoadFlatLand();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ToFlatLandPressed>d__30 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private Exception <e>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ToFlatLandPressed>d__30(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<e>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				try
				{
					<>4__this.matchmaker = MatchConsole.GetGameObject();
					<>4__this.regionBoard = RegionSelector.GetGameObject();
					((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>().ResetPlayerController();
				}
				catch (Exception ex)
				{
					<e>5__1 = ex;
				}
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.flatLandActive = true;
				<>4__this.DeloadGym();
				<>4__this.LoadFlatLand();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <TurnOffAllExtraRootObjects>d__32 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private GameObject <temp1>5__1;

		private Scene <ddolScene>5__2;

		private GameObject[] <ddolGameObjects>5__3;

		private GameObject[] <allGameObjects>5__4;

		private GameObject[] <>s__5;

		private int <>s__6;

		private GameObject <temp>5__7;

		private GameObject[] <>s__8;

		private int <>s__9;

		private GameObject <temp>5__10;

		private int <i>5__11;

		private int <j>5__12;

		private int <i>5__13;

		private int <j>5__14;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <TurnOffAllExtraRootObjects>d__32(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<temp1>5__1 = null;
			<ddolGameObjects>5__3 = null;
			<allGameObjects>5__4 = null;
			<>s__5 = null;
			<temp>5__7 = null;
			<>s__8 = null;
			<temp>5__10 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			if (<>1__state != 0)
			{
				return false;
			}
			<>1__state = -1;
			<temp1>5__1 = new GameObject();
			Object.DontDestroyOnLoad((Object)(object)<temp1>5__1);
			<ddolScene>5__2 = <temp1>5__1.scene;
			Object.DestroyImmediate((Object)(object)<temp1>5__1);
			<ddolGameObjects>5__3 = Il2CppArrayBase<GameObject>.op_Implicit((Il2CppArrayBase<GameObject>)(object)((Scene)(ref <ddolScene>5__2)).GetRootGameObjects());
			Scene activeScene = SceneManager.GetActiveScene();
			<allGameObjects>5__4 = Il2CppArrayBase<GameObject>.op_Implicit((Il2CppArrayBase<GameObject>)(object)((Scene)(ref activeScene)).GetRootGameObjects());
			<>s__5 = <ddolGameObjects>5__3;
			for (<>s__6 = 0; <>s__6 < <>s__5.Length; <>s__6++)
			{
				<temp>5__7 = <>s__5[<>s__6];
				if (<temp>5__7.activeSelf && !dontDisableGameObject.Contains(((Object)<temp>5__7).name))
				{
					<temp>5__7.SetActive(false);
					<>4__this.DisabledDDOLGameObjects.Add(<temp>5__7);
				}
				<temp>5__7 = null;
			}
			<>s__5 = null;
			<>s__8 = <allGameObjects>5__4;
			for (<>s__9 = 0; <>s__9 < <>s__8.Length; <>s__9++)
			{
				<temp>5__10 = <>s__8[<>s__9];
				if (<temp>5__10.activeSelf && !dontDisableGameObject.Contains(((Object)<temp>5__10).name))
				{
					<temp>5__10.SetActive(false);
				}
				else if (((Object)<temp>5__10).name == "--------------LOGIC--------------")
				{
					<i>5__11 = 0;
					while (<i>5__11 < <temp>5__10.transform.GetChildCount())
					{
						if (((Object)((Component)<temp>5__10.transform.GetChild(<i>5__11)).gameObject).name == "Heinhouser products")
						{
							<j>5__12 = 0;
							while (<j>5__12 < <temp>5__10.transform.GetChild(<i>5__11).GetChildCount())
							{
								if (((Object)((Component)<temp>5__10.transform.GetChild(<i>5__11).GetChild(<j>5__12)).gameObject).name != "MatchConsole" && ((Object)((Component)<temp>5__10.transform.GetChild(<i>5__11).GetChild(<j>5__12)).gameObject).name != "RegionSelector")
								{
									((Component)<temp>5__10.transform.GetChild(<i>5__11).GetChild(<j>5__12)).gameObject.SetActive(false);
								}
								else if (!<>4__this.loadMatchmaker)
								{
									((Component)<temp>5__10.transform.GetChild(<i>5__11).GetChild(<j>5__12)).gameObject.SetActive(false);
								}
								<j>5__12++;
							}
						}
						else if (((Object)((Component)<temp>5__10.transform.GetChild(<i>5__11)).gameObject).name != "Handelers")
						{
							((Component)<temp>5__10.transform.GetChild(<i>5__11)).gameObject.SetActive(false);
						}
						<i>5__11++;
					}
				}
				else if (((Object)<temp>5__10).name == "--------------SCENE--------------")
				{
					<temp>5__10.transform.GetChild(4).GetChild(1).position = new Vector3(6.84f, 4.3841f, 1.0968f);
					<temp>5__10.transform.GetChild(4).GetChild(1).localRotation = Quaternion.Euler(58.2924f, 189.6045f, 292.3752f);
					<i>5__13 = 0;
					while (<i>5__13 < <temp>5__10.transform.GetChildCount())
					{
						if (<i>5__13 == 4)
						{
							<j>5__14 = 0;
							while (<j>5__14 < <temp>5__10.transform.GetChild(4).childCount)
							{
								if (<j>5__14 != 1 && <j>5__14 != 3)
								{
									((Component)<temp>5__10.transform.GetChild(<i>5__13).GetChild(<j>5__14)).gameObject.SetActive(false);
								}
								<j>5__14++;
							}
						}
						else
						{
							((Component)<temp>5__10.transform.GetChild(<i>5__13)).gameObject.SetActive(false);
						}
						<i>5__13++;
					}
				}
				<temp>5__10 = null;
			}
			<>s__8 = null;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private string currentScene = "Loader";

	private string lastScene = "";

	private bool gymInit = false;

	private bool flatLandActive = false;

	private bool respawning = false;

	private GameObject buttonToSwaptoFlatLand;

	private GameObject flatLandTextPanel;

	private GameObject flatLandParent;

	public static List<string> dontDisableGameObject = new List<string>();

	private List<GameObject> DisabledDDOLGameObjects = new List<GameObject>();

	private GameObject landParent;

	private GameObject plane;

	private GameObject measureParent;

	private GameObject flatLandParent2;

	private GameObject matchmaker;

	private GameObject regionBoard;

	private UI UI = UI.instance;

	public static Mod FlatLand = new Mod();

	private int size;

	private bool loadMatchmaker;

	private bool showMeasurements;

	private bool darkMode;

	private bool autoLoad;

	public override void OnLateInitializeMelon()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Expected O, but got Unknown
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		FlatLand.ModName = "FlatLand";
		FlatLand.ModVersion = "1.8.2";
		FlatLand.SetFolder("FlatLand");
		FlatLand.AddToList("Map Size", 125, "Determins the size of the FlatLand", new Tags());
		FlatLand.AddToList("Have Matchmaker", false, 0, "Loads a Matchmaker into FlatLand", new Tags());
		FlatLand.AddToList("Show Measurements", true, 0, "Shows Numbers in FlatLand for Easy Measurements", new Tags());
		FlatLand.AddToList("DarkMode", false, 0, "Toggles Walls for Dark Mode", new Tags());
		FlatLand.AddToList("Auto Load FlatLand", false, 0, "Automatically Loads into FlatLand instead of the Gym", new Tags());
		FlatLand.GetFromFile();
		FlatLand.ModSaved += Save;
		size = (int)FlatLand.Settings[0].SavedValue;
		if (size < 1)
		{
			size = 1;
			FlatLand.Settings[0].SavedValue = 1;
			FlatLand.Settings[0].Value = 1;
		}
		loadMatchmaker = (bool)FlatLand.Settings[1].SavedValue;
		showMeasurements = (bool)FlatLand.Settings[2].SavedValue;
		darkMode = (bool)FlatLand.Settings[3].SavedValue;
		autoLoad = (bool)FlatLand.Settings[4].SavedValue;
		UI.instance.UI_Initialized += UIInit;
		Calls.onMapInitialized += SceneInit;
		dontDisableGameObject.Add("UniverseLibBehaviour");
		dontDisableGameObject.Add("ExplorerBehaviour");
		dontDisableGameObject.Add("SteamManager");
		dontDisableGameObject.Add("LanguageManager");
		dontDisableGameObject.Add("PhotonMono");
		dontDisableGameObject.Add("Game Instance");
		dontDisableGameObject.Add("Timer Updater");
		dontDisableGameObject.Add("PlayFabHttp");
		dontDisableGameObject.Add("LIV");
		dontDisableGameObject.Add("UniverseLibCanvas");
		dontDisableGameObject.Add("UE_Freecam");
		dontDisableGameObject.Add("--------------SCENE--------------");
		dontDisableGameObject.Add("--------------LOGIC--------------");
		dontDisableGameObject.Add("!ftraceLightmaps");
		dontDisableGameObject.Add("VoiceLogger");
		dontDisableGameObject.Add("Player Controller(Clone)");
		dontDisableGameObject.Add("Health");
		dontDisableGameObject.Add("New Game Object");
		dontDisableGameObject.Add("LCK Tablet");
	}

	private void Save()
	{
		size = (int)FlatLand.Settings[0].SavedValue;
		if (size < 1)
		{
			size = 1;
			FlatLand.Settings[0].SavedValue = 1;
			FlatLand.Settings[0].Value = 1;
		}
		bool flag = loadMatchmaker;
		loadMatchmaker = (bool)FlatLand.Settings[1].SavedValue;
		showMeasurements = (bool)FlatLand.Settings[2].SavedValue;
		darkMode = (bool)FlatLand.Settings[3].SavedValue;
		autoLoad = (bool)FlatLand.Settings[4].SavedValue;
		if (flatLandActive)
		{
			if (flag != loadMatchmaker)
			{
				matchmaker.SetActive(loadMatchmaker);
				regionBoard.SetActive(loadMatchmaker);
			}
			MelonCoroutines.Start(ReLoadFlatLand());
		}
	}

	private void UIInit()
	{
		UI.AddMod(FlatLand);
	}

	public override void OnFixedUpdate()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		if (flatLandActive)
		{
			float y = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform.GetChild(2).GetChild(3).position.y;
			if (!respawning && y <= -10f)
			{
				respawning = true;
				((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>().ResetPlayerController();
			}
			else if (respawning && y >= -10f)
			{
				respawning = false;
			}
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		lastScene = currentScene;
		currentScene = sceneName;
		if (flatLandActive)
		{
			ReactivateDDOLObjects();
			flatLandActive = false;
		}
		gymInit = false;
	}

	private void SceneInit()
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Expected O, but got Unknown
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		if (!(currentScene == "Gym") || gymInit)
		{
			return;
		}
		try
		{
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			val.AddComponent<MeshCollider>();
			((Object)val).name = "BackPanel";
			val.GetComponent<Renderer>().material.shader = Shader.Find("Universal Render Pipeline/Lit");
			val.GetComponent<Renderer>().material.color = new Color(0f, 1f, 0.814f);
			val.transform.parent = MatchConsole.GetGameObject().transform;
			val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			val.transform.localPosition = new Vector3(-0.4915f, 1.2083f, -0.0151f);
			val.transform.localScale = new Vector3(3f, 2.41f, 0.02f);
			flatLandParent = new GameObject();
			((Object)flatLandParent).name = "FlatLand";
			flatLandTextPanel = Object.Instantiate<GameObject>(((Component)MatchmakingSettings.GetGameObject().transform.GetChild(1)).gameObject);
			((Object)flatLandTextPanel).name = "FlatLand Plate";
			flatLandTextPanel.transform.parent = flatLandParent.transform;
			flatLandTextPanel.transform.position = new Vector3(7.45f, 1.9f, 10.12f);
			flatLandTextPanel.transform.rotation = Quaternion.Euler(90f, 122.8f, 0f);
			flatLandTextPanel.transform.localScale = new Vector3(0.29f, 0.3036f, 0.362f);
			GameObject val2 = Object.Instantiate<GameObject>(((Component)MatchmakingSettings.GetGameObject().transform.GetChild(3)).gameObject);
			val2.transform.parent = flatLandTextPanel.transform;
			((Object)val2).name = "Text";
			val2.transform.localPosition = new Vector3(0.04f, 0.74f, 0f);
			val2.transform.localRotation = Quaternion.Euler(0f, 270f, 90f);
			val2.transform.localScale = new Vector3(6.0414f, 3.7636f, 6.462f);
			TextMeshPro component = val2.GetComponent<TextMeshPro>();
			((TMP_Text)component).text = "FlatLand";
			buttonToSwaptoFlatLand = Create.NewButton();
			((Object)buttonToSwaptoFlatLand).name = "FlatLandButton";
			buttonToSwaptoFlatLand.transform.parent = flatLandParent.transform;
			buttonToSwaptoFlatLand.transform.position = new Vector3(7.67f, 1.7f, 10f);
			buttonToSwaptoFlatLand.transform.localRotation = Quaternion.Euler(0f, 302.5f, 90f);
			((Component)buttonToSwaptoFlatLand.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
			{
				MelonCoroutines.Start(ToFlatLandPressed());
			}));
			gymInit = true;
			if (autoLoad && lastScene != "Gym")
			{
				MelonCoroutines.Start(AutoLoad(currentScene));
			}
		}
		catch (Exception)
		{
		}
	}

	[IteratorStateMachine(typeof(<AutoLoad>d__29))]
	private IEnumerator AutoLoad(string scene)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <AutoLoad>d__29(0)
		{
			<>4__this = this,
			scene = scene
		};
	}

	[IteratorStateMachine(typeof(<ToFlatLandPressed>d__30))]
	private IEnumerator ToFlatLandPressed()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ToFlatLandPressed>d__30(0)
		{
			<>4__this = this
		};
	}

	[IteratorStateMachine(typeof(<ReLoadFlatLand>d__31))]
	private IEnumerator ReLoadFlatLand()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ReLoadFlatLand>d__31(0)
		{
			<>4__this = this
		};
	}

	[IteratorStateMachine(typeof(<TurnOffAllExtraRootObjects>d__32))]
	private IEnumerator TurnOffAllExtraRootObjects()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TurnOffAllExtraRootObjects>d__32(0)
		{
			<>4__this = this
		};
	}

	private void DeloadGym()
	{
		ResetStructures();
		try
		{
			Object.Destroy((Object)(object)SceneBoundaryStructuresGYM.GetGameObject());
		}
		catch
		{
		}
		try
		{
			Object.Destroy((Object)(object)SceneBoundaryPlayerGYM.GetGameObject());
		}
		catch
		{
		}
		MelonCoroutines.Start(TurnOffAllExtraRootObjects());
	}

	private void ResetStructures()
	{
		Singleton<PoolManager>.instance.GetPool("Disc").Reset(true);
		Singleton<PoolManager>.instance.GetPool("Ball").Reset(true);
		Singleton<PoolManager>.instance.GetPool("Pillar").Reset(true);
		Singleton<PoolManager>.instance.GetPool("RockCube").Reset(true);
		Singleton<PoolManager>.instance.GetPool("Wall").Reset(true);
		Singleton<PoolManager>.instance.GetPool("BoulderBall").Reset(true);
		Singleton<PoolManager>.instance.GetPool("SmallRock").Reset(true);
		Singleton<PoolManager>.instance.GetPool("LargeRock").Reset(true);
	}

	private void ReLoadGym()
	{
		if (matchmaker.activeSelf)
		{
			InteractionLever component = ((Component)matchmaker.transform.GetChild(7).GetChild(2).GetChild(0)).GetComponent<InteractionLever>();
			if (((InteractionNumericalBase)component).snappedStep == 1)
			{
				((InteractionNumericalBase)component).SetStep(0, false, false);
			}
		}
		Singleton<SceneManager>.instance.LoadSceneAsync(1, false, false, 2f, (LoadSceneMode)0, (AudioCall)null);
	}

	private void ReactivateDDOLObjects()
	{
		foreach (GameObject disabledDDOLGameObject in DisabledDDOLGameObjects)
		{
			disabledDDOLGameObject.SetActive(true);
		}
		DisabledDDOLGameObjects.Clear();
	}

	private void LoadFlatLand()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		//IL_0075: 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_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Expected O, but got Unknown
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0700: Expected O, but got Unknown
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0789: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_082e: Unknown result type (might be due to invalid IL or missing references)
		//IL_084e: Unknown result type (might be due to invalid IL or missing references)
		//IL_086e: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0986: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a33: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a75: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0af9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b98: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c13: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c3b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c60: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c85: Unknown result type (might be due to invalid IL or missing references)
		//IL_044d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0488: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0683: Unknown result type (might be due to invalid IL or missing references)
		//IL_054f: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_057c: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			landParent = new GameObject();
			((Object)landParent).name = "LandParent";
			plane = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)plane).name = "Floor";
			plane.transform.parent = landParent.transform;
			plane.transform.localScale = new Vector3((float)size, 0.01f, (float)size);
			plane.transform.position = new Vector3(2.8007f, 0f, -1.9802f);
			plane.layer = 9;
			Object.Destroy((Object)(object)plane.GetComponent<BoxCollider>());
			plane.GetComponent<Renderer>().material.shader = Shader.Find("Universal Render Pipeline/Lit");
			plane.GetComponent<Renderer>().material.color = new Color(0.5f, 0.5f, 0.5f);
			if (darkMode)
			{
				plane.GetComponent<Renderer>().material.color = new Color(0.1f, 0.1f, 0.1f);
				GameObject val = Object.Instantiate<GameObject>(plane);
				val.transform.parent = landParent.transform;
				val.transform.position = new Vector3((float)(size / 2) + 2.8007f, (float)(size / 2), -1.9802f);
				val.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
				GameObject val2 = Object.Instantiate<GameObject>(val);
				val2.transform.parent = landParent.transform;
				val2.transform.position = new Vector3((float)(-size / 2) + 2.8007f, (float)(size / 2), -1.9802f);
				val2.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
				GameObject val3 = Object.Instantiate<GameObject>(val);
				val3.transform.parent = landParent.transform;
				val3.transform.position = new Vector3(2.8007f, (float)(size / 2), (float)(size / 2) - 1.9802f);
				val3.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
				GameObject val4 = Object.Instantiate<GameObject>(val);
				val4.transform.parent = landParent.transform;
				val4.transform.position = new Vector3(2.8007f, (float)(size / 2), (float)(-size / 2) - 1.9802f);
				val4.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
				GameObject val5 = Object.Instantiate<GameObject>(val);
				val5.transform.parent = landParent.transform;
				val5.transform.position = new Vector3(2.8007f, (float)size - 1f, -1.9802f);
				val5.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
			}
			MeshCollider collider = plane.AddComponent<MeshCollider>();
			GroundCollider val6 = plane.AddComponent<GroundCollider>();
			val6.isMainGroundCollider = true;
			val6.collider = (Collider)(object)collider;
			measureParent = new GameObject();
			((Object)measureParent).name = "Measurements";
			measureParent.transform.position = new Vector3(0f, 0f, 0f);
			for (int i = 0; i <= 1; i++)
			{
				for (int j = -size / 2; j <= size / 2; j++)
				{
					GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)3);
					Object.Destroy((Object)(object)val7.GetComponent<BoxCollider>());
					val7.GetComponent<Renderer>().material.shader = Shader.Find("Universal Render Pipeline/Lit");
					val7.GetComponent<Renderer>().material.color = new Color(0f, 0f, 0f);
					val7.transform.parent = measureParent.transform;
					val7.transform.localScale = new Vector3(0.01f, 0.0101f, (float)size);
					if (i == 0)
					{
						val7.transform.position = new Vector3((float)j + 2.8007f, 0f, -1.9802f);
						if (showMeasurements && j % 5 == 0 && j != 0)
						{
							GameObject val8 = Create.NewText();
							((TMP_Text)val8.GetComponent<TextMeshPro>()).text = Mathf.Abs(j).ToString();
							((TMP_Text)val8.GetComponent<TextMeshPro>()).fontSize = 10f;
							val8.transform.parent = measureParent.transform;
							val8.transform.position = new Vector3((float)j + 2.8007f, 0.5f, -1.9802f);
							if (j < 0)
							{
								val8.transform.rotation = Quaternion.Euler(0f, -90f, 0f);
							}
							else
							{
								val8.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
							}
						}
						continue;
					}
					val7.transform.position = new Vector3(2.8007f, 0f, (float)j - 1.9802f);
					val7.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
					if (showMeasurements && j % 5 == 0 && j != 0)
					{
						GameObject val9 = Create.NewText();
						((TMP_Text)val9.GetComponent<TextMeshPro>()).text = Mathf.Abs(j).ToString();
						((TMP_Text)val9.GetComponent<TextMeshPro>()).fontSize = 10f;
						val9.transform.parent = measureParent.transform;
						val9.transform.position = new Vector3(2.8007f, 0.5f, (float)j - 1.9802f);
						if (j < 0)
						{
							val9.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
						}
					}
				}
			}
			flatLandParent2 = new GameObject();
			((Object)flatLandParent2).name = "FlatLandButtonParent";
			flatLandParent2.transform.position = new Vector3(-3.8f, 0f, -11.2473f);
			GameObject val10 = Object.Instantiate<GameObject>(((Component)MatchmakingSettings.GetGameObject().transform.GetChild(1)).gameObject);
			((Object)val10).name = "FlatLand Plate";
			val10.transform.parent = flatLandParent2.transform;
			val10.transform.localPosition = new Vector3(9.09f, 1.1882f, 5.6149f);
			val10.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
			val10.transform.localScale = new Vector3(0.29f, 0.3036f, 0.362f);
			Object.Destroy((Object)(object)val10.GetComponent<BoxCollider>());
			GameObject val11 = Object.Instantiate<GameObject>(((Component)MatchmakingSettings.GetGameObject().transform.GetChild(3)).gameObject);
			val11.transform.parent = val10.transform;
			((Object)val11).name = "Text";
			val11.transform.localPosition = new Vector3(0.04f, 0.74f, 0f);
			val11.transform.localRotation = Quaternion.Euler(0f, 270f, 90f);
			val11.transform.localScale = new Vector3(6.0414f, 3.7636f, 6.462f);
			TextMeshPro component = val11.GetComponent<TextMeshPro>();
			((TMP_Text)component).text = "To Gym";
			GameObject val12 = Create.NewButton();
			((Object)val12).name = "FlatLand Button";
			val12.transform.parent = flatLandParent2.transform;
			val12.transform.localPosition = new Vector3(9.0845f, 1f, 5.8345f);
			val12.transform.localRotation = Quaternion.Euler(0f, 180f, 90f);
			((Component)val12.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
			{
				ReLoadGym();
			}));
			GameObject val13 = Object.Instantiate<GameObject>(((Component)MatchmakingSettings.GetGameObject().transform.GetChild(1)).gameObject);
			((Object)val13).name = "Kill Structures Plate";
			val13.transform.parent = flatLandParent2.transform;
			val13.transform.localPosition = new Vector3(9.09f, 1.7882f, 5.4749f);
			val13.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
			val13.transform.localScale = new Vector3(0.29f, 0.5f, 0.362f);
			Object.Destroy((Object)(object)val13.GetComponent<BoxCollider>());
			GameObject val14 = Object.Instantiate<GameObject>(((Component)MatchmakingSettings.GetGameObject().transform.GetChild(3)).gameObject);
			val14.transform.parent = val13.transform;
			((Object)val14).name = "Text";
			val14.transform.localPosition = new Vector3(0.04f, 0.74f, 0f);
			val14.transform.localRotation = Quaternion.Euler(0f, 270f, 90f);
			val14.transform.localScale = new Vector3(3.525f, 3.8836f, 6.462f);
			TextMeshPro component2 = val14.GetComponent<TextMeshPro>();
			((TMP_Text)component2).text = "Reset Structures";
			GameObject val15 = Create.NewButton();
			((Object)val15).name = "Kill Structures Button";
			val15.transform.parent = flatLandParent2.transform;
			val15.transform.localPosition = new Vector3(9.0845f, 1.6f, 5.8345f);
			val15.transform.localRotation = Quaternion.Euler(0f, 180f, 90f);
			((Component)val15.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
			{
				ResetStructures();
			}));
			GameObject val16 = Object.Instantiate<GameObject>(ShiftstoneQuickswapper.GetGameObject());
			val16.SetActive(true);
			Object.Destroy((Object)(object)((Component)val16.transform.GetChild(0).GetChild(0)).GetComponent<MeshCollider>());
			val16.transform.parent = flatLandParent2.transform;
			val16.transform.localPosition = new Vector3(8.4845f, 1f, 6.6345f);
			val16.transform.rotation = Quaternion.Euler(0f, 355.9185f, 0f);
			if (loadMatchmaker)
			{
				matchmaker.transform.position = new Vector3(2.5214f, -0.001f, -5.9377f);
				matchmaker.transform.rotation = Quaternion.Euler(0f, 179.2461f, 0f);
				GameObject gameObject = Bell.GetGameObject();
				gameObject.transform.localPosition = new Vector3(0.75f, 2.15f, -0.5f);
				regionBoard.transform.position = new Vector3(0.676f, 0.958f, -4.45f);
				regionBoard.transform.rotation = Quaternion.Euler(0f, 90f, 305f);
			}
		}
		catch (Exception)
		{
		}
	}
}