Decompiled source of LevelUpChoices v1.0.9

plugins/LevelUpChoices.dll

Decompiled an hour ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using LevelUpChoices.Extensions;
using LookingGlass.ItemStatsNameSpace;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[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("LevelUpChoices")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6ac5a8c51aa4506475de79f5b53a9ad3baa76c84")]
[assembly: AssemblyProduct("LevelUpChoices")]
[assembly: AssemblyTitle("LevelUpChoices")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LevelUpChoices
{
	public class DebugManager : MonoBehaviour
	{
		private bool CheckDebugEnabled()
		{
			if (ModConfig.DebugPassword == null)
			{
				return false;
			}
			if (ModConfig.DebugPassword.Value != 3169)
			{
				return false;
			}
			return true;
		}

		private void Update()
		{
			try
			{
				if (Input.GetKeyDown((KeyCode)283))
				{
					if (CheckDebugEnabled() && NetworkServer.active)
					{
						TeamManager.instance.GiveTeamExperience((TeamIndex)1, (TeamManager.instance.GetTeamNextLevelExperience((TeamIndex)1) - TeamManager.instance.GetTeamCurrentLevelExperience((TeamIndex)1)) / 6);
						Log.Info("Granted debug XP", "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\DebugManager.cs", "Update");
					}
				}
				else if (Input.GetKeyDown((KeyCode)285) && CheckDebugEnabled())
				{
					DumpAllItemsToJson();
				}
			}
			catch (Exception data)
			{
				Log.Error(data, "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\DebugManager.cs", "Update");
			}
		}

		private static void DumpAllItemsToJson()
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad6: Invalid comparison between Unknown and I4
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Expected I4, but got Unknown
			//IL_0c1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c31: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c66: Expected I4, but got Unknown
			//IL_0ec6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_0757: Unknown result type (might be due to invalid IL or missing references)
			//IL_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_075e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0760: Unknown result type (might be due to invalid IL or missing references)
			//IL_077e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_087b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0885: Expected I4, but got Unknown
			//IL_0898: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Expected I4, but got Unknown
			//IL_0a40: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine("{");
				stringBuilder.AppendLine("  \"_metadata\": {");
				stringBuilder.AppendLine("    \"dumpTime\": \"" + Esc(DateTime.UtcNow.ToString("o")) + "\",");
				stringBuilder.AppendLine($"    \"itemCatalogCount\": {ItemCatalog.itemCount},");
				stringBuilder.AppendLine($"    \"pickupCatalogCount\": {PickupCatalog.pickupCount},");
				stringBuilder.AppendLine($"    \"equipmentCatalogCount\": {EquipmentCatalog.equipmentCount}");
				stringBuilder.AppendLine("  },");
				stringBuilder.AppendLine("  \"itemTierDefs\": [");
				bool flag = true;
				ItemTier[] array = new ItemTier[11];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				ItemTier[] array2 = (ItemTier[])(object)array;
				foreach (ItemTier val in array2)
				{
					if (!flag)
					{
						stringBuilder.AppendLine(",");
					}
					flag = false;
					ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(val);
					stringBuilder.AppendLine("    {");
					stringBuilder.AppendLine($"      \"tier\": \"{val}\",");
					stringBuilder.AppendLine("      \"tierDefExists\": " + Bool((Object)(object)itemTierDef != (Object)null) + ",");
					if ((Object)(object)itemTierDef != (Object)null)
					{
						stringBuilder.AppendLine("      \"isDroppable\": " + Bool(itemTierDef.isDroppable) + ",");
						stringBuilder.AppendLine("      \"canScrap\": " + Bool(itemTierDef.canScrap) + ",");
						stringBuilder.AppendLine("      \"canRestack\": " + Bool(itemTierDef.canRestack) + ",");
						stringBuilder.AppendLine($"      \"colorIndex\": \"{itemTierDef.colorIndex}\",");
						stringBuilder.AppendLine($"      \"darkColorIndex\": \"{itemTierDef.darkColorIndex}\",");
						stringBuilder.AppendLine($"      \"pickupRules\": \"{itemTierDef.pickupRules}\",");
						stringBuilder.AppendLine("      \"bgIconTexture\": \"" + Esc(((Object)(object)itemTierDef.bgIconTexture != (Object)null) ? ((Object)itemTierDef.bgIconTexture).name : "null") + "\",");
						stringBuilder.AppendLine("      \"highlightPrefab\": \"" + Esc(((Object)(object)itemTierDef.highlightPrefab != (Object)null) ? ((Object)itemTierDef.highlightPrefab).name : "null") + "\",");
						stringBuilder.AppendLine("      \"dropletDisplayPrefab\": \"" + Esc(((Object)(object)itemTierDef.dropletDisplayPrefab != (Object)null) ? ((Object)itemTierDef.dropletDisplayPrefab).name : "null") + "\"");
					}
					else
					{
						stringBuilder.AppendLine("      \"_note\": \"ItemTierDef is null for this tier\"");
					}
					stringBuilder.Append("    }");
				}
				stringBuilder.AppendLine();
				stringBuilder.AppendLine("  ],");
				stringBuilder.AppendLine("  \"items\": [");
				bool flag2 = true;
				AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator();
				try
				{
					while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
					{
						ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
						if (!flag2)
						{
							stringBuilder.AppendLine(",");
						}
						flag2 = false;
						ItemDef itemDef = ItemCatalog.GetItemDef(current);
						bool flag3 = (Object)(object)itemDef == (Object)null;
						stringBuilder.AppendLine("    {");
						stringBuilder.AppendLine($"      \"itemIndex\": {(int)current},");
						stringBuilder.AppendLine("      \"itemDefExists\": " + Bool(!flag3) + ",");
						if (flag3)
						{
							stringBuilder.AppendLine("      \"skipReason\": \"DEF_NULL\"");
							stringBuilder.Append("    }");
							continue;
						}
						stringBuilder.AppendLine("      \"name\": \"" + Esc(((Object)itemDef).name) + "\",");
						stringBuilder.AppendLine("      \"nameToken\": \"" + Esc(itemDef.nameToken) + "\",");
						stringBuilder.AppendLine("      \"displayName\": \"" + Esc(SafeGetString(itemDef.nameToken)) + "\",");
						stringBuilder.AppendLine("      \"pickupToken\": \"" + Esc(itemDef.pickupToken) + "\",");
						stringBuilder.AppendLine("      \"pickupDescription\": \"" + Esc(SafeGetString(itemDef.pickupToken)) + "\",");
						stringBuilder.AppendLine("      \"descriptionToken\": \"" + Esc(itemDef.descriptionToken) + "\",");
						stringBuilder.AppendLine("      \"fullDescription\": \"" + Esc(SafeGetString(Integrations.lookingGlassEnabled ? LookingGlassIntegration.GetItemDescription(itemDef, 0, null, withOneMore: false) : itemDef.descriptionToken)) + "\",");
						stringBuilder.AppendLine("      \"loreToken\": \"" + Esc(itemDef.loreToken) + "\",");
						stringBuilder.AppendLine($"      \"tier\": \"{itemDef.tier}\",");
						ItemTierDef itemTierDef2 = ItemTierCatalog.GetItemTierDef(itemDef.tier);
						stringBuilder.AppendLine("      \"tierDef\": {");
						if ((Object)(object)itemTierDef2 != (Object)null)
						{
							stringBuilder.AppendLine("        \"isDroppable\": " + Bool(itemTierDef2.isDroppable) + ",");
							stringBuilder.AppendLine("        \"canScrap\": " + Bool(itemTierDef2.canScrap) + ",");
							stringBuilder.AppendLine("        \"canRestack\": " + Bool(itemTierDef2.canRestack) + ",");
							stringBuilder.AppendLine($"        \"pickupRules\": \"{itemTierDef2.pickupRules}\"");
						}
						else
						{
							stringBuilder.AppendLine("        \"_note\": \"null\"");
						}
						stringBuilder.AppendLine("      },");
						stringBuilder.AppendLine("      \"hidden\": " + Bool(itemDef.hidden) + ",");
						stringBuilder.AppendLine("      \"canRemove\": " + Bool(itemDef.canRemove) + ",");
						string s = ((itemDef.tags != null) ? string.Join(", ", itemDef.tags) : "null");
						stringBuilder.AppendLine("      \"tags\": \"" + Esc(s) + "\",");
						stringBuilder.AppendLine("      \"tagsArray\": [" + ((itemDef.tags != null) ? string.Join(", ", itemDef.tags.Select((ItemTag t) => $"\"{t}\"")) : "") + "],");
						stringBuilder.AppendLine("      \"pickupIconSprite\": \"" + Esc(((Object)(object)itemDef.pickupIconSprite != (Object)null) ? ((Object)itemDef.pickupIconSprite).name : "null") + "\",");
						stringBuilder.AppendLine("      \"unlockableDef\": \"" + Esc(((Object)(object)itemDef.unlockableDef != (Object)null) ? itemDef.unlockableDef.cachedName : "null") + "\",");
						stringBuilder.AppendLine("      \"requiredExpansion\": \"" + Esc(((Object)(object)itemDef.requiredExpansion != (Object)null) ? ((Object)itemDef.requiredExpansion).name : "null") + "\",");
						PickupIndex val2 = PickupCatalog.FindPickupIndex(current);
						bool flag4 = val2 != PickupIndex.none;
						stringBuilder.AppendLine("      \"pickup\": {");
						stringBuilder.AppendLine($"        \"pickupIndex\": {val2.value},");
						stringBuilder.AppendLine("        \"hasPickup\": " + Bool(flag4) + ",");
						if (flag4)
						{
							PickupDef pickupDef = PickupCatalog.GetPickupDef(val2);
							if (pickupDef != null)
							{
								stringBuilder.AppendLine("        \"internalName\": \"" + Esc(pickupDef.internalName) + "\",");
								stringBuilder.AppendLine("        \"nameToken\": \"" + Esc(pickupDef.nameToken) + "\",");
								stringBuilder.AppendLine("        \"interactContextToken\": \"" + Esc(pickupDef.interactContextToken) + "\",");
								stringBuilder.AppendLine("        \"isLunar\": " + Bool(pickupDef.isLunar) + ",");
								stringBuilder.AppendLine("        \"isBoss\": " + Bool(pickupDef.isBoss) + ",");
								stringBuilder.AppendLine($"        \"itemIndex\": {(int)pickupDef.itemIndex},");
								stringBuilder.AppendLine($"        \"itemTier\": \"{pickupDef.itemTier}\",");
								stringBuilder.AppendLine($"        \"equipmentIndex\": {(int)pickupDef.equipmentIndex},");
								stringBuilder.AppendLine($"        \"coinValue\": {pickupDef.coinValue},");
								stringBuilder.AppendLine("        \"baseColor\": \"" + Esc(((object)(Color)(ref pickupDef.baseColor)).ToString()) + "\",");
								stringBuilder.AppendLine("        \"darkColor\": \"" + Esc(((object)(Color)(ref pickupDef.darkColor)).ToString()) + "\",");
								stringBuilder.AppendLine("        \"iconSprite\": \"" + Esc(((Object)(object)pickupDef.iconSprite != (Object)null) ? ((Object)pickupDef.iconSprite).name : "null") + "\",");
								stringBuilder.AppendLine("        \"displayPrefab\": \"" + Esc(((Object)(object)pickupDef.displayPrefab != (Object)null) ? ((Object)pickupDef.displayPrefab).name : "null") + "\",");
								stringBuilder.AppendLine("        \"dropletDisplayPrefab\": \"" + Esc(((Object)(object)pickupDef.dropletDisplayPrefab != (Object)null) ? ((Object)pickupDef.dropletDisplayPrefab).name : "null") + "\"");
							}
							else
							{
								stringBuilder.AppendLine("        \"_note\": \"PickupDef is null despite valid PickupIndex\"");
							}
						}
						else
						{
							stringBuilder.AppendLine("        \"_note\": \"no pickup entry\"");
						}
						stringBuilder.AppendLine("      },");
						bool flag5 = false;
						bool flag6 = false;
						try
						{
							if ((Object)(object)Run.instance != (Object)null)
							{
								flag6 = true;
								flag5 = Run.instance.availableItems.Contains(current);
							}
						}
						catch
						{
						}
						stringBuilder.AppendLine("      \"run\": {");
						stringBuilder.AppendLine("        \"runInstanceExists\": " + Bool(flag6) + ",");
						stringBuilder.AppendLine("        \"isAvailableInRun\": " + Bool(flag5));
						stringBuilder.AppendLine("      },");
						bool flag7 = PlayerDropTable.BannedItemNames.Contains(((Object)itemDef).name);
						bool flag8 = itemDef.tags != null && itemDef.tags.Contains((ItemTag)25);
						ItemTier tier = itemDef.tier;
						bool flag9 = (int)tier <= 4;
						bool flag10 = flag9;
						string text = "INCLUDED";
						if (itemDef.hidden)
						{
							text = "HIDDEN";
						}
						else if (flag8)
						{
							text = "IGNORE_FOR_DROP_LIST";
						}
						else if (flag7)
						{
							text = "BANNED";
						}
						else if (!flag10)
						{
							text = "INVALID_TIER";
						}
						else if (!flag4)
						{
							text = "NO_PICKUP_INDEX";
						}
						else if (!flag6)
						{
							text = "RUN_INSTANCE_NULL";
						}
						else if (!flag5)
						{
							text = "NOT_AVAILABLE_IN_RUN";
						}
						stringBuilder.AppendLine("      \"filter\": {");
						stringBuilder.AppendLine("        \"isBanned\": " + Bool(flag7) + ",");
						stringBuilder.AppendLine("        \"ignoreForDropList\": " + Bool(flag8) + ",");
						stringBuilder.AppendLine("        \"isAllowedTier\": " + Bool(flag10) + ",");
						stringBuilder.AppendLine("        \"skipReason\": \"" + text + "\"");
						stringBuilder.AppendLine("      }");
						stringBuilder.Append("    }");
					}
				}
				finally
				{
					((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
				}
				stringBuilder.AppendLine();
				stringBuilder.AppendLine("  ],");
				stringBuilder.AppendLine("  \"equipment\": [");
				bool flag11 = true;
				AllEquipmentEnumerator enumerator2 = EquipmentCatalog.allEquipment.GetEnumerator();
				try
				{
					while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext())
					{
						EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current;
						if (!flag11)
						{
							stringBuilder.AppendLine(",");
						}
						flag11 = false;
						EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current2);
						stringBuilder.AppendLine("    {");
						stringBuilder.AppendLine($"      \"equipmentIndex\": {(int)current2},");
						stringBuilder.AppendLine("      \"equipmentDefExists\": " + Bool((Object)(object)equipmentDef != (Object)null) + ",");
						if ((Object)(object)equipmentDef == (Object)null)
						{
							stringBuilder.AppendLine("      \"_note\": \"EquipmentDef is null\"");
							stringBuilder.Append("    }");
							continue;
						}
						stringBuilder.AppendLine("      \"name\": \"" + Esc(((Object)equipmentDef).name) + "\",");
						stringBuilder.AppendLine("      \"nameToken\": \"" + Esc(equipmentDef.nameToken) + "\",");
						stringBuilder.AppendLine("      \"displayName\": \"" + Esc(SafeGetString(equipmentDef.nameToken)) + "\",");
						stringBuilder.AppendLine("      \"pickupToken\": \"" + Esc(equipmentDef.pickupToken) + "\",");
						stringBuilder.AppendLine("      \"pickupDescription\": \"" + Esc(SafeGetString(equipmentDef.pickupToken)) + "\",");
						stringBuilder.AppendLine("      \"descriptionToken\": \"" + Esc(equipmentDef.descriptionToken) + "\",");
						stringBuilder.AppendLine("      \"loreToken\": \"" + Esc(equipmentDef.loreToken) + "\",");
						stringBuilder.AppendLine("      \"isLunar\": " + Bool(equipmentDef.isLunar) + ",");
						stringBuilder.AppendLine("      \"isBoss\": " + Bool(equipmentDef.isBoss) + ",");
						stringBuilder.AppendLine($"      \"cooldown\": {equipmentDef.cooldown},");
						stringBuilder.AppendLine("      \"enigmaCompatible\": " + Bool(equipmentDef.enigmaCompatible) + ",");
						stringBuilder.AppendLine("      \"canDrop\": " + Bool(equipmentDef.canDrop) + ",");
						stringBuilder.AppendLine("      \"canBeRandomlyTriggered\": " + Bool(equipmentDef.canBeRandomlyTriggered) + ",");
						stringBuilder.AppendLine("      \"appearsInSinglePlayer\": " + Bool(equipmentDef.appearsInSinglePlayer) + ",");
						stringBuilder.AppendLine("      \"appearsInMultiPlayer\": " + Bool(equipmentDef.appearsInMultiPlayer) + ",");
						stringBuilder.AppendLine($"      \"colorIndex\": \"{equipmentDef.colorIndex}\",");
						stringBuilder.AppendLine($"      \"dropOnDeathChance\": {equipmentDef.dropOnDeathChance},");
						stringBuilder.AppendLine("      \"passiveBuffDef\": \"" + Esc(((Object)(object)equipmentDef.passiveBuffDef != (Object)null) ? ((Object)equipmentDef.passiveBuffDef).name : "null") + "\",");
						stringBuilder.AppendLine("      \"pickupIconSprite\": \"" + Esc(((Object)(object)equipmentDef.pickupIconSprite != (Object)null) ? ((Object)equipmentDef.pickupIconSprite).name : "null") + "\",");
						stringBuilder.AppendLine("      \"unlockableDef\": \"" + Esc(((Object)(object)equipmentDef.unlockableDef != (Object)null) ? equipmentDef.unlockableDef.cachedName : "null") + "\",");
						stringBuilder.AppendLine("      \"requiredExpansion\": \"" + Esc(((Object)(object)equipmentDef.requiredExpansion != (Object)null) ? ((Object)equipmentDef.requiredExpansion).name : "null") + "\",");
						PickupIndex val3 = PickupCatalog.FindPickupIndex(current2);
						bool v = val3 != PickupIndex.none;
						stringBuilder.AppendLine("      \"pickup\": {");
						stringBuilder.AppendLine($"        \"pickupIndex\": {val3.value},");
						stringBuilder.AppendLine("        \"hasPickup\": " + Bool(v));
						stringBuilder.AppendLine("      }");
						stringBuilder.Append("    }");
					}
				}
				finally
				{
					((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose();
				}
				stringBuilder.AppendLine();
				stringBuilder.AppendLine("  ]");
				stringBuilder.AppendLine("}");
				string text2 = Path.Combine(Paths.BepInExRootPath, "LevelUpChoices");
				string text3 = Path.Combine(text2, "item_dump.json");
				Directory.CreateDirectory(text2);
				File.WriteAllText(text3, stringBuilder.ToString());
				Log.Info("Item dump written to " + text3, "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\DebugManager.cs", "DumpAllItemsToJson");
			}
			catch (Exception data)
			{
				Log.Error(data, "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\DebugManager.cs", "DumpAllItemsToJson");
			}
		}

		private static string Bool(bool v)
		{
			if (!v)
			{
				return "false";
			}
			return "true";
		}

		private static string Esc(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				return "";
			}
			return s.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\n", "\\n")
				.Replace("\r", "\\r")
				.Replace("\t", "\\t");
		}

		private static string SafeGetString(string token)
		{
			try
			{
				if (string.IsNullOrEmpty(token))
				{
					return "";
				}
				return Language.GetString(token) ?? "";
			}
			catch
			{
				return "";
			}
		}
	}
	public class ExperienceHook : MonoBehaviour
	{
		private uint cachedLevel;

		private double cachedMultiplier;

		private float StartMultiplier => ModConfig.ExperienceStartMultiplier.Value;

		private float GrowthRate => ModConfig.ExperienceGrowthRate.Value;

		public static event Action<uint> OnLevelUp;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			TeamManager.GiveTeamExperience += new hook_GiveTeamExperience(TeamManager_GiveTeamExperience);
			Run.onRunDestroyGlobal += OnRunDestroy;
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			TeamManager.GiveTeamExperience -= new hook_GiveTeamExperience(TeamManager_GiveTeamExperience);
			Run.onRunDestroyGlobal -= OnRunDestroy;
		}

		private void OnRunDestroy(Run run)
		{
			cachedLevel = 0u;
			cachedMultiplier = 0.0;
		}

		private void TeamManager_GiveTeamExperience(orig_GiveTeamExperience orig, TeamManager self, TeamIndex teamIndex, ulong experience)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if ((int)teamIndex != 1 || !ModConfig.ModEnabled.Value)
			{
				orig.Invoke(self, teamIndex, experience);
				return;
			}
			if (cachedLevel == 0)
			{
				cachedLevel = self.GetTeamLevel(teamIndex);
				cachedMultiplier = (double)StartMultiplier * Math.Pow(GrowthRate, cachedLevel - 1);
			}
			ulong num = (ulong)((double)experience * cachedMultiplier);
			if (num < experience)
			{
				num = ulong.MaxValue;
			}
			num = Math.Max(num, 1uL);
			orig.Invoke(self, teamIndex, num);
			uint teamLevel = self.GetTeamLevel(teamIndex);
			if (teamLevel > cachedLevel)
			{
				uint num2 = cachedLevel;
				cachedLevel = teamLevel;
				cachedMultiplier = (double)StartMultiplier * Math.Pow(GrowthRate, cachedLevel - 1);
				for (uint num3 = num2 + 1; num3 <= teamLevel; num3++)
				{
					ExperienceHook.OnLevelUp?.Invoke(num3);
				}
			}
		}
	}
	public class InteractableSpawnHook : MonoBehaviour
	{
		private void Start()
		{
			SceneDirector.onPrePopulateSceneServer += OnPrePopulateSceneServer;
		}

		private void OnPrePopulateSceneServer(SceneDirector director)
		{
			if (!ModConfig.ModEnabled.Value || !ModConfig.EnableInteractableRemoval.Value || !Object.op_Implicit((Object)(object)ClassicStageInfo.instance) || !Object.op_Implicit((Object)(object)ClassicStageInfo.instance.interactableCategories))
			{
				return;
			}
			DirectorCardCategorySelection interactableCategories = ClassicStageInfo.instance.interactableCategories;
			if (!Object.op_Implicit((Object)(object)interactableCategories))
			{
				Log.Error("No interactable categories found on ClassicStageInfo!", "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\InteractableSpawnHook.cs", "OnPrePopulateSceneServer");
				return;
			}
			string text = "isccasinochest";
			string text2 = "isccategorychestdamage";
			string text3 = "isccategorychesthealing";
			string text4 = "isccategorychestutility";
			string text5 = "iscchest1";
			string text6 = "iscchest1stealthed";
			string text7 = "iscchest2";
			string text8 = "iscduplicator";
			string text9 = "iscduplicatorlarge";
			string text10 = "iscduplicatormilitary";
			string text11 = "iscduplicatorwild";
			string text12 = "iscgoldchest";
			string text13 = "isclunarchest";
			string text14 = "iscscrapper";
			string text15 = "iscshrineblood";
			string text16 = "iscshrinebloodsandy";
			string text17 = "iscshrinebloodsnowy";
			string text18 = "iscshrinechance";
			string text19 = "iscshrinechancesandy";
			string text20 = "iscshrinechancesnowy";
			string text21 = "iscshrinecleanse";
			string text22 = "iscshrinecleansesandy";
			string text23 = "iscshrinecleansesnowy";
			string text24 = "iscshrinecombat";
			string text25 = "iscshrinecombatsandy";
			string text26 = "iscshrinecombatsnowy";
			string text27 = "iscshrinerestack";
			string text28 = "iscshrinerestacksandy";
			string text29 = "iscshrinerestacksnowy";
			string text30 = "isctripleshop";
			string text31 = "isctripleshoplarge";
			string text32 = "isccategorychest2damage";
			string text33 = "isccategorychest2healing";
			string text34 = "isccategorychest2utility";
			string[] blacklistedSpawns = new string[34]
			{
				text, text2, text3, text4, text5, text6, text7, text8, text9, text10,
				text11, text12, text13, text14, text15, text16, text17, text18, text19, text20,
				text21, text22, text23, text24, text25, text26, text27, text28, text29, text30,
				text31, text32, text33, text34
			};
			float num = 0f;
			for (int i = 0; i < interactableCategories.categories.Length; i++)
			{
				interactableCategories.categories[i].cards = interactableCategories.categories[i].cards.Where((DirectorCard c) => !blacklistedSpawns.Contains<string>(((Object)c.spawnCard).name, StringComparer.OrdinalIgnoreCase)).ToArray();
				if (interactableCategories.categories[i].cards.Length == 0)
				{
					num += interactableCategories.categories[i].selectionWeight;
					interactableCategories.categories[i].selectionWeight = 0f;
				}
			}
			for (int j = 0; j < interactableCategories.categories.Length; j++)
			{
				if (interactableCategories.categories[j].name.Equals("Barrels", StringComparison.OrdinalIgnoreCase))
				{
					interactableCategories.categories[j].selectionWeight += num;
					break;
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("karaeren.LevelUpChoices", "LevelUpChoices", "1.0.9")]
	public class LevelUpChoices : BaseUnityPlugin
	{
		public const string PluginGUID = "karaeren.LevelUpChoices";

		public const string PluginAuthor = "karaeren";

		public const string PluginName = "LevelUpChoices";

		public const string PluginVersion = "1.0.9";

		public void Awake()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Log.Init(((BaseUnityPlugin)this).Logger);
			ModConfig.Init(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Info);
			((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)Integrations.Init);
			NetworkingAPI.RegisterMessageType<Networking.SyncPlayerState>();
			NetworkingAPI.RegisterMessageType<Networking.SyncItems>();
			NetworkingAPI.RegisterMessageType<Networking.SendItemSelection>();
			NetworkingAPI.RegisterMessageType<Networking.SendBanish>();
			NetworkingAPI.RegisterMessageType<Networking.SendReroll>();
			NetworkingAPI.RegisterMessageType<Networking.SendPickingState>();
			GameObject val = new GameObject("LevelUpLogic");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<LevelUpManager>();
			val.AddComponent<LevelUpUI>();
			val.AddComponent<ExperienceHook>();
			val.AddComponent<InteractableSpawnHook>();
			val.AddComponent<DebugManager>();
			Log.Info("LevelUpChoices initialized.", "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\LevelUpChoices.cs", "Awake");
		}
	}
	public class LevelUpManager : MonoBehaviour
	{
		public class PlayerState
		{
			public int SelectionTokens;

			public int BanishTokens = ModConfig.StartingBanishTokens.Value;

			public int RerollTokens = ModConfig.StartingRerollTokens.Value;

			public int UsedTokens;

			public List<ItemIndex> CurrentOptions = new List<ItemIndex>();

			public PlayerDropTable DropTable = new PlayerDropTable();
		}

		public static LevelUpManager Instance;

		private List<PickupIndex> currentOptions = new List<PickupIndex>();

		private readonly Dictionary<NetworkInstanceId, PlayerState> playerStates = new Dictionary<NetworkInstanceId, PlayerState>();

		public int AvailableTokens { get; private set; }

		public int BanishTokens { get; private set; }

		public int RerollTokens { get; private set; }

		private void Awake()
		{
			if (Object.op_Implicit((Object)(object)Instance))
			{
				Object.Destroy((Object)(object)Instance);
			}
			Instance = this;
			ExperienceHook.OnLevelUp += OnLevelUp;
			Run.onRunDestroyGlobal += OnRunDestroy;
		}

		private void OnDestroy()
		{
			ExperienceHook.OnLevelUp -= OnLevelUp;
			Run.onRunDestroyGlobal -= OnRunDestroy;
		}

		private void OnLevelUp(uint newLevel)
		{
			//IL_0042: 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_004e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !ModConfig.ModEnabled.Value)
			{
				return;
			}
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance.networkUser))
				{
					NetworkInstanceId netId = ((NetworkBehaviour)instance.networkUser).netId;
					if (!playerStates.ContainsKey(netId))
					{
						playerStates[netId] = new PlayerState();
						bool enableScraps = instance.body.bodyIndex == BodyPrefabs.DrifterBody.bodyIndex;
						playerStates[netId].DropTable.Initialize(enableScraps);
					}
					PlayerState playerState = playerStates[netId];
					playerState.SelectionTokens++;
					int value = ModConfig.LevelsPerBanishToken.Value;
					if (value > 0 && newLevel % (uint)value == 0)
					{
						playerState.BanishTokens++;
					}
					if (playerState.CurrentOptions == null || playerState.CurrentOptions.Count == 0)
					{
						RollItemsForPlayer(netId);
					}
					SyncState(netId);
					SyncOptions(netId);
				}
			}
		}

		private void OnRunDestroy(Run run)
		{
			AvailableTokens = 0;
			BanishTokens = 0;
			RerollTokens = 0;
			playerStates.Clear();
			currentOptions.Clear();
			GamePauseManager.ForceReset();
			if (Object.op_Implicit((Object)(object)LevelUpUI.Instance))
			{
				LevelUpUI.Instance.Hide();
			}
		}

		public void UpdatePlayerState(int sTokens, int bTokens, int rTokens)
		{
			AvailableTokens = sTokens;
			BanishTokens = bTokens;
			RerollTokens = rTokens;
			LevelUpUI.Instance.UpdateTokens();
		}

		public void UpdateAvailableItems(List<PickupIndex> options)
		{
			currentOptions = options;
			if ((Object)(object)LevelUpUI.Instance != (Object)null && LevelUpUI.Instance.IsVisible)
			{
				LevelUpUI.Instance.UpdateOptions(currentOptions);
			}
		}

		public bool SpendTokenLocal()
		{
			if (AvailableTokens > 0)
			{
				AvailableTokens--;
				if (AvailableTokens <= 0)
				{
					LevelUpUI.Instance.Hide();
				}
				LevelUpUI.Instance.UpdateTokens();
				return true;
			}
			return false;
		}

		private void SyncState(NetworkInstanceId netId)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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)
			if (playerStates.ContainsKey(netId))
			{
				PlayerState playerState = playerStates[netId];
				NetMessageExtensions.Send((INetMessage)(object)new Networking.SyncPlayerState(netId, playerState.SelectionTokens, playerState.BanishTokens, playerState.RerollTokens), (NetworkDestination)1);
			}
		}

		private void SyncOptions(NetworkInstanceId netId)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (playerStates.ContainsKey(netId))
			{
				List<PickupIndex> pickupIndices = (from i in playerStates[netId].CurrentOptions
					select PickupCatalog.FindPickupIndex(i) into p
					where p != PickupIndex.none
					select p).ToList();
				NetMessageExtensions.Send((INetMessage)(object)new Networking.SyncItems(netId, pickupIndices), (NetworkDestination)1);
			}
		}

		public void HandlePlayerSelection(NetworkInstanceId netId, PickupIndex selection)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !playerStates.ContainsKey(netId))
			{
				return;
			}
			PlayerState playerState = playerStates[netId];
			if (playerState.SelectionTokens <= 0)
			{
				return;
			}
			playerState.SelectionTokens--;
			playerState.UsedTokens++;
			playerState.DropTable.RecalculateWeights(playerState.UsedTokens);
			if (ModConfig.RerollTokenRefreshOnPick.Value)
			{
				playerState.RerollTokens = 1;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(selection);
			if (pickupDef == null || (int)pickupDef.itemIndex == -1)
			{
				Log.Warning($"Invalid pickup {selection}. Refunding token.", "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\LevelUpManager.cs", "HandlePlayerSelection");
				playerState.SelectionTokens++;
				playerState.UsedTokens--;
				SyncState(netId);
				return;
			}
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance.networkUser) && ((NetworkBehaviour)instance.networkUser).netId == netId)
				{
					CharacterMaster master = instance.master;
					if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory))
					{
						master.inventory.GiveItemPermanent(pickupDef.itemIndex, 1);
					}
					break;
				}
			}
			RollItemsForPlayer(netId);
			SyncState(netId);
		}

		public void HandlePlayerBanish(NetworkInstanceId netId, int slotIndex)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_004d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && playerStates.ContainsKey(netId))
			{
				PlayerState playerState = playerStates[netId];
				if (playerState.BanishTokens > 0 && slotIndex >= 0 && slotIndex < playerState.CurrentOptions.Count)
				{
					ItemIndex item = playerState.CurrentOptions[slotIndex];
					playerState.BanishTokens--;
					playerState.DropTable.Remove(item);
					List<ItemIndex> list = new List<ItemIndex>(playerState.CurrentOptions);
					list.RemoveAt(slotIndex);
					playerState.CurrentOptions[slotIndex] = playerState.DropTable.Roll(list);
					SyncState(netId);
					SyncOptions(netId);
				}
			}
		}

		public void HandlePlayerReroll(NetworkInstanceId netId, int slotIndex)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && playerStates.ContainsKey(netId))
			{
				PlayerState playerState = playerStates[netId];
				if (playerState.RerollTokens > 0 && slotIndex >= 0 && slotIndex < playerState.CurrentOptions.Count)
				{
					playerState.RerollTokens--;
					List<ItemIndex> list = new List<ItemIndex>(playerState.CurrentOptions);
					list.RemoveAt(slotIndex);
					playerState.CurrentOptions[slotIndex] = playerState.DropTable.Roll(list);
					SyncState(netId);
					SyncOptions(netId);
				}
			}
		}

		private void RollItemsForPlayer(NetworkInstanceId netId)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			if (!playerStates.ContainsKey(netId))
			{
				return;
			}
			PlayerState playerState = playerStates[netId];
			playerState.CurrentOptions.Clear();
			int num = Mathf.Max(1, ModConfig.ItemChoiceCount.Value);
			for (int j = 0; j < num; j++)
			{
				ItemIndex val = playerState.DropTable.Roll(playerState.CurrentOptions);
				if ((int)val == -1 || PickupCatalog.FindPickupIndex(val) == PickupIndex.none)
				{
					Log.Warning($"Rolled invalid item {val}, skipping slot.", "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\LevelUpManager.cs", "RollItemsForPlayer");
				}
				else
				{
					playerState.CurrentOptions.Add(val);
				}
			}
			SyncOptions(netId);
			if (NetworkUser.readOnlyLocalPlayersList.Count > 0 && ((NetworkBehaviour)NetworkUser.readOnlyLocalPlayersList[0]).netId == netId)
			{
				UpdateAvailableItems(playerState.CurrentOptions.Select((ItemIndex i) => PickupCatalog.FindPickupIndex(i)).ToList());
			}
		}

		private void Update()
		{
			//IL_0005: 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)
			KeyboardShortcut value = ModConfig.ToggleMenuKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown() && Object.op_Implicit((Object)(object)LevelUpUI.Instance))
			{
				if (LevelUpUI.Instance.IsVisible)
				{
					LevelUpUI.Instance.Hide();
				}
				else if ((Object)(object)Run.instance != (Object)null && AvailableTokens > 0)
				{
					LevelUpUI.Instance.ShowChoices(currentOptions);
				}
			}
		}
	}
	public class LevelUpUI : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <HideNextFrame>d__28 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public LevelUpUI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				LevelUpUI levelUpUI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					EventSystem current = EventSystem.current;
					if (current != null)
					{
						current.SetSelectedGameObject((GameObject)null);
					}
					levelUpUI.containerObject.SetActive(false);
					return false;
				}
				}
			}

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

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

		public static LevelUpUI Instance;

		private GameObject canvasObject;

		private GameObject containerObject;

		private GameObject notificationPanel;

		private HGTextMeshProUGUI notificationText;

		private HGTextMeshProUGUI tokenHeader;

		private TMP_FontAsset ror2Font;

		private Sprite panelSprite;

		private Sprite buttonSprite;

		private readonly List<GameObject> buttonObjects = new List<GameObject>();

		private bool isPaused;

		private float lastClickTime;

		private const float ClickCooldown = 0.15f;

		public bool IsVisible { get; private set; }

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)Instance))
			{
				Object.Destroy((Object)(object)Instance);
			}
			Instance = this;
			ror2Font = Addressables.LoadAssetAsync<TMP_FontAsset>((object)"RoR2/Base/Common/Fonts/Bombardier.asset").WaitForCompletion();
			panelSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUICleanButton.png").WaitForCompletion();
			buttonSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIHighlightBoxOutlineThick.png").WaitForCompletion();
			BuildUI();
			PauseScreenController.OnEnable += new hook_OnEnable(OnPauseScreenEnabled);
			PauseScreenController.OnDisable += new hook_OnDisable(OnPauseScreenDisabled);
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			PauseScreenController.OnEnable -= new hook_OnEnable(OnPauseScreenEnabled);
			PauseScreenController.OnDisable -= new hook_OnDisable(OnPauseScreenDisabled);
		}

		private void OnPauseScreenEnabled(orig_OnEnable orig, PauseScreenController self)
		{
			orig.Invoke(self);
			isPaused = true;
			if (!GamePauseManager.IsPausedByUs && Object.op_Implicit((Object)(object)canvasObject))
			{
				canvasObject.SetActive(false);
			}
		}

		private void OnPauseScreenDisabled(orig_OnDisable orig, PauseScreenController self)
		{
			orig.Invoke(self);
			isPaused = false;
			if (!GamePauseManager.IsPausedByUs && Object.op_Implicit((Object)(object)canvasObject))
			{
				canvasObject.SetActive(true);
			}
		}

		private HGTextMeshProUGUI MakeLabel(Transform parent, string text, float fontSize, Color color, TextAlignmentOptions alignment = 514, bool wordWrap = false)
		{
			//IL_0005: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Label");
			val.transform.SetParent(parent, false);
			HGTextMeshProUGUI val2 = val.AddComponent<HGTextMeshProUGUI>();
			if (Object.op_Implicit((Object)(object)ror2Font))
			{
				((TMP_Text)val2).font = ror2Font;
			}
			((TMP_Text)val2).text = text;
			((TMP_Text)val2).fontSize = fontSize;
			((Graphic)val2).color = color;
			((TMP_Text)val2).alignment = alignment;
			((TMP_Text)val2).enableWordWrapping = wordWrap;
			return val2;
		}

		private Image MakePanel(Transform parent, Color color, bool sliced = true)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			Image val = ((Component)parent).gameObject.AddComponent<Image>();
			if (Object.op_Implicit((Object)(object)panelSprite))
			{
				val.sprite = panelSprite;
				val.type = (Type)(sliced ? 1 : 0);
			}
			((Graphic)val).color = color;
			return val;
		}

		private Color GetTierColor(ItemDef itemDef)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)itemDef == (Object)null)
			{
				return Color.white;
			}
			ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier);
			if ((Object)(object)itemTierDef == (Object)null)
			{
				return Color.white;
			}
			return Color32.op_Implicit(ColorCatalog.GetColor(itemTierDef.colorIndex));
		}

		private void BuildUI()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Expected O, but got Unknown
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			canvasObject = new GameObject("LevelUpCanvas");
			Object.DontDestroyOnLoad((Object)(object)canvasObject);
			Canvas obj = canvasObject.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 100;
			CanvasScaler obj2 = canvasObject.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.screenMatchMode = (ScreenMatchMode)0;
			obj2.matchWidthOrHeight = 0.5f;
			canvasObject.AddComponent<GraphicRaycaster>();
			canvasObject.AddComponent<MPEventSystemProvider>().fallBackToMainEventSystem = true;
			canvasObject.AddComponent<MPEventSystemLocator>();
			containerObject = new GameObject("Container");
			containerObject.transform.SetParent(canvasObject.transform, false);
			RectTransform obj3 = containerObject.AddComponent<RectTransform>();
			obj3.anchorMin = new Vector2(0.5f, 0.5f);
			obj3.anchorMax = new Vector2(0.5f, 0.5f);
			obj3.pivot = new Vector2(0.5f, 0.5f);
			obj3.sizeDelta = new Vector2(1560f, 0f);
			obj3.anchoredPosition = Vector2.zero;
			containerObject.AddComponent<CursorOpener>();
			MakePanel(containerObject.transform, new Color(0.04f, 0.04f, 0.06f, 0.97f));
			VerticalLayoutGroup obj4 = containerObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj4).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj4).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj4).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj4).spacing = 4f;
			((LayoutGroup)obj4).padding = new RectOffset(12, 12, 10, 10);
			containerObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			GameObject val = new GameObject("TitleBar");
			val.transform.SetParent(containerObject.transform, false);
			((Graphic)val.AddComponent<Image>()).color = new Color(1f, 0.82f, 0.18f, 0.12f);
			val.AddComponent<LayoutElement>().preferredHeight = 36f;
			RectTransform component = ((Component)MakeLabel(val.transform, "CHOOSE AN ITEM", 32f, new Color(1f, 0.88f, 0.35f), (TextAlignmentOptions)514)).GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			GameObject val2 = new GameObject("TokenHeader");
			val2.transform.SetParent(containerObject.transform, false);
			val2.AddComponent<LayoutElement>().preferredHeight = 24f;
			tokenHeader = MakeLabel(val2.transform, "Loading...", 24f, new Color(0.75f, 0.88f, 1f), (TextAlignmentOptions)514);
			RectTransform component2 = ((Component)tokenHeader).GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			GameObject val3 = new GameObject("ItemRow");
			val3.transform.SetParent(containerObject.transform, false);
			HorizontalLayoutGroup obj5 = val3.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj5).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj5).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj5).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj5).childForceExpandHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj5).spacing = 16f;
			val3.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			containerObject.SetActive(false);
			notificationPanel = new GameObject("NotificationPanel");
			notificationPanel.transform.SetParent(canvasObject.transform, false);
			RectTransform obj6 = notificationPanel.AddComponent<RectTransform>();
			obj6.anchorMin = new Vector2(0.5f, 0f);
			obj6.anchorMax = new Vector2(0.5f, 0f);
			obj6.pivot = new Vector2(0.5f, 0f);
			obj6.anchoredPosition = new Vector2(0f, 24f);
			obj6.sizeDelta = new Vector2(260f, 62f);
			Image val4 = notificationPanel.AddComponent<Image>();
			if (Object.op_Implicit((Object)(object)panelSprite))
			{
				val4.sprite = panelSprite;
				val4.type = (Type)1;
			}
			((Graphic)val4).color = new Color(0.9f, 0.68f, 0.08f, 0.88f);
			GameObject val5 = new GameObject("Accent");
			val5.transform.SetParent(notificationPanel.transform, false);
			RectTransform obj7 = val5.AddComponent<RectTransform>();
			obj7.anchorMin = new Vector2(0f, 1f);
			obj7.anchorMax = new Vector2(1f, 1f);
			obj7.offsetMin = new Vector2(0f, -5f);
			obj7.offsetMax = new Vector2(0f, 0f);
			((Graphic)val5.AddComponent<Image>()).color = new Color(1f, 0.88f, 0.18f, 1f);
			notificationText = MakeLabel(notificationPanel.transform, "LEVEL UP!\nPress F3", 18f, Color.white, (TextAlignmentOptions)514);
			RectTransform component3 = ((Component)notificationText).GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = Vector2.one;
			notificationPanel.SetActive(false);
		}

		public void UpdateTokens()
		{
			if (Object.op_Implicit((Object)(object)tokenHeader))
			{
				((TMP_Text)tokenHeader).text = $"<color=#FFE066>SELECT</color>  {LevelUpManager.Instance.AvailableTokens}   " + $"<color=#FF6060>BANISH</color>  {LevelUpManager.Instance.BanishTokens}   " + $"<color=#60AAFF>REROLL</color>  {LevelUpManager.Instance.RerollTokens}";
			}
		}

		public void ShowChoices(List<PickupIndex> pickupIndices)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!IsVisible)
			{
				IsVisible = true;
				float value = ModConfig.UIScale.Value;
				((Transform)containerObject.GetComponent<RectTransform>()).localScale = new Vector3(value, value, 1f);
				if (Object.op_Implicit((Object)(object)canvasObject) && !canvasObject.activeSelf)
				{
					canvasObject.SetActive(true);
				}
				containerObject.SetActive(true);
				UpdateTokens();
				UpdateOptions(pickupIndices);
				GamePauseManager.Pause();
			}
		}

		public void UpdateOptions(List<PickupIndex> pickupIndices)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Expected O, but got Unknown
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Expected O, but got Unknown
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4->IL03d4: Incompatible stack types: O vs I4
			//IL_03cd->IL03d4: Incompatible stack types: I4 vs O
			//IL_03cd->IL03d4: Incompatible stack types: O vs I4
			Transform val = containerObject.transform.Find("ItemRow");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			for (int num = val.childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)val.GetChild(num)).gameObject);
			}
			buttonObjects.Clear();
			for (int i = 0; i < pickupIndices.Count; i++)
			{
				int slotIndex = i;
				PickupIndex pickupIndex = pickupIndices[i];
				PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
				ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)));
				Color tierColor = GetTierColor(itemDef);
				GameObject val2 = new GameObject($"Card_{i}");
				val2.transform.SetParent(val, false);
				Image val3 = val2.AddComponent<Image>();
				if (Object.op_Implicit((Object)(object)panelSprite))
				{
					val3.sprite = panelSprite;
					val3.type = (Type)1;
				}
				((Graphic)val3).color = new Color(0.08f, 0.08f, 0.12f, 0.96f);
				Button obj = val2.AddComponent<Button>();
				((Selectable)obj).targetGraphic = (Graphic)(object)val3;
				ColorBlock colors = ((Selectable)obj).colors;
				((ColorBlock)(ref colors)).normalColor = Color.white;
				((ColorBlock)(ref colors)).highlightedColor = new Color(1.25f, 1.25f, 1.25f, 1f);
				((ColorBlock)(ref colors)).pressedColor = new Color(0.75f, 0.75f, 0.75f, 1f);
				((ColorBlock)(ref colors)).fadeDuration = 0.1f;
				((Selectable)obj).colors = colors;
				((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					OnItemClicked(pickupIndex);
				});
				LayoutElement obj2 = val2.AddComponent<LayoutElement>();
				obj2.preferredWidth = 0f;
				obj2.flexibleWidth = 1f;
				VerticalLayoutGroup obj3 = val2.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)obj3).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj3).spacing = 6f;
				((LayoutGroup)obj3).padding = new RectOffset(8, 8, 10, 56);
				GameObject val4 = new GameObject("TierBorder");
				val4.transform.SetParent(val2.transform, false);
				RectTransform obj4 = val4.AddComponent<RectTransform>();
				obj4.anchorMin = new Vector2(0f, 1f);
				obj4.anchorMax = Vector2.one;
				obj4.offsetMin = new Vector2(0f, -4f);
				obj4.offsetMax = Vector2.zero;
				val4.AddComponent<LayoutElement>().ignoreLayout = true;
				((Graphic)val4.AddComponent<Image>()).color = tierColor;
				GameObject val5 = new GameObject("Icon");
				val5.transform.SetParent(val2.transform, false);
				LayoutElement obj5 = val5.AddComponent<LayoutElement>();
				obj5.minHeight = 96f;
				obj5.preferredHeight = 96f;
				obj5.flexibleHeight = 0f;
				((Graphic)val5.AddComponent<Image>()).color = new Color(tierColor.r, tierColor.g, tierColor.b, 0.18f);
				GameObject val6 = new GameObject("IconSprite");
				val6.transform.SetParent(val5.transform, false);
				RectTransform obj6 = val6.AddComponent<RectTransform>();
				obj6.anchorMin = new Vector2(0.1f, 0.1f);
				obj6.anchorMax = new Vector2(0.9f, 0.9f);
				obj6.offsetMin = Vector2.zero;
				obj6.offsetMax = Vector2.zero;
				Image val7 = val6.AddComponent<Image>();
				((Graphic)val7).color = Color.white;
				val7.preserveAspect = true;
				if ((Object)(object)pickupDef?.iconSprite != (Object)null)
				{
					val7.sprite = pickupDef.iconSprite;
				}
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				CharacterMaster val8 = ((firstLocalUser != null) ? firstLocalUser.cachedMaster : null);
				int? obj7;
				if (val8 == null)
				{
					obj7 = null;
				}
				else
				{
					object obj8 = val8.inventory;
					if (obj8 == null)
					{
						obj7 = null;
					}
					else
					{
						int num2;
						if (itemDef != null)
						{
							obj8 = itemDef.itemIndex;
							num2 = (int)obj8;
						}
						else
						{
							num2 = -1;
							obj8 = num2;
							num2 = (int)obj8;
						}
						obj7 = ((Inventory)num2).GetItemCountEffective((ItemIndex)obj8);
					}
				}
				int? num3 = obj7;
				int valueOrDefault = num3.GetValueOrDefault();
				GameObject val9 = new GameObject("NameSpacer");
				val9.transform.SetParent(val2.transform, false);
				LayoutElement obj9 = val9.AddComponent<LayoutElement>();
				obj9.minHeight = 1f;
				obj9.preferredHeight = 1f;
				obj9.flexibleHeight = 0f;
				string text = (((Object)(object)itemDef != (Object)null) ? Language.GetString(itemDef.nameToken) : "Unknown");
				text += ((valueOrDefault > 0) ? $"  <color=#60C060>({valueOrDefault})</color>" : "");
				HGTextMeshProUGUI obj10 = MakeLabel(val2.transform, text, 24f, tierColor, (TextAlignmentOptions)514, wordWrap: true);
				((TMP_Text)obj10).fontStyle = (FontStyles)1;
				((Component)obj10).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
				if (ModConfig.ShowItemDescriptions.Value)
				{
					string text2 = ((!((Object)(object)itemDef != (Object)null)) ? "" : (Integrations.lookingGlassEnabled ? LookingGlassIntegration.GetItemDescription(itemDef, valueOrDefault, val8, withOneMore: true) : Language.GetString(itemDef.pickupToken)));
					((Component)MakeLabel(val2.transform, text2, 18f, new Color(0.72f, 0.72f, 0.78f), (TextAlignmentOptions)514, wordWrap: true)).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
				}
				GameObject val10 = new GameObject("FlexSpacer");
				val10.transform.SetParent(val2.transform, false);
				LayoutElement obj11 = val10.AddComponent<LayoutElement>();
				obj11.minHeight = 1f;
				obj11.preferredHeight = 1f;
				obj11.flexibleHeight = 1f;
				BuildAbsoluteButton(val2.transform, "BANISH", new Vector2(0f, 0f), new Vector2(0.5f, 0f), new Vector2(8f, 8f), new Vector2(-4f, 48f), new Color(0.5f, 0.07f, 0.07f, 0.95f), new Color(0.9f, 0.22f, 0.22f, 1f), (UnityAction)delegate
				{
					OnBanishClicked(slotIndex);
				});
				BuildAbsoluteButton(val2.transform, "REROLL", new Vector2(0.5f, 0f), new Vector2(1f, 0f), new Vector2(4f, 8f), new Vector2(-8f, 48f), new Color(0.06f, 0.16f, 0.42f, 0.95f), new Color(0.28f, 0.54f, 1f, 1f), (UnityAction)delegate
				{
					OnRerollClicked(slotIndex);
				});
				buttonObjects.Add(val2);
			}
			Transform val11 = containerObject.transform.Find("ItemRow");
			if (Object.op_Implicit((Object)(object)val11))
			{
				foreach (Transform item in val11)
				{
					LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)item).GetComponent<RectTransform>());
				}
				LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)val11).GetComponent<RectTransform>());
			}
			LayoutRebuilder.ForceRebuildLayoutImmediate(containerObject.GetComponent<RectTransform>());
		}

		private void BuildAbsoluteButton(Transform parent, string label, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax, Color bgColor, Color accentColor, UnityAction callback)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(label + "Btn");
			val.transform.SetParent(parent, false);
			val.AddComponent<LayoutElement>().ignoreLayout = true;
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = anchorMin;
			component.anchorMax = anchorMax;
			component.offsetMin = offsetMin;
			component.offsetMax = offsetMax;
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = bgColor;
			GameObject val3 = new GameObject("Accent");
			val3.transform.SetParent(val.transform, false);
			val3.AddComponent<LayoutElement>().ignoreLayout = true;
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.offsetMin = new Vector2(0f, -4f);
			component2.offsetMax = new Vector2(0f, 0f);
			((Graphic)val3.AddComponent<Image>()).color = accentColor;
			Button obj = val.AddComponent<Button>();
			ColorBlock colors = ((Selectable)obj).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).highlightedColor = new Color(0.7f, 0.7f, 0.7f, 1f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.5f, 0.5f, 0.5f, 1f);
			((ColorBlock)(ref colors)).selectedColor = Color.white;
			((ColorBlock)(ref colors)).fadeDuration = 0.12f;
			((Selectable)obj).colors = colors;
			((Selectable)obj).targetGraphic = (Graphic)(object)val2;
			((UnityEvent)obj.onClick).AddListener(callback);
			HGTextMeshProUGUI obj2 = MakeLabel(val.transform, label, 18f, Color.white, (TextAlignmentOptions)514);
			((TMP_Text)obj2).fontStyle = (FontStyles)1;
			RectTransform component3 = ((Component)obj2).GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = Vector2.one;
			component3.offsetMin = new Vector2(0f, 4f);
			component3.offsetMax = new Vector2(0f, -4f);
		}

		public void Hide()
		{
			if (IsVisible)
			{
				IsVisible = false;
				GamePauseManager.Unpause();
				((MonoBehaviour)this).StartCoroutine(HideNextFrame());
			}
		}

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

		public void ShowNotification()
		{
			if (ModConfig.EnableNotifications.Value)
			{
				notificationPanel.SetActive(true);
				UpdateNotificationText();
			}
		}

		private void UpdateNotificationText()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			int availableTokens = LevelUpManager.Instance.AvailableTokens;
			KeyboardShortcut value = ModConfig.ToggleMenuKey.Value;
			KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			string arg = ((object)(KeyCode)(ref mainKey)).ToString();
			string arg2 = ((availableTokens == 1) ? "TOKEN" : "TOKENS");
			((TMP_Text)notificationText).text = $"{availableTokens} UNUSED {arg2}\nPRESS {arg}";
		}

		private void Update()
		{
			bool flag = ModConfig.EnableNotifications.Value && LevelUpManager.Instance.AvailableTokens > 0 && !IsVisible && !isPaused;
			if (notificationPanel.activeSelf != flag)
			{
				notificationPanel.SetActive(flag);
			}
			if (flag)
			{
				UpdateNotificationText();
			}
		}

		private void OnItemClicked(PickupIndex pickupIndex)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			if (Time.unscaledTime - lastClickTime < 0.15f)
			{
				return;
			}
			lastClickTime = Time.unscaledTime;
			if (LevelUpManager.Instance.SpendTokenLocal())
			{
				NetworkInstanceId netId = ((NetworkBehaviour)NetworkUser.readOnlyLocalPlayersList[0]).netId;
				if (NetworkServer.active)
				{
					LevelUpManager.Instance.HandlePlayerSelection(netId, pickupIndex);
				}
				else
				{
					NetMessageExtensions.Send((INetMessage)(object)new Networking.SendItemSelection(pickupIndex, netId), (NetworkDestination)2);
				}
			}
		}

		private void OnBanishClicked(int slotIndex)
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (LevelUpManager.Instance.BanishTokens > 0)
			{
				NetworkInstanceId netId = ((NetworkBehaviour)NetworkUser.readOnlyLocalPlayersList[0]).netId;
				if (NetworkServer.active)
				{
					LevelUpManager.Instance.HandlePlayerBanish(netId, slotIndex);
				}
				else
				{
					NetMessageExtensions.Send((INetMessage)(object)new Networking.SendBanish(slotIndex, netId), (NetworkDestination)2);
				}
			}
		}

		private void OnRerollClicked(int slotIndex)
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (LevelUpManager.Instance.RerollTokens > 0)
			{
				NetworkInstanceId netId = ((NetworkBehaviour)NetworkUser.readOnlyLocalPlayersList[0]).netId;
				if (NetworkServer.active)
				{
					LevelUpManager.Instance.HandlePlayerReroll(netId, slotIndex);
				}
				else
				{
					NetMessageExtensions.Send((INetMessage)(object)new Networking.SendReroll(slotIndex, netId), (NetworkDestination)2);
				}
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data, [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "")
		{
			_logSource.LogDebug((object)FormatLog(data, filePath, memberName));
		}

		internal static void Error(object data, [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "")
		{
			_logSource.LogError((object)FormatLog(data, filePath, memberName));
		}

		internal static void Fatal(object data, [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "")
		{
			_logSource.LogFatal((object)FormatLog(data, filePath, memberName));
		}

		internal static void Info(object data, [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "")
		{
			_logSource.LogInfo((object)FormatLog(data, filePath, memberName));
		}

		internal static void Message(object data, [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "")
		{
			_logSource.LogMessage((object)FormatLog(data, filePath, memberName));
		}

		internal static void Warning(object data, [CallerFilePath] string filePath = "", [CallerMemberName] string memberName = "")
		{
			_logSource.LogWarning((object)FormatLog(data, filePath, memberName));
		}

		private static string FormatLog(object data, string filePath, string memberName)
		{
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath);
			string text = data?.ToString() ?? "null";
			string text2 = fileNameWithoutExtension + "." + memberName + "()";
			if (text.StartsWith(text2))
			{
				string text3 = text;
				int length = text2.Length;
				text = text3.Substring(length, text3.Length - length).TrimStart(':', '-', ' ');
			}
			else if (text.StartsWith(fileNameWithoutExtension + "." + memberName))
			{
				string text3 = text;
				int length = (fileNameWithoutExtension + "." + memberName).Length;
				text = text3.Substring(length, text3.Length - length).TrimStart('(', ')', ':', '-', ' ');
			}
			return fileNameWithoutExtension + "." + memberName + "() - " + text;
		}
	}
	public static class ModConfig
	{
		public static ConfigEntry<bool> ModEnabled;

		public static ConfigEntry<bool> PauseOnItemSelect;

		public static ConfigEntry<int> DebugPassword;

		public static ConfigEntry<KeyboardShortcut> ToggleMenuKey;

		public static ConfigEntry<float> UIScale;

		public static ConfigEntry<bool> ShowItemDescriptions;

		public static ConfigEntry<bool> EnableNotifications;

		public static ConfigEntry<bool> EnableInteractableRemoval;

		public static ConfigEntry<int> ItemChoiceCount;

		public static ConfigEntry<float> ExperienceStartMultiplier;

		public static ConfigEntry<float> ExperienceGrowthRate;

		public static ConfigEntry<int> LevelsPerBanishToken;

		public static ConfigEntry<int> StartingBanishTokens;

		public static ConfigEntry<int> StartingRerollTokens;

		public static ConfigEntry<bool> RerollTokenRefreshOnPick;

		public static ConfigEntry<float> EarlyWeightTier1;

		public static ConfigEntry<float> EarlyWeightTier2;

		public static ConfigEntry<float> EarlyWeightTier3;

		public static ConfigEntry<float> EarlyWeightLunar;

		public static ConfigEntry<float> EarlyWeightBoss;

		public static ConfigEntry<float> LateWeightTier1;

		public static ConfigEntry<float> LateWeightTier2;

		public static ConfigEntry<float> LateWeightTier3;

		public static ConfigEntry<float> LateWeightLunar;

		public static ConfigEntry<float> LateWeightBoss;

		public static void Init(ConfigFile config, PluginInfo pluginInfo)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Expected O, but got Unknown
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			ModEnabled = config.Bind<bool>("Shared", "Mod Enabled", true, "Master toggle – when disabled the mod does nothing.");
			PauseOnItemSelect = config.Bind<bool>("Shared", "Pause On Item Select", true, "Pause the game while the item selection UI is open. In singleplayer, pauses directly. In multiplayer, uses the built-in pause system (requires host with multiplayer pause enabled).");
			DebugPassword = config.Bind<int>("Shared", "Debug Password", 1, "This is only to be used by the developer for debugging the game.");
			ToggleMenuKey = config.Bind<KeyboardShortcut>("Client", "Toggle Menu Key", new KeyboardShortcut((KeyCode)284, Array.Empty<KeyCode>()), "Key to open / close the level-up item selection menu.");
			UIScale = config.Bind<float>("Client", "UI Scale", 1f, "Scale multiplier for the level-up selection UI (0.5 = half size, 2.0 = double).");
			ShowItemDescriptions = config.Bind<bool>("Client", "Show Item Descriptions", true, "Display the pickup description text under each item card.");
			EnableNotifications = config.Bind<bool>("Client", "Enable Notifications", true, "Shows the notification badge when item selection is available.");
			EnableInteractableRemoval = config.Bind<bool>("Server", "Remove Chests & Interactables", true, "Remove chests, printers, shrines and other item-giving interactables from stages.");
			ItemChoiceCount = config.Bind<int>("Server", "Item Choices", 3, "Number of item choices presented on each level up.");
			ExperienceStartMultiplier = config.Bind<float>("Server", "XP Start Multiplier", 1.69f, "Experience multiplier applied at level 1.");
			ExperienceGrowthRate = config.Bind<float>("Server", "XP Growth Rate", 1.169f, "Multiplier compounded per level (effective mult = Start * Growth^(level-1)).");
			LevelsPerBanishToken = config.Bind<int>("Server", "Levels Per Banish Token", 10, "Every N levels the player gains an extra banish token.");
			StartingBanishTokens = config.Bind<int>("Server", "Starting Banish Tokens", 1, "Banish tokens each player starts with at the beginning of a run.");
			StartingRerollTokens = config.Bind<int>("Server", "Starting Reroll Tokens", 1, "Reroll tokens each player starts with at the beginning of a run.");
			RerollTokenRefreshOnPick = config.Bind<bool>("Server", "Reroll Token Refresh On Pick", true, "When enabled, the player's reroll token is restored to 1 after picking an item.");
			EarlyWeightTier1 = config.Bind<float>("Server", "Early Weight – Common", 79f, "Category weight for Common (Tier 1) items at 0 tokens used.");
			EarlyWeightTier2 = config.Bind<float>("Server", "Early Weight – Uncommon", 15f, "Category weight for Uncommon (Tier 2) items at 0 tokens used.");
			EarlyWeightTier3 = config.Bind<float>("Server", "Early Weight – Legendary", 4f, "Category weight for Legendary (Tier 3) items at 0 tokens used.");
			EarlyWeightLunar = config.Bind<float>("Server", "Early Weight – Lunar", 1f, "Category weight for Lunar items at 0 tokens used.");
			EarlyWeightBoss = config.Bind<float>("Server", "Early Weight – Boss", 1f, "Category weight for Boss items at 0 tokens used.");
			LateWeightTier1 = config.Bind<float>("Server", "Late Weight – Common", 20f, "Category weight for Common (Tier 1) items at 30+ tokens used.");
			LateWeightTier2 = config.Bind<float>("Server", "Late Weight – Uncommon", 41f, "Category weight for Uncommon (Tier 2) items at 30+ tokens used.");
			LateWeightTier3 = config.Bind<float>("Server", "Late Weight – Legendary", 21f, "Category weight for Legendary (Tier 3) items at 30+ tokens used.");
			LateWeightLunar = config.Bind<float>("Server", "Late Weight – Lunar", 10f, "Category weight for Lunar items at 30+ tokens used.");
			LateWeightBoss = config.Bind<float>("Server", "Late Weight – Boss", 8f, "Category weight for Boss items at 30+ tokens used.");
			ModSettingsManager.SetModDescription("Level Up Choices – pick items when your team levels up.");
			try
			{
				string[] files = Directory.GetFiles(Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "icons"));
				if (files.Length != 0)
				{
					byte[] array = File.ReadAllBytes(files[0]);
					Texture2D val = new Texture2D(256, 256, (TextureFormat)5, false, false);
					ImageConversion.LoadImage(val, array);
					((Texture)val).filterMode = (FilterMode)0;
					ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 1u, (SpriteMeshType)1, Vector4.zero, true));
				}
			}
			catch (Exception ex)
			{
				Log.Warning("Failed to load mod icon: " + ex.Message, "C:\\Users\\erenk\\OneDrive\\Desktop\\R2Boilerplate-master\\src\\ModConfig.cs", "Init");
			}
			RegisterSharedOptions();
			RegisterClientOptions();
			RegisterServerOptions();
		}

		private static void RegisterSharedOptions()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//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)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ModEnabled));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PauseOnItemSelect));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(DebugPassword, new IntSliderConfig
			{
				min = 1,
				max = 9999
			}));
		}

		private static void RegisterClientOptions()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(ToggleMenuKey));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(UIScale, new StepSliderConfig
			{
				min = 0.5f,
				max = 2f,
				increment = 0.1f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowItemDescriptions));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableNotifications));
		}

		private static void RegisterServerOptions()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00c4: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Expected O, but got Unknown
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Expected O, but got Unknown
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: 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)
			//IL_02b3: Expected O, but got Unknown
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableInteractableRemoval));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ItemChoiceCount, new IntSliderConfig
			{
				min = 1,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(ExperienceStartMultiplier, new StepSliderConfig
			{
				min = 0.5f,
				max = 5f,
				increment = 0.01f
			}));
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(ExperienceGrowthRate, new StepSliderConfig
			{
				min = 1f,
				max = 2f,
				increment = 0.001f
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(LevelsPerBanishToken, new IntSliderConfig
			{
				min = 1,
				max = 50
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(StartingBanishTokens, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(StartingRerollTokens, new IntSliderConfig
			{
				min = 0,
				max = 10
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RerollTokenRefreshOnPick));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(EarlyWeightTier1, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(EarlyWeightTier2, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(EarlyWeightTier3, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(EarlyWeightLunar, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(EarlyWeightBoss, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(LateWeightTier1, new SliderConfig
			{
				min = 0f,
				max = 100f
			}));
			ModSettingsManager.AddOption((BaseOption)new SliderOption(LateWeightTier2, ne