Decompiled source of UpgradeEveryRound v1.2.1

UpgradeEveryRound.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UpgradeEveryRound")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.7")]
[assembly: AssemblyInformationalVersion("1.2.1+d62443fc26f813a83dc614ffd7f6786affd69f58")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("UpgradeEveryRound")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.7.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UpgradeEveryRound
{
	[HarmonyPatch(typeof(StatsUI), "Update")]
	public static class StatsUIPatch
	{
		private static void Prefix(ref float ___showStatsTimer)
		{
			if (UpgradeMenu.isOpen)
			{
				___showStatsTimer = 5f;
			}
		}
	}
	[HarmonyPatch(typeof(StatsManager))]
	[HarmonyPatch("Start")]
	public static class StatsManagerPatch
	{
		private static void Prefix(StatsManager __instance)
		{
			__instance.dictionaryOfDictionaries.Add("playerUpgradesUsed", new Dictionary<string, int>());
			__instance.dictionaryOfDictionaries.Add("UERDataSync", new Dictionary<string, int> { 
			{
				"HostConfig",
				Plugin.configData
			} });
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	[HarmonyPatch("ChangeLevel")]
	public static class RunManagerChangeLevelPatch
	{
		private static void Prefix()
		{
			UpgradeMenu.isOpen = false;
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	[HarmonyPatch("LeaveToMainMenu")]
	public static class RunManagerMainMenuPatch
	{
		private static void Prefix()
		{
			UpgradeMenu.isOpen = false;
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar))]
	[HarmonyPatch("SpawnRPC")]
	public static class PlayerSpawnPatch
	{
		private static void Prefix(PhotonView ___photonView)
		{
			if (!((IEnumerable<Level>)(object)new Level[3]
			{
				RunManager.instance.levelMainMenu,
				RunManager.instance.levelLobbyMenu,
				RunManager.instance.levelTutorial
			}).Contains(RunManager.instance.levelCurrent))
			{
				string steamID = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(SemiFunc.PhotonViewIDPlayerAvatarLocal()));
				int num = RunManager.instance.levelsCompleted * Plugin.UpgradesPerRound;
				if (Plugin.NumUpgradesUsed(steamID) < num && (!GameManager.Multiplayer() || ___photonView.IsMine))
				{
					MenuManager.instance.PageCloseAll();
					UpgradeMenu.createMenu(steamID).OpenPage(false);
					UpgradeMenu.isOpen = true;
				}
			}
		}
	}
	[BepInPlugin("dev.redfops.repo.upgradeeveryround", "Upgrade Every Round", "1.2.1")]
	[BepInDependency("nickklmao.menulib", "2.1.3")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "dev.redfops.repo.upgradeeveryround";

		public const string modName = "Upgrade Every Round";

		public const string modVersion = "1.2.1";

		private static ConfigEntry<int> upgradesPerRound;

		private static ConfigEntry<bool> limitedChoices;

		private static ConfigEntry<int> numChoices;

		private static ConfigEntry<bool> allowMapCount;

		private static ConfigEntry<bool> allowEnergy;

		private static ConfigEntry<bool> allowExtraJump;

		private static ConfigEntry<bool> allowRange;

		private static ConfigEntry<bool> allowStrength;

		private static ConfigEntry<bool> allowHealth;

		private static ConfigEntry<bool> allowSpeed;

		private static ConfigEntry<bool> allowTumbleLaunch;

		public static int configData;

		internal static ManualLogSource Logger;

		private readonly Harmony harmony = new Harmony("dev.redfops.repo.upgradeeveryround");

		public static int UpgradesPerRound
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 7;
				}
				return upgradesPerRound.Value;
			}
		}

		public static bool LimitedChoices
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x40) == 1;
				}
				return limitedChoices.Value;
			}
		}

		public static int NumChoices
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x38) >> 3) + 1;
				}
				return numChoices.Value;
			}
		}

		public static bool AllowMapCount
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x80) == 1;
				}
				return allowMapCount.Value;
			}
		}

		public static bool AllowEnergy
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x100) == 1;
				}
				return allowEnergy.Value;
			}
		}

		public static bool AllowExtraJump
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x200) == 1;
				}
				return allowExtraJump.Value;
			}
		}

		public static bool AllowRange
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x400) == 1;
				}
				return allowRange.Value;
			}
		}

		public static bool AllowStrength
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x800) == 1;
				}
				return allowStrength.Value;
			}
		}

		public static bool AllowHealth
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x1000) == 1;
				}
				return allowHealth.Value;
			}
		}

		public static bool AllowSpeed
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x2000) == 1;
				}
				return allowSpeed.Value;
			}
		}

		public static bool AllowTumbleLaunch
		{
			get
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer())
				{
					return (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x4000) == 1;
				}
				return allowTumbleLaunch.Value;
			}
		}

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			upgradesPerRound = ((BaseUnityPlugin)this).Config.Bind<int>("Upgrades", "Upgrades Per Round", 1, new ConfigDescription("Number of upgrades per round", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 7), Array.Empty<object>()));
			limitedChoices = ((BaseUnityPlugin)this).Config.Bind<bool>("Upgrades", "Limited random choices", false, new ConfigDescription("Only presents a fixed number of random options", (AcceptableValueBase)null, Array.Empty<object>()));
			numChoices = ((BaseUnityPlugin)this).Config.Bind<int>("Upgrades", "Number of choices", 3, new ConfigDescription("Number of options to choose from per upgrade", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>()));
			allowMapCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Map Player Count", true, new ConfigDescription("Allows Map Player Count Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Stamina", true, new ConfigDescription("Allows Stamina Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowExtraJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Extra Jump", true, new ConfigDescription("Allows Extra Jump Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowRange = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Range", true, new ConfigDescription("Allows Range Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowStrength = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Strength", true, new ConfigDescription("Allows Strength Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowHealth = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Health", true, new ConfigDescription("Allows Health Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Speed", true, new ConfigDescription("Allows Speed Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			allowTumbleLaunch = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Tumble Launch", true, new ConfigDescription("Allows Tumble Launch Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
			upgradesPerRound.SettingChanged += ConfigUpdated;
			limitedChoices.SettingChanged += ConfigUpdated;
			numChoices.SettingChanged += ConfigUpdated;
			allowMapCount.SettingChanged += ConfigUpdated;
			allowEnergy.SettingChanged += ConfigUpdated;
			allowExtraJump.SettingChanged += ConfigUpdated;
			allowRange.SettingChanged += ConfigUpdated;
			allowStrength.SettingChanged += ConfigUpdated;
			allowHealth.SettingChanged += ConfigUpdated;
			allowSpeed.SettingChanged += ConfigUpdated;
			allowTumbleLaunch.SettingChanged += ConfigUpdated;
			UpdateConfigData();
			harmony.PatchAll(typeof(PlayerSpawnPatch));
			harmony.PatchAll(typeof(RunManagerChangeLevelPatch));
			harmony.PatchAll(typeof(RunManagerMainMenuPatch));
			harmony.PatchAll(typeof(StatsManagerPatch));
			harmony.PatchAll(typeof(StatsUIPatch));
			harmony.PatchAll(typeof(UpgradeMapPlayerCountPatch));
			harmony.PatchAll(typeof(UpgradePlayerEnergyPatch));
			harmony.PatchAll(typeof(UpgradePlayerExtraJumpPatch));
			harmony.PatchAll(typeof(UpgradePlayerGrabRangePatch));
			harmony.PatchAll(typeof(UpgradePlayerGrabStrengthPatch));
			harmony.PatchAll(typeof(UpgradePlayerHealthPatch));
			harmony.PatchAll(typeof(UpgradePlayerSprintSpeedPatch));
			harmony.PatchAll(typeof(UpgradePlayerTumbleLaunchPatch));
			Logger.LogInfo((object)"Plugin UpgradeEveryRound is loaded!");
		}

		private void ConfigUpdated(object sender, EventArgs args)
		{
			UpdateConfigData();
			if (SemiFunc.IsMultiplayer() && PhotonNetwork.IsMasterClient)
			{
				((Component)PunManager.instance).GetComponent<PhotonView>().RPC("UpdateStatRPC", (RpcTarget)1, new object[3] { "UERDataSync", "HostConfig", configData });
			}
		}

		private void UpdateConfigData()
		{
			configData = upgradesPerRound.Value & 7;
			configData |= (numChoices.Value - 1 << 3) & 0x38;
			configData |= (limitedChoices.Value ? 64 : 0);
			configData |= (allowMapCount.Value ? 128 : 0);
			configData |= (allowEnergy.Value ? 256 : 0);
			configData |= (allowExtraJump.Value ? 512 : 0);
			configData |= (allowRange.Value ? 1024 : 0);
			configData |= (allowStrength.Value ? 2048 : 0);
			configData |= (allowHealth.Value ? 4096 : 0);
			configData |= (allowSpeed.Value ? 8192 : 0);
			configData |= (allowTumbleLaunch.Value ? 16384 : 0);
		}

		public static void ApplyUpgrade(string _steamID, REPOPopupPage popupPage)
		{
			StatsUI.instance.Fetch();
			StatsUI.instance.ShowStats();
			CameraGlitch.Instance.PlayUpgrade();
			int num = ++StatsManager.instance.dictionaryOfDictionaries["playerUpgradesUsed"][_steamID];
			if (GameManager.Multiplayer())
			{
				((Component)PunManager.instance).GetComponent<PhotonView>().RPC("UpdateStatRPC", (RpcTarget)1, new object[3] { "playerUpgradesUsed", _steamID, num });
			}
			UpgradeMenu.isOpen = false;
			popupPage.ClosePage(true);
			if (RunManager.instance.levelsCompleted * UpgradesPerRound > num)
			{
				UpgradeMenu.createMenu(_steamID).OpenPage(false);
				UpgradeMenu.isOpen = true;
			}
		}

		public static int NumUpgradesUsed(string _steamID)
		{
			return StatsManager.instance.dictionaryOfDictionaries["playerUpgradesUsed"][_steamID];
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradeMapPlayerCount")]
	public static class UpgradeMapPlayerCountPatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradeMapPlayerCountRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeMapPlayerCount[_steamID]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerEnergy")]
	public static class UpgradePlayerEnergyPatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerEnergyCountRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeStamina[_steamID]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerExtraJump")]
	public static class UpgradePlayerExtraJumpPatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerExtraJumpRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeExtraJump[_steamID]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerGrabRange")]
	public static class UpgradePlayerGrabRangePatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerGrabRangeRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeRange[_steamID]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerGrabStrength")]
	public static class UpgradePlayerGrabStrengthPatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerGrabStrengthRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeStrength[_steamID]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerHealth")]
	public static class UpgradePlayerHealthPatch
	{
		private static void Postfix(string playerName, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerHealthRPC", (RpcTarget)1, new object[2]
				{
					playerName,
					___statsManager.playerUpgradeHealth[playerName]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerSprintSpeed")]
	public static class UpgradePlayerSprintSpeedPatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerSprintSpeedRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeSpeed[_steamID]
				});
			}
		}
	}
	[HarmonyPatch(typeof(PunManager))]
	[HarmonyPatch("UpgradePlayerTumbleLaunch")]
	public static class UpgradePlayerTumbleLaunchPatch
	{
		private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
		{
			if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
			{
				___photonView.RPC("UpgradePlayerTumbleLaunchRPC", (RpcTarget)1, new object[2]
				{
					_steamID,
					___statsManager.playerUpgradeLaunch[_steamID]
				});
			}
		}
	}
	public static class UpgradeMenu
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__1_0;

			public static ShouldCloseMenuDelegate <>9__1_1;

			internal void <createMenu>b__1_0()
			{
				isOpen = false;
			}

			internal bool <createMenu>b__1_1()
			{
				return false;
			}
		}

		public static bool isOpen;

		public static REPOPopupPage createMenu(string _steamID)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01e6: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_0217: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			//IL_0248: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_0279: Expected O, but got Unknown
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Expected O, but got Unknown
			//IL_02aa: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Expected O, but got Unknown
			//IL_02db: Expected O, but got Unknown
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			//IL_0309: Expected O, but got Unknown
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0337: Expected O, but got Unknown
			StatsUI.instance.Fetch();
			StatsUI.instance.ShowStats();
			REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Choose an upgrade", (PresetSide)1, false, true, 1.5f);
			UnityEvent onPageEnd = repoPopupPage.menuPage.onPageEnd;
			object obj = <>c.<>9__1_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					isOpen = false;
				};
				<>c.<>9__1_0 = val;
				obj = (object)val;
			}
			onPageEnd.AddListener((UnityAction)obj);
			REPOPopupPage obj2 = repoPopupPage;
			object obj3 = <>c.<>9__1_1;
			if (obj3 == null)
			{
				ShouldCloseMenuDelegate val2 = () => false;
				<>c.<>9__1_1 = val2;
				obj3 = (object)val2;
			}
			obj2.onEscapePressed = (ShouldCloseMenuDelegate)obj3;
			int num = (Plugin.LimitedChoices ? Plugin.NumChoices : 8);
			List<int> list = new List<int>(8) { 0, 1, 2, 3, 4, 5, 6, 7 };
			bool[] array = new bool[8]
			{
				Plugin.AllowEnergy,
				Plugin.AllowExtraJump,
				Plugin.AllowRange,
				Plugin.AllowStrength,
				Plugin.AllowHealth,
				Plugin.AllowSpeed,
				Plugin.AllowTumbleLaunch,
				Plugin.AllowMapCount
			};
			int num2 = 0;
			for (int i = 0; i < list.Count; i++)
			{
				if (!array[i])
				{
					list.RemoveAt(i - num2);
					num2++;
				}
			}
			bool choseUpgrade = false;
			BuilderDelegate val12 = default(BuilderDelegate);
			BuilderDelegate val18 = default(BuilderDelegate);
			BuilderDelegate val14 = default(BuilderDelegate);
			BuilderDelegate val8 = default(BuilderDelegate);
			BuilderDelegate val6 = default(BuilderDelegate);
			BuilderDelegate val16 = default(BuilderDelegate);
			BuilderDelegate val10 = default(BuilderDelegate);
			BuilderDelegate val3 = default(BuilderDelegate);
			for (int j = 0; j < num; j++)
			{
				int index = (Plugin.LimitedChoices ? Random.Range(0, list.Count) : 0);
				int num3 = list[index];
				list.RemoveAt(index);
				switch (num3)
				{
				case 0:
				{
					REPOPopupPage obj12 = repoPopupPage;
					BuilderDelegate obj13 = val12;
					if (obj13 == null)
					{
						BuilderDelegate val13 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Stamina", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerEnergy(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(390f, 18f));
						};
						BuilderDelegate val5 = val13;
						val12 = val13;
						obj13 = val5;
					}
					obj12.AddElement(obj13);
					break;
				}
				case 1:
				{
					REPOPopupPage obj18 = repoPopupPage;
					BuilderDelegate obj19 = val18;
					if (obj19 == null)
					{
						BuilderDelegate val19 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Extra Jump", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerExtraJump(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(530f, 18f));
						};
						BuilderDelegate val5 = val19;
						val18 = val19;
						obj19 = val5;
					}
					obj18.AddElement(obj19);
					break;
				}
				case 2:
				{
					REPOPopupPage obj14 = repoPopupPage;
					BuilderDelegate obj15 = val14;
					if (obj15 == null)
					{
						BuilderDelegate val15 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Range", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerGrabRange(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(390f, 60f));
						};
						BuilderDelegate val5 = val15;
						val14 = val15;
						obj15 = val5;
					}
					obj14.AddElement(obj15);
					break;
				}
				case 3:
				{
					REPOPopupPage obj8 = repoPopupPage;
					BuilderDelegate obj9 = val8;
					if (obj9 == null)
					{
						BuilderDelegate val9 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Strength", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerGrabStrength(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(530f, 60f));
						};
						BuilderDelegate val5 = val9;
						val8 = val9;
						obj9 = val5;
					}
					obj8.AddElement(obj9);
					break;
				}
				case 4:
				{
					REPOPopupPage obj6 = repoPopupPage;
					BuilderDelegate obj7 = val6;
					if (obj7 == null)
					{
						BuilderDelegate val7 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Health", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerHealth(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(390f, 102f));
						};
						BuilderDelegate val5 = val7;
						val6 = val7;
						obj7 = val5;
					}
					obj6.AddElement(obj7);
					break;
				}
				case 5:
				{
					REPOPopupPage obj16 = repoPopupPage;
					BuilderDelegate obj17 = val16;
					if (obj17 == null)
					{
						BuilderDelegate val17 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Sprint speed", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerSprintSpeed(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(530f, 102f));
						};
						BuilderDelegate val5 = val17;
						val16 = val17;
						obj17 = val5;
					}
					obj16.AddElement(obj17);
					break;
				}
				case 6:
				{
					REPOPopupPage obj10 = repoPopupPage;
					BuilderDelegate obj11 = val10;
					if (obj11 == null)
					{
						BuilderDelegate val11 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Tumble Launch", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradePlayerTumbleLaunch(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(390f, 144f));
						};
						BuilderDelegate val5 = val11;
						val10 = val11;
						obj11 = val5;
					}
					obj10.AddElement(obj11);
					break;
				}
				case 7:
				{
					REPOPopupPage obj4 = repoPopupPage;
					BuilderDelegate obj5 = val3;
					if (obj5 == null)
					{
						BuilderDelegate val4 = delegate(Transform parent)
						{
							//IL_002f: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.CreateREPOButton("Map Player Count", (Action)delegate
							{
								if (!choseUpgrade)
								{
									choseUpgrade = true;
									PunManager.instance.UpgradeMapPlayerCount(_steamID);
									Plugin.ApplyUpgrade(_steamID, repoPopupPage);
								}
							}, parent, new Vector2(530f, 144f));
						};
						BuilderDelegate val5 = val4;
						val3 = val4;
						obj5 = val5;
					}
					obj4.AddElement(obj5);
					break;
				}
				}
			}
			return repoPopupPage;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "UpgradeEveryRound";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}