Decompiled source of REPORanked v0.9.12

RepoRanked.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Photon.Pun;
using RepoRanked.API;
using RepoRanked.EnemyGeneration;
using RepoRanked.LevelControllers;
using RepoRanked.LevelGeneration;
using RepoRanked.MainMenu;
using RepoRanked.MainMenu.QueuePollers;
using RepoRanked.Mods;
using RepoRankedApiResponseModel;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Networking;
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 = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("danos")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ea5af0d65369d957957f225a0959922fb553f999")]
[assembly: AssemblyProduct("RepoRanked")]
[assembly: AssemblyTitle("RepoRanked")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RepoRanked
{
	[BepInPlugin("danos.RepoRanked", "RepoRanked", "0.9.12")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class RepoRanked : BaseUnityPlugin
	{
		internal static RepoRanked Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

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

		internal Harmony? Harmony { get; set; }

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

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

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

		private void Update()
		{
		}
	}
}
namespace RepoRanked.Patches
{
	[HarmonyPatch]
	internal class ChatManagerPatch
	{
		[HarmonyPatch(typeof(ChatManager), "Update")]
		[HarmonyPrefix]
		public static bool UpdatePrefix(ChatManager __instance)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected I4, but got Unknown
			ChatManager.instance.chatActive = true;
			ChatManager.instance.PossessionActive();
			if (Object.op_Implicit((Object)(object)ChatManager.instance.playerAvatar) && ChatManager.instance.playerAvatar.isDisabled && (ChatManager.instance.possessBatchQueue.Count > 0 || ChatManager.instance.currentBatch != null))
			{
				ChatManager.instance.InterruptCurrentPossessBatch();
			}
			if (!LevelGenerator.Instance.Generated)
			{
				ChatManager.instance.NewLevelResets();
				return false;
			}
			ImportantFetches(__instance);
			ChatManager.instance.PossessChatCustomLogic();
			if (!ChatManager.instance.textMeshFetched || !ChatManager.instance.localPlayerAvatarFetched)
			{
				return false;
			}
			ChatState chatState = ChatManager.instance.chatState;
			ChatState val = chatState;
			switch ((int)val)
			{
			case 0:
				ChatManager.instance.StateInactive();
				break;
			case 1:
				ChatManager.instance.StateActive();
				break;
			case 2:
				ChatManager.instance.StatePossessed();
				break;
			case 3:
				ChatManager.instance.StateSend();
				break;
			}
			ChatManager.instance.PossessChatCustomLogic();
			if (ChatManager.instance.spamTimer > 0f)
			{
				ChatManager instance = ChatManager.instance;
				instance.spamTimer -= Time.deltaTime;
			}
			if (SemiFunc.FPSImpulse15() && ChatManager.instance.betrayalActive && PlayerController.instance.playerAvatarScript.RoomVolumeCheck.inTruck)
			{
				ChatManager.instance.PossessCancelSelfDestruction();
			}
			return false;
		}

		private static void ImportantFetches(ChatManager __instance)
		{
			if (!Object.op_Implicit((Object)(object)__instance.chatText))
			{
				__instance.textMeshFetched = false;
			}
			if (!Object.op_Implicit((Object)(object)__instance.playerAvatar))
			{
				__instance.localPlayerAvatarFetched = false;
			}
			if (!__instance.textMeshFetched && Object.op_Implicit((Object)(object)ChatUI.instance) && Object.op_Implicit((Object)(object)ChatUI.instance.chatText))
			{
				__instance.chatText = ChatUI.instance.chatText;
				__instance.textMeshFetched = true;
			}
			if (__instance.localPlayerAvatarFetched)
			{
				return;
			}
			List<PlayerAvatar> list = SemiFunc.PlayerGetList();
			if (list.Count <= 0)
			{
				return;
			}
			foreach (PlayerAvatar item in list)
			{
				if (item.isLocal)
				{
					__instance.playerAvatar = item;
					__instance.localPlayerAvatarFetched = true;
					break;
				}
			}
		}
	}
	[HarmonyPatch]
	public class CompletePatch
	{
		[HarmonyPatch(typeof(TruckScreenText), "GotoNextLevel")]
		[HarmonyPrefix]
		public static bool GoToNextLevelPrefix()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected I4, but got Unknown
			QueueTypes queueType = DanosMatchQueuePoller.QueueType;
			QueueTypes val = queueType;
			switch ((int)val)
			{
			case 0:
			{
				RankedGameManager instance3 = RankedGameManager.Instance;
				if ((Object)(object)instance3 == (Object)null)
				{
					return true;
				}
				instance3.CompleteMatch("finished");
				break;
			}
			case 3:
			{
				RankedGameManager instance2 = RankedGameManager.Instance;
				if ((Object)(object)instance2 == (Object)null)
				{
					return true;
				}
				instance2.CompleteMatch("finished");
				break;
			}
			case 4:
			{
				MonthlyGameManager instance = MonthlyGameManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return true;
				}
				instance.CompletedRound();
				return true;
			}
			}
			return false;
		}
	}
	[HarmonyPatch]
	public class DeathPatches
	{
		[HarmonyPatch(typeof(PlayerAvatar), "PlayerDeath")]
		[HarmonyPostfix]
		public static void PlayerDeathRPCPostfix(PlayerAvatar __instance, int enemyIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected I4, but got Unknown
			QueueTypes queueType = DanosMatchQueuePoller.QueueType;
			QueueTypes val = queueType;
			switch ((int)val)
			{
			case 0:
			{
				RankedGameManager instance3 = RankedGameManager.Instance;
				if (!((Object)(object)instance3 == (Object)null))
				{
					instance3.CompleteMatch("dead");
				}
				break;
			}
			case 3:
			{
				RankedGameManager instance2 = RankedGameManager.Instance;
				if (!((Object)(object)instance2 == (Object)null))
				{
					instance2.CompleteMatch("dead");
				}
				break;
			}
			case 4:
				if (!SemiFunc.RunIsShop())
				{
					MonthlyGameManager instance = MonthlyGameManager.Instance;
					if (!((Object)(object)instance == (Object)null))
					{
						instance.CompleteMatch("dead");
					}
				}
				break;
			case 1:
			case 2:
				break;
			}
		}
	}
	[HarmonyPatch]
	internal class MainMenuButtonPatch
	{
		[HarmonyPatch(typeof(MenuPageEsc), "ButtonEventQuitToMenu")]
		[HarmonyPrefix]
		public static bool Prefix()
		{
			ForfitMatch();
			return true;
		}

		[HarmonyPatch(typeof(MenuPageEsc), "ButtonEventQuit")]
		[HarmonyPrefix]
		public static bool OtherPrefix()
		{
			ForfitMatch();
			return true;
		}

		private static void ForfitMatch()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected I4, but got Unknown
			QueueTypes queueType = DanosMatchQueuePoller.QueueType;
			QueueTypes val = queueType;
			switch ((int)val)
			{
			case 0:
			{
				RankedGameManager instance2 = RankedGameManager.Instance;
				if (!((Object)(object)instance2 == (Object)null))
				{
					instance2.CompleteMatch("forfeit");
				}
				break;
			}
			case 3:
			{
				RankedGameManager instance3 = RankedGameManager.Instance;
				if (!((Object)(object)instance3 == (Object)null))
				{
					instance3.CompleteMatch("forfeit");
				}
				break;
			}
			case 4:
			{
				MonthlyGameManager instance = MonthlyGameManager.Instance;
				if (!((Object)(object)instance == (Object)null))
				{
					instance.CompleteMatch("forfeit");
				}
				break;
			}
			case 1:
			case 2:
				break;
			}
		}
	}
	public class ShopItemManagerPatch
	{
		[HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")]
		[HarmonyPrefix]
		private static bool Prefix(ShopManager __instance)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Invalid comparison between Unknown and I4
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Invalid comparison between Unknown and I4
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Invalid comparison between Unknown and I4
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Invalid comparison between Unknown and I4
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Invalid comparison between Unknown and I4
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Invalid comparison between Unknown and I4
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Invalid comparison between Unknown and I4
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random(DanosLevelGenerator.Seed);
			if (SemiFunc.IsNotMasterClient())
			{
				return false;
			}
			__instance.potentialItems.Clear();
			__instance.potentialItemConsumables.Clear();
			__instance.potentialItemUpgrades.Clear();
			__instance.potentialItemHealthPacks.Clear();
			__instance.potentialSecretItems.Clear();
			foreach (Item value in StatsManager.instance.itemDictionary.Values)
			{
				int num = SemiFunc.StatGetItemsPurchased(value.itemAssetName);
				float num2 = value.value.valueMax / 1000f * __instance.itemValueMultiplier;
				if ((int)value.itemType == 3)
				{
					num2 -= num2 * 0.05f * (float)(GameDirector.instance.PlayerList.Count - 1);
					int itemsUpgradesPurchased = StatsManager.instance.GetItemsUpgradesPurchased(value.itemAssetName);
					num2 += num2 * __instance.upgradeValueIncrease * (float)itemsUpgradesPurchased;
					num2 = Mathf.Ceil(num2);
				}
				if ((int)value.itemType == 8)
				{
					num2 += num2 * __instance.healthPackValueIncrease * (float)RunManager.instance.levelsCompleted;
					num2 = Mathf.Ceil(num2);
				}
				if ((int)value.itemType == 5)
				{
					num2 += num2 * __instance.crystalValueIncrease * (float)RunManager.instance.levelsCompleted;
					num2 = Mathf.Ceil(num2);
				}
				float num3 = Mathf.Clamp(num2, 1f, num2);
				bool flag = (int)value.itemType == 5;
				bool flag2 = (int)value.itemType == 3;
				bool flag3 = (int)value.itemType == 8;
				int maxAmountInShop = value.maxAmountInShop;
				if (num >= maxAmountInShop || (value.maxPurchase && StatsManager.instance.GetItemsUpgradesPurchasedTotal(value.itemAssetName) >= value.maxPurchaseAmount) || (!(num3 <= (float)__instance.totalCurrency) && random.Next(0, 100) >= 25))
				{
					continue;
				}
				for (int i = 0; i < maxAmountInShop - num; i++)
				{
					if (flag2)
					{
						__instance.potentialItemUpgrades.Add(value);
						continue;
					}
					if (flag3)
					{
						__instance.potentialItemHealthPacks.Add(value);
						continue;
					}
					if (flag)
					{
						__instance.potentialItemConsumables.Add(value);
						continue;
					}
					if ((int)value.itemSecretShopType == 0)
					{
						__instance.potentialItems.Add(value);
						continue;
					}
					if (!__instance.potentialSecretItems.ContainsKey(value.itemSecretShopType))
					{
						__instance.potentialSecretItems.Add(value.itemSecretShopType, new List<Item>());
					}
					__instance.potentialSecretItems[value.itemSecretShopType].Add(value);
				}
			}
			__instance.potentialItems.ShuffleWithRng(random);
			__instance.potentialItemConsumables.ShuffleWithRng(random);
			__instance.potentialItemUpgrades.ShuffleWithRng(random);
			__instance.potentialItemHealthPacks.ShuffleWithRng(random);
			foreach (List<Item> value2 in __instance.potentialSecretItems.Values)
			{
				value2.ShuffleWithRng(random);
			}
			return false;
		}

		[HarmonyPatch(typeof(ShopManager), "GetAllItemVolumesInScene")]
		[HarmonyPrefix]
		private static bool GetAllItemVolumesInScenePrefix(ShopManager __instance)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Random rng = new Random(DanosLevelGenerator.Seed);
			if (SemiFunc.IsNotMasterClient())
			{
				return false;
			}
			__instance.itemVolumes.Clear();
			ItemVolume[] array = Object.FindObjectsOfType<ItemVolume>();
			ItemVolume[] array2 = array;
			foreach (ItemVolume val in array2)
			{
				if ((int)val.itemSecretShopType == 0)
				{
					__instance.itemVolumes.Add(val);
					continue;
				}
				if (!__instance.secretItemVolumes.ContainsKey(val.itemSecretShopType))
				{
					__instance.secretItemVolumes.Add(val.itemSecretShopType, new List<ItemVolume>());
				}
				__instance.secretItemVolumes[val.itemSecretShopType].Add(val);
			}
			foreach (List<ItemVolume> value in __instance.secretItemVolumes.Values)
			{
				value.ShuffleWithRng(rng);
			}
			__instance.itemVolumes.ShuffleWithRng(rng);
			return false;
		}
	}
	[HarmonyPatch]
	internal class StallingPatch
	{
		[HarmonyPatch(typeof(TruckScreenText), "NextLine")]
		[HarmonyPrefix]
		private static bool Prefix(TruckScreenText __instance, int _currentLineIndex)
		{
			Random random = new Random(DanosLevelGenerator.Seed);
			List<TextPages> pages = __instance.pages;
			int currentPageIndex = __instance.currentPageIndex;
			int currentLineIndex = __instance.currentLineIndex;
			if (pages[currentPageIndex].textLines.Count != 0)
			{
				int maxValue = pages[currentPageIndex].textLines[currentLineIndex].textLines.Count();
				if (GameManager.instance.gameMode == 0)
				{
					int num = random.Next(0, maxValue);
					__instance.NextLineLogic(_currentLineIndex, num);
				}
				else if (PhotonNetwork.IsMasterClient)
				{
					int num2 = random.Next(0, maxValue);
					__instance.photonView.RPC("NextLineRPC", (RpcTarget)0, new object[2] { num2, _currentLineIndex });
				}
			}
			return false;
		}
	}
	[HarmonyPatch]
	public class ValuableObjectPatch
	{
		[HarmonyPatch(typeof(ValuableObject), "DollarValueSetLogic")]
		[HarmonyPrefix]
		public static bool DollarValueSetLogicPrefix(ValuableObject __instance)
		{
			if (DanosValuableGeneration.Instance == null)
			{
				return true;
			}
			DanosValuableGeneration.Instance.DollarValueSetLogic(__instance);
			return false;
		}

		[HarmonyPatch(typeof(ValuableObject), "Start")]
		[HarmonyPrefix]
		private static bool QueueObjectPrefix(ValuableObject __instance)
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Invalid comparison between Unknown and I4
			__instance.physGrabObject = ((Component)__instance).GetComponent<PhysGrabObject>();
			__instance.roomVolumeCheck = ((Component)__instance).GetComponent<RoomVolumeCheck>();
			__instance.navMeshObstacle = ((Component)__instance).GetComponent<NavMeshObstacle>();
			if (Object.op_Implicit((Object)(object)__instance.navMeshObstacle))
			{
				Debug.LogError((object)(((Object)((Component)__instance).gameObject).name + " has a NavMeshObstacle component. Please remove it."));
			}
			((MonoBehaviour)__instance).StartCoroutine(DanosValuableGeneration.CustomDollarValueSet(__instance));
			__instance.rigidBodyMass = __instance.physAttributePreset.mass;
			__instance.rb = ((Component)__instance).GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)__instance.rb))
			{
				__instance.rb.mass = __instance.rigidBodyMass;
			}
			__instance.physGrabObject.massOriginal = __instance.rigidBodyMass;
			if (!LevelGenerator.Instance.Generated)
			{
				ValuableDirector instance = ValuableDirector.instance;
				instance.valuableSpawnAmount++;
				ValuableDirector.instance.valuableList.Add(__instance);
			}
			if ((int)__instance.volumeType <= 1)
			{
				__instance.physGrabObject.clientNonKinematic = true;
			}
			return false;
		}
	}
}
namespace RepoRanked.Patches.LevelGeneration
{
	[HarmonyPatch(typeof(LevelGenerator), "Start")]
	public class Patch_LevelManager_Generate
	{
		private static bool Prefix(LevelGenerator __instance)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected I4, but got Unknown
			if (StatsManager.instance.teamName != "REPORanked")
			{
				return true;
			}
			RepoRanked.Logger.LogInfo((object)"Using custom Generate() coroutine for REPORanked.");
			string text = null;
			QueueTypes queueType = DanosMatchQueuePoller.QueueType;
			QueueTypes val = queueType;
			switch ((int)val)
			{
			case 0:
				if ((Object)(object)RankedGameManager.Instance == (Object)null)
				{
					RepoRanked.Logger.LogError((object)"RankedGameManager instance is null.");
					return true;
				}
				text = RankedGameManager.Instance.matchData.Seed;
				break;
			case 3:
				if ((Object)(object)RankedGameManager.Instance == (Object)null)
				{
					RepoRanked.Logger.LogError((object)"RankedGameManager instance is null.");
					return true;
				}
				text = RankedGameManager.Instance.matchData.Seed;
				break;
			case 4:
			{
				if ((Object)(object)MonthlyGameManager.Instance == (Object)null)
				{
					RepoRanked.Logger.LogError((object)"MonthlyGameManager instance is null.");
					return true;
				}
				FTTDMapData currentMapData = MonthlyGameManager.Instance.GetCurrentMapData();
				text = currentMapData.seed.ToString();
				break;
			}
			default:
				RepoRanked.Logger.LogError((object)"Unsupported queue type.");
				return true;
			}
			if (string.IsNullOrEmpty(text))
			{
				RepoRanked.Logger.LogError((object)"Seed is null or empty.");
				return true;
			}
			if (!int.TryParse(text, out var result))
			{
				RepoRanked.Logger.LogError((object)("Failed to parse seed '" + text + "' as int."));
				return true;
			}
			DanosLevelGenerator.Create(result);
			DanosValuableGeneration.Create(result);
			Random.InitState(result);
			((MonoBehaviour)__instance).StartCoroutine(DanosLevelGenerator.GenerateWithSeed(__instance, result));
			return false;
		}
	}
	[HarmonyPatch(typeof(LevelGenerator), "PickModule")]
	internal class PickModulePatch
	{
		private static bool Prefix(ref GameObject __result, List<GameObject> _list1, List<GameObject> _list2, List<GameObject> _list3, ref int _index1, ref int _index2, ref int _index3, ref int _loops1, ref int _loops2, ref int _loops3)
		{
			DanosLevelGenerator instance = DanosLevelGenerator.Instance;
			if (instance == null)
			{
				RepoRanked.Logger.LogError((object)"DanosLevelGenerator instance is null.");
				return true;
			}
			LevelGenerator instance2 = LevelGenerator.Instance;
			if ((Object)(object)instance2 == (Object)null)
			{
				RepoRanked.Logger.LogError((object)"LevelGenerator instance is null.");
				return true;
			}
			__result = DanosLevelGenerator.PickModule(_list1, _list2, _list3, ref _index1, ref _index2, ref _index3, ref _loops1, ref _loops2, ref _loops3, instance2, instance.rng);
			if ((Object)(object)__result == (Object)null)
			{
				RepoRanked.Logger.LogError((object)"Picked module is null. Check your module lists and RNG settings.");
				return true;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(RunManager), "SetRunLevel")]
	public class RunManagerPatch_SetRunLevel
	{
		private static void Postfix(RunManager __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected I4, but got Unknown
			Debug.Log((object)$"RunManagerPatch_SetRunLevel: DanosMatchQueuePoller.QueueType = {DanosMatchQueuePoller.QueueType}");
			QueueTypes queueType = DanosMatchQueuePoller.QueueType;
			QueueTypes val = queueType;
			switch ((int)val)
			{
			case 0:
				RankedLogic(__instance);
				break;
			case 3:
				RankedLogic(__instance);
				break;
			case 4:
				MonthlyLogic(__instance);
				break;
			default:
				RepoRanked.Logger.LogWarning((object)"Unsupported queue type for SetRunLevel.");
				break;
			}
		}

		private static void MonthlyLogic(RunManager instance)
		{
			List<Level> levels = instance.levels;
			if (levels == null || levels.Count == 0)
			{
				RepoRanked.Logger.LogWarning((object)"RunManager.levels is empty or null.");
				return;
			}
			if ((Object)(object)MonthlyGameManager.Instance == (Object)null)
			{
				RepoRanked.Logger.LogWarning((object)"MonthlyGameManager.Instance is null.");
				return;
			}
			if (MonthlyGameManager.Instance.FirstToTenData == null)
			{
				RepoRanked.Logger.LogWarning((object)"MonthlyGameManager.Instance is null.");
				return;
			}
			FTTDMapData currentMapData = MonthlyGameManager.Instance.GetCurrentMapData();
			if (currentMapData == null)
			{
				RepoRanked.Logger.LogWarning((object)"Current map data is null.");
				return;
			}
			string map = currentMapData.map;
			if (string.IsNullOrEmpty(map))
			{
				RepoRanked.Logger.LogWarning((object)"Map name is null or empty.");
				return;
			}
			foreach (Level item in levels)
			{
				if ((Object)(object)item != (Object)null && item.ResourcePath.Contains(map))
				{
					instance.levelCurrent = item;
					RepoRanked.Logger.LogInfo((object)("Set currentLevel to: " + item.ResourcePath));
					break;
				}
			}
		}

		private static void RankedLogic(RunManager __instance)
		{
			List<Level> levels = __instance.levels;
			if (levels == null || levels.Count == 0)
			{
				RepoRanked.Logger.LogWarning((object)"RunManager.levels is empty or null.");
				return;
			}
			if ((Object)(object)RankedGameManager.Instance == (Object)null)
			{
				RepoRanked.Logger.LogWarning((object)"RankedGameManager.Instance is null.");
				return;
			}
			if (RankedGameManager.Instance.matchData == null)
			{
				RepoRanked.Logger.LogWarning((object)"RankedGameManager.Instance.matchData is null.");
				return;
			}
			string text = RankedGameManager.Instance.matchData.Map;
			if (text == "unknown")
			{
				text = "Wizard";
			}
			string text2 = "";
			foreach (KeyValuePair<long, string> player in RankedGameManager.Instance.matchData.Players)
			{
				if (player.Value != null)
				{
					text2 = text2 + player.Value + " vs ";
				}
			}
			if (text2.Length > 4)
			{
				text2 = text2.Substring(0, text2.Length - 4);
			}
			foreach (Level item in levels)
			{
				if ((Object)(object)item != (Object)null && item.ResourcePath.Contains(text))
				{
					__instance.levelCurrent = item;
					__instance.levelCurrent.NarrativeName = text2;
					RepoRanked.Logger.LogInfo((object)("Set currentLevel to: " + item.ResourcePath));
					break;
				}
			}
		}
	}
}
namespace RepoRanked.Patches.EnemyDirectorP
{
	[HarmonyPatch(typeof(EnemyDirector), "AmountSetup")]
	public class Patch_EnemyDirector_AmountSetup
	{
		private static bool Prefix(EnemyDirector __instance)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected I4, but got Unknown
			DifficultyAmountLogger.GenerateDifficultyAmountTable(__instance.amountCurve1_1, __instance.amountCurve2_1, __instance.amountCurve3_1);
			EnemyExtractor.GenerateEnemiesFullJson(__instance);
			EnemyExtractor.GenerateEnemiesJson(__instance);
			if (StatsManager.instance.teamName == "REPORanked")
			{
				QueueTypes queueType = DanosMatchQueuePoller.QueueType;
				QueueTypes val = queueType;
				EnemySetup val2;
				switch ((int)val)
				{
				case 0:
					if ((Object)(object)RankedGameManager.Instance == (Object)null)
					{
						RepoRanked.Logger.LogWarning((object)"RankedGameManager.Instance is null.");
						return true;
					}
					if (RankedGameManager.Instance.matchData == null)
					{
						RepoRanked.Logger.LogWarning((object)"RankedGameManager.Instance.matchData is null.");
						return true;
					}
					val2 = DanosEnemyGenerator.CreateCustomEnemySetup(RankedGameManager.Instance.matchData.Enemies);
					break;
				case 3:
					if ((Object)(object)RankedGameManager.Instance == (Object)null)
					{
						RepoRanked.Logger.LogWarning((object)"RankedGameManager.Instance is null.");
						return true;
					}
					if (RankedGameManager.Instance.matchData == null)
					{
						RepoRanked.Logger.LogWarning((object)"RankedGameManager.Instance.matchData is null.");
						return true;
					}
					val2 = DanosEnemyGenerator.CreateCustomEnemySetup(RankedGameManager.Instance.matchData.Enemies);
					break;
				case 4:
					val2 = DanosEnemyGenerator.CreateCustomEnemySetup(MonthlyGameManager.Instance.GetCurrentMapData().Enemies);
					break;
				default:
					RepoRanked.Logger.LogWarning((object)"Unsupported queue type for EnemyDirector.AmountSetup.");
					return true;
				}
				__instance.enemyList = new List<EnemySetup>();
				if ((Object)(object)val2 != (Object)null)
				{
					List<EnemySetup> list = new List<EnemySetup>();
					list.Add(val2);
					EnemyDirector.instance.PickEnemies(list);
					EnemyDirector.instance.totalAmount = 1;
					return false;
				}
			}
			return true;
		}
	}
}
namespace RepoRanked.Mods
{
	public class DanosModChecker : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <ModCheckCoroutine>d__16 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DanosModChecker <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				<>4__this.RunCheck();
				<>2__current = (object)new WaitForSeconds(<>4__this.CheckIntervalSeconds);
				<>1__state = 1;
				return true;
			}

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

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

		public List<string> AllowedModGuids = new List<string> { "danos.RepoRanked", "nickklmao.menulib" };

		public float CheckIntervalSeconds = 10f;

		public static DanosModChecker Instance { get; private set; }

		public bool IsCompliant { get; private set; } = true;


		public bool IsGameVersionCompliant { get; private set; } = true;


		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null)
			{
				Debug.LogWarning((object)"Duplicate DanosModChecker detected. Destroying new instance.");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Debug.Log((object)"DanosModChecker initialized.");
				Instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
		}

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(ModCheckCoroutine());
		}

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

		private void RunCheck()
		{
			Dictionary<string, PluginInfo>.ValueCollection values = Chainloader.PluginInfos.Values;
			bool flag = true;
			foreach (PluginInfo item in values)
			{
				if (!AllowedModGuids.Contains(item.Metadata.GUID))
				{
					flag = false;
				}
			}
			IsCompliant = flag;
			if (!flag && (Object)(object)RankedGameManager.Instance != (Object)null && RankedGameManager.Instance.matchData != null)
			{
				RankedGameManager.Instance.CompleteMatch("non_allowed_mods");
			}
			RunGameVersionCheck();
		}

		private void RunGameVersionCheck()
		{
			Version val = null;
			BuildManager instance = BuildManager.instance;
			if (!((Object)(object)instance != (Object)null))
			{
				return;
			}
			val = instance.version;
			if ((Object)(object)val != (Object)null)
			{
				if (val.title.ToLower().Contains("beta"))
				{
					IsGameVersionCompliant = false;
				}
				if (!val.title.ToLower().Contains("0.2."))
				{
					IsGameVersionCompliant = false;
				}
				else
				{
					IsGameVersionCompliant = true;
				}
			}
		}

		public void ForceCheck()
		{
			RunCheck();
		}

		public static void Create()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("DanosModChecker");
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<DanosModChecker>();
			}
		}
	}
}
namespace RepoRanked.MainMenu
{
	public class DanosMainMenuManager : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuilderDelegate <>9__14_0;

			public static Action <>9__14_2;

			public static Action <>9__16_0;

			public static BuilderDelegate <>9__25_0;

			public static BuilderDelegate <>9__27_0;

			public static Action<string> <>9__27_3;

			public static BuilderDelegate <>9__27_1;

			public static BuilderDelegate <>9__29_0;

			public static BuilderDelegate <>9__31_2;

			public static BuilderDelegate <>9__33_0;

			internal void <ShowPrivacyConsentPopup>b__14_0(Transform parent)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("To use REPORanked, we collect your SteamID and match data.\nThis is used solely for matchmaking, match tracking and\nElo calculations.\n\nYou can view the full policy by clicking 'View Policy' below\nBy continuing, you consent to this data being collected\nand agree to the Privacy Policy located at\nhttps://reporanked.splitstats.io/PrivacyPolicy.", parent, new Vector2(400f, 220f));
				((TMP_Text)val.labelTMP).fontSize = 10f;
			}

			internal void <ShowPrivacyConsentPopup>b__14_2()
			{
				Application.OpenURL("https://reporanked.splitstats.io/PrivacyPolicy");
			}

			internal void <GetDiscordButton>b__16_0()
			{
				Application.OpenURL("https://discord.gg/y7WBzTT9jF");
			}

			internal void <ShowFTTPopup>b__25_0(Transform parent)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("10 Level Set Seed Comp\nCheck the Discord for more info :D", parent, new Vector2(400f, 260f));
				((Graphic)val.labelTMP).color = Color.white;
				((TMP_Text)val.labelTMP).fontSize = 10f;
			}

			internal void <ShowPassphrasePopup>b__27_0(Transform parent)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Set a passphrase for the unranked queue here!\nMax 7 characters, everything else is truncated\nOnly letters and numbers.", parent, new Vector2(400f, 260f));
				((Graphic)val.labelTMP).color = Color.white;
				((TMP_Text)val.labelTMP).fontSize = 10f;
			}

			internal void <ShowPassphrasePopup>b__27_1(Transform parent)
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				string passphrase = DanosPassphraseManager.GetPassphrase();
				MenuAPI.CreateREPOInputField("Passphrase", (Action<string>)delegate(string value)
				{
					DanosPassphraseManager.SetPassphrase(value);
				}, parent, new Vector2(400f, 200f), false, "Enter passphrase...", passphrase);
			}

			internal void <ShowPassphrasePopup>b__27_3(string value)
			{
				DanosPassphraseManager.SetPassphrase(value);
			}

			internal void <ShowQueueSelectorPopup>b__29_0(Transform parent)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Select a queue to join:", parent, new Vector2(400f, 260f));
				((Graphic)val.labelTMP).color = Color.white;
				((TMP_Text)val.labelTMP).fontSize = 10f;
			}

			internal void <ShowRankedPopup>b__31_2(Transform parent)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Your rank:", parent, new Vector2(400f, 235f));
				((Graphic)val.labelTMP).color = Color.white;
				((TMP_Text)val.labelTMP).fontSize = 10f;
			}

			internal void <ShowUnRankedPopup>b__33_0(Transform parent)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel("Play against your friends!\nMake sure to set a Passphrase in the main menu!", parent, new Vector2(400f, 260f));
				((Graphic)val.labelTMP).color = Color.white;
				((TMP_Text)val.labelTMP).fontSize = 10f;
			}
		}

		public static bool SpawnedButtonWarning;

		private Vector2 hostPosition = Vector2.zero;

		private Vector2 joinPosition = Vector2.zero;

		private const string DiscordInviteUrl = "https://discord.gg/y7WBzTT9jF";

		public static TMP_FontAsset fontAsset;

		private bool isProcessing = false;

		public REPOPopupPage? fttPopupPage;

		private REPOPopupPage? passphrasePopup;

		private REPOPopupPage? queueSelectorPopup;

		public REPOPopupPage? eloPopupPage;

		public REPOPopupPage? unRankedPopupPage;

		public static DanosMainMenuManager Instance { get; private set; }

		public static void Create()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("DanosMainMenuManager");
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<DanosMainMenuManager>();
			}
		}

		public void Init()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			MenuAPI.AddElementToMainMenu((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				MenuPage component = ((Component)parent).GetComponent<MenuPage>();
				if ((Object)(object)component == (Object)null)
				{
					Debug.Log((object)"MenuPage component not found in the parent object.");
				}
				else
				{
					RemoveMainButtons(parent);
					if (!SpawnedButtonWarning)
					{
						MenuManager.instance.PagePopUpScheduled("RepoRanked", Color.yellow, "To avoid possible bugs, please be patient when pressing a button. Depending on your network, when you press a button, the menu could dissapear for some time. Avoid opening menus again without waiting at least one second.", "Let me play...", true);
					}
					SpawnedButtonWarning = true;
					REPOButton queueSelectorButton = GetQueueSelectorButton(parent);
					REPOButton discordButton = GetDiscordButton(parent);
					if (RankedGameManager.LastMatchId != -1)
					{
						REPOButton lastMatchButton = GetLastMatchButton(parent);
						RunLastMatchCheckAsync();
					}
				}
			});
		}

		private async Task RunLastMatchCheckAsync()
		{
			long matchId = RankedGameManager.LastMatchId;
			MatchResultResponse response = await DanosAPI.GetMatchResults(matchId);
			if (response == null)
			{
				return;
			}
			string playerResults = "";
			foreach (KeyValuePair<long, string> player in response.Players)
			{
				long steamId = player.Key;
				string name = player.Value;
				string result = (response.Results.ContainsKey(steamId) ? response.Results[steamId] : "unknown");
				int eloChange = (response.EloChanges.ContainsKey(steamId) ? response.EloChanges[steamId] : 0);
				string display = $"{name} - {result}, Elo Δ: {eloChange}";
				playerResults = playerResults + "\n" + display;
			}
			MenuManager.instance.PagePopUpScheduled($"Match results ({response.MatchId})", (response.WinnerSteamId == (long)SteamClient.SteamId.Value) ? Color.green : Color.red, $"Elo Δ changed: {response.EloChanges[(long)SteamClient.SteamId.Value]}\n{playerResults}", "GG", true);
		}

		private REPOPopupPage ShowErrorPopup(string message)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			string message2 = message;
			REPOPopupPage? obj = queueSelectorPopup;
			if (obj != null)
			{
				obj.ClosePage(true);
			}
			REPOPopupPage popup = MenuAPI.CreateREPOPopupPage("Notice", (PresetSide)1, false, true, 1.5f);
			popup.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				REPOLabel val = MenuAPI.CreateREPOLabel(message2, parent, new Vector2(400f, 220f));
				((TMP_Text)val.labelTMP).fontSize = 10f;
			});
			popup.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Close", (Action)delegate
				{
					popup.ClosePage(false);
				}, parent, new Vector2(400f, 100f));
			});
			popup.OpenPage(false);
			return popup;
		}

		private void ShowPrivacyConsentPopup(Action onAccept)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//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_005e: Expected O, but got Unknown
			Action onAccept2 = onAccept;
			REPOPopupPage? obj = queueSelectorPopup;
			if (obj != null)
			{
				obj.ClosePage(true);
			}
			REPOPopupPage popup = MenuAPI.CreateREPOPopupPage("Privacy Notice", (PresetSide)1, false, true, 1.5f);
			REPOPopupPage obj2 = popup;
			object obj3 = <>c.<>9__14_0;
			if (obj3 == null)
			{
				BuilderDelegate val = delegate(Transform parent)
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					REPOLabel val2 = MenuAPI.CreateREPOLabel("To use REPORanked, we collect your SteamID and match data.\nThis is used solely for matchmaking, match tracking and\nElo calculations.\n\nYou can view the full policy by clicking 'View Policy' below\nBy continuing, you consent to this data being collected\nand agree to the Privacy Policy located at\nhttps://reporanked.splitstats.io/PrivacyPolicy.", parent, new Vector2(400f, 220f));
					((TMP_Text)val2.labelTMP).fontSize = 10f;
				};
				<>c.<>9__14_0 = val;
				obj3 = (object)val;
			}
			obj2.AddElement((BuilderDelegate)obj3);
			popup.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("View Policy", (Action)delegate
				{
					Application.OpenURL("https://reporanked.splitstats.io/PrivacyPolicy");
				}, parent, new Vector2(400f, 140f));
				MenuAPI.CreateREPOButton("Accept", (Action)delegate
				{
					onAccept2();
					popup.ClosePage(false);
				}, parent, new Vector2(400f, 100f));
				MenuAPI.CreateREPOButton("Decline", (Action)delegate
				{
					popup.ClosePage(false);
				}, parent, new Vector2(400f, 60f));
			});
			popup.OpenPage(false);
		}

		public REPOButton CreateQueueButton(string label, Vector2 position, Func<RegisterPlayerResponse, Task> onSuccess, Transform parent)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			string label2 = label;
			Func<RegisterPlayerResponse, Task> onSuccess2 = onSuccess;
			return MenuAPI.CreateREPOButton(label2, (Action)async delegate
			{
				if (!isProcessing)
				{
					isProcessing = true;
					REPOPopupPage? obj = queueSelectorPopup;
					if (obj != null)
					{
						obj.ClosePage(true);
					}
					Debug.Log((object)("REPORanked " + label2 + " clicked!"));
					DanosModChecker.Create();
					DanosModChecker.Instance.ForceCheck();
					if ((Object)(object)DanosModChecker.Instance != (Object)null && !DanosModChecker.Instance.IsCompliant)
					{
						ShowErrorPopup("You are using disallowed mods. \nWe do this to keep competitive integrity.\n\nAllowed mods are:\n-REPORanked\n-MenuLib\n\n\nPlease remove any others to play :).");
						isProcessing = false;
					}
					else if ((Object)(object)DanosModChecker.Instance != (Object)null && !DanosModChecker.Instance.IsGameVersionCompliant)
					{
						ShowErrorPopup("Your game version is not compliant with REPORanked.\n\nPlease update your game to the latest version.\n\nIf you are using the beta branch, please revert to the normal one.");
						isProcessing = false;
					}
					else
					{
						ShowPrivacyConsentPopup(async delegate
						{
							RegisterPlayerResponse response = await DanosAPI.RegisterPlayer((long)SteamClient.SteamId.Value, SteamClient.Name);
							if (response != null)
							{
								if (response.Status == "ok")
								{
									await onSuccess2(response);
								}
								else if (response.Status == "error")
								{
									ShowErrorPopup(response.Message);
								}
								else
								{
									Debug.LogError((object)"Unknown response status.");
								}
							}
							else
							{
								Debug.LogError((object)"Failed to register player.");
							}
							isProcessing = false;
						});
						isProcessing = false;
					}
				}
			}, parent, position);
		}

		public REPOButton GetDiscordButton(Transform parent)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			return MenuAPI.CreateREPOButton("Join Discord", (Action)delegate
			{
				Application.OpenURL("https://discord.gg/y7WBzTT9jF");
			}, parent, hostPosition + new Vector2(0f, -40f));
		}

		public REPOButton GetFTTButton(Transform parent)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return CreateQueueButton("Set Seed Queue", new Vector2(380f, 160f), delegate
			{
				ShowFTTPopup();
				return Task.CompletedTask;
			}, parent);
		}

		public REPOButton GetLastMatchButton(Transform parent)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			return MenuAPI.CreateREPOButton("Last Match Results", (Action)async delegate
			{
				if (!isProcessing)
				{
					isProcessing = true;
					long matchId = RankedGameManager.LastMatchId;
					MatchResultResponse response = await DanosAPI.GetMatchResults(matchId);
					if (response != null)
					{
						REPOPopupPage popup = MenuAPI.CreateREPOPopupPage("Last Match Results", (PresetSide)1, false, true, 1.5f);
						popup.AddElement((BuilderDelegate)delegate(Transform scrollParent)
						{
							//IL_0028: Unknown result type (might be due to invalid IL or missing references)
							string text = $"Match #{response.MatchId}";
							MenuAPI.CreateREPOLabel(text, scrollParent, new Vector2(400f, 260f));
						});
						int y = 220;
						foreach (KeyValuePair<long, string> player in response.Players)
						{
							long steamId = player.Key;
							string name = player.Value;
							string result = (response.Results.ContainsKey(steamId) ? response.Results[steamId] : "unknown");
							int eloChange = (response.EloChanges.ContainsKey(steamId) ? response.EloChanges[steamId] : 0);
							string display = $"{name} - {result}, Elo Δ: {eloChange}";
							popup.AddElement((BuilderDelegate)delegate(Transform scrollParent)
							{
								//IL_0019: Unknown result type (might be due to invalid IL or missing references)
								REPOLabel val = MenuAPI.CreateREPOLabel(display, scrollParent, new Vector2(400f, (float)y));
								((TMP_Text)val.labelTMP).fontSize = 10f;
								fontAsset = ((TMP_Text)val.labelTMP).font;
								y -= 30;
							});
						}
						popup.AddElement((BuilderDelegate)delegate(Transform scrollParent)
						{
							//IL_0035: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Close", (Action)delegate
							{
								popup.ClosePage(false);
							}, scrollParent, new Vector2(400f, (float)(y - 30)));
						});
						popup.OpenPage(false);
					}
					else
					{
						Debug.LogError((object)"Failed to retrieve match result.");
					}
					isProcessing = false;
				}
			}, parent, hostPosition + new Vector2(0f, -80f));
		}

		public REPOButton GetPassphraseButton(Transform parent)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			return MenuAPI.CreateREPOButton("Set Unranked Passphrase", (Action)delegate
			{
				if (!isProcessing)
				{
					isProcessing = true;
					ShowPassphrasePopup();
					isProcessing = false;
				}
			}, parent, new Vector2(400f, 140f));
		}

		public REPOButton GetQueueSelectorButton(Transform parent)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			return MenuAPI.CreateREPOButton("REPORanked", (Action)delegate
			{
				ShowQueueSelectorPopup();
			}, parent, hostPosition);
		}

		public REPOButton GetRankedButton(Transform parent)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return CreateQueueButton("Ranked", new Vector2(380f, 240f), delegate(RegisterPlayerResponse response)
			{
				Debug.Log((object)$"Registered with Elo {response.EloRating}");
				ShowRankedPopup(response.EloRating, response.Message, response.Matches);
				return Task.CompletedTask;
			}, parent);
		}

		public void RemoveMainButtons(Transform parent)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in parent)
			{
				Transform val = item;
				Debug.Log((object)("Removing child: " + ((Object)val).name + " from parent: " + ((Object)parent).name));
				switch (((Object)val).name)
				{
				case "Menu Button - Private Game":
					hostPosition = Vector2.op_Implicit(val.localPosition);
					Object.Destroy((Object)(object)((Component)val).gameObject);
					break;
				case "Menu Button - Public Game":
					joinPosition = Vector2.op_Implicit(val.localPosition);
					Object.Destroy((Object)(object)((Component)val).gameObject);
					break;
				case "Menu Button - join friend":
					Object.Destroy((Object)(object)((Component)val).gameObject);
					break;
				case "Menu Button - singleplayer":
				case "Menu Button - Tutorial":
					((Behaviour)((Component)val).GetComponent<MenuButton>()).enabled = false;
					((Behaviour)((Component)val).GetComponent<MenuSelectableElement>()).enabled = false;
					((Graphic)((Component)((Component)val).transform.GetChild(0)).GetComponent<TMP_Text>()).color = new Color(1f, 1f, 1f, 0.1f);
					if (((Object)val).name == "Menu Button - singleplayer" && RankedGameManager.LastMatchId != -1)
					{
						Object.Destroy((Object)(object)((Component)val).gameObject);
					}
					break;
				}
			}
		}

		public REPOButton GetUnRankedButton(Transform parent)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return CreateQueueButton("Un-Ranked", new Vector2(380f, 200f), delegate
			{
				ShowUnRankedPopup();
				return Task.CompletedTask;
			}, parent);
		}

		private void ShowFTTPopup()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			if ((Object)(object)fttPopupPage == (Object)null)
			{
				REPOPopupPage? obj = queueSelectorPopup;
				if (obj != null)
				{
					obj.ClosePage(true);
				}
				fttPopupPage = MenuAPI.CreateREPOPopupPage("REPORanked", (PresetSide)1, true, true, 1.5f);
				REPOPopupPage? obj2 = fttPopupPage;
				object obj3 = <>c.<>9__25_0;
				if (obj3 == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						REPOLabel val2 = MenuAPI.CreateREPOLabel("10 Level Set Seed Comp\nCheck the Discord for more info :D", parent, new Vector2(400f, 260f));
						((Graphic)val2.labelTMP).color = Color.white;
						((TMP_Text)val2.labelTMP).fontSize = 10f;
					};
					<>c.<>9__25_0 = val;
					obj3 = (object)val;
				}
				obj2.AddElement((BuilderDelegate)obj3);
				fttPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Queue", (Action)async delegate
					{
						if (!isProcessing)
						{
							isProcessing = true;
							long steamId = (long)SteamClient.SteamId.Value;
							if (await DanosAPI.Enqueue(steamId, (QueueTypes)6))
							{
								DanosLobbyQueuePoller.Create();
								DanosLobbyQueuePoller.Instance.StartPolling(fttPopupPage);
							}
							else
							{
								Debug.LogError((object)"Failed to queue for match.");
							}
							isProcessing = false;
						}
					}, parent, new Vector2(400f, 180f));
				});
				fttPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Close", (Action)delegate
					{
						fttPopupPage.ClosePage(true);
					}, parent, new Vector2(400f, 100f));
				});
			}
			fttPopupPage.OpenPage(false);
		}

		public void ShowPassphrasePopup()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			if ((Object)(object)passphrasePopup == (Object)null)
			{
				REPOPopupPage? obj = queueSelectorPopup;
				if (obj != null)
				{
					obj.ClosePage(true);
				}
				REPOPopupPage? obj2 = unRankedPopupPage;
				if (obj2 != null)
				{
					obj2.ClosePage(true);
				}
				passphrasePopup = MenuAPI.CreateREPOPopupPage("Set Passphrase", (PresetSide)1, false, true, 1.5f);
				REPOPopupPage? obj3 = passphrasePopup;
				object obj4 = <>c.<>9__27_0;
				if (obj4 == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						REPOLabel val3 = MenuAPI.CreateREPOLabel("Set a passphrase for the unranked queue here!\nMax 7 characters, everything else is truncated\nOnly letters and numbers.", parent, new Vector2(400f, 260f));
						((Graphic)val3.labelTMP).color = Color.white;
						((TMP_Text)val3.labelTMP).fontSize = 10f;
					};
					<>c.<>9__27_0 = val;
					obj4 = (object)val;
				}
				obj3.AddElement((BuilderDelegate)obj4);
				REPOPopupPage? obj5 = passphrasePopup;
				object obj6 = <>c.<>9__27_1;
				if (obj6 == null)
				{
					BuilderDelegate val2 = delegate(Transform parent)
					{
						//IL_0036: Unknown result type (might be due to invalid IL or missing references)
						string passphrase = DanosPassphraseManager.GetPassphrase();
						MenuAPI.CreateREPOInputField("Passphrase", (Action<string>)delegate(string value)
						{
							DanosPassphraseManager.SetPassphrase(value);
						}, parent, new Vector2(400f, 200f), false, "Enter passphrase...", passphrase);
					};
					<>c.<>9__27_1 = val2;
					obj6 = (object)val2;
				}
				obj5.AddElement((BuilderDelegate)obj6);
				passphrasePopup.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Close", (Action)delegate
					{
						passphrasePopup.ClosePage(true);
					}, parent, new Vector2(400f, 150f));
				});
			}
			passphrasePopup.OpenPage(false);
		}

		public void ShowQueueSelectorPopup()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			if ((Object)(object)queueSelectorPopup == (Object)null)
			{
				queueSelectorPopup = MenuAPI.CreateREPOPopupPage("Available Queues", (PresetSide)1, false, true, 1.5f);
				REPOPopupPage? obj = queueSelectorPopup;
				object obj2 = <>c.<>9__29_0;
				if (obj2 == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						REPOLabel val2 = MenuAPI.CreateREPOLabel("Select a queue to join:", parent, new Vector2(400f, 260f));
						((Graphic)val2.labelTMP).color = Color.white;
						((TMP_Text)val2.labelTMP).fontSize = 10f;
					};
					<>c.<>9__29_0 = val;
					obj2 = (object)val;
				}
				obj.AddElement((BuilderDelegate)obj2);
				queueSelectorPopup.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					REPOButton rankedButton = GetRankedButton(parent);
				});
				queueSelectorPopup.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					REPOButton unRankedButton = GetUnRankedButton(parent);
				});
			}
			REPOPopupPage? obj3 = queueSelectorPopup;
			if (obj3 != null)
			{
				obj3.OpenPage(false);
			}
		}

		private void ShowRankedPopup(int elo, string bracket, int matches)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			string bracket2 = bracket;
			if ((Object)(object)eloPopupPage == (Object)null)
			{
				eloPopupPage = MenuAPI.CreateREPOPopupPage("REPORanked", (PresetSide)1, true, true, 1.5f);
				eloPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					REPOLabel val3 = MenuAPI.CreateREPOLabel($"{matches} matches in the last 30 mins!", parent, new Vector2(400f, 260f));
					((Graphic)val3.labelTMP).color = Color.white;
					((TMP_Text)val3.labelTMP).fontSize = 10f;
				});
				eloPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOLabel($"{bracket2} ({elo})", parent, new Vector2(400f, 220f));
				});
				REPOPopupPage? obj = eloPopupPage;
				object obj2 = <>c.<>9__31_2;
				if (obj2 == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						REPOLabel val2 = MenuAPI.CreateREPOLabel("Your rank:", parent, new Vector2(400f, 235f));
						((Graphic)val2.labelTMP).color = Color.white;
						((TMP_Text)val2.labelTMP).fontSize = 10f;
					};
					<>c.<>9__31_2 = val;
					obj2 = (object)val;
				}
				obj.AddElement((BuilderDelegate)obj2);
				eloPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Queue for Match", (Action)async delegate
					{
						if (!isProcessing)
						{
							isProcessing = true;
							long steamId = (long)SteamClient.SteamId.Value;
							if (await DanosAPI.Enqueue(steamId, (QueueTypes)0))
							{
								DanosMatchQueuePoller.Create((QueueTypes)0);
								DanosMatchQueuePoller.Instance.StartPolling(eloPopupPage, (QueueTypes)0);
							}
							else
							{
								Debug.LogError((object)"Failed to queue for match.");
							}
							isProcessing = false;
						}
					}, parent, new Vector2(400f, 180f));
				});
				eloPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Close", (Action)delegate
					{
						eloPopupPage.ClosePage(true);
					}, parent, new Vector2(400f, 140f));
				});
			}
			eloPopupPage.OpenPage(false);
		}

		private void ShowUnRankedPopup()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			if ((Object)(object)unRankedPopupPage == (Object)null)
			{
				REPOPopupPage? obj = queueSelectorPopup;
				if (obj != null)
				{
					obj.ClosePage(true);
				}
				unRankedPopupPage = MenuAPI.CreateREPOPopupPage("REPORanked", (PresetSide)1, true, true, 1.5f);
				REPOPopupPage? obj2 = unRankedPopupPage;
				object obj3 = <>c.<>9__33_0;
				if (obj3 == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_0011: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						REPOLabel val2 = MenuAPI.CreateREPOLabel("Play against your friends!\nMake sure to set a Passphrase in the main menu!", parent, new Vector2(400f, 260f));
						((Graphic)val2.labelTMP).color = Color.white;
						((TMP_Text)val2.labelTMP).fontSize = 10f;
					};
					<>c.<>9__33_0 = val;
					obj3 = (object)val;
				}
				obj2.AddElement((BuilderDelegate)obj3);
				unRankedPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Queue with Password (Unranked)", (Action)async delegate
					{
						if (!isProcessing)
						{
							isProcessing = true;
							long steamId = (long)SteamClient.SteamId.Value;
							if (await DanosAPI.Enqueue(steamId, (QueueTypes)3, DanosPassphraseManager.GetPassphrase()))
							{
								DanosMatchQueuePoller.Create((QueueTypes)3);
								DanosMatchQueuePoller.Instance.StartPolling(unRankedPopupPage, (QueueTypes)3);
							}
							else
							{
								Debug.LogError((object)"Failed to queue for match.");
							}
							isProcessing = false;
						}
					}, parent, new Vector2(400f, 180f));
				});
				unRankedPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					REPOButton passphraseButton = GetPassphraseButton(parent);
				});
				unRankedPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Close", (Action)delegate
					{
						unRankedPopupPage.ClosePage(true);
					}, parent, new Vector2(400f, 100f));
				});
			}
			unRankedPopupPage.OpenPage(false);
		}
	}
	public static class DanosPassphraseManager
	{
		private static string _passphrase;

		private static readonly string FolderPath = Path.Combine(Application.persistentDataPath, "reporanked");

		private static readonly string FilePath = Path.Combine(FolderPath, "passphrase.txt");

		public static string GetPassphrase()
		{
			if (File.Exists(FilePath))
			{
				_passphrase = File.ReadAllText(FilePath);
			}
			if (string.IsNullOrEmpty(_passphrase))
			{
				_passphrase = "default";
				SetPassphrase(_passphrase);
			}
			else
			{
				SetPassphrase(_passphrase);
			}
			return _passphrase ?? string.Empty;
		}

		public static void SetPassphrase(string passphrase)
		{
			passphrase = passphrase.Substring(0, Math.Min(passphrase.Length, 7));
			if (!Regex.IsMatch(passphrase, "^[a-zA-Z0-9]+$"))
			{
				passphrase = Regex.Replace(passphrase, "[^a-zA-Z0-9]", "");
			}
			_passphrase = passphrase;
			if (!Directory.Exists(FolderPath))
			{
				Directory.CreateDirectory(FolderPath);
			}
			File.WriteAllText(FilePath, passphrase);
		}
	}
	public class DanosLobbyQueuePoller : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <PollLobbyStatus>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DanosLobbyQueuePoller <>4__this;

			private long <steamId>5__1;

			private Task<bool> <task>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<steamId>5__1 = (long)SteamClient.SteamId.Value;
					break;
				case 1:
					<>1__state = -1;
					<task>5__2 = <>4__this.CheckLobbyStatusAsync(<steamId>5__1);
					goto IL_0091;
				case 2:
					{
						<>1__state = -1;
						goto IL_0091;
					}
					IL_0091:
					if (!<task>5__2.IsCompleted)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					if (<task>5__2.Result)
					{
						<>4__this.pollingCoroutine = null;
						return false;
					}
					<task>5__2 = null;
					break;
				}
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}

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

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

		private Coroutine? pollingCoroutine;

		private REPOPopupPage? queuePage;

		private REPOLabel? statusLabel;

		private REPOLabel? playersLabel;

		private REPOLabel? countdownLabel;

		public static DanosLobbyQueuePoller Instance { get; private set; }

		public static void Create()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("DanosLobbyQueuePoller");
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<DanosLobbyQueuePoller>();
			}
		}

		public void StartPolling(REPOPopupPage? pageToClose)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			if (pollingCoroutine != null)
			{
				return;
			}
			if (pageToClose != null)
			{
				pageToClose.ClosePage(true);
			}
			Vector2 queuePosition = new Vector2(400f, 80f);
			queuePage = MenuAPI.CreateREPOPopupPage("First To Ten Lobby", (PresetSide)1, false, true, 1.5f);
			queuePage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0017: 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)
				statusLabel = MenuAPI.CreateREPOLabel("Joining lobby...", parent, new Vector2(400f, 250f));
				((TMP_Text)statusLabel.labelTMP).fontSize = 10f;
				((Graphic)statusLabel.labelTMP).color = Color.white;
			});
			queuePage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0017: 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)
				playersLabel = MenuAPI.CreateREPOLabel("Waiting for players...", parent, new Vector2(400f, 220f));
				((TMP_Text)playersLabel.labelTMP).fontSize = 10f;
				((Graphic)playersLabel.labelTMP).color = Color.white;
			});
			queuePage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0017: 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)
				countdownLabel = MenuAPI.CreateREPOLabel("", parent, new Vector2(400f, 270f));
				((TMP_Text)countdownLabel.labelTMP).fontSize = 10f;
				((Graphic)countdownLabel.labelTMP).color = Color.yellow;
			});
			queuePage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Cancel", (Action)async delegate
				{
					long steamId = (long)SteamClient.SteamId.Value;
					if (await DanosAPI.LeaveLobby(steamId))
					{
						Instance?.StopPolling();
					}
					else
					{
						Debug.LogError((object)"Failed to leave lobby.");
					}
				}, parent, queuePosition);
			});
			queuePage.OpenPage(false);
			pollingCoroutine = ((MonoBehaviour)this).StartCoroutine(PollLobbyStatus());
		}

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

		private async Task<bool> CheckLobbyStatusAsync(long steamId)
		{
			LobbyStatusResponse status = await DanosAPI.GetLobbyStatus(steamId);
			if (status == null)
			{
				REPOLabel? obj = statusLabel;
				if (obj != null)
				{
					((TMP_Text)obj.labelTMP).SetText("Failed to get lobby status.", true);
				}
				return false;
			}
			REPOLabel? obj2 = statusLabel;
			if (obj2 != null)
			{
				((TMP_Text)obj2.labelTMP).SetText("Status: " + status.Status, true);
			}
			StringBuilder sb = new StringBuilder();
			sb.AppendLine($"Players ({status.Players.Count}):");
			foreach (KeyValuePair<long, string> player in status.Players)
			{
				sb.AppendLine(player.Value);
			}
			REPOLabel? obj3 = playersLabel;
			if (obj3 != null)
			{
				((TMP_Text)obj3.labelTMP).SetText(sb.ToString(), true);
			}
			if (status.Status == "started" && status.MatchInfo != null)
			{
				REPOPopupPage? obj4 = queuePage;
				if (obj4 != null)
				{
					obj4.ClosePage(true);
				}
				if ((int)status.MatchInfo.QueueType == 6)
				{
					return true;
				}
			}
			if (status.CountdownStarted.HasValue && status.RemainingSeconds.HasValue && status.TotalRequiredSeconds.HasValue)
			{
				REPOLabel? obj5 = countdownLabel;
				if (obj5 != null)
				{
					((TMP_Text)obj5.labelTMP).SetText($"Countdown: {status.RemainingSeconds.Value}s remaining", true);
				}
			}
			else
			{
				REPOLabel? obj6 = countdownLabel;
				if (obj6 != null)
				{
					((TMP_Text)obj6.labelTMP).SetText("", true);
				}
			}
			return false;
		}

		public void StopPolling()
		{
			if (pollingCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(pollingCoroutine);
				pollingCoroutine = null;
			}
			REPOPopupPage? obj = queuePage;
			if (obj != null)
			{
				obj.ClosePage(false);
			}
		}
	}
}
namespace RepoRanked.MainMenu.QueuePollers
{
	public class DanosMatchQueuePoller : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <PollForMatch>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DanosMatchQueuePoller <>4__this;

			private long <steamId>5__1;

			private Task<bool> <task>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<steamId>5__1 = (long)SteamClient.SteamId.Value;
					break;
				case 1:
					<>1__state = -1;
					<task>5__2 = <>4__this.CheckMatchStatusAsync(<steamId>5__1);
					goto IL_0091;
				case 2:
					{
						<>1__state = -1;
						goto IL_0091;
					}
					IL_0091:
					if (!<task>5__2.IsCompleted)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					if (<task>5__2.Result)
					{
						<>4__this.pollingCoroutine = null;
						return false;
					}
					<task>5__2 = null;
					break;
				}
				<>2__current = (object)new WaitForSeconds(4f);
				<>1__state = 1;
				return true;
			}

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

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

		private Coroutine? pollingCoroutine;

		private REPOPopupPage? queuePage;

		public static DanosMatchQueuePoller Instance { get; private set; }

		public static QueueTypes QueueType { get; private set; }

		public static void Create(QueueTypes queue)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("DanosMatchQueuePoller");
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<DanosMatchQueuePoller>();
				QueueType = queue;
			}
		}

		public void StartPolling(REPOPopupPage? pageToClose, QueueTypes queue)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			if (pollingCoroutine != null)
			{
				return;
			}
			QueueType = queue;
			if (pageToClose != null)
			{
				pageToClose.ClosePage(true);
			}
			Vector2 queuePosition = new Vector2(400f, 80f);
			queuePage = MenuAPI.CreateREPOPopupPage("Searching for Match...", (PresetSide)1, false, true, 1.5f);
			queuePage.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Cancel", (Action)async delegate
				{
					long steamId = (long)SteamClient.SteamId.Value;
					if (await DanosAPI.DeQueue(steamId))
					{
						Instance?.StopPolling();
					}
					else
					{
						Debug.LogError((object)"Failed to dequeue for match.");
					}
				}, parent, queuePosition);
			});
			queuePage.OpenPage(false);
			pollingCoroutine = ((MonoBehaviour)this).StartCoroutine(PollForMatch());
		}

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

		private async Task<bool> CheckMatchStatusAsync(long steamId)
		{
			MatchmakingStatusResponse status = await DanosAPI.GetMatchmakingStatus(steamId);
			if (((status != null) ? status.Status : null) == "matched")
			{
				REPOPopupPage? obj = queuePage;
				if (obj != null)
				{
					obj.ClosePage(true);
				}
				if ((int)QueueType == 0)
				{
					RankedGameManager.StartMatch(status);
				}
				else if ((int)QueueType == 3)
				{
					RankedGameManager.StartMatch(status);
				}
				else if ((int)QueueType == 4)
				{
					MonthlyGameManager.StartMatch(status);
				}
				return true;
			}
			return false;
		}

		public void StopPolling()
		{
			if (pollingCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(pollingCoroutine);
				pollingCoroutine = null;
			}
			REPOPopupPage? obj = queuePage;
			if (obj != null)
			{
				obj.ClosePage(false);
			}
		}
	}
}
namespace RepoRanked.LevelGeneration
{
	public class DanosLevelGenerator
	{
		[CompilerGenerated]
		private sealed class <GenerateBlockObjects>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LevelGenerator instance;

			private float <moduleWidth>5__1;

			private int <x>5__2;

			private int <y>5__3;

			private float <num>5__4;

			private float <num2>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Invalid comparison between Unknown and I4
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_030f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0323: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_0347;
				}
				<>1__state = -1;
				instance.waitingForSubCoroutine = true;
				instance.State = (LevelState)6;
				<moduleWidth>5__1 = LevelGenerator.ModuleWidth * LevelGenerator.TileSize;
				<x>5__2 = 0;
				goto IL_0389;
				IL_0389:
				if (<x>5__2 < instance.LevelWidth)
				{
					<y>5__3 = 0;
					goto IL_035a;
				}
				instance.waitingForSubCoroutine = false;
				return false;
				IL_035a:
				if (<y>5__3 < instance.LevelHeight)
				{
					if (instance.LevelGrid[<x>5__2, <y>5__3].active && (int)instance.LevelGrid[<x>5__2, <y>5__3].type == 0)
					{
						<num>5__4 = (float)<x>5__2 * <moduleWidth>5__1 - (float)(instance.LevelWidth / 2) * <moduleWidth>5__1;
						<num2>5__5 = (float)<y>5__3 * <moduleWidth>5__1 + <moduleWidth>5__1 / 2f;
						if (<y>5__3 + 1 >= instance.LevelHeight || !instance.LevelGrid[<x>5__2, <y>5__3 + 1].active)
						{
							instance.SpawnBlockObject(new Vector3(<num>5__4, 0f, <num2>5__5 + <moduleWidth>5__1 / 2f), new Vector3(0f, 180f, 0f));
						}
						if (<x>5__2 + 1 >= instance.LevelWidth || !instance.LevelGrid[<x>5__2 + 1, <y>5__3].active)
						{
							instance.SpawnBlockObject(new Vector3(<num>5__4 + <moduleWidth>5__1 / 2f, 0f, <num2>5__5), new Vector3(0f, -90f, 0f));
						}
						if ((<y>5__3 - 1 < 0 || !instance.LevelGrid[<x>5__2, <y>5__3 - 1].active) && (<x>5__2 != instance.LevelWidth / 2 || <y>5__3 != 0))
						{
							instance.SpawnBlockObject(new Vector3(<num>5__4, 0f, <num2>5__5 - <moduleWidth>5__1 / 2f), new Vector3(0f, 0f, 0f));
						}
						if (<x>5__2 - 1 < 0 || !instance.LevelGrid[<x>5__2 - 1, <y>5__3].active)
						{
							instance.SpawnBlockObject(new Vector3(<num>5__4 - <moduleWidth>5__1 / 2f, 0f, <num2>5__5), new Vector3(0f, 90f, 0f));
						}
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					goto IL_0347;
				}
				<x>5__2++;
				goto IL_0389;
				IL_0347:
				<y>5__3++;
				goto IL_035a;
			}

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

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

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

			private object <>2__current;

			public LevelGenerator instance;

			private float <moduleWidth>5__1;

			private int <x>5__2;

			private int <y>5__3;

			private float <num>5__4;

			private float <num2>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_028c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0291: Unknown result type (might be due to invalid IL or missing references)
				//IL_034d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0361: Unknown result type (might be due to invalid IL or missing references)
				//IL_0433: Unknown result type (might be due to invalid IL or missing references)
				//IL_0438: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_0535;
				}
				<>1__state = -1;
				instance.waitingForSubCoroutine = true;
				instance.State = (LevelState)4;
				<moduleWidth>5__1 = LevelGenerator.ModuleWidth * LevelGenerator.TileSize;
				<x>5__2 = 0;
				goto IL_0577;
				IL_0577:
				if (<x>5__2 < instance.LevelWidth)
				{
					<y>5__3 = 0;
					goto IL_0548;
				}
				instance.waitingForSubCoroutine = false;
				return false;
				IL_0548:
				if (<y>5__3 < instance.LevelHeight)
				{
					if (instance.LevelGrid[<x>5__2, <y>5__3].active)
					{
						if (instance.GridCheckActive(<x>5__2, <y>5__3 + 1))
						{
							Tile obj = instance.LevelGrid[<x>5__2, <y>5__3];
							obj.connections++;
						}
						if (instance.GridCheckActive(<x>5__2, <y>5__3 - 1))
						{
							Tile obj2 = instance.LevelGrid[<x>5__2, <y>5__3];
							obj2.connections++;
						}
						if (instance.GridCheckActive(<x>5__2 + 1, <y>5__3))
						{
							Tile obj3 = instance.LevelGrid[<x>5__2, <y>5__3];
							obj3.connections++;
						}
						if (instance.GridCheckActive(<x>5__2 - 1, <y>5__3))
						{
							Tile obj4 = instance.LevelGrid[<x>5__2, <y>5__3];
							obj4.connections++;
						}
						<num>5__4 = (float)<x>5__2 * <moduleWidth>5__1 - (float)(instance.LevelWidth / 2) * <moduleWidth>5__1;
						<num2>5__5 = (float)<y>5__3 * <moduleWidth>5__1 + <moduleWidth>5__1 / 2f;
						if (<y>5__3 + 1 < instance.LevelHeight && instance.LevelGrid[<x>5__2, <y>5__3 + 1].active && !instance.LevelGrid[<x>5__2, <y>5__3 + 1].connectedBot)
						{
							instance.SpawnConnectObject(new Vector3(<num>5__4, 0f, <num2>5__5 + <moduleWidth>5__1 / 2f), Vector3.zero);
							instance.LevelGrid[<x>5__2, <y>5__3].connectedTop = true;
						}
						if (<x>5__2 + 1 < instance.LevelWidth && instance.LevelGrid[<x>5__2 + 1, <y>5__3].active && !instance.LevelGrid[<x>5__2 + 1, <y>5__3].connectedLeft)
						{
							instance.SpawnConnectObject(new Vector3(<num>5__4 + <moduleWidth>5__1 / 2f, 0f, <num2>5__5), new Vector3(0f, 90f, 0f));
							instance.LevelGrid[<x>5__2, <y>5__3].connectedRight = true;
						}
						if ((<y>5__3 - 1 >= 0 && instance.LevelGrid[<x>5__2, <y>5__3 - 1].active && !instance.LevelGrid[<x>5__2, <y>5__3 - 1].connectedTop) || (<x>5__2 == instance.LevelWidth / 2 && <y>5__3 == 0))
						{
							instance.SpawnConnectObject(new Vector3(<num>5__4, 0f, <num2>5__5 - <moduleWidth>5__1 / 2f), Vector3.zero);
							instance.LevelGrid[<x>5__2, <y>5__3].connectedBot = true;
						}
						if (<x>5__2 - 1 >= 0 && instance.LevelGrid[<x>5__2 - 1, <y>5__3].active && !instance.LevelGrid[<x>5__2 - 1, <y>5__3].connectedRight)
						{
							instance.SpawnConnectObject(new Vector3(<num>5__4 - <moduleWidth>5__1 / 2f, 0f, <num2>5__5), Vector3.zero);
							instance.LevelGrid[<x>5__2, <y>5__3].connectedLeft = true;
						}
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					goto IL_0535;
				}
				<x>5__2++;
				goto IL_0577;
				IL_0535:
				<y>5__3++;
				goto IL_0548;
			}

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

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

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

			private object <>2__current;

			public LevelGenerator instance;

			public int seedBase;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Expected O, but got Unknown
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Expected O, but got Unknown
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Expected O, but got Unknown
				//IL_0397: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: Expected O, but got Unknown
				//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_04be: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c8: Expected O, but got Unknown
				//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_057a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0585: Unknown result type (might be due to invalid IL or missing references)
				//IL_058f: Expected O, but got Unknown
				//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_05f8: Expected O, but got Unknown
				//IL_0651: Unknown result type (might be due to invalid IL or missing references)
				//IL_065c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0666: Expected O, but got Unknown
				//IL_0708: Unknown result type (might be due to invalid IL or missing references)
				//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b8: Expected O, but got Unknown
				//IL_0855: Unknown result type (might be due to invalid IL or missing references)
				//IL_085f: Expected O, but got Unknown
				//IL_0517: Unknown result type (might be due to invalid IL or missing references)
				//IL_051d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0419: Unknown result type (might be due to invalid IL or missing references)
				//IL_0424: Unknown result type (might be due to invalid IL or missing references)
				//IL_042e: Expected O, but got Unknown
				//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_076e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0778: Expected O, but got Unknown
				//IL_080e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0814: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Seed = seedBase;
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!SemiFunc.IsMultiplayer())
					{
						instance.AllPlayersReady = true;
					}
					goto IL_0148;
				case 2:
					<>1__state = -1;
					goto IL_0148;
				case 3:
					<>1__state = -1;
					instance.Level = RunManager.instance.levelCurrent;
					RunManager.instance.levelPrevious = instance.Level;
					if (SemiFunc.IsMasterClientOrSingleplayer())
					{
						instance.ModuleAmount = instance.Level.ModuleAmount;
						if (instance.DebugAmount > 0)
						{
							instance.ModuleAmount = instance.DebugAmount;
						}
						((MonoBehaviour)instance).StartCoroutine(TileGeneration(instance));
						goto IL_022a;
					}
					goto IL_03be;
				case 4:
					<>1__state = -1;
					goto IL_022a;
				case 5:
					<>1__state = -1;
					goto IL_026d;
				case 6:
					<>1__state = -1;
					goto IL_02b0;
				case 7:
					<>1__state = -1;
					goto IL_02f3;
				case 8:
					<>1__state = -1;
					goto IL_0336;
				case 9:
					<>1__state = -1;
					goto IL_03be;
				case 10:
					<>1__state = -1;
					goto IL_0440;
				case 11:
					<>1__state = -1;
					goto IL_04da;
				case 12:
					<>1__state = -1;
					goto IL_05a1;
				case 13:
					<>1__state = -1;
					goto IL_060a;
				case 14:
					<>1__state = -1;
					goto IL_060a;
				case 15:
					<>1__state = -1;
					goto IL_0678;
				case 16:
					<>1__state = -1;
					goto IL_0678;
				case 17:
					<>1__state = -1;
					if (GameManager.Multiplayer())
					{
						goto IL_078a;
					}
					goto IL_07ca;
				case 18:
					<>1__state = -1;
					goto IL_078a;
				case 19:
					<>1__state = -1;
					goto IL_07ca;
				case 20:
					{
						<>1__state = -1;
						goto IL_0871;
					}
					IL_078a:
					if (!instance.EnemyReady)
					{
						instance.State = (LevelState)14;
						if (instance.EnemyReadyPlayers >= PhotonNetwork.CurrentRoom.PlayerCount || instance.EnemiesSpawnTarget <= 0)
						{
							instance.PhotonView.RPC("EnemyReadyAllRPC", (RpcTarget)3, Array.Empty<object>());
							instance.EnemyReady = true;
						}
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 18;
						return true;
					}
					goto IL_07ea;
					IL_05a1:
					if (!ValuableDirector.instance.setupComplete)
					{
						instance.State = (LevelState)11;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 12;
						return true;
					}
					instance.NavMeshSetup();
					<>2__current = null;
					<>1__state = 13;
					return true;
					IL_03be:
					if (instance.ModulesSpawned < instance.ModuleAmount - 1)
					{
						instance.State = (LevelState)7;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 9;
						return true;
					}
					if (GameManager.instance.gameMode == 1)
					{
						instance.PhotonView.RPC("ModulesReadyRPC", (RpcTarget)3, Array.Empty<object>());
					}
					goto IL_0440;
					IL_022a:
					if (instance.waitingForSubCoroutine)
					{
						<>2__current = null;
						<>1__state = 4;
						return true;
					}
					((MonoBehaviour)instance).StartCoroutine(StartRoomGeneration(instance));
					goto IL_026d;
					IL_0148:
					if (!instance.AllPlayersReady)
					{
						instance.State = (LevelState)1;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 2;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 3;
					return true;
					IL_07ca:
					if (instance.EnemiesSpawned < instance.EnemiesSpawnTarget)
					{
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 19;
						return true;
					}
					goto IL_07ea;
					IL_026d:
					if (instance.waitingForSubCoroutine)
					{
						<>2__current = null;
						<>1__state = 5;
						return true;
					}
					((MonoBehaviour)instance).StartCoroutine(GenerateConnectObjects(instance));
					goto IL_02b0;
					IL_0678:
					if (instance.playerSpawned < GameDirector.instance.PlayerList.Count)
					{
						instance.State = (LevelState)13;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 16;
						return true;
					}
					if (instance.Level.HasEnemies && !instance.DebugNoEnemy)
					{
						instance.EnemySetup();
						<>2__current = null;
						<>1__state = 17;
						return true;
					}
					goto IL_07ea;
					IL_0440:
					if (GameManager.instance.gameMode == 1 && instance.ModulesReadyPlayers < PhotonNetwork.CurrentRoom.PlayerCount)
					{
						instance.State = (LevelState)8;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 10;
						return true;
					}
					EnvironmentDirector.Instance.Setup();
					PostProcessing.Instance.Setup();
					LevelMusic.instance.Setup();
					ConstantMusic.instance.Setup();
					if (SemiFunc.IsMasterClientOrSingleplayer())
					{
						goto IL_04da;
					}
					goto IL_0871;
					IL_02f3:
					if (instance.waitingForSubCoroutine)
					{
						<>2__current = null;
						<>1__state = 7;
						return true;
					}
					((MonoBehaviour)instance).StartCoroutine(GenerateBlockObjects(instance));
					goto IL_0336;
					IL_07ea:
					instance.State = (LevelState)15;
					if (!SemiFunc.IsMultiplayer())
					{
						instance.GenerateDone(default(PhotonMessageInfo));
					}
					else
					{
						instance.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty<object>());
					}
					SessionManager.instance.CrownPlayer();
					break;
					IL_0336:
					if (instance.waitingForSubCoroutine)
					{
						<>2__current = null;
						<>1__state = 8;
						return true;
					}
					if (GameManager.instance.gameMode == 1)
					{
						instance.PhotonView.RPC("ModuleAmountRPC", (RpcTarget)3, new object[1] { instance.ModuleAmount });
					}
					goto IL_03be;
					IL_04da:
					if (instance.LevelPathPoints.Count == 0)
					{
						instance.State = (LevelState)9;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 11;
						return true;
					}
					instance.State = (LevelState)10;
					if (!SemiFunc.IsMultiplayer())
					{
						instance.ItemSetup(default(PhotonMessageInfo));
					}
					else
					{
						instance.PhotonView.RPC("ItemSetup", (RpcTarget)3, Array.Empty<object>());
					}
					Random.InitState(seedBase + 5);
					((MonoBehaviour)instance).StartCoroutine(DanosValuableGeneration.Instance.SetupHost(ValuableDirector.instance));
					goto IL_05a1;
					IL_02b0:
					if (instance.waitingForSubCoroutine)
					{
						<>2__current = null;
						<>1__state = 6;
						return true;
					}
					((MonoBehaviour)instance).StartCoroutine(ModuleGeneration(instance));
					goto IL_02f3;
					IL_060a:
					if (GameDirector.instance.PlayerList.Count == 0)
					{
						instance.State = (LevelState)12;
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 14;
						return true;
					}
					instance.PlayerSpawn();
					<>2__current = null;
					<>1__state = 15;
					return true;
					IL_0871:
					if (!instance.Generated)
					{
						<>2__current = (objec

RepoRankedApiResponseModel.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoRankedApiResponseModel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4b38b8ce16efcd90500fe7dc9bf09196cf6544c7")]
[assembly: AssemblyProduct("RepoRankedApiResponseModel")]
[assembly: AssemblyTitle("RepoRankedApiResponseModel")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RepoRankedApiResponseModel
{
	public class DanosSaveData
	{
		public Dictionary<string, int> runStats { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> itemsPurchased { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> itemsPurchasedTotal { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> itemsUpgradesPurchased { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> itemBatteryUpgrades { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> item { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> itemUpgradesPurchased { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> itemStatBattery { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerHealth { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeHealth { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeStamina { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeExtraJump { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeLaunch { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeMapPlayerCount { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeSpeed { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeStrength { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeRange { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeThrow { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeCrouchRest { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerUpgradeTumbleWings { get; set; } = new Dictionary<string, int>();


		public Dictionary<string, int> playerHasCrown { get; set; } = new Dictionary<string, int>();

	}
	public class EnqueueRequest
	{
		public long SteamId { get; set; }

		public string? QueueType { get; set; }

		public QueueTypes QueueTypes { get; set; } = QueueTypes.ranked;


		public string PassPhrase { get; set; } = string.Empty;

	}
	public class EnqueueResponse
	{
		public string Status { get; set; }

		public string? Message { get; set; } = null;

	}
	public class FirstToTenData
	{
		public List<FTTDMapData> maps { get; set; } = new List<FTTDMapData>();

	}
	public class FTTDMapData
	{
		public int level { get; set; } = 0;


		public int seed { get; set; } = 0;


		public string map { get; set; } = string.Empty;


		public bool isShop { get; set; } = false;


		public Dictionary<string, int> Enemies { get; set; } = new Dictionary<string, int>();

	}
	public class LobbyLeaveRequest
	{
		public long SteamId { get; set; }
	}
	public class LobbyLeaveResponse
	{
		public bool Success { get; set; }

		public string? Message { get; set; }
	}
	public class LobbyStatusRequest
	{
		public long SteamId { get; set; }
	}
	public class LobbyStatusResponse
	{
		public string Status { get; set; }

		public int LobbyId { get; set; }

		public Dictionary<long, string> Players { get; set; }

		public long? CountdownStarted { get; set; }

		public long? TotalRequiredSeconds { get; set; }

		public long? RemainingSeconds { get; set; }

		public MatchmakingStatusResponse? MatchInfo { get; set; }
	}
	public class MatchCompleteRequest
	{
		public long MatchId { get; set; }

		public long SteamId { get; set; }

		public long Timestamp { get; set; }

		public string EndReason { get; set; } = "complete";

	}
	public class MatchCompleteResponse
	{
		public string Status { get; set; }

		public long? Winner { get; set; }

		public Dictionary<long, int>? EloChanges { get; set; }
	}
	public class MatchmakingStatusResponse
	{
		public string Status { get; set; }

		public long MatchId { get; set; }

		public string Seed { get; set; }

		public string Map { get; set; }

		public Dictionary<string, int> Enemies { get; set; }

		public Dictionary<long, string> Players { get; set; }

		public DanosSaveData saveData { get; set; } = new DanosSaveData();


		public QueueTypes QueueType { get; set; } = QueueTypes.ranked;


		public FirstToTenData FirstToTenData { get; set; }
	}
	public class MatchPingRequest
	{
		public long MatchId { get; set; }

		public long SteamId { get; set; }

		public int Progress { get; set; }

		public int ExtractionsCompleted { get; set; }

		public long Timestamp { get; set; }

		public int Level { get; set; }
	}
	public class MatchPingResponse
	{
		public string Status { get; set; }

		public int OpponentProgress { get; set; }

		public int OpponentExtractions { get; set; }

		public long OpponentLastPing { get; set; }

		public bool GameOver { get; set; }

		public int Level { get; set; }

		public List<MatchPingFTTResponse>? FirstToTenData { get; set; } = null;

	}
	public class MatchPingFTTResponse
	{
		public long OpponentSteamID { get; set; }

		public int OpponentProgress { get; set; }

		public int OpponentExtractions { get; set; }

		public long OpponentLastPing { get; set; }

		public bool GameOver { get; set; }

		public int Level { get; set; }
	}
	public class MatchResultResponse
	{
		public long MatchId { get; set; }

		public long WinnerSteamId { get; set; }

		public Dictionary<long, string> Players { get; set; } = new Dictionary<long, string>();


		public Dictionary<long, int> EloChanges { get; set; } = new Dictionary<long, int>();


		public Dictionary<long, string> Results { get; set; } = new Dictionary<long, string>();

	}
	public enum QueueTypes
	{
		ranked,
		fiveranked,
		lastmanstanding,
		unranked,
		monthlychallenge,
		solopractice,
		firsttoten
	}
	public class RegisterPlayerRequest
	{
		public long SteamId { get; set; }

		public string DisplayName { get; set; } = string.Empty;

	}
	public class RegisterPlayerResponse
	{
		public string Status { get; set; }

		public string Message { get; set; }

		public int Matches { get; set; }

		public int EloRating { get; set; }
	}
	public class SerializableEnemySetup
	{
		public List<string> Enemies { get; set; } = new List<string>();


		public bool LevelsCompletedCondition { get; set; }

		public int LevelsCompletedMin { get; set; }

		public int LevelsCompletedMax { get; set; }

		public SerializableRarityPreset RarityPreset { get; set; } = new SerializableRarityPreset();


		public int RunsPlayed { get; set; }
	}
	public class SerializableRarityPreset
	{
		public string Name { get; set; } = "None";


		public float Chance { get; set; } = 0f;

	}
}