Decompiled source of Repo Leveling v0.1.2

RepoLeveling.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Einhornyordle")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.2")]
[assembly: AssemblyInformationalVersion("0.1.2+37423bf9bc2c599022b756bde0d5a4c8fecd9c03")]
[assembly: AssemblyProduct("RepoLeveling")]
[assembly: AssemblyTitle("RepoLeveling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.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 RepoLeveling
{
	[HarmonyPatch(typeof(PunManager))]
	internal static class PunManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ReceiveSyncData")]
		private static void ReceiveSyncData_Postfix(bool finalChunk)
		{
			if (finalChunk)
			{
				SaveDataManager.ApplySkills();
			}
		}
	}
	[BepInPlugin("Einhornyordle.RepoLeveling", "RepoLeveling", "0.1.2")]
	public class RepoLeveling : BaseUnityPlugin
	{
		private static RepoLeveling Instance { get; set; }

		internal static ManualLogSource Logger => Instance._logger;

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

		private Harmony? Harmony { get; set; }

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

		private void Patch()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0025: 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 static class SaveDataManager
	{
		internal static ConfigEntry<int> SaveCumulativeHaul;

		internal static ConfigEntry<int> SaveMapPlayerCount;

		internal static ConfigEntry<int> SaveEnergy;

		internal static ConfigEntry<int> SaveExtraJump;

		internal static ConfigEntry<int> SaveGrabRange;

		internal static ConfigEntry<int> SaveGrabStrength;

		internal static ConfigEntry<int> SaveGrabThrow;

		internal static ConfigEntry<int> SaveHealth;

		internal static ConfigEntry<int> SaveSprintSpeed;

		internal static ConfigEntry<int> SaveTumbleLaunch;

		internal static void Initialize()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Expected O, but got Unknown
			ConfigFile val = new ConfigFile(Path.Combine(Application.persistentDataPath, "REPOModData/RepoLeveling/save.cfg"), false);
			SaveCumulativeHaul = val.Bind<int>("General", "CumulativeHaul", 0, new ConfigDescription("The total value of all hauls you've ever completed. This value is used to calculate your available skill points. Increase this to cheat skill points. Set to 0 to reset your progress.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveMapPlayerCount = val.Bind<int>("Skills", "MapPlayerCount", 0, new ConfigDescription("The amount of map player count upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveEnergy = val.Bind<int>("Skills", "Energy", 0, new ConfigDescription("The amount of stamina upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveExtraJump = val.Bind<int>("Skills", "ExtraJump", 0, new ConfigDescription("The amount of double jump upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveGrabRange = val.Bind<int>("Skills", "GrabRange", 0, new ConfigDescription("The amount of range upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveGrabStrength = val.Bind<int>("Skills", "GrabStrength", 0, new ConfigDescription("The amount of strength upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveGrabThrow = val.Bind<int>("Skills", "GrabThrow", 0, new ConfigDescription("The amount of throw upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveHealth = val.Bind<int>("Skills", "Health", 0, new ConfigDescription("The amount of health upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveSprintSpeed = val.Bind<int>("Skills", "SprintSpeed", 0, new ConfigDescription("The amount of sprint speed upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
			SaveTumbleLaunch = val.Bind<int>("Skills", "TumbleLaunch", 0, new ConfigDescription("The amount of tumble launch upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
		}

		internal static void ResetProgress()
		{
			SaveCumulativeHaul.Value = 0;
			SaveMapPlayerCount.Value = 0;
			SaveEnergy.Value = 0;
			SaveExtraJump.Value = 0;
			SaveGrabRange.Value = 0;
			SaveGrabStrength.Value = 0;
			SaveGrabThrow.Value = 0;
			SaveHealth.Value = 0;
			SaveSprintSpeed.Value = 0;
			SaveTumbleLaunch.Value = 0;
			RepoLeveling.Logger.LogDebug((object)"Progress reset.");
		}

		private static void ApplyUpgrade(Dictionary<string, int> upgradeDict, ConfigEntry<int> savedValue, Action<string> upgradeAction, string rpcName)
		{
			upgradeDict.TryAdd(PlayerController.instance.playerSteamID, 0);
			while (upgradeDict[PlayerController.instance.playerSteamID] < savedValue.Value)
			{
				string playerSteamID = PlayerController.instance.playerSteamID;
				int value = upgradeDict[playerSteamID] + 1;
				upgradeDict[playerSteamID] = value;
				upgradeAction(PlayerController.instance.playerSteamID);
				if (SemiFunc.IsMultiplayer())
				{
					PunManager.instance.photonView.RPC(rpcName, (RpcTarget)1, new object[2]
					{
						PlayerController.instance.playerSteamID,
						upgradeDict[PlayerController.instance.playerSteamID]
					});
				}
			}
		}

		internal static void ApplySkills()
		{
			RepoLeveling.Logger.LogDebug((object)"Applying skill points...");
			ApplyUpgrade(StatsManager.instance.playerUpgradeMapPlayerCount, SaveMapPlayerCount, (Action<string>)PunManager.instance.UpdateMapPlayerCountRightAway, "UpgradeMapPlayerCountRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeStamina, SaveEnergy, (Action<string>)PunManager.instance.UpdateEnergyRightAway, "UpgradePlayerEnergyRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeExtraJump, SaveExtraJump, (Action<string>)PunManager.instance.UpdateExtraJumpRightAway, "UpgradePlayerExtraJumpRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeRange, SaveGrabRange, (Action<string>)PunManager.instance.UpdateGrabRangeRightAway, "UpgradePlayerGrabRangeRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeStrength, SaveGrabStrength, (Action<string>)PunManager.instance.UpdateGrabStrengthRightAway, "UpgradePlayerGrabStrengthRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeThrow, SaveGrabThrow, (Action<string>)PunManager.instance.UpdateThrowStrengthRightAway, "UpgradePlayerThrowStrengthRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeHealth, SaveHealth, (Action<string>)PunManager.instance.UpdateHealthRightAway, "UpgradePlayerHealthRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeSpeed, SaveSprintSpeed, (Action<string>)PunManager.instance.UpdateSprintSpeedRightAway, "UpgradePlayerSprintSpeedRPC");
			ApplyUpgrade(StatsManager.instance.playerUpgradeLaunch, SaveTumbleLaunch, (Action<string>)PunManager.instance.UpdateTumbleLaunchRightAway, "UpgradePlayerTumbleLaunchRPC");
			RepoLeveling.Logger.LogDebug((object)"Skill points applied.");
		}

		internal static int SkillPointsFromCumulativeHaul()
		{
			int num = (int)((-1.0 + Math.Sqrt(1.0 + (double)(4 * SaveCumulativeHaul.Value) / 75.0)) / 2.0);
			RepoLeveling.Logger.LogDebug((object)$"Total skill points: {num}");
			return num;
		}

		private static int TotalSpentSkillPoints()
		{
			int num = SaveMapPlayerCount.Value + SaveEnergy.Value + SaveExtraJump.Value + SaveGrabRange.Value + SaveGrabStrength.Value + SaveGrabThrow.Value + SaveHealth.Value + SaveSprintSpeed.Value + SaveTumbleLaunch.Value;
			RepoLeveling.Logger.LogDebug((object)$"Spent skill points: {num}");
			return num;
		}

		internal static int AvailableSkillPoints()
		{
			int num = SkillPointsFromCumulativeHaul() - TotalSpentSkillPoints();
			RepoLeveling.Logger.LogDebug((object)$"Available skill points: {num}");
			return num;
		}

		private static int TotalCumulativeHaulNeededForNextSkillPoint()
		{
			int num = SkillPointsFromCumulativeHaul() + 1;
			int num2 = 75 * num * (num + 1);
			RepoLeveling.Logger.LogDebug((object)$"Total haul needed for next skill point: {num2}");
			return num2;
		}

		internal static int NeededCumulativeHaulForNextSkillPoint()
		{
			int num = TotalCumulativeHaulNeededForNextSkillPoint() - SaveCumulativeHaul.Value;
			RepoLeveling.Logger.LogDebug((object)$"Haul still needed for next skill point: {num}");
			return num;
		}
	}
	[HarmonyPatch(typeof(SemiFunc))]
	internal static class SemiFuncPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnSceneSwitch")]
		private static void OnSceneSwitch_Prefix()
		{
			if (SemiFunc.RunIsArena())
			{
				RepoLeveling.Logger.LogDebug((object)$"Level failed, saving haul of {StatsManager.instance.GetRunStatTotalHaul()}");
				ConfigEntry<int> saveCumulativeHaul = SaveDataManager.SaveCumulativeHaul;
				saveCumulativeHaul.Value += StatsManager.instance.GetRunStatTotalHaul();
				RepoLeveling.Logger.LogDebug((object)$"New total: {SaveDataManager.SaveCumulativeHaul.Value}");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnSceneSwitch")]
		private static void OnSceneSwitch_Postfix()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.RunIsLevel() && !StatsManager.instance.FetchPlayerUpgrades(PlayerController.instance.playerSteamID).Values.Any((int val) => val != 0))
			{
				SaveDataManager.ApplySkills();
			}
		}
	}
	public static class SkillsMenu
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuilderDelegate <>9__2_0;

			public static BuilderDelegate <>9__2_1;

			public static BuilderDelegate <>9__2_2;

			public static Action<int> <>9__5_0;

			public static Action<int> <>9__5_1;

			public static Action<int> <>9__5_2;

			public static Action<int> <>9__5_3;

			public static Action<int> <>9__5_4;

			public static Action<int> <>9__5_5;

			public static Action<int> <>9__5_6;

			public static Action<int> <>9__5_7;

			public static Action<int> <>9__5_8;

			internal void <Initialize>b__2_0(Transform parent)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Skills", (Action)CreateSkillsMenu, parent, new Vector2(0f, 360f));
			}

			internal void <Initialize>b__2_1(Transform parent)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Skills", (Action)CreateSkillsMenu, parent, new Vector2(0f, 360f));
			}

			internal void <Initialize>b__2_2(Transform parent)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Skills", (Action)CreateSkillsMenu, parent, new Vector2(0f, 360f));
			}

			internal void <CreateSkillsPage>b__5_0(int value)
			{
				OnSkillPointAssignmentChanged(0, SaveDataManager.SaveMapPlayerCount, value);
			}

			internal void <CreateSkillsPage>b__5_1(int value)
			{
				OnSkillPointAssignmentChanged(1, SaveDataManager.SaveEnergy, value);
			}

			internal void <CreateSkillsPage>b__5_2(int value)
			{
				OnSkillPointAssignmentChanged(2, SaveDataManager.SaveExtraJump, value);
			}

			internal void <CreateSkillsPage>b__5_3(int value)
			{
				OnSkillPointAssignmentChanged(3, SaveDataManager.SaveGrabRange, value);
			}

			internal void <CreateSkillsPage>b__5_4(int value)
			{
				OnSkillPointAssignmentChanged(4, SaveDataManager.SaveGrabStrength, value);
			}

			internal void <CreateSkillsPage>b__5_5(int value)
			{
				OnSkillPointAssignmentChanged(5, SaveDataManager.SaveGrabThrow, value);
			}

			internal void <CreateSkillsPage>b__5_6(int value)
			{
				OnSkillPointAssignmentChanged(6, SaveDataManager.SaveHealth, value);
			}

			internal void <CreateSkillsPage>b__5_7(int value)
			{
				OnSkillPointAssignmentChanged(7, SaveDataManager.SaveSprintSpeed, value);
			}

			internal void <CreateSkillsPage>b__5_8(int value)
			{
				OnSkillPointAssignmentChanged(8, SaveDataManager.SaveTumbleLaunch, value);
			}
		}

		private static REPOLabel _availableSkillPoints;

		private static REPOSlider[] _skillSliders;

		internal static void Initialize()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//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_0043: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				BuilderDelegate val = delegate(Transform parent)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Skills", (Action)CreateSkillsMenu, parent, new Vector2(0f, 360f));
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			MenuAPI.AddElementToMainMenu((BuilderDelegate)obj);
			object obj2 = <>c.<>9__2_1;
			if (obj2 == null)
			{
				BuilderDelegate val2 = delegate(Transform parent)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Skills", (Action)CreateSkillsMenu, parent, new Vector2(0f, 360f));
				};
				<>c.<>9__2_1 = val2;
				obj2 = (object)val2;
			}
			MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj2);
			object obj3 = <>c.<>9__2_2;
			if (obj3 == null)
			{
				BuilderDelegate val3 = delegate(Transform parent)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Skills", (Action)CreateSkillsMenu, parent, new Vector2(0f, 360f));
				};
				<>c.<>9__2_2 = val3;
				obj3 = (object)val3;
			}
			MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj3);
		}

		private static void CreateSkillsMenu()
		{
			CreateStatisticsPage();
			CreateSkillsPage();
		}

		private static void CreateStatisticsPage()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: 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_02b7: 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)
			REPOPopupPage statisticsPage = MenuAPI.CreateREPOPopupPage("Statistics", (PresetSide)0, false, true, 0f);
			REPOElement[] array = (REPOElement[])(object)new REPOElement[13]
			{
				(REPOElement)MenuAPI.CreateREPOLabel("Total Hauled:", ((Component)statisticsPage).transform, new Vector2(70f, 270f)),
				(REPOElement)MenuAPI.CreateREPOLabel("Next SP in:", ((Component)statisticsPage).transform, new Vector2(70f, 240f)),
				(REPOElement)MenuAPI.CreateREPOLabel("Total SP earned:", ((Component)statisticsPage).transform, new Vector2(70f, 210f)),
				(REPOElement)MenuAPI.CreateREPOLabel("Available SP:", ((Component)statisticsPage).transform, new Vector2(70f, 180f)),
				(REPOElement)MenuAPI.CreateREPOLabel("Current Haul:", ((Component)statisticsPage).transform, new Vector2(70f, 150f)),
				(REPOElement)MenuAPI.CreateREPOLabel($"{SaveDataManager.SaveCumulativeHaul.Value}k", ((Component)statisticsPage).transform, new Vector2(260f, 270f)),
				(REPOElement)MenuAPI.CreateREPOLabel($"{SaveDataManager.NeededCumulativeHaulForNextSkillPoint()}k", ((Component)statisticsPage).transform, new Vector2(260f, 240f)),
				(REPOElement)MenuAPI.CreateREPOLabel($"{SaveDataManager.SkillPointsFromCumulativeHaul()}", ((Component)statisticsPage).transform, new Vector2(260f, 210f)),
				(REPOElement)(_availableSkillPoints = MenuAPI.CreateREPOLabel($"{SaveDataManager.AvailableSkillPoints()}", ((Component)statisticsPage).transform, new Vector2(260f, 180f))),
				(REPOElement)MenuAPI.CreateREPOLabel($"{StatsManager.instance.GetRunStatTotalHaul()}k", ((Component)statisticsPage).transform, new Vector2(260f, 150f)),
				(REPOElement)MenuAPI.CreateREPOLabel("Note: SP = Skill Points", ((Component)statisticsPage).transform, new Vector2(70f, 60f)),
				(REPOElement)MenuAPI.CreateREPOButton("Reset progress", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Reset Progress", Color.red, "Are you sure that you want to reset your progress? This cannot be undone!", (Action)delegate
					{
						SaveDataManager.ResetProgress();
						statisticsPage.ClosePage(true);
					}, (Action)null);
				}, ((Component)statisticsPage).transform, new Vector2(190f, 30f)),
				(REPOElement)MenuAPI.CreateREPOButton("Close", (Action)delegate
				{
					statisticsPage.ClosePage(true);
				}, ((Component)statisticsPage).transform, new Vector2(60f, 30f))
			};
			REPOElement[] array2 = array;
			foreach (REPOElement val in array2)
			{
				statisticsPage.AddElement(val.rectTransform, Vector2.op_Implicit(((Transform)val.rectTransform).localPosition));
			}
			statisticsPage.OpenPage(false);
		}

		private static void CreateSkillsPage()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: 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_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			int num = SaveDataManager.AvailableSkillPoints();
			REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Skills", (PresetSide)1, false, false, 0f);
			_skillSliders = (REPOSlider[])(object)new REPOSlider[9]
			{
				MenuAPI.CreateREPOSlider("Map Player Count", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(0, SaveDataManager.SaveMapPlayerCount, value);
				}, ((Component)val).transform, new Vector2(395f, 270f), 0, Math.Min(SaveDataManager.SaveMapPlayerCount.Value + num, 1), SaveDataManager.SaveMapPlayerCount.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Stamina", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(1, SaveDataManager.SaveEnergy, value);
				}, ((Component)val).transform, new Vector2(395f, 240f), 0, Math.Min(SaveDataManager.SaveEnergy.Value + num, int.MaxValue), SaveDataManager.SaveEnergy.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Double Jump", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(2, SaveDataManager.SaveExtraJump, value);
				}, ((Component)val).transform, new Vector2(395f, 210f), 0, Math.Min(SaveDataManager.SaveExtraJump.Value + num, int.MaxValue), SaveDataManager.SaveExtraJump.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Range", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(3, SaveDataManager.SaveGrabRange, value);
				}, ((Component)val).transform, new Vector2(395f, 180f), 0, Math.Min(SaveDataManager.SaveGrabRange.Value + num, int.MaxValue), SaveDataManager.SaveGrabRange.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Strength", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(4, SaveDataManager.SaveGrabStrength, value);
				}, ((Component)val).transform, new Vector2(395f, 150f), 0, Math.Min(SaveDataManager.SaveGrabStrength.Value + num, int.MaxValue), SaveDataManager.SaveGrabStrength.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Throw", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(5, SaveDataManager.SaveGrabThrow, value);
				}, ((Component)val).transform, new Vector2(395f, 120f), 0, Math.Min(SaveDataManager.SaveGrabThrow.Value + num, int.MaxValue), SaveDataManager.SaveGrabThrow.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Health", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(6, SaveDataManager.SaveHealth, value);
				}, ((Component)val).transform, new Vector2(395f, 90f), 0, Math.Min(SaveDataManager.SaveHealth.Value + num, int.MaxValue), SaveDataManager.SaveHealth.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Sprint Speed", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(7, SaveDataManager.SaveSprintSpeed, value);
				}, ((Component)val).transform, new Vector2(395f, 60f), 0, Math.Min(SaveDataManager.SaveSprintSpeed.Value + num, int.MaxValue), SaveDataManager.SaveSprintSpeed.Value, "", "", (BarBehavior)0),
				MenuAPI.CreateREPOSlider("Tumble Launch", string.Empty, (Action<int>)delegate(int value)
				{
					OnSkillPointAssignmentChanged(8, SaveDataManager.SaveTumbleLaunch, value);
				}, ((Component)val).transform, new Vector2(395f, 30f), 0, Math.Min(SaveDataManager.SaveTumbleLaunch.Value + num, int.MaxValue), SaveDataManager.SaveTumbleLaunch.Value, "", "", (BarBehavior)0)
			};
			REPOSlider[] skillSliders = _skillSliders;
			foreach (REPOSlider val2 in skillSliders)
			{
				val.AddElement(((REPOElement)val2).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)val2).rectTransform).localPosition));
			}
			val.OpenPage(true);
		}

		private static void OnSkillPointAssignmentChanged(int index, ConfigEntry<int> entry, int value)
		{
			entry.Value = value;
			int num = SaveDataManager.AvailableSkillPoints();
			((TMP_Text)_availableSkillPoints.labelTMP).text = num.ToString();
			REPOSlider[] skillSliders = _skillSliders;
			foreach (REPOSlider val in skillSliders)
			{
				int num2 = ((((TMP_Text)val.labelTMP).text == "Map Player Count") ? 1 : int.MaxValue);
				if ((Object)(object)val == (Object)(object)_skillSliders[index])
				{
					val.max = Mathf.Min(value + num, num2);
				}
				else
				{
					val.max = Mathf.Min(val.value + (float)num, (float)num2);
				}
				val.SetValue(val.value, false);
			}
		}
	}
}