Decompiled source of CoordinateForEasterEggs v0.3.0

CoordinateForEasterEggs.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CoordinateForEasterEggs.NetcodePatcher;
using CoordinateForEasterEggs.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Modules;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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 = "")]
[assembly: AssemblyCompany("CoordinateForEasterEggs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0")]
[assembly: AssemblyProduct("CoordinateForEasterEggs")]
[assembly: AssemblyTitle("CoordinateForEasterEggs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
namespace testModLethalCompany
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CoordinateForEasterEggs";

		public const string PLUGIN_NAME = "CoordinateForEasterEggs";

		public const string PLUGIN_VERSION = "0.3.0";
	}
}
namespace CoordinateForEasterEggs
{
	public class CFEEInput : LcInputActions
	{
		[InputAction("<Keyboard>/f5", Name = "Toggle CFEE")]
		public InputAction ToggleCFEE { get; set; }

		[InputAction("<Keyboard>/f4", Name = "Toggle Info")]
		public InputAction ToggleInfo { get; set; }

		[InputAction("", Name = "Toggle Virtual generation mode")]
		public InputAction ToggleVirtualGenerationMode { get; set; }

		[InputAction("", Name = "Clear Tiles")]
		public InputAction ClearTiles { get; set; }

		[InputAction("", Name = "Clear Conditions")]
		public InputAction ClearConditions { get; set; }

		[InputAction("", Name = "Start Generation")]
		public InputAction StartGeneration { get; set; }

		[InputAction("", Name = "Stop Generation")]
		public InputAction StopGeneration { get; set; }

		public static void KeyInput()
		{
			if (Plugin.inputCfee == null)
			{
				Plugin.mls.LogInfo((object)"Error: inputCfee is null.");
				return;
			}
			if (Plugin.inputCfee.ToggleCFEE.triggered)
			{
				CFEEManager.ToggleCFEEWithInput();
			}
			if (Plugin.inputCfee.ToggleInfo.triggered)
			{
				HUDTextCfee.ToggleInfo();
			}
			if (Plugin.inputCfee.ToggleVirtualGenerationMode.triggered)
			{
				CFEEManager.ToggleVirtualGenerationModeWithInput();
			}
			if (Plugin.inputCfee.ClearTiles.triggered)
			{
				CFEEManager.ClearTilesWithInput();
			}
			if (Plugin.inputCfee.ClearConditions.triggered)
			{
				CFEEManager.ClearConditionsWithInput();
			}
			if (Plugin.inputCfee.StartGeneration.triggered)
			{
				CFEEManager.StartGenerationWithInput();
			}
			if (Plugin.inputCfee.StopGeneration.triggered)
			{
				CFEEManager.StopGenerationWithInput();
			}
			if (!HUDTextCfee.initToggleText)
			{
				HUDTextCfee.UpdateToggleText(InputActionRebindingExtensions.GetBindingDisplayString(Plugin.inputCfee.ToggleInfo, 0, (DisplayStringOptions)0));
				HUDTextCfee.initToggleText = true;
				Plugin.mls.LogInfo((object)("initToggleText: key name is " + InputActionRebindingExtensions.GetBindingDisplayString(Plugin.inputCfee.ToggleInfo, 0, (DisplayStringOptions)0)));
			}
		}

		public static string GetToggleInfoBindingDispalyString()
		{
			if (Plugin.inputCfee == null)
			{
				Plugin.mls.LogInfo((object)"Error: inputCfee is null.");
				string text;
				return text = "Error text";
			}
			return InputActionRebindingExtensions.GetBindingDisplayString(Plugin.inputCfee.ToggleInfo, 0, (DisplayStringOptions)0);
		}
	}
	internal class EggLine : MonoBehaviour
	{
		private LineRenderer lineRenderer;

		private GameObject eggPosObj;

		private GameObject highlightFloorObj;

		private Vector3 pos;

		private float aliveCount;

		private readonly float aliveTime = 12f;

		private readonly float lineLength = 15f;

		public bool isDisabled = false;

		public void InitAndSetPos(Vector3 eggPos, bool isExplode, in float floorHeight)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_0031: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_007f: 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_0075: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_018d: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			pos = eggPos;
			aliveCount = 0f;
			if ((Object)(object)lineRenderer == (Object)null)
			{
				lineRenderer = new LineRenderer();
			}
			Shader val = Shader.Find("Sprites/Default");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: Shader 'Sprites/Default' not found!!");
				return;
			}
			Material material = new Material(val);
			float num = 0.017f;
			Color val2 = ((!isExplode) ? Color.cyan : Color.green);
			int positionCount = 2;
			GameObject val3 = new GameObject("EggLineObj");
			lineRenderer = val3.AddComponent<LineRenderer>();
			lineRenderer.positionCount = positionCount;
			lineRenderer.startWidth = num;
			lineRenderer.endWidth = num;
			((Renderer)lineRenderer).material = material;
			lineRenderer.startColor = val2;
			lineRenderer.endColor = val2;
			if ((Object)(object)eggPosObj == (Object)null)
			{
				eggPosObj = GameObject.CreatePrimitive((PrimitiveType)3);
			}
			Shader val4 = Shader.Find("Sprites/Default");
			if ((Object)(object)val4 == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found!!");
				return;
			}
			Material val5 = new Material(val4);
			if (isExplode)
			{
				val5.color = new Color(0f, 1f, 0f, 0.25f);
			}
			else
			{
				val5.color = new Color(0f, 1f, 1f, 0.25f);
			}
			eggPosObj.transform.position = pos;
			eggPosObj.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
			eggPosObj.transform.localScale = new Vector3(0.17f, 0.17f, 0.17f);
			((Renderer)eggPosObj.GetComponent<MeshRenderer>()).material = val5;
			Collider component = eggPosObj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if ((Object)(object)highlightFloorObj == (Object)null)
			{
				highlightFloorObj = GameObject.CreatePrimitive((PrimitiveType)4);
			}
			Shader val6 = Shader.Find("Sprites/Default");
			if ((Object)(object)val4 == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found!!");
				return;
			}
			Material val7 = new Material(val4);
			if (isExplode)
			{
				val7.color = new Color(0f, 0.6f, 0f, 0.9f);
			}
			else
			{
				val7.color = new Color(0f, 0.6f, 0.6f, 0.9f);
			}
			highlightFloorObj.transform.position = new Vector3(pos.x, floorHeight, pos.z);
			highlightFloorObj.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
			highlightFloorObj.transform.localScale = new Vector3(0.006f, 1f, 0.006f);
			((Renderer)highlightFloorObj.GetComponent<MeshRenderer>()).material = val7;
			Collider component2 = highlightFloorObj.GetComponent<Collider>();
			if ((Object)(object)component2 != (Object)null)
			{
				Object.Destroy((Object)(object)component2);
			}
			SetLine();
			SetCube();
		}

		public void UpdateEggLine(float floorHeightPosY)
		{
			//IL_0060: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!isDisabled && !((Object)(object)highlightFloorObj == (Object)null) && !((Object)(object)eggPosObj == (Object)null) && !((Object)(object)lineRenderer == (Object)null))
			{
				highlightFloorObj.transform.position = new Vector3(pos.x, floorHeightPosY, pos.z);
				if (highlightFloorObj.transform.position.y > pos.y + lineLength || highlightFloorObj.transform.position.y < pos.y - lineLength)
				{
					highlightFloorObj.SetActive(false);
				}
				else
				{
					highlightFloorObj.SetActive(true);
				}
				if (aliveCount >= aliveTime)
				{
					DisableIndicator();
				}
				aliveCount += Time.deltaTime;
			}
		}

		private void SetLine()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0059: 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_0066: 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)
			if (!((Object)(object)lineRenderer == (Object)null))
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0f, lineLength, 0f);
				Vector3 val2 = pos + val;
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(0f, 0f - lineLength, 0f);
				Vector3 val4 = pos + val3;
				lineRenderer.SetPosition(0, val2);
				lineRenderer.SetPosition(1, val4);
			}
		}

		private void SetCube()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)eggPosObj == (Object)null))
			{
				eggPosObj.transform.position = pos;
			}
		}

		internal void DisableIndicator()
		{
			isDisabled = true;
			Object.Destroy((Object)(object)lineRenderer);
			Object.Destroy((Object)(object)eggPosObj);
			Object.Destroy((Object)(object)highlightFloorObj);
		}
	}
	public class EggLineSync : NetworkBehaviour
	{
		public static EggLineSync Instance;

		public void Awake()
		{
			Plugin.mls.LogInfo((object)"Awake is called.");
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)Instance);
			}
			Instance = this;
		}

		[ClientRpc]
		public void EggLinesClientRpc(Vector3 egglinePos, bool explode)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a4: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3129578397u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref egglinePos);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref explode, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3129578397u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					CFEEManager.GenerateEggLine(egglinePos, explode);
				}
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			Plugin.mls.LogInfo((object)"NetworkPrefab Spawned.");
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3129578397u, new RpcReceiveHandler(__rpc_handler_3129578397), "EggLinesClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_3129578397(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 egglinePos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref egglinePos);
				bool explode = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref explode, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EggLineSync)(object)target).EggLinesClientRpc(egglinePos, explode);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "EggLineSync";
		}
	}
	public struct HorizontalIntPos
	{
		public int x;

		public int z;

		public void InitToZero()
		{
			x = 0;
			z = 0;
		}

		public bool Equals(HorizontalIntPos other)
		{
			return x == other.x && z == other.z;
		}

		public override bool Equals(object obj)
		{
			if (obj is HorizontalIntPos other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return HashCode.Combine(x, z);
		}

		public static bool operator ==(HorizontalIntPos a, HorizontalIntPos b)
		{
			return a.x == b.x && a.z == b.z;
		}

		public static bool operator !=(HorizontalIntPos a, HorizontalIntPos b)
		{
			return !(a == b);
		}
	}
	public class CheckSceneChange
	{
		[HarmonyPatch(typeof(GameNetworkManager))]
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Init()
		{
			SceneManager.activeSceneChanged -= OnSceneChanged;
			SceneManager.activeSceneChanged += OnSceneChanged;
			Plugin.mls.LogInfo((object)"Initialized CheckSceneChange.");
		}

		private static void OnSceneChanged(Scene oldScene, Scene newScene)
		{
			Plugin.mls.LogInfo((object)("Changed scene to: " + ((Scene)(ref newScene)).name));
			if (((Scene)(ref newScene)).name == "MainMenu")
			{
				CFEEManager.ResetAll();
				HUDTextCfee.ClearGenerationStatus();
			}
		}
	}
	internal class CommandReader
	{
		[HarmonyPatch(typeof(HUDManager))]
		[HarmonyPatch("AddTextToChatOnServer")]
		[HarmonyPostfix]
		private static void GetCommandFromChat(string chatMessage, int playerId = -1)
		{
			if (!chatMessage.StartsWith("/"))
			{
				return;
			}
			string[] array = chatMessage.Trim().Split(' ');
			string text = array[0];
			string text2 = ((array.Length > 1) ? array[1] : null);
			string text3 = ((array.Length > 2) ? array[2] : null);
			string text4 = ((array.Length > 3) ? array[3] : null);
			string text5 = ((array.Length > 4) ? array[4] : null);
			string text6 = ((array.Length > 5) ? array[5] : null);
			if (text == null)
			{
				return;
			}
			switch (text.ToLower())
			{
			case "/view":
			case "/vie":
			{
				int result4;
				if (!CFEEManager.isCFEEenabled)
				{
					Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
				}
				else if (text2 == null || text3 != null)
				{
					Plugin.mls.LogInfo((object)("Usage: /view <value(max: " + CFEEManager.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15"));
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /view <value(max: " + CFEEManager.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15", false, false, "LC_Tip1");
				}
				else if (int.TryParse(text2, out result4))
				{
					if (result4 > CFEEManager.maxLineRadius || result4 < CFEEManager.minLineRadius)
					{
						Plugin.mls.LogInfo((object)("Warning: The configurable range is " + CFEEManager.minLineRadius + " to " + CFEEManager.maxLineRadius + ".\nDefault: 15"));
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The configurable range is " + CFEEManager.minLineRadius + " to " + CFEEManager.maxLineRadius + ".\nDefault: 15", false, false, "LC_Tip1");
					}
					else if (!CFEEManager.isVirtualGenerationMode)
					{
						CFEEManager.DeleteLineAndTile();
						CFEEManager.lineRadius = result4;
						CFEEManager.isRangeChanged = true;
						HUDTextCfee.UpdateViewDistance();
						Plugin.mls.LogInfo((object)("View distance set to " + result4 + ".\nDefault: 15"));
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "View distance set to " + result4 + ".\nDefault: 15", false, false, "LC_Tip1");
					}
					else
					{
						Plugin.mls.LogInfo((object)"Warning: The command is unavailable while Virtual Generation Mode is active.");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while Virtual Generation Mode is active.", false, false, "LC_Tip1");
					}
				}
				else
				{
					Plugin.mls.LogInfo((object)("Usage: /view <value(max: " + CFEEManager.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15"));
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /view <value(max: " + CFEEManager.maxLineRadius + ")>\nThis command changes the view distance of coordinates.\nDefault: 15", false, false, "LC_Tip1");
				}
				break;
			}
			case "/virtual":
			case "/virtua":
			case "/virtu":
			case "/virt":
			case "/vir":
				if (!CFEEManager.isCFEEenabled)
				{
					Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
				}
				else if (text2 == null)
				{
					CFEEManager.ToggleVirtualGenerationModeWithInput();
				}
				else if ((text2.ToLower() == "true" || text2.ToLower() == "tru") && text3 == null)
				{
					if (CFEEManager.isVirtualGenerationMode)
					{
						Plugin.mls.LogInfo((object)"Warning: Virtual Generation Mode is already on.");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Virtual Generation Mode is already on.", false, false, "LC_Tip1");
						break;
					}
					CFEEManager.isVirtualGenerationMode = true;
					HUDTextCfee.UpdateVirtualGenMode();
					CFEEManager.virtualMapSeed = -1;
					CFEEManager.DeleteLineAndTile();
					Plugin.mls.LogInfo((object)"Virtual Generation Mode enabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode enabled.", false, false, "LC_Tip1");
				}
				else if ((text2.ToLower() == "false" || text2.ToLower() == "fals" || text2.ToLower() == "fal") && text3 == null)
				{
					if (!CFEEManager.isVirtualGenerationMode)
					{
						Plugin.mls.LogInfo((object)"Warning: Virtual Generation Mode is already off.");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Virtual Generation Mode is already off.", false, false, "LC_Tip1");
						break;
					}
					CFEEManager.isVirtualGenerationMode = false;
					HUDTextCfee.UpdateVirtualGenMode();
					CFEEManager.virtualMapSeed = -1;
					CFEEManager.DeleteLineAndTile();
					CFEEManager.isLerpedColor = false;
					CFEEManager.DeleteAllTileChache();
					CFEEManager.isForceToUpdateNext = true;
					Plugin.mls.LogInfo((object)"Virtual Generation Mode disabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode disabled.", false, false, "LC_Tip1");
				}
				else
				{
					Plugin.mls.LogInfo((object)"Usage: /virtual");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /virtual", false, false, "LC_Tip1");
				}
				break;
			case "/seed":
			case "/see":
			{
				int result5;
				if (!CFEEManager.isCFEEenabled)
				{
					Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
				}
				else if (!CFEEManager.isVirtualGenerationMode)
				{
					Plugin.mls.LogInfo((object)"Warning: This command is only available in Virtual Generation Mode.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is only available in Virtual Generation Mode.", false, false, "LC_Tip1");
				}
				else if (CFEEManager.isGeneratingSeed)
				{
					Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1");
				}
				else if (text2 == null || text3 != null)
				{
					Plugin.mls.LogInfo((object)"Usage: /seed <seed value>\n/seed random");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /seed <seed value>\n/seed random", false, false, "LC_Tip1");
				}
				else if (text2.ToLower() == "random" || text2.ToLower() == "rando" || text2.ToLower() == "rand" || text2.ToLower() == "ran")
				{
					CFEEManager.SetVirtualTilesMatToDefault();
					CFEEManager.VirtualNewLevelGeneratorWithConditions(300, isDisplayTip: true);
				}
				else if (int.TryParse(text2, out result5))
				{
					CFEEManager.SetVirtualTilesMatToDefault();
					CFEEManager.VirtualNewLevelGenerator(result5);
				}
				break;
			}
			case "/clear":
			case "/clea":
			case "/cle":
				if (!CFEEManager.isCFEEenabled)
				{
					Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
					break;
				}
				if (!CFEEManager.isVirtualGenerationMode)
				{
					Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1");
					break;
				}
				if (CFEEManager.isGeneratingSeed)
				{
					Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1");
					break;
				}
				if (text2 != null)
				{
					Plugin.mls.LogInfo((object)"Usage: /clear");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /clear", false, false, "LC_Tip1");
					break;
				}
				CFEEManager.SetVirtualTilesMatToDefault();
				CFEEManager.SetVirtualTilesToFalse();
				HUDTextCfee.ClearGenerationStatus();
				Plugin.mls.LogInfo((object)"Cleared virtual tiles.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Cleared virtual tiles.", false, false, "LC_Tip1");
				break;
			case "/conditions":
			case "/condition":
			case "/conditio":
			case "/conditi":
			case "/condit":
			case "/condi":
			case "/cond":
			case "/con":
				if (CFEEManager.isGeneratingSeed)
				{
					Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1");
				}
				else if (text2 == null)
				{
					Plugin.mls.LogInfo((object)"Usage: /condition 'word'.\nword: interior, scraps, clear");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition 'word'.\nword: interior, scraps, clear", false, false, "LC_Tip1");
				}
				else if (text2.ToLower() == "clear" || text2.ToLower() == "clea" || text2.ToLower() == "cle")
				{
					if (text3 != null)
					{
						Plugin.mls.LogInfo((object)"Usage: /condition clear");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition clear", false, false, "LC_Tip1");
					}
					else
					{
						CFEEManager.ClearConditionsWithInput();
					}
				}
				else if (text2.ToLower() == "dungeon" || text2.ToLower() == "dungeo" || text2.ToLower() == "dunge" || text2.ToLower() == "dung" || text2.ToLower() == "dun" || text2.ToLower() == "interior" || text2.ToLower() == "interio" || text2.ToLower() == "interi" || text2.ToLower() == "inter" || text2.ToLower() == "inte" || text2.ToLower() == "int")
				{
					if (text3 == null)
					{
						Plugin.mls.LogInfo((object)"Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft", false, false, "LC_Tip1");
					}
					else if (text3.ToLower() == "factory" || text3.ToLower() == "factor" || text3.ToLower() == "facto" || text3.ToLower() == "fact" || text3.ToLower() == "fac" || text3.ToLower() == "facility" || text3.ToLower() == "facilit" || text3.ToLower() == "facili" || text3.ToLower() == "facil" || text3.ToLower() == "faci")
					{
						CFEEManager.isConditionedFactory = true;
						CFEEManager.isConditionedAnyDungeon = true;
						HUDTextCfee.UpdateInteriorType();
						Plugin.mls.LogInfo((object)"Interior conditions set to Factory.");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Interior conditions set to Factory.", false, false, "LC_Tip1");
					}
					else if (text3.ToLower() == "mansion" || text3.ToLower() == "mansio" || text3.ToLower() == "mansi" || text3.ToLower() == "mans" || text3.ToLower() == "man")
					{
						CFEEManager.isConditionedMansion = true;
						CFEEManager.isConditionedAnyDungeon = true;
						HUDTextCfee.UpdateInteriorType();
						Plugin.mls.LogInfo((object)"Interior conditions set to Mansion.");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Interior conditions set to Mansion.", false, false, "LC_Tip1");
					}
					else if (text3.ToLower() == "mineshaft" || text3.ToLower() == "mineshaf" || text3.ToLower() == "minesha" || text3.ToLower() == "minesh" || text3.ToLower() == "mines" || text3.ToLower() == "mine" || text3.ToLower() == "min")
					{
						CFEEManager.isConditionedMineshaft = true;
						CFEEManager.isConditionedAnyDungeon = true;
						HUDTextCfee.UpdateInteriorType();
						Plugin.mls.LogInfo((object)"Interior conditions set to Mineshaft.");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Interior conditions set to Mineshaft.", false, false, "LC_Tip1");
					}
					else
					{
						Plugin.mls.LogInfo((object)"Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition interior 'word'.\nword: factory, mansion, mineshaft", false, false, "LC_Tip1");
					}
				}
				else if (text2.ToLower() == "scraps" || text2.ToLower() == "scrap" || text2.ToLower() == "scra" || text2.ToLower() == "scr")
				{
					if (text3 != null && int.TryParse(text3, out var result))
					{
						if (text4 != null && text4 == "to")
						{
							if (text5 != null && int.TryParse(text5, out var result2))
							{
								if (text6 == null)
								{
									if (result < StartOfRound.Instance.currentLevel.minScrap)
									{
										result = StartOfRound.Instance.currentLevel.minScrap;
										Plugin.mls.LogInfo((object)"Warning: minScraps adjusted to match the allowed range.");
									}
									if (result2 > StartOfRound.Instance.currentLevel.maxScrap - 1)
									{
										result2 = StartOfRound.Instance.currentLevel.maxScrap - 1;
										Plugin.mls.LogInfo((object)"Warning: maxScraps adjusted to match the allowed range.");
									}
									if (result > result2)
									{
										Plugin.mls.LogInfo((object)("Warning: Min scraps must be less than max scraps.\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + "."));
										HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Min scraps must be less than max scraps.\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1");
									}
									else
									{
										CFEEManager.conditionedMinScraps = result;
										CFEEManager.conditionedMaxScraps = result2;
										HUDTextCfee.UpdateScrapRange();
										Plugin.mls.LogInfo((object)("Scrap conditions set to " + result + " to " + result2 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + "."));
										HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + result + " to " + result2 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1");
									}
								}
								else
								{
									UsageConditionScraps();
								}
							}
							else
							{
								UsageConditionScraps();
							}
						}
						else if (text4 == null)
						{
							if (int.TryParse(text3, out var result3))
							{
								if (result3 < StartOfRound.Instance.currentLevel.minScrap)
								{
									result3 = StartOfRound.Instance.currentLevel.minScrap;
									Plugin.mls.LogInfo((object)"Warning: minScraps adjusted to match the allowed range.");
								}
								if (result3 > StartOfRound.Instance.currentLevel.maxScrap - 1)
								{
									result3 = StartOfRound.Instance.currentLevel.maxScrap - 1;
									Plugin.mls.LogInfo((object)"Warning: maxScraps adjusted to match the allowed range.");
								}
								CFEEManager.conditionedMinScraps = result3;
								CFEEManager.conditionedMaxScraps = result3;
								HUDTextCfee.UpdateScrapRange();
								Plugin.mls.LogInfo((object)("Scrap conditions set to " + result3 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + "."));
								HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + result3 + ".\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1");
							}
							else
							{
								UsageConditionScraps();
							}
						}
						else
						{
							UsageConditionScraps();
						}
					}
					else if (text3 != null && (text3.ToLower() == "upper" || text3.ToLower() == "uppe" || text3.ToLower() == "upp") && text4 == null)
					{
						float num = ((float)StartOfRound.Instance.currentLevel.minScrap + (float)StartOfRound.Instance.currentLevel.maxScrap) / 2f;
						int conditionedMinScraps = (int)Math.Ceiling(num);
						int conditionedMaxScraps = StartOfRound.Instance.currentLevel.maxScrap - 1;
						CFEEManager.conditionedMinScraps = conditionedMinScraps;
						CFEEManager.conditionedMaxScraps = conditionedMaxScraps;
						HUDTextCfee.UpdateScrapRange();
						Plugin.mls.LogInfo((object)("Scrap conditions set to " + conditionedMinScraps + " to " + conditionedMaxScraps + ".\n(Upper half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + "."));
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + conditionedMinScraps + " to " + conditionedMaxScraps + ".\n(Upper half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1");
					}
					else if (text3 != null && (text3.ToLower() == "lower" || text3.ToLower() == "lowe" || text3.ToLower() == "low") && text4 == null)
					{
						float num2 = ((float)StartOfRound.Instance.currentLevel.minScrap + (float)StartOfRound.Instance.currentLevel.maxScrap) / 2f;
						int minScrap = StartOfRound.Instance.currentLevel.minScrap;
						int num3 = (int)Math.Floor(num2);
						if (num2 % 1f == 0f)
						{
							num3--;
						}
						CFEEManager.conditionedMinScraps = minScrap;
						CFEEManager.conditionedMaxScraps = num3;
						HUDTextCfee.UpdateScrapRange();
						Plugin.mls.LogInfo((object)("Scrap conditions set to " + minScrap + " to " + num3 + ".\n(Lower half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + "."));
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Scrap conditions set to " + minScrap + " to " + num3 + ".\n(Lower half)\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1");
					}
					else
					{
						UsageConditionScraps();
					}
				}
				else
				{
					Plugin.mls.LogInfo((object)"Usage: /condition 'word'.\nword: interior, scraps, clear");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition 'word'.\nword: interior, scraps, clear", false, false, "LC_Tip1");
				}
				break;
			case "/generations":
			case "/generation":
			case "/generatio":
			case "/generati":
			case "/generat":
			case "/genera":
			case "/gener":
			case "/gene":
			case "/gen":
				if (!CFEEManager.isCFEEenabled)
				{
					Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
				}
				else if (text2 != null)
				{
					if (text2 == "start" || text2 == "star" || text2 == "sta")
					{
						if (text3 == null)
						{
							CFEEManager.StartGenerationWithInput();
							break;
						}
						Plugin.mls.LogInfo((object)"Usage: /generation start");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation start", false, false, "LC_Tip1");
						break;
					}
					if (text2 == "stop" || text2 == "sto")
					{
						if (text3 == null)
						{
							CFEEManager.StopGenerationWithInput();
							break;
						}
						Plugin.mls.LogInfo((object)"Usage: /generation stop");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation stop", false, false, "LC_Tip1");
						break;
					}
					switch (text2)
					{
					default:
						if (!(text2 == "int"))
						{
							Plugin.mls.LogInfo((object)"Usage: /generation start\n/generation stop\n/generation interval");
							HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation start\n/generation stop\n/generation interval", false, false, "LC_Tip1");
							break;
						}
						goto case "interval";
					case "interval":
					case "interva":
					case "interv":
					case "inter":
					case "inte":
					{
						if (text3 != null && float.TryParse(text3, out var result7))
						{
							if (float.IsNaN(result7) || float.IsInfinity(result7))
							{
								Plugin.mls.LogInfo((object)"Warning: Invalid value.");
								HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Invalid value.", false, false, "LC_Tip1");
							}
							else if (text4 == null)
							{
								if (result7 < CFEEManager.minGenerationTimeInterval || result7 > CFEEManager.maxGenerationTimeInterval)
								{
									Plugin.mls.LogInfo((object)("Warning: The configurable range is " + CFEEManager.minGenerationTimeInterval + " to " + CFEEManager.maxGenerationTimeInterval));
									HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The configurable range is " + CFEEManager.minGenerationTimeInterval + " to " + CFEEManager.maxGenerationTimeInterval, false, false, "LC_Tip1");
									break;
								}
								if (CFEEManager.isGeneratingSeed)
								{
									Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating.");
									HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1");
									break;
								}
								CFEEManager.generationTimeInterval = result7;
								HUDTextCfee.UpdateGenerationInterval();
								Plugin.mls.LogInfo((object)("Generation interval set to " + result7 + "."));
								HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation interval set to " + result7 + ".", false, false, "LC_Tip1");
							}
							else
							{
								Plugin.mls.LogInfo((object)"Usage: /generation interval <float value(interval)>\nDefault: 0.05");
								HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation interval <float value(interval)>\nDefault: 0.1", false, false, "LC_Tip1");
							}
						}
						else
						{
							Plugin.mls.LogInfo((object)"Usage: /generation interval <float value(interval)>\nDefault: 0.05");
							HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation interval <float value(interval)>\nDefault: 0.1", false, false, "LC_Tip1");
						}
						break;
					}
					}
				}
				else
				{
					Plugin.mls.LogInfo((object)"Usage: /generation start\n/generation stop\n/generation interval");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /generation start\n/generation stop\n/generation interval", false, false, "LC_Tip1");
				}
				break;
			case "/number":
			case "/numbe":
			case "/numb":
			case "/num":
			{
				if (text2 != null && int.TryParse(text2, out var result6))
				{
					if (text3 == null)
					{
						if (!CFEEManager.isGeneratingSeed)
						{
							if (result6 >= CFEEManager.minNumberOfAttempts && result6 <= CFEEManager.maxNumberOfAttempts)
							{
								CFEEManager.numberOfAttempts = result6;
								HUDTextCfee.UpdateNumberOfAttempts();
								Plugin.mls.LogInfo((object)("The number of attempts has been set to " + result6 + "."));
								HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "The number of attempts has been set to " + result6 + ".", false, false, "LC_Tip1");
								break;
							}
							Plugin.mls.LogInfo((object)("Warning: The configurable range is " + CFEEManager.minNumberOfAttempts + " to " + CFEEManager.maxNumberOfAttempts + "."));
							HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The configurable range is " + CFEEManager.minNumberOfAttempts + " to " + CFEEManager.maxNumberOfAttempts + ".", false, false, "LC_Tip1");
						}
						else
						{
							Plugin.mls.LogInfo((object)"Warning: This command is unavailable while generating.");
							HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is unavailable while generating.", false, false, "LC_Tip1");
						}
					}
					else
					{
						Plugin.mls.LogInfo((object)"Usage: /number <value(number of attempts)>");
						HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /number <value(number of attempts)>", false, false, "LC_Tip1");
					}
				}
				else
				{
					Plugin.mls.LogInfo((object)"Usage: /number <value(number of attempts)>");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /number <value(number of attempts)>", false, false, "LC_Tip1");
				}
				break;
			}
			case "/enable":
			case "/enabl":
			case "/enab":
			case "/ena":
				if (text2 != null)
				{
					Plugin.mls.LogInfo((object)"Usage: /enable");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /enable", false, false, "LC_Tip1");
				}
				else if (!CFEEManager.isCFEEenabled)
				{
					CFEEManager.isVirtualGenerationMode = false;
					HUDTextCfee.UpdateVirtualGenMode();
					CFEEManager.virtualMapSeed = -1;
					CFEEManager.DeleteLineAndTile();
					CFEEManager.isForceToUpdateNext = true;
					CFEEManager.isCFEEenabled = true;
					Plugin.mls.LogInfo((object)"CFEE enabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE enabled.", false, false, "LC_Tip1");
				}
				else
				{
					Plugin.mls.LogInfo((object)"Warning: CFEE is already enabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: CFEE is already enabled.", false, false, "LC_Tip1");
				}
				break;
			case "/disable":
			case "/disabl":
			case "/disab":
			case "/disa":
			case "/dis":
				if (text2 != null)
				{
					Plugin.mls.LogInfo((object)"Usage: /disable");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /disable", false, false, "LC_Tip1");
				}
				else if (CFEEManager.isVirtualGenerationMode)
				{
					Plugin.mls.LogInfo((object)"Warning: The command is unavailable while Virtual Generation Mode is active.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while Virtual Generation Mode is active.", false, false, "LC_Tip1");
				}
				else if (CFEEManager.isCFEEenabled)
				{
					CFEEManager.isVirtualGenerationMode = false;
					HUDTextCfee.UpdateVirtualGenMode();
					CFEEManager.virtualMapSeed = -1;
					CFEEManager.DisableAllEgglines();
					CFEEManager.DeleteLineAndTile();
					CFEEManager.isCFEEenabled = false;
					Plugin.mls.LogInfo((object)"CFEE disabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE disabled.", false, false, "LC_Tip1");
				}
				else
				{
					Plugin.mls.LogInfo((object)"Warning: CFEE is already disabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: CFEE is already disabled.", false, false, "LC_Tip1");
				}
				break;
			case "/info":
			case "/inf":
				if (text2 == null)
				{
					HUDTextCfee.ToggleInfo();
					break;
				}
				Plugin.mls.LogInfo((object)"Usage: /info");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /info", false, false, "LC_Tip1");
				break;
			default:
				Plugin.mls.LogInfo((object)"Warning: Unknown command.\nUsage: /enable /disable /view /virtual /seed /clear /condition /number /generation /info");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Unknown command.\nUsage: /enable /disable /view /virtual /seed /clear /condition /number /generation /info", false, false, "LC_Tip1");
				break;
			}
		}

		private static void UsageConditionScraps()
		{
			Plugin.mls.LogInfo((object)("Usage: /condition scraps <value(min)> to <value(max)>\n/condition scraps <value>\n/condition scraps upper\n/condition scraps lower\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + "."));
			HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Usage: /condition scraps <value(min)> to <value(max)>\n/condition scraps <value>\n/condition scraps upper\n/condition scraps lower\nThis moon can spawn scraps in the range of " + StartOfRound.Instance.currentLevel.minScrap + " to " + (StartOfRound.Instance.currentLevel.maxScrap - 1) + ".", false, false, "LC_Tip1");
		}
	}
	[BepInPlugin("kakeEdition.CFEE", "CoordinateForEasterEggs", "0.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "kakeEdition.CFEE";

		public const string modName = "CoordinateForEasterEggs";

		public const string modVersion = "0.3.0";

		private static Harmony _harmony = new Harmony("kakeEdition.CFEE");

		internal static ManualLogSource mls = Logger.CreateLogSource("kakeEdition.CFEE");

		public ConfigEntry<int> viewDistanceAtStart;

		public ConfigEntry<bool> enableCfeeAtStart;

		public ConfigEntry<int> numberOfAttemptsAtStart;

		public ConfigEntry<float> generationIntervalAtStartup;

		public static int viewDistanceAtStart_;

		public static bool enableCfeeAtStart_;

		internal static CFEEInput inputCfee;

		private void Awake()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			viewDistanceAtStart = ((BaseUnityPlugin)this).Config.Bind<int>("STARTUP SETTINGS", "View Distance", 15, new ConfigDescription("View distance of coordinate at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 35), Array.Empty<object>()));
			enableCfeeAtStart = ((BaseUnityPlugin)this).Config.Bind<bool>("STARTUP SETTINGS", "Enable CFEE", false, "Whether CFEE is enabled at startup.(this value will not be updated even if changed via command)");
			numberOfAttemptsAtStart = ((BaseUnityPlugin)this).Config.Bind<int>("STARTUP SETTINGS", "Number of attempts", 1000, new ConfigDescription("Number of generation attempts at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100000), Array.Empty<object>()));
			generationIntervalAtStartup = ((BaseUnityPlugin)this).Config.Bind<float>("STARTUP SETTINGS", "Generation Interval", 0.1f, new ConfigDescription("Generation Interval at startup(this value will not be updated even if changed via command).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 10f), Array.Empty<object>()));
			mls.LogInfo((object)"CoordinateForEasterEggs0.3.0 has loaded.");
			CFEEManager.networkPrefab = NetworkPrefabs.CreateNetworkPrefab("networkPrefab");
			CFEEManager.networkPrefab.AddComponent<EggLineSync>();
			NetworkPrefabs.RegisterNetworkPrefab(CFEEManager.networkPrefab);
			mls.LogInfo((object)"Network registered.");
			inputCfee = new CFEEInput();
			CFEEManager.InitLineRadiusConfigEntry(viewDistanceAtStart.Value);
			CFEEManager.InitIsCFEEenabledConfigEntry(enableCfeeAtStart.Value);
			CFEEManager.InitNumberOfAttemptsConfigEntry(numberOfAttemptsAtStart.Value);
			CFEEManager.InitGenerationIntervalConfigEntry(generationIntervalAtStartup.Value);
			PatchAllStuff();
		}

		private static void PatchAllStuff()
		{
			_harmony.PatchAll(typeof(CFEEManager));
			_harmony.PatchAll(typeof(CheckSceneChange));
			_harmony.PatchAll(typeof(CommandReader));
			_harmony.PatchAll(typeof(HUDTextCfee));
		}
	}
}
namespace CoordinateForEasterEggs.Patches
{
	internal class LevelEmulator
	{
		internal static int EmulateNumberOfBaseScrapsSpawn(ref Random anomalyRandomRef)
		{
			return (int)((float)anomalyRandomRef.Next(StartOfRound.Instance.currentLevel.minScrap, StartOfRound.Instance.currentLevel.maxScrap) * RoundManager.Instance.scrapAmountMultiplier);
		}

		internal static int EmulateGenerateNewFloor(ref Random levelRandomRef)
		{
			int num = -1;
			int num2 = -1;
			if (StartOfRound.Instance.currentLevel.dungeonFlowTypes != null && StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length != 0)
			{
				List<int> list = new List<int>();
				for (int i = 0; i < StartOfRound.Instance.currentLevel.dungeonFlowTypes.Length; i++)
				{
					list.Add(StartOfRound.Instance.currentLevel.dungeonFlowTypes[i].rarity);
				}
				int randomWeightedIndex = RoundManager.Instance.GetRandomWeightedIndex(list.ToArray(), levelRandomRef);
				return RoundManager.Instance.currentLevel.dungeonFlowTypes[randomWeightedIndex].id;
			}
			return 0;
		}

		internal static bool EmulateExplodeEgg(in Vector3 position)
		{
			return (float)new Random(CFEEManager.randomMapSeed + 10 + (int)position.x + (int)position.z).Next(0, 100) <= CFEEManager.chanceToExplode;
		}

		internal static bool EmulateExplodeEggWithVirtualSeed(in Vector3 position)
		{
			return (float)new Random(CFEEManager.virtualMapSeed + 10 + (int)position.x + (int)position.z).Next(0, 100) <= CFEEManager.chanceToExplode;
		}

		internal static bool EmulateExplodeEggWithVirtualSeedAdditionXZ(int additionXZ)
		{
			return (float)new Random(CFEEManager.virtualMapSeed + 10 + additionXZ).Next(0, 100) <= CFEEManager.chanceToExplode;
		}

		internal static int EmulateChooseNewRandomMapSeed()
		{
			return Random.Range(1, 100000000);
		}
	}
	internal class CFEEManager : NetworkBehaviour
	{
		private static bool isLocalPlayerServer;

		internal static int randomMapSeed = -1;

		internal static readonly float chanceToExplode = 16f;

		private static HorizontalIntPos closestPos;

		private static HorizontalIntPos previousClosestPos;

		private static float previousPlayerFloorPosY;

		private static float lastUpdateTime;

		private static float playerFloorPosY;

		internal static GameObject CFEEcontainer;

		internal static bool isInitializedCFEEcontainer = false;

		private static List<LineRenderer> linesX = new List<LineRenderer>();

		private static List<LineRenderer> linesZ = new List<LineRenderer>();

		private static List<List<GameObject>> tiles = new List<List<GameObject>>();

		private static List<List<GameObject>> virtualTiles = new List<List<GameObject>>();

		private static Material lineMaterial;

		private static Material tileMaterial;

		private static Material virtualTileMaterial;

		private static Material virtualTileMaterial0to09;

		private static Material virtualTileMaterial1to9;

		private static Material virtualTileMaterial10to19;

		private static Material virtualTileMaterial20to29;

		private static Material virtualTileMaterial30to39;

		private static Material virtualTileMaterial40to49;

		private static Material virtualTileMaterial50to59;

		private static Material virtualTileMaterial60to69;

		private static Material virtualTileMaterial70to79;

		private static Material virtualTileMaterial80to89;

		private static Material virtualTileMaterial90to99;

		private static Material virtualTileMaterial100;

		private static List<List<Vector3>> tilePos = new List<List<Vector3>>();

		private static List<EggLine> eggLines = new List<EggLine>();

		internal static int lineRadius;

		private static int lineDiameter;

		internal static bool isRangeChanged = false;

		internal static bool isInitializedLines = false;

		internal static bool isInitializedVirtualTiles = false;

		internal static bool isInitializedTiles = false;

		private static readonly int accurateTileDis = 15;

		private static readonly int prioritizedTileDis1 = 25;

		private static readonly int prioritizedTileDis2 = 30;

		private static readonly int prioritizedTileDis3 = 35;

		private static readonly int prioritizedTileDis4 = 40;

		private static readonly int prioritizedTileDis5 = 44;

		private static readonly int prioritizedTileDis6 = 48;

		private static readonly int prioritizedTileDis7 = 50;

		internal static readonly int maxLineRadius = 35;

		internal static readonly int minLineRadius = 1;

		private static bool[] isProcessed = new bool[8];

		private static bool isTransitioningLine = false;

		private static float transitionLineTimer = 0f;

		private static float transitionLineCurrentTime = 0f;

		private static Color transitionLineStartCol;

		private static Color transitionLineEndCol;

		private static Color transitionLineCurrentCol;

		private static readonly Color transitionColorToNormal = new Color(1f, 0.3f, 0.3f, 1f);

		private static readonly Color transitionColorToVirtual = new Color(0.3f, 0.3f, 1f, 1f);

		internal static bool isCFEEenabled;

		private static float toggleCFEENextTime = 0f;

		private static readonly float toggleCFEEInterval = 0.5f;

		internal static bool isVirtualGenerationMode = false;

		internal static bool isForceToUpdateNext = false;

		internal static int virtualMapSeed = -1;

		internal static int virtualBaseScraps = -1;

		internal static int virtualDungeonType = -1;

		internal static int numberOfAttempts;

		internal static bool isSuccessfulGen = false;

		internal static bool isGeneratingSeed = false;

		internal static float generationTime = 0f;

		internal static float generationpPreviousExcutedTime = -100f;

		internal static float generationTimeInterval;

		internal static int generationSuccessfulCount = 0;

		internal static readonly float minGenerationTimeInterval = 0.05f;

		internal static readonly float maxGenerationTimeInterval = 10f;

		internal static readonly int minNumberOfAttempts = 10;

		internal static readonly int maxNumberOfAttempts = 100000;

		internal static int attemptsCount = 0;

		internal static float previousUpdateTileTime = -100f;

		internal static readonly float updateTileInterval = 1f;

		internal static readonly float notificationInterval = 3f;

		internal static float notificationLastTime = 0f;

		internal static readonly float debugLogInterval = 1f;

		internal static float debugLogLastTime = 0f;

		internal static int failedToGenerateInARowCount = 0;

		internal static bool isLerpedColor = false;

		internal static List<List<int>> addition_XZ = new List<List<int>>();

		internal static HashSet<int> nonDuplicate_XZ = new HashSet<int>();

		internal static Dictionary<int, int> noDuplicateDict = new Dictionary<int, int>();

		internal static bool isConditionedFactory = false;

		internal static bool isConditionedMansion = false;

		internal static bool isConditionedMineshaft = false;

		internal static bool isConditionedAnyDungeon = false;

		internal static int conditionedMinScraps = -1;

		internal static int conditionedMaxScraps = -1;

		internal static GameObject networkPrefab;

		public static void InitLineRadiusConfigEntry(int value)
		{
			lineRadius = value;
		}

		public static void InitIsCFEEenabledConfigEntry(bool flag)
		{
			isCFEEenabled = flag;
		}

		public static void InitNumberOfAttemptsConfigEntry(int value)
		{
			numberOfAttempts = value;
		}

		public static void InitGenerationIntervalConfigEntry(float value)
		{
			generationTimeInterval = value;
		}

		private static void InitializeContainerObj()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			if ((Object)(object)CFEEcontainer == (Object)null)
			{
				CFEEcontainer = new GameObject("CFEEcontainer");
				Plugin.mls.LogInfo((object)"Initialized CFEEcontainer");
			}
			else
			{
				Plugin.mls.LogInfo((object)"Error: CFEEcontainer has already been initialized.");
			}
			isInitializedCFEEcontainer = true;
		}

		private static void InitializeLines()
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			if (!isCFEEenabled)
			{
				return;
			}
			if (linesX == null)
			{
				linesX = new List<LineRenderer>();
			}
			if (linesZ == null)
			{
				linesZ = new List<LineRenderer>();
			}
			if (tiles == null)
			{
				tiles = new List<List<GameObject>>();
			}
			if (virtualTiles == null)
			{
				virtualTiles = new List<List<GameObject>>();
			}
			if (tilePos == null)
			{
				tilePos = new List<List<Vector3>>();
			}
			if (eggLines == null)
			{
				eggLines = new List<EggLine>();
			}
			ResetIsProcessed();
			lineDiameter = lineRadius * 2;
			Shader val = Shader.Find("Sprites/Default");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: Shader 'Sprites/Default' not found.");
				return;
			}
			if ((Object)(object)lineMaterial == (Object)null)
			{
				lineMaterial = new Material(val);
			}
			float num = 0.017f;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(1f, 1f, 1f, 1f);
			int positionCount = 2;
			for (int i = 0; i < lineDiameter + 1; i++)
			{
				LineRenderer val3 = new LineRenderer();
				GameObject val4 = new GameObject("LineObjZ" + i);
				if ((Object)(object)CFEEcontainer != (Object)null)
				{
					val4.transform.SetParent(CFEEcontainer.transform);
				}
				val3 = new LineRenderer();
				val3 = val4.AddComponent<LineRenderer>();
				val3.positionCount = positionCount;
				val3.startWidth = num;
				val3.endWidth = num;
				((Renderer)val3).sharedMaterial = lineMaterial;
				val3.startColor = val2;
				val3.endColor = val2;
				linesZ.Add(val3);
			}
			for (int j = 0; j < lineDiameter + 1; j++)
			{
				LineRenderer val5 = new LineRenderer();
				GameObject val6 = new GameObject("LineObjX" + j);
				if ((Object)(object)CFEEcontainer != (Object)null)
				{
					val6.transform.SetParent(CFEEcontainer.transform);
				}
				val5 = new LineRenderer();
				val5 = val6.AddComponent<LineRenderer>();
				val5.positionCount = positionCount;
				val5.startWidth = num;
				val5.endWidth = num;
				((Renderer)val5).sharedMaterial = lineMaterial;
				val5.startColor = val2;
				val5.endColor = val2;
				linesX.Add(val5);
			}
			if (isVirtualGenerationMode)
			{
				TransitionLineColor(transitionColorToVirtual, new Color(1f, 1f, 1f, 1f), 2.3f);
			}
			else
			{
				TransitionLineColor(transitionColorToNormal, new Color(1f, 1f, 1f, 1f), 2.3f);
			}
			isInitializedLines = true;
			Plugin.mls.LogInfo((object)"Initialized lines.");
		}

		private static void InitializeTiles()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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)
			if (!isCFEEenabled)
			{
				return;
			}
			Shader val = Shader.Find("Sprites/Default");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found.");
				return;
			}
			if ((Object)(object)tileMaterial == (Object)null)
			{
				tileMaterial = new Material(val);
			}
			tileMaterial.color = new Color(1f, 0f, 0f, 0.25f);
			Vector3 item = default(Vector3);
			for (int i = 0; i < lineDiameter; i++)
			{
				List<GameObject> list = new List<GameObject>();
				List<Vector3> list2 = new List<Vector3>();
				for (int j = 0; j < lineDiameter; j++)
				{
					GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5);
					if ((Object)(object)CFEEcontainer != (Object)null)
					{
						val2.transform.SetParent(CFEEcontainer.transform);
					}
					val2.transform.position = new Vector3(0f, 0f, 0f);
					val2.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
					val2.transform.localScale = new Vector3(1f, 1f, 1f);
					((Renderer)val2.GetComponent<MeshRenderer>()).sharedMaterial = tileMaterial;
					Collider component = val2.GetComponent<Collider>();
					if ((Object)(object)component != (Object)null)
					{
						Object.Destroy((Object)(object)component);
					}
					list.Add(val2);
					((Vector3)(ref item))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, 0f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i);
					list2.Add(item);
				}
				tiles.Add(list);
				tilePos.Add(list2);
			}
			isInitializedTiles = true;
			Plugin.mls.LogInfo((object)"Initialized tiles.");
		}

		private static void InitializeVirtualTiles()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Expected O, but got Unknown
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Expected O, but got Unknown
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Expected O, but got Unknown
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Expected O, but got Unknown
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Expected O, but got Unknown
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Expected O, but got Unknown
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Expected O, but got Unknown
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			if (!isCFEEenabled)
			{
				return;
			}
			Shader val = Shader.Find("Sprites/Default");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: Shader 'Sprites / Default'' not found.");
				return;
			}
			if ((Object)(object)virtualTileMaterial == (Object)null)
			{
				virtualTileMaterial = new Material(val);
			}
			virtualTileMaterial.color = new Color(1f, 0f, 1f, 0.25f);
			Vector3 item = default(Vector3);
			for (int i = 0; i < lineDiameter; i++)
			{
				List<GameObject> list = new List<GameObject>();
				List<Vector3> list2 = new List<Vector3>();
				for (int j = 0; j < lineDiameter; j++)
				{
					GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5);
					if ((Object)(object)CFEEcontainer != (Object)null)
					{
						val2.transform.SetParent(CFEEcontainer.transform);
					}
					val2.transform.position = new Vector3(0f, 0f, 0f);
					val2.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
					val2.transform.localScale = new Vector3(1f, 1f, 1f);
					((Renderer)val2.GetComponent<MeshRenderer>()).sharedMaterial = virtualTileMaterial;
					Collider component = val2.GetComponent<Collider>();
					if ((Object)(object)component != (Object)null)
					{
						Object.Destroy((Object)(object)component);
					}
					list.Add(val2);
					((Vector3)(ref item))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)j, 0f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i);
					list2.Add(item);
				}
				virtualTiles.Add(list);
				tilePos.Add(list2);
			}
			for (int k = 0; k < 12; k++)
			{
				float num = (float)k / 11f;
				float num2 = Mathf.Lerp(0.5f, 1f, num);
				Color color = Color.HSVToRGB(num2, 1f, 1f);
				color.a = 0.25f;
				switch (k)
				{
				case 0:
					if ((Object)(object)virtualTileMaterial0to09 != (Object)null)
					{
						return;
					}
					virtualTileMaterial0to09 = new Material(val);
					virtualTileMaterial0to09.color = color;
					break;
				case 1:
					if ((Object)(object)virtualTileMaterial1to9 != (Object)null)
					{
						return;
					}
					virtualTileMaterial1to9 = new Material(val);
					virtualTileMaterial1to9.color = color;
					break;
				case 2:
					if ((Object)(object)virtualTileMaterial10to19 != (Object)null)
					{
						return;
					}
					virtualTileMaterial10to19 = new Material(val);
					virtualTileMaterial10to19.color = color;
					break;
				case 3:
					if ((Object)(object)virtualTileMaterial20to29 != (Object)null)
					{
						return;
					}
					virtualTileMaterial20to29 = new Material(val);
					virtualTileMaterial20to29.color = color;
					break;
				case 4:
					if ((Object)(object)virtualTileMaterial30to39 != (Object)null)
					{
						return;
					}
					virtualTileMaterial30to39 = new Material(val);
					virtualTileMaterial30to39.color = color;
					break;
				case 5:
					if ((Object)(object)virtualTileMaterial40to49 != (Object)null)
					{
						return;
					}
					virtualTileMaterial40to49 = new Material(val);
					virtualTileMaterial40to49.color = color;
					break;
				case 6:
					if ((Object)(object)virtualTileMaterial50to59 != (Object)null)
					{
						return;
					}
					virtualTileMaterial50to59 = new Material(val);
					virtualTileMaterial50to59.color = color;
					break;
				case 7:
					if ((Object)(object)virtualTileMaterial60to69 != (Object)null)
					{
						return;
					}
					virtualTileMaterial60to69 = new Material(val);
					virtualTileMaterial60to69.color = color;
					break;
				case 8:
					if ((Object)(object)virtualTileMaterial70to79 != (Object)null)
					{
						return;
					}
					virtualTileMaterial70to79 = new Material(val);
					virtualTileMaterial70to79.color = color;
					break;
				case 9:
					if ((Object)(object)virtualTileMaterial80to89 != (Object)null)
					{
						return;
					}
					virtualTileMaterial80to89 = new Material(val);
					virtualTileMaterial80to89.color = color;
					break;
				case 10:
					if ((Object)(object)virtualTileMaterial90to99 != (Object)null)
					{
						return;
					}
					virtualTileMaterial90to99 = new Material(val);
					virtualTileMaterial90to99.color = color;
					break;
				case 11:
					if ((Object)(object)virtualTileMaterial100 != (Object)null)
					{
						return;
					}
					virtualTileMaterial100 = new Material(val);
					virtualTileMaterial100.color = color;
					break;
				}
			}
			SetVirtualTilesToFalse();
			isInitializedVirtualTiles = true;
			Plugin.mls.LogInfo((object)"Initialized virtualTiles.");
		}

		[HarmonyPatch(typeof(StartOfRound))]
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void InitializeOnServer()
		{
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab);
				val.GetComponent<NetworkObject>().Spawn(true);
				Plugin.mls.LogInfo((object)"InitializedOnServer is called.");
			}
		}

		private static void ResetIsProcessed()
		{
			if (isProcessed == null)
			{
				isProcessed = new bool[8];
			}
			for (int i = 0; i < isProcessed.Length; i++)
			{
				isProcessed[i] = false;
			}
		}

		[HarmonyPatch(typeof(RoundManager))]
		[HarmonyPatch("__rpc_handler_2729232387")]
		[HarmonyPostfix]
		private static void SetRandomMapSeed(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			randomMapSeed = StartOfRound.Instance.randomMapSeed;
			Plugin.mls.LogInfo((object)("Current mapseed is " + randomMapSeed));
			VirtualNewLevelGenerator(randomMapSeed);
		}

		internal static void ToggleCFEEWithInput()
		{
			if (isVirtualGenerationMode)
			{
				Plugin.mls.LogInfo((object)"Warning: The command is unavailable while Virtual Generation Mode is active.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while Virtual Generation Mode is active.", false, false, "LC_Tip1");
			}
			else if (Time.time >= toggleCFEENextTime)
			{
				toggleCFEENextTime = Time.time + toggleCFEEInterval;
				if (!isCFEEenabled)
				{
					isVirtualGenerationMode = false;
					HUDTextCfee.UpdateVirtualGenMode();
					virtualMapSeed = -1;
					DeleteLineAndTile();
					isForceToUpdateNext = true;
					isCFEEenabled = true;
					Plugin.mls.LogInfo((object)"CFEE enabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE enabled.", false, false, "LC_Tip1");
				}
				else if (isCFEEenabled)
				{
					isVirtualGenerationMode = false;
					HUDTextCfee.UpdateVirtualGenMode();
					virtualMapSeed = -1;
					DisableAllEgglines();
					DeleteLineAndTile();
					isCFEEenabled = false;
					Plugin.mls.LogInfo((object)"CFEE disabled.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "CFEE disabled.", false, false, "LC_Tip1");
				}
			}
		}

		internal static void ToggleVirtualGenerationModeWithInput()
		{
			if (!isCFEEenabled)
			{
				Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled.\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
			}
			else if (isVirtualGenerationMode)
			{
				isVirtualGenerationMode = false;
				HUDTextCfee.UpdateVirtualGenMode();
				virtualMapSeed = -1;
				DeleteLineAndTile();
				isLerpedColor = false;
				DeleteAllTileChache();
				isForceToUpdateNext = true;
				Plugin.mls.LogInfo((object)"Virtual Generation Mode disabled.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode disabled.", false, false, "LC_Tip1");
			}
			else if (!isVirtualGenerationMode)
			{
				isVirtualGenerationMode = true;
				HUDTextCfee.UpdateVirtualGenMode();
				virtualMapSeed = -1;
				DeleteLineAndTile();
				isForceToUpdateNext = true;
				Plugin.mls.LogInfo((object)"Virtual Generation Mode enabled.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Virtual Generation Mode enabled.", false, false, "LC_Tip1");
			}
		}

		internal static void ClearTilesWithInput()
		{
			if (!isCFEEenabled)
			{
				Plugin.mls.LogInfo((object)"Warning: The command is unavailable while CFEE is disabled\nTo enable CFEE, use the /enable command.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: The command is unavailable while CFEE is disabled\nTo enable CFEE, use the /enable command.", false, false, "LC_Tip1");
				return;
			}
			if (!isVirtualGenerationMode)
			{
				Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1");
				return;
			}
			SetVirtualTilesToFalse();
			HUDTextCfee.ClearGenerationStatus();
			Plugin.mls.LogInfo((object)"Cleared virtual tiles.");
			HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Cleared virtual tiles.", false, false, "LC_Tip1");
		}

		internal static void ClearConditionsWithInput(bool isNotification = true)
		{
			isConditionedFactory = false;
			isConditionedMansion = false;
			isConditionedMineshaft = false;
			isConditionedAnyDungeon = false;
			conditionedMinScraps = -1;
			conditionedMaxScraps = -1;
			HUDTextCfee.UpdateScrapRange();
			HUDTextCfee.UpdateInteriorType();
			HUDTextCfee.ClearGenerationStatus();
			if (isNotification)
			{
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Conditions were cleared.", false, false, "LC_Tip1");
			}
			Plugin.mls.LogInfo((object)"Conditions were cleared.");
		}

		[HarmonyPatch(typeof(StartOfRound))]
		[HarmonyPatch("ChangeLevel")]
		[HarmonyPostfix]
		private static void StopGenerationWhenChangeLevel()
		{
			if (isVirtualGenerationMode && isGeneratingSeed)
			{
				UpdateLerpedColorVirtualTiles(isReferGenSuccessfulCount: true);
				StopGeneration(completed: false);
			}
		}

		[HarmonyPatch(typeof(StartOfRound))]
		[HarmonyPatch("ArriveAtLevel")]
		[HarmonyPostfix]
		private static void ClearConditionsWhenArriveAtLevel()
		{
			if (isCFEEenabled && (conditionedMinScraps != -1 || conditionedMaxScraps != -1 || isConditionedAnyDungeon))
			{
				ClearConditionsWithInput();
			}
			else
			{
				ClearConditionsWithInput(isNotification: false);
			}
		}

		internal static void StartGenerationWithInput()
		{
			if (isVirtualGenerationMode)
			{
				if (!isGeneratingSeed)
				{
					StartGeneration();
					return;
				}
				Plugin.mls.LogInfo((object)"Warning: Generation has already started.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Generation has already started.", false, false, "LC_Tip1");
			}
			else
			{
				Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1");
			}
		}

		internal static void StopGenerationWithInput()
		{
			if (isVirtualGenerationMode)
			{
				if (isGeneratingSeed)
				{
					UpdateLerpedColorVirtualTiles(isReferGenSuccessfulCount: true);
					StopGeneration(completed: false);
					Plugin.mls.LogInfo((object)"Generation stopped.");
				}
				else
				{
					Plugin.mls.LogInfo((object)"Warning: Generation has not started.");
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: Generation has not started.", false, false, "LC_Tip1");
				}
			}
			else
			{
				Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1");
			}
		}

		internal static void StartGeneration()
		{
			if (isCFEEenabled)
			{
				CreateTileChache();
				isGeneratingSeed = true;
				attemptsCount = 0;
				generationTime = 0f;
				generationSuccessfulCount = 0;
				generationpPreviousExcutedTime = 0f;
				failedToGenerateInARowCount = 0;
				HUDTextCfee.ClearGenerationStatus();
				Plugin.mls.LogInfo((object)"Generation started.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation started.", false, false, "LC_Tip1");
			}
		}

		internal static void StopGeneration(bool completed)
		{
			isGeneratingSeed = false;
			isSuccessfulGen = false;
			generationTime = 0f;
			previousUpdateTileTime = -100f;
			generationpPreviousExcutedTime = 0f;
			failedToGenerateInARowCount = 0;
			if (completed)
			{
				Plugin.mls.LogInfo((object)"Generation completed.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation completed.", false, false, "LC_Tip1");
				HUDTextCfee.UpdateSuccessRate();
			}
			else
			{
				Plugin.mls.LogInfo((object)"Generation stopped.");
				HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Generation stopped.", false, false, "LC_Tip1");
				HUDTextCfee.UpdateSuccessRate();
			}
		}

		private static void CreateTileChache()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			DeleteAllTileChache();
			for (int i = 0; i < virtualTiles.Count; i++)
			{
				List<int> list = new List<int>();
				for (int j = 0; j < virtualTiles[i].Count; j++)
				{
					int num = (int)virtualTiles[i][j].transform.position.x + (int)virtualTiles[i][j].transform.position.z;
					list.Add(num);
					noDuplicateDict[num] = 0;
				}
				addition_XZ.Add(list);
			}
			Plugin.mls.LogInfo((object)("Tile chache created. dictionary count: " + noDuplicateDict.Count + "\nKeys list:"));
			Plugin.mls.LogInfo((object)string.Join(", ", noDuplicateDict.Keys));
		}

		internal static void DeleteAllTileChache()
		{
			noDuplicateDict.Clear();
			addition_XZ.Clear();
			Plugin.mls.LogInfo((object)"Tile chache deleted.");
		}

		private static void UpdateGeneration()
		{
			if (!isCFEEenabled || !isGeneratingSeed || !isVirtualGenerationMode)
			{
				return;
			}
			if (generationTimeInterval >= 0f)
			{
				if (generationTimeInterval <= generationTime - generationpPreviousExcutedTime)
				{
					for (int i = 0; i < 10; i++)
					{
						if (generationSuccessfulCount < numberOfAttempts)
						{
							VirtualNewLevelGeneratorWithConditions();
							if (isSuccessfulGen)
							{
								UpdateNoDuplicateDict();
							}
						}
					}
					generationpPreviousExcutedTime = generationTime;
				}
			}
			else
			{
				Plugin.mls.LogInfo((object)"Error: generationTimeInterval is less than 0.");
			}
			if (updateTileInterval <= generationTime - previousUpdateTileTime)
			{
				UpdateLerpedColorVirtualTiles();
				previousUpdateTileTime = generationTime;
			}
			generationTime += Time.deltaTime;
			if (generationSuccessfulCount >= numberOfAttempts)
			{
				UpdateLerpedColorVirtualTiles(isReferGenSuccessfulCount: true);
				StopGeneration(completed: true);
			}
		}

		internal static void VirtualNewLevelGenerator(int mapSeed, bool isDisplayTip = true)
		{
			if (isCFEEenabled)
			{
				Random anomalyRandomRef = new Random(mapSeed + 5);
				int num = LevelEmulator.EmulateNumberOfBaseScrapsSpawn(ref anomalyRandomRef);
				Random levelRandomRef = new Random(mapSeed);
				int num2 = LevelEmulator.EmulateGenerateNewFloor(ref levelRandomRef);
				string text = ((num2 == 0 || num2 == 2 || num2 == 3) ? new string("Factory") : (num2 switch
				{
					1 => new string("Mansion"), 
					4 => new string("MineShaft"), 
					_ => new string("Unknown"), 
				}));
				if (isVirtualGenerationMode)
				{
					virtualMapSeed = mapSeed;
					virtualDungeonType = num2;
					virtualBaseScraps = num;
				}
				isForceToUpdateNext = true;
				if (isDisplayTip && !isVirtualGenerationMode)
				{
					Plugin.mls.LogInfo((object)("Current mapseed: " + randomMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text));
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Current mapseed: " + randomMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text, false, false, "LC_Tip1");
				}
				if (isDisplayTip && isVirtualGenerationMode)
				{
					Plugin.mls.LogInfo((object)("Current mapseed: " + virtualMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text));
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Current mapseed: " + virtualMapSeed + "\nBase scraps: " + num + "\nInterior type: " + text, false, false, "LC_Tip1");
				}
			}
		}

		internal static void VirtualNewLevelGeneratorWithConditions(int maxTimes = 50, bool isDisplayTip = false)
		{
			if (!isCFEEenabled)
			{
				return;
			}
			if (!isVirtualGenerationMode)
			{
				if (UpdateAndCheckNotificationInterval())
				{
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Warning: This command is available only in Virtual Generation Mode.", false, false, "LC_Tip1");
				}
				if (UpdateAndCheckDebugLogInterval())
				{
					Plugin.mls.LogInfo((object)"Warning: This command is available only in Virtual Generation Mode.");
				}
				return;
			}
			isSuccessfulGen = false;
			int timeToSuccessful = 0;
			string text = "unknown";
			int num = -1;
			int num2 = -1;
			for (int i = 0; i < maxTimes; i++)
			{
				attemptsCount++;
				num2 = LevelEmulator.EmulateChooseNewRandomMapSeed();
				Random anomalyRandomRef = new Random(num2 + 5);
				num = LevelEmulator.EmulateNumberOfBaseScrapsSpawn(ref anomalyRandomRef);
				if ((conditionedMinScraps != -1 || conditionedMaxScraps != -1) && (num < conditionedMinScraps || num > conditionedMaxScraps))
				{
					failedToGenerateInARowCount++;
					continue;
				}
				Random levelRandomRef = new Random(num2);
				int num3 = LevelEmulator.EmulateGenerateNewFloor(ref levelRandomRef);
				if (num3 == 0 || num3 == 2 || num3 == 3)
				{
					if (!isConditionedFactory && isConditionedAnyDungeon)
					{
						failedToGenerateInARowCount++;
						continue;
					}
					text = "Factory";
				}
				else
				{
					switch (num3)
					{
					case 1:
						if (!isConditionedMansion && isConditionedAnyDungeon)
						{
							failedToGenerateInARowCount++;
							continue;
						}
						text = "Mansion";
						break;
					case 4:
						if (!isConditionedMineshaft && isConditionedAnyDungeon)
						{
							failedToGenerateInARowCount++;
							continue;
						}
						text = "MineShaft";
						break;
					default:
						failedToGenerateInARowCount++;
						continue;
					}
				}
				virtualMapSeed = num2;
				virtualDungeonType = num3;
				virtualBaseScraps = num;
				timeToSuccessful = i + 1;
				isSuccessfulGen = true;
				break;
			}
			if (isSuccessfulGen)
			{
				generationSuccessfulCount++;
				int num4 = failedToGenerateInARowCount + 1;
				if (UpdateAndCheckDebugLogInterval())
				{
					Plugin.mls.LogInfo((object)("A valid mapseed after " + timeToSuccessful + " attempts. Mapseed: " + num2 + " Base scraps: " + num + " Interior type: " + text + " " + generationSuccessfulCount + "/" + numberOfAttempts));
				}
				if (isDisplayTip && !isGeneratingSeed)
				{
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "A valid mapseed after " + timeToSuccessful + " attempts. Mapseed: " + num2 + " Base scraps: " + num + " Interior type: " + text, false, false, "LC_Tip1");
				}
				failedToGenerateInARowCount = 0;
				isForceToUpdateNext = true;
				if (isGeneratingSeed)
				{
					HUDTextCfee.UpdateGenStatus(virtualMapSeed, generationSuccessfulCount, timeToSuccessful, text, num);
				}
				else
				{
					HUDTextCfee.UpdateGenStatusSingleAttempt(virtualMapSeed, timeToSuccessful, text, num);
				}
			}
			else
			{
				if (UpdateAndCheckDebugLogInterval())
				{
					Plugin.mls.LogInfo((object)("Failed to generate a mapseed that meets the conditions after " + failedToGenerateInARowCount + " attempts. " + generationSuccessfulCount + "/" + numberOfAttempts));
				}
				if (UpdateAndCheckNotificationInterval())
				{
					HUDManager.Instance.DisplayTip("CoordinateForEasterEggs", "Failed to generate a mapseed that meets the conditions after " + failedToGenerateInARowCount + " attempts. " + generationSuccessfulCount + "/" + numberOfAttempts, false, false, "LC_Tip1");
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB))]
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void PlayerControllerUpdateExtension(PlayerControllerB __instance)
		{
			//IL_0140: 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)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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)
			if ((Object)(object)__instance == (Object)null)
			{
				Plugin.mls.LogInfo((object)"Error: PlayerControllerB __instance is null.");
			}
			else
			{
				if ((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController || !__instance.isPlayerControlled)
				{
					return;
				}
				CFEEInput.KeyInput();
				HUDTextCfee.HUDTextCfeeUpdate();
				if (!isCFEEenabled)
				{
					return;
				}
				if (!isInitializedCFEEcontainer)
				{
					InitializeContainerObj();
				}
				if (!isInitializedLines)
				{
					InitializeLines();
					if (!isInitializedTiles && !isVirtualGenerationMode)
					{
						InitializeTiles();
					}
					else if (!isInitializedVirtualTiles && isVirtualGenerationMode)
					{
						InitializeVirtualTiles();
						closestPos.x = (int)Math.Round(((Component)__instance).transform.position.x);
						closestPos.z = (int)Math.Round(((Component)__instance).transform.position.z);
					}
					if (!isInitializedLines)
					{
						Plugin.mls.LogInfo((object)"Error: Failed to initialize Lines.");
						return;
					}
				}
				_ = ((Component)__instance).transform.position;
				if (false)
				{
					Plugin.mls.LogInfo((object)"Error: transform.position is null.");
					return;
				}
				playerFloorPosY = ((Component)__instance).transform.position.y;
				if (!isVirtualGenerationMode)
				{
					closestPos.x = (int)Math.Round(((Component)__instance).transform.position.x);
					closestPos.z = (int)Math.Round(((Component)__instance).transform.position.z);
				}
				UpdateGeneration();
				UpdateLine();
				UpdateTransitionLineColor();
				if (!isVirtualGenerationMode)
				{
					UpdateTilePosition();
				}
				else if (isVirtualGenerationMode)
				{
					UpdateTilePositionOnVirtualGenerationMode();
				}
				UpdateEggLines();
				previousClosestPos = closestPos;
				previousPlayerFloorPosY = playerFloorPosY;
				isLocalPlayerServer = ((NetworkBehaviour)__instance).IsServer;
				lastUpdateTime += Time.deltaTime;
				if (isRangeChanged)
				{
					isRangeChanged = false;
				}
				if (isForceToUpdateNext)
				{
					isForceToUpdateNext = false;
				}
			}
		}

		private static void UpdateLine()
		{
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			if (linesZ == null || linesX == null)
			{
				Plugin.mls.LogInfo((object)"Skipped UpdateLine because some variables are null.");
				return;
			}
			_ = previousClosestPos;
			if (false)
			{
				previousClosestPos.InitToZero();
			}
			if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY && !isRangeChanged && !isForceToUpdateNext)
			{
				return;
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor((float)closestPos.x - (float)(lineDiameter / 2), playerFloorPosY + 0.102f, (float)closestPos.z);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor((float)closestPos.x + (float)(lineDiameter / 2), playerFloorPosY + 0.102f, (float)closestPos.z);
			for (int i = 0; i < linesZ.Count; i++)
			{
				if ((Object)(object)linesZ[i] == (Object)null)
				{
					continue;
				}
				int num = 0;
				if (i != 0)
				{
					if (i % 2 == 0)
					{
						num = i / 2;
						num = -num;
					}
					else
					{
						num = (i + 1) / 2;
					}
				}
				Vector3 val3 = val;
				val3.z += num;
				Vector3 val4 = val2;
				val4.z += num;
				linesZ[i].SetPosition(0, val3);
				linesZ[i].SetPosition(1, val4);
			}
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor((float)closestPos.x, playerFloorPosY + 0.102f, (float)closestPos.z - (float)(lineDiameter / 2));
			Vector3 val6 = default(Vector3);
			((Vector3)(ref val6))..ctor((float)closestPos.x, playerFloorPosY + 0.102f, (float)closestPos.z + (float)(lineDiameter / 2));
			for (int j = 0; j < linesX.Count; j++)
			{
				if ((Object)(object)linesX[j] == (Object)null)
				{
					continue;
				}
				int num2 = 0;
				if (j != 0)
				{
					if (j % 2 == 0)
					{
						num2 = j / 2;
						num2 = -num2;
					}
					else
					{
						num2 = (j + 1) / 2;
					}
				}
				Vector3 val7 = val5;
				val7.x += num2;
				Vector3 val8 = val6;
				val8.x += num2;
				linesX[j].SetPosition(0, val7);
				linesX[j].SetPosition(1, val8);
			}
		}

		private static void UpdateTilePosition()
		{
			//IL_070c: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			if (tilePos == null || tiles == null)
			{
				Plugin.mls.LogInfo((object)"Skipped UpdateTilePosition because some variables are null.");
			}
			else if (randomMapSeed != -1)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor((float)closestPos.x, 0f, (float)closestPos.z);
				if (previousClosestPos != closestPos || isRangeChanged || isForceToUpdateNext)
				{
					Vector3 val2 = default(Vector3);
					for (int i = 0; i < lineDiameter; i++)
					{
						int num = 0;
						while (num < lineDiameter)
						{
							if (!((Object)(object)tiles[i][num] == (Object)null))
							{
								((Vector3)(ref val2))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)num, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)i);
								tilePos[i][num] = val + val2;
								tiles[i][num].transform.position = tilePos[i][num];
								if (i >= lineRadius - accurateTileDis && i <= lineRadius + accurateTileDis && num >= lineRadius - accurateTileDis && num <= lineRadius + accurateTileDis)
								{
									GameObject obj = tiles[i][num];
									Vector3 position = tiles[i][num].transform.position;
									obj.SetActive(LevelEmulator.EmulateExplodeEgg(in position));
								}
								num++;
								continue;
							}
							goto IL_00bb;
						}
						continue;
						IL_00bb:
						Plugin.mls.LogInfo((object)"Error: Tile is null.");
						break;
					}
					lastUpdateTime = 0f;
					ResetIsProcessed();
					isProcessed[0] = true;
				}
				else if (lastUpdateTime > 0.24f && isProcessed[7])
				{
					if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY)
					{
						return;
					}
					Vector3 val3 = default(Vector3);
					for (int j = 0; j < lineDiameter; j++)
					{
						for (int k = 0; k < lineDiameter; k++)
						{
							((Vector3)(ref val3))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)k, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)j);
							tilePos[j][k] = val + val3;
							tiles[j][k].transform.position = tilePos[j][k];
						}
					}
				}
				else if (lastUpdateTime > 0.21f && !isProcessed[7] && isProcessed[6])
				{
					ProcessTileUpdate(playerFloorPosY, prioritizedTileDis6, prioritizedTileDis7);
					isProcessed[7] = true;
				}
				else if (lastUpdateTime > 0.18f && !isProcessed[6] && isProcessed[5])
				{
					ProcessTileUpdate(playerFloorPosY, prioritizedTileDis5, prioritizedTileDis6);
					isProcessed[6] = true;
				}
				else if (lastUpdateTime > 0.15f && !isProcessed[5] && isProcessed[4])
				{
					ProcessTileUpdate(playerFloorPosY, prioritizedTileDis4, prioritizedTileDis5);
					isProcessed[5] = true;
				}
				else if (lastUpdateTime > 0.12f && !isProcessed[4] && isProcessed[3])
				{
					ProcessTileUpdate(playerFloorPosY, prioritizedTileDis3, prioritizedTileDis4);
					isProcessed[4] = true;
				}
				else if (lastUpdateTime > 0.09f && !isProcessed[3] && isProcessed[2])
				{
					ProcessTileUpdate(playerFloorPosY, prioritizedTileDis2, prioritizedTileDis3);
					isProcessed[3] = true;
				}
				else if (lastUpdateTime > 0.06f && !isProcessed[2] && isProcessed[1])
				{
					ProcessTileUpdate(playerFloorPosY, prioritizedTileDis1, prioritizedTileDis2);
					isProcessed[2] = true;
				}
				else if (lastUpdateTime > 0.03f && !isProcessed[1] && isProcessed[0])
				{
					ProcessTileUpdate(playerFloorPosY, accurateTileDis, prioritizedTileDis1);
					isProcessed[1] = true;
				}
				else
				{
					if (previousClosestPos == closestPos && playerFloorPosY == previousPlayerFloorPosY)
					{
						return;
					}
					Vector3 val4 = default(Vector3);
					for (int l = 0; l < lineDiameter; l++)
					{
						for (int m = 0; m < lineDiameter; m++)
						{
							((Vector3)(ref val4))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)m, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)l);
							tilePos[l][m] = val + val4;
							tiles[l][m].transform.position = tilePos[l][m];
						}
					}
				}
			}
			else
			{
				if (!(previousClosestPos != closestPos) && !isRangeChanged && !isForceToUpdateNext)
				{
					return;
				}
				Vector3 val5 = default(Vector3);
				((Vector3)(ref val5))..ctor((float)closestPos.x, 0f, (float)closestPos.z);
				Vector3 val6 = default(Vector3);
				for (int n = 0; n < lineDiameter; n++)
				{
					for (int num2 = 0; num2 < lineDiameter; num2++)
					{
						((Vector3)(ref val6))..ctor((float)(-lineDiameter / 2) + 0.5f + (float)num2, playerFloorPosY + 0.1f, 0f + ((float)(-lineDiameter / 2) + 0.5f) + (float)n);
						tilePos[n][num2] = val5 + val6;
						tiles[n][num2].transform.position = tilePos[n][num2];
						tiles[n][num2].SetActive(false);
					}
				}
			}
		}

		private static void UpdateTilePositionOnVirtualGenerationMode()
		{
			//IL_0699: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			if (tilePos == null || virtualTiles == null)
			{
				Plugin.mls.LogInfo((object)"Skipped UpdateTilePosition because some variables are null.");
			}
			else if (virtualMapSeed != -1)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor((float)closestPos.x, 0f, (float)c