Decompiled source of LevelScaling v1.1.0

LevelScaling.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LevelScaling.LevelStats;
using LevelScaling.Menu;
using LevelScaling.Patches;
using MenuLib;
using MenuLib.MonoBehaviors;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LevelScaling")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LevelScaling")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("94187d6e-952a-4336-b083-0210fe153e6f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LevelScaling
{
	public class ChallengeManager
	{
		public enum ChallengeType
		{
			None,
			LightsOut,
			HighQuota,
			LargeMap,
			EnemyRush,
			FragileValuables,
			IncreasedDamage,
			HiddenInformation,
			FoggyLevel,
			TimeAttack,
			OverOvercharge,
			NoMap,
			DangerZone,
			SharedDurability
		}

		public class Challenge
		{
			public ChallengeType type;

			public string name;

			public string info;

			public int Weight => type switch
			{
				ChallengeType.LightsOut => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_LightsOut), 
				ChallengeType.HighQuota => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_HighQuota), 
				ChallengeType.LargeMap => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_LargeMap), 
				ChallengeType.FoggyLevel => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_FoggyLevel), 
				ChallengeType.IncreasedDamage => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_IncreasedDamage), 
				ChallengeType.FragileValuables => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_FragileValuables), 
				ChallengeType.OverOvercharge => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_OverOvercharge), 
				ChallengeType.NoMap => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_NoMap), 
				ChallengeType.EnemyRush => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_EnemyRush), 
				ChallengeType.HiddenInformation => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_HiddenInformation), 
				ChallengeType.DangerZone => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_DangerZone), 
				ChallengeType.SharedDurability => Helpers.GetConfig<int>(Plugin.ChallengeChanceMultiplier_SharedDurability), 
				_ => 0, 
			};

			public int StartingLevel => type switch
			{
				ChallengeType.LightsOut => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_LightsOut), 
				ChallengeType.HighQuota => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_HighQuota), 
				ChallengeType.LargeMap => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_LargeMap), 
				ChallengeType.FoggyLevel => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_FoggyLevel), 
				ChallengeType.IncreasedDamage => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_IncreasedDamage), 
				ChallengeType.FragileValuables => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_FragileValuables), 
				ChallengeType.OverOvercharge => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_OverOvercharge), 
				ChallengeType.NoMap => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_NoMap), 
				ChallengeType.EnemyRush => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_EnemyRush), 
				ChallengeType.HiddenInformation => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_HiddenInformation), 
				ChallengeType.DangerZone => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_DangerZone), 
				ChallengeType.SharedDurability => Helpers.GetConfig<int>(Plugin.ChallengeStartingLevel_SharedDurability), 
				_ => 0, 
			};

			public Challenge(ChallengeType type, string name, string info)
			{
				this.type = type;
				this.name = name;
				this.info = info;
			}
		}

		public static List<ChallengeType> currentChallenges = new List<ChallengeType>();

		public static List<ChallengeType> _blacklistedChallenges = new List<ChallengeType>();

		public static ChallengeType forceChallenge = ChallengeType.None;

		public static Dictionary<string, int> challengesDofD = new Dictionary<string, int>
		{
			{ "currentSeed", 1 },
			{ "lastChallengeLevel", -1 },
			{ "lastChallengeType", -1 }
		};

		public static readonly List<Challenge> allChallenges = new List<Challenge>
		{
			new Challenge(ChallengeType.LightsOut, "Lights Out", "The level's lights have stopped working,<br>you'll be stuck in the dark."),
			new Challenge(ChallengeType.HighQuota, "Overtime", "Taxman is requiring extra effort for this level.<br>Your quotas will be significantly higher."),
			new Challenge(ChallengeType.LargeMap, "Enlarged Level", "This level's layout is much larger than normal.<br>Remember to use your map."),
			new Challenge(ChallengeType.FoggyLevel, "Dense Fog", "There's lots of heavy fog on this level.<br>Visibility will be low, tread carefully."),
			new Challenge(ChallengeType.IncreasedDamage, "Increased Damage", "All incoming damage for both Semibots and enemies<br>will be greatly increased. Be careful."),
			new Challenge(ChallengeType.FragileValuables, "Fragile Valuables", "All valuables are very fragile, regardless of how they<br>look on the outside. Each valuable will be priced higher."),
			new Challenge(ChallengeType.OverOvercharge, "Over-Overcharge", "Overcharge will build up from holding valuables too.<br>Pay close attention and don't explode yourself."),
			new Challenge(ChallengeType.NoMap, "Broken Map", "Your map is disabled, however Semibots will naturally<br>regenerate health slowly; up to the health they started the level with."),
			new Challenge(ChallengeType.EnemyRush, "Enemy Rush", "There are many more enemies than usual on this level,<br>but enemies are lighter, and have significantly reduced health."),
			new Challenge(ChallengeType.HiddenInformation, "Hidden Information", "This level's size and length are randomized, and some important<br>information will be obstructed for the duration of the level."),
			new Challenge(ChallengeType.DangerZone, "Danger Zone", "Semibots will take damage over time, gradually speeding up the longer<br>you spend on the level. Damaging enemies heals all Semibots."),
			new Challenge(ChallengeType.SharedDurability, "Shared Durability", "A portion of damage valuables take is instead given to Semibots. More value<br>lost, more damage given. Extractions will heal Semibots based on value extracted.")
		};

		public static int CurrentSeed
		{
			get
			{
				if (!challengesDofD.ContainsKey("currentSeed"))
				{
					challengesDofD.Add("currentSeed", 1);
				}
				return challengesDofD["currentSeed"];
			}
			set
			{
				if (!challengesDofD.ContainsKey("currentSeed"))
				{
					challengesDofD.Add("currentSeed", value);
				}
				else
				{
					challengesDofD["currentSeed"] = value;
				}
			}
		}

		public static int LastChallengeLevel
		{
			get
			{
				if (!challengesDofD.ContainsKey("lastChallengeLevel"))
				{
					challengesDofD.Add("lastChallengeLevel", -1);
				}
				return challengesDofD["lastChallengeLevel"];
			}
			set
			{
				if (!challengesDofD.ContainsKey("lastChallengeLevel"))
				{
					challengesDofD.Add("lastChallengeLevel", value);
				}
				else
				{
					challengesDofD["lastChallengeLevel"] = value;
				}
			}
		}

		public static int LastChallengeType
		{
			get
			{
				if (!challengesDofD.ContainsKey("lastChallengeType"))
				{
					challengesDofD.Add("lastChallengeType", -1);
				}
				return challengesDofD["lastChallengeType"];
			}
			set
			{
				if (!challengesDofD.ContainsKey("lastChallengeType"))
				{
					challengesDofD.Add("lastChallengeType", value);
				}
				else
				{
					challengesDofD["lastChallengeType"] = value;
				}
			}
		}

		public static bool IsChallengeActive(ChallengeType challenge)
		{
			return currentChallenges.Contains(challenge);
		}

		public static Challenge GetChallenge(ChallengeType challenge)
		{
			foreach (Challenge allChallenge in allChallenges)
			{
				if (allChallenge.type == challenge)
				{
					return allChallenge;
				}
			}
			return new Challenge(ChallengeType.None, "????????", "Unknown challenge - can't get any info. Sorry!");
		}

		public static void DetermineChallengeForLevel(int level, int initialSeed)
		{
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer() || Plugin.ClientSideMode || Helpers.GetConfig<float>(Plugin.ChallengeChanceMultiplier) <= 0f)
			{
				return;
			}
			int num = initialSeed + level;
			Random random = new Random(num);
			int num2 = Mathf.Max(0, level - Mathf.Max(1, LastChallengeLevel) - 1);
			float num3 = SwaggiFunc.DetermineChallengeChance(level);
			float num4 = Mathf.Clamp((float)num2 * 4f, 0f, 20f);
			float num5 = num3 + num4;
			if (num2 >= 3 && level >= 10)
			{
				num5 += 5f;
				if (num2 >= 5)
				{
					num5 += 7f;
				}
			}
			if (level >= 5 && LastChallengeLevel == -1)
			{
				num5 += 15f;
				if (level >= 7)
				{
					num5 += 20f;
				}
			}
			num5 *= Helpers.GetConfig<float>(Plugin.ChallengeChanceMultiplier);
			float num6 = (float)random.Next(0, 1000) / 10f;
			bool flag = (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelShop || (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelTutorial || (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelArena || (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobby || (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu;
			bool flag2 = level <= 3 || (level <= 20 && level % 5 == 0 && Helpers.GetConfig<bool>(Plugin.ChallengeDisableMoonPhase));
			bool flag3 = num6 >= num5;
			bool flag4 = LastChallengeLevel == level - 1 && random.Next(0, 100) >= 5;
			bool flag5 = MalfunctionManager.IsMalfunctionActive(MalfunctionManager.MalfunctionType.QuotaDifficulty) || Helpers.GetConfig<bool>(Plugin.ChallengeGuarantee);
			if (Plugin.DeepLog)
			{
				Helpers.DeepLog($"[ChallengeManager] seed: {num}\n" + $"base chance       = {num3:0.0}%\n" + $"consecutive bonus = {num4:0.0}%\n" + $"final chance      = {num5:0.0}%\n" + "---\n" + $"passes chance     = {!flag3} ({num6:0.0} < {num5:0.0}%) ({Helpers.GetConfig<float>(Plugin.ChallengeChanceMultiplier):0.00}x)\n" + $"passes level type = {!flag} ({RunManager.instance.levelCurrent.NarrativeName})\n" + $"passes level num  = {!flag2} ({level})\n" + $"passes last level = {!flag4} ({LastChallengeLevel} == {level - 1})\n");
			}
			if (flag || (!flag5 && forceChallenge == ChallengeType.None && (flag2 || flag3 || flag4)))
			{
				if (GameManager.Multiplayer())
				{
					LevelStatsSyncing instance = LevelStatsSyncing.instance;
					if (instance != null)
					{
						PhotonView photonView = instance.photonView;
						if (photonView != null)
						{
							photonView.RPC("SyncChallengeRPC", (RpcTarget)0, new object[1] { 0 });
						}
					}
				}
				else
				{
					LevelStatsSyncing.instance?.SyncChallengeRPC(0);
				}
				return;
			}
			int num7 = 0;
			int num8 = 0;
			int num9 = 0;
			List<Challenge> list = new List<Challenge>();
			foreach (Challenge allChallenge in allChallenges)
			{
				if ((flag5 || ((Helpers.GetConfig<bool>(Plugin.ChallengeDisableLevelRequirements) || LevelGeneratorPatch.CurrentLevel >= allChallenge.StartingLevel) && allChallenge.type != (ChallengeType)LastChallengeType)) && (allChallenge.type != ChallengeType.OverOvercharge || level >= 10) && !_blacklistedChallenges.Contains(allChallenge.type))
				{
					list.Add(allChallenge);
					num9 += allChallenge.Weight;
				}
			}
			int num10 = random.Next(0, num9);
			foreach (Challenge item in list)
			{
				num8 += item.Weight;
				if (num8 > num10)
				{
					num7 = (int)item.type;
					break;
				}
			}
			if (forceChallenge != 0)
			{
				num7 = (int)forceChallenge;
			}
			forceChallenge = ChallengeType.None;
			LastChallengeLevel = level;
			LastChallengeType = num7;
			if (GameManager.Multiplayer())
			{
				LevelStatsSyncing instance2 = LevelStatsSyncing.instance;
				if (instance2 != null)
				{
					PhotonView photonView2 = instance2.photonView;
					if (photonView2 != null)
					{
						photonView2.RPC("SyncChallengeRPC", (RpcTarget)0, new object[1] { num7 });
					}
				}
			}
			else
			{
				LevelStatsSyncing.instance?.SyncChallengeRPC(num7);
			}
		}

		public static void SetupChallenges(ChallengeType challenge)
		{
			currentChallenges.Clear();
			if (Plugin.DeepLog)
			{
				Helpers.DeepLog($"[ChallengeManager] selected challenge: {challenge}");
			}
			if (challenge != 0)
			{
				currentChallenges.Add(challenge);
			}
		}
	}
	public class Helpers
	{
		public enum RoundingOptions
		{
			Floor,
			Round,
			Ceil
		}

		public static PlayerChatBoxState truckScreenState = (PlayerChatBoxState)0;

		private static readonly Dictionary<int, Color> difficultyColors = new Dictionary<int, Color>
		{
			{
				2147483639,
				new Color(0f, 0f, 0f)
			},
			{
				999,
				new Color(0f, 0f, 0f)
			},
			{
				100,
				new Color(0.2f, 0.2f, 0.2f)
			},
			{
				90,
				new Color(0f, 1f, 0.5f)
			},
			{
				80,
				new Color(0f, 1f, 1f)
			},
			{
				70,
				new Color(0f, 0.5f, 1f)
			},
			{
				60,
				new Color(0f, 0f, 1f)
			},
			{
				50,
				new Color(0.5f, 0f, 1f)
			},
			{
				40,
				new Color(1f, 0f, 1f)
			},
			{
				30,
				new Color(1f, 0f, 0.5f)
			},
			{
				20,
				new Color(1f, 0f, 0f)
			},
			{
				15,
				new Color(1f, 0.5f, 0f)
			},
			{
				10,
				new Color(1f, 1f, 0f)
			},
			{
				5,
				new Color(0.5f, 1f, 0f)
			},
			{
				1,
				new Color(0f, 1f, 0f)
			}
		};

		public static int PlayerCount => GameDirector.instance.PlayerList.Count;

		public static bool TruckStarting => (int)truckScreenState == 3;

		public static bool TruckLeaving
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Invalid comparison between Unknown and I4
				if ((int)truckScreenState != 2)
				{
					return TruckStarting;
				}
				return true;
			}
		}

		public static int CurrentLevel => LevelGeneratorPatch.CurrentLevel;

		public static ExtractionPoint ExtractionPointCurrent => Traverse.Create((object)RoundDirector.instance).Field("extractionPointCurrent").GetValue<ExtractionPoint>();

		public static int ExtractionHaulGoal => Traverse.Create((object)RoundDirector.instance).Field("extractionHaulGoal").GetValue<int>();

		public static bool AllExtractionPointsCompleted => Traverse.Create((object)RoundDirector.instance).Field("allExtractionPointsCompleted").GetValue<bool>();

		public static int Round(float number, RoundingOptions options, int factor = 1)
		{
			switch (options)
			{
			case RoundingOptions.Floor:
				number = Mathf.Floor(number / (float)factor);
				break;
			case RoundingOptions.Round:
				number = Mathf.Round(number / (float)factor);
				break;
			case RoundingOptions.Ceil:
				number = Mathf.Ceil(number / (float)factor);
				break;
			}
			return (int)(number * (float)factor);
		}

		public static int RoundClamp(float number, RoundingOptions options, int min, int max, int factor = 1)
		{
			return Mathf.Clamp(Round(number, options, factor), min, max);
		}

		public static void DebugForceLoadLevel(int level, ChallengeManager.ChallengeType forcedChallenge = ChallengeManager.ChallengeType.None)
		{
			RunManager.instance.levelsCompleted = level - 1;
			ChallengeManager.forceChallenge = forcedChallenge;
			RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)1);
		}

		public static string TimeToString(float seconds)
		{
			seconds = Mathf.Clamp(seconds, 0f, 360000f);
			int num = (int)(seconds * 1000f) % 1000;
			int num2 = (int)seconds % 60;
			int num3 = (int)(seconds / 60f) % 60;
			int num4 = (int)(seconds / 3600f);
			return $"{num4:00}:{num3:00}:{num2:00}<size=75%>.{num:000}</size>";
		}

		public static Color GetDifficultyColor(int level)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0040: 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_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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.black;
			int num = 0;
			foreach (KeyValuePair<int, Color> difficultyColor in difficultyColors)
			{
				if (level >= difficultyColor.Key)
				{
					float num2 = (float)(level - difficultyColor.Key) / (float)(num - difficultyColor.Key);
					return Color.Lerp(difficultyColor.Value, val, num2);
				}
				val = difficultyColor.Value;
				num = difficultyColor.Key;
			}
			return new Color(0f, 0f, 0f);
		}

		public static string ColoredText(string text, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			string text2 = ColorUtility.ToHtmlStringRGB(color);
			return ColoredText(text, "#" + text2);
		}

		public static string ColoredText(string text, string hexColor)
		{
			return "<color=" + hexColor + ">" + text + "</color>";
		}

		public static string PlusMinus(int number)
		{
			if (number < 0)
			{
				return number.ToString();
			}
			if (number > 0)
			{
				return $"+{number}";
			}
			return $"±{number}";
		}

		public static string PlusMinus(float number)
		{
			if (number < 0f)
			{
				return $"{number:0.00}";
			}
			if (number > 0f)
			{
				return $"+{number:0.00}";
			}
			return $"±{number:0.00}";
		}

		public static float RoundTo100(float original)
		{
			return Mathf.Round(original / 100f) * 100f;
		}

		public static void DeepLog(string log)
		{
			if (Plugin.DeepLogging.Value)
			{
				Plugin.loggy.LogDebug((object)log);
			}
		}

		public static float RGDM1(int level)
		{
			return Mathf.Clamp01(((float)level - 1f) / 9f);
		}

		public static float RGDM2(int level)
		{
			return Mathf.Clamp01(((float)level - 10f) / 10f);
		}

		public static float RGDM3(int level)
		{
			return Mathf.Clamp01(((float)level - 20f) / 10f);
		}

		public static T GetConfig<T>(ConfigEntry<T> config)
		{
			return (T)(MalfunctionManager.IsMalfunctionActive() ? ((ConfigEntryBase)config).DefaultValue : ((object)config.Value));
		}

		public static bool AllPlayersDead()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if (!Traverse.Create((object)player).Field("isDisabled").GetValue<bool>())
				{
					return false;
				}
			}
			return true;
		}
	}
	public class MalfunctionManager
	{
		public enum MalfunctionType
		{
			None,
			QuotaDifficulty,
			LowMapValue,
			RandomLevelSize,
			SingleExtraction,
			RandomValuableValue,
			E10_10_10,
			MaxModeEasy,
			MaxMode
		}

		public class Malfunction
		{
			public MalfunctionType type;

			public string name;

			public string[] infoLines;

			public Malfunction(MalfunctionType type, string name, string info)
			{
				this.type = type;
				this.name = name;
				infoLines = info.Split(new char[1] { '/' });
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				_solitude_ShownWarning = byte.MaxValue;
				if ((Object)(object)Helpers.ExtractionPointCurrent == (Object)null)
				{
					return false;
				}
				if (!SemiFunc.IsMasterClientOrSingleplayer() || _solitudeCompletedSequence || _solitudeGameOverSequence)
				{
					return false;
				}
				if (SolitudeQuotaMet)
				{
					if (GameManager.Multiplayer() && SemiFunc.IsMasterClient())
					{
						LevelStatsSyncing instance = LevelStatsSyncing.instance;
						if (instance != null)
						{
							PhotonView photonView = instance.photonView;
							if (photonView != null)
							{
								photonView.RPC("Solitude_CompleteRPC", (RpcTarget)0, Array.Empty<object>());
							}
						}
						return false;
					}
					LevelStatsSyncing.instance?.Solitude_CompleteRPC();
					return false;
				}
				if (GameManager.Multiplayer() && SemiFunc.IsMasterClient())
				{
					LevelStatsSyncing instance2 = LevelStatsSyncing.instance;
					if (instance2 != null)
					{
						PhotonView photonView2 = instance2.photonView;
						if (photonView2 != null)
						{
							photonView2.RPC("Solitude_KillSelfRPC", (RpcTarget)0, Array.Empty<object>());
						}
					}
					return false;
				}
				LevelStatsSyncing.instance?.Solitude_KillSelfRPC();
				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 bool malfunctionSetThisSave = false;

		public static List<MalfunctionType> _whitelistedMalfunctions = new List<MalfunctionType>();

		public static MalfunctionType selectedMalfunction = MalfunctionType.None;

		public static MalfunctionType activeMalfunction = MalfunctionType.None;

		public static readonly Dictionary<MalfunctionType, int> bestMalfunctionLevels = new Dictionary<MalfunctionType, int>();

		public static readonly List<Malfunction> allMalfunctions = new List<Malfunction>
		{
			new Malfunction(MalfunctionType.QuotaDifficulty, "Perfectionist", "• Quota difficulty starts at 0.7/• Difficulty will rise linearly/• Caps at 0.99 at Level 20/• Challenges appear every level"),
			new Malfunction(MalfunctionType.LowMapValue, "Sparsity", "• All maps have 3x less value/• Valuable limit is significantly lower/• Levels are larger/• Levels have less extraction points"),
			new Malfunction(MalfunctionType.RandomLevelSize, "Oscillation", "• Each map is either very tiny or super large/• Map size does not scale with level number/• Map size is determined randomly every level/• +2% walk speed & stamina regen speed per module explored/    *Resets every level"),
			new Malfunction(MalfunctionType.SingleExtraction, "Solitude", "• There is only one extraction point every level/• All maps are 20% smaller/• Valuables in the extraction point will not have gravity/• Quotas have two \"stages\", completing stage 2 will extract immediately/• Extraction will occur automatically after a set time, immediately lose if/if you don't meet the stage 1 quota at the time limit./• Time starts at 5 min, then +5 min at each moon phase/• -1 sec per $500 broken during a level/• -10 sec (permanently) per additional team member (up to -60)/• +15 sec per orb dropped from an enemy/• +5 sec per enemy killed/• Players are auto-revived if there's at least 1:30 on the clock/• -75 sec per player revived"),
			new Malfunction(MalfunctionType.RandomValuableValue, "Arbitrarity", "• Valuable values are randomized/• Small valuables are more likely to be cheap & vice versa/• Each valuable's mass is randomized/• Any valuable size can appear on any level/• Enemy strength breakpoints are randomized"),
			new Malfunction(MalfunctionType.E10_10_10, "Formidable", "• Start with 1 enemy of each tier/• Each level adds 1 enemy of each tier/• Caps at 10 enemies per tier after level 10/• Enemies have half health/• Enemies cannot be grabstunned outside Enemy Rush/• Players take 50% less damage"),
			new Malfunction(MalfunctionType.MaxModeEasy, "Grandmaster", "• All settings are overtuned/• Scaling is linear from level 1 to 100/• Good luck."),
			new Malfunction(MalfunctionType.MaxMode, "Max Mode", "• All settings are maxed out, no exceptions/• Each level is the same, no difficulty scaling/• Not meant to be possible./• Your game might lag.")
		};

		public static Dictionary<PlayerAvatar, float> solitudeDeathTimers = new Dictionary<PlayerAvatar, float>();

		public static int solitudeRevives = 0;

		public static int _lastSolitudeSecondsRemoved = 0;

		public static byte _solitude_ShownWarning = 0;

		public static Coroutine _solitude_timesUpSequence;

		public static bool _solitudeGameOverSequence = false;

		public static bool _solitudeCompletedSequence = false;

		public static float SolitudeTimeLimitSeconds
		{
			get
			{
				int num = GameDirector.instance.PlayerList.Count switch
				{
					1 => 0, 
					2 => -10, 
					3 => -20, 
					4 => -30, 
					5 => -40, 
					_ => -60, 
				};
				float num2 = Mathf.Clamp(Mathf.Floor((float)Helpers.CurrentLevel / 5f) + 1f, 1f, 5f);
				return (300f + (float)num) * num2;
			}
		}

		public static int SolitudeSecondsRemovedBroken => (int)(LevelStatsManager.totalValueBroken / 500f);

		public static int SolitudeSecondsAddedOrbs => LevelStatsManager.enemyKills * 15;

		public static int SolitudeSecondsAddedKills => LevelStatsManager.enemyKillsRaw * 5;

		public static int SolitudeSecondsRemovedRevives => solitudeRevives * 75;

		public static float SolitudeTimeRemainingSeconds => Mathf.Clamp(SolitudeTimeLimitSeconds - LevelStatsManager.thisLevelTime - (float)SolitudeSecondsRemovedBroken - (float)SolitudeSecondsRemovedRevives + (float)SolitudeSecondsAddedOrbs + (float)SolitudeSecondsAddedKills, 0f, 5999f);

		public static int SolitudeRequiredQuota
		{
			get
			{
				float num = Mathf.Lerp(0.25f, 0.7f, Mathf.InverseLerp(1f, 20f, (float)Helpers.CurrentLevel));
				return (int)((float)Helpers.ExtractionHaulGoal * num);
			}
		}

		public static bool SolitudeQuotaMet => Traverse.Create((object)Helpers.ExtractionPointCurrent).Field("haulCurrent").GetValue<int>() >= SolitudeRequiredQuota;

		public static void Setup()
		{
			_whitelistedMalfunctions.Clear();
			_whitelistedMalfunctions.Add(MalfunctionType.RandomValuableValue);
			_whitelistedMalfunctions.Add(MalfunctionType.RandomLevelSize);
			_whitelistedMalfunctions.Add(MalfunctionType.QuotaDifficulty);
			_whitelistedMalfunctions.Add(MalfunctionType.LowMapValue);
			_whitelistedMalfunctions.Add(MalfunctionType.SingleExtraction);
			if (!Plugin.Compatibility_SpawnConfig)
			{
				_whitelistedMalfunctions.Add(MalfunctionType.E10_10_10);
				_whitelistedMalfunctions.Add(MalfunctionType.MaxModeEasy);
				_whitelistedMalfunctions.Add(MalfunctionType.MaxMode);
			}
		}

		public static bool IsMalfunctionActive()
		{
			if (activeMalfunction != 0)
			{
				return SemiFunc.RunIsLevel();
			}
			return false;
		}

		public static bool IsMalfunctionActive(MalfunctionType type)
		{
			if (activeMalfunction == type)
			{
				return SemiFunc.RunIsLevel();
			}
			return false;
		}

		public static Malfunction GetMalfunction(MalfunctionType type)
		{
			foreach (Malfunction allMalfunction in allMalfunctions)
			{
				if (allMalfunction.type == type)
				{
					return allMalfunction;
				}
			}
			return new Malfunction(MalfunctionType.None, "????????", "N/A");
		}

		public static void SelectMalfunction(MalfunctionType type)
		{
			selectedMalfunction = type;
			if (SemiFunc.IsMainMenu())
			{
				SetMalfunction(type);
			}
			else if (SemiFunc.RunIsLobbyMenu() && SemiFunc.IsMasterClientOrSingleplayer())
			{
				SyncMalfunction(type);
			}
		}

		public static void SyncMalfunction()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				SyncMalfunction(activeMalfunction);
			}
		}

		public static void SyncMalfunction(MalfunctionType type)
		{
			//IL_004d: 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)
			if (Plugin.ClientSideMode || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (GameManager.Multiplayer())
			{
				LevelStatsSyncing instance = LevelStatsSyncing.instance;
				if (instance != null)
				{
					instance.photonView.RPC("SyncMalfunctionRPC", (RpcTarget)0, new object[1] { (int)type });
				}
			}
			else
			{
				LevelStatsSyncing.instance?.SyncMalfunctionRPC((int)type);
			}
		}

		public static void SetMalfunction(MalfunctionType type, bool withNotification = false)
		{
			//IL_0091: 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_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)
			if (Plugin.ClientSideMode)
			{
				selectedMalfunction = MalfunctionType.None;
				return;
			}
			if (activeMalfunction != type && withNotification)
			{
				string text = GetMalfunction(type).name.ToUpper();
				if (type == MalfunctionType.None)
				{
					SwaggiFunc.DisplayBigMessage("MALFUNCTION DISABLED", "{!}", 3f, new Color(0.5f, 0.5f, 0.5f), Color.red);
				}
				else
				{
					SwaggiFunc.DisplayBigMessage("<size=36>" + text + "</size>\nMALFUNCTION ACTIVE!", "{!}", 3f, new Color(0.5f, 0f, 1f), Color.red);
				}
			}
			activeMalfunction = type;
		}

		public static void SetMalfunctionBestLevel(MalfunctionType type, int level, bool allowBelow = false)
		{
			if (bestMalfunctionLevels.ContainsKey(type))
			{
				int value = level;
				if (!allowBelow)
				{
					value = Mathf.Max(level, bestMalfunctionLevels[type]);
				}
				bestMalfunctionLevels[type] = value;
			}
			else
			{
				bestMalfunctionLevels.Add(type, level);
			}
		}

		public static int GetMalfunctionBestLevel(MalfunctionType type)
		{
			if (bestMalfunctionLevels.ContainsKey(type))
			{
				return bestMalfunctionLevels[type];
			}
			return 0;
		}

		public static bool IsLevelLargeMap(int level, bool withoutRandomness = false)
		{
			if (withoutRandomness)
			{
				return level % 2 == 0;
			}
			if (level == 1)
			{
				return false;
			}
			return new Random(ChallengeManager.CurrentSeed + 88266 + level).Next(0, 2) == 1;
		}

		public static int Formidable_EnemiesThisLevel(int level)
		{
			return Mathf.Clamp(level, 1, 10);
		}

		public static void Solitude_HandleTimer()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Invalid comparison between Unknown and I4
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Invalid comparison between Unknown and I4
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Invalid comparison between Unknown and I4
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Invalid comparison between Unknown and I4
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Invalid comparison between Unknown and I4
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Invalid comparison between Unknown and I4
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.RunIsLevel() || Plugin.ClientSideMode || !IsMalfunctionActive(MalfunctionType.SingleExtraction))
			{
				return;
			}
			Solitude_HandleDeadPlayers();
			ExtractionPoint extractionPointCurrent = Helpers.ExtractionPointCurrent;
			if ((Object)(object)extractionPointCurrent == (Object)null)
			{
				return;
			}
			State value = Traverse.Create((object)extractionPointCurrent).Field("currentState").GetValue<State>();
			if (SolitudeTimeRemainingSeconds <= 0f && _solitude_ShownWarning < 100)
			{
				Solitude_TimerOut(value);
			}
			if (_solitude_ShownWarning < 100)
			{
				if ((int)value == 2 || (int)value == 3)
				{
					extractionPointCurrent.haulGoal = Mathf.Max(SolitudeRequiredQuota + 1, LevelStatsManager.RemainingTotalMapValue);
				}
				if ((int)value == 4 || (int)value == 6)
				{
					int value2 = Traverse.Create((object)extractionPointCurrent).Field("haulCurrent").GetValue<int>();
					extractionPointCurrent.haulGoal = Mathf.Max(extractionPointCurrent.haulGoal, value2);
					Traverse.Create((object)RoundDirector.instance).Field("extractionHaulGoal").SetValue((object)value2);
				}
			}
			if ((int)value == 6 || (int)value == 9 || (int)value == 7)
			{
				return;
			}
			if (_lastSolitudeSecondsRemoved != SolitudeSecondsRemovedBroken)
			{
				GoalUIPatch.FlashRed();
				_lastSolitudeSecondsRemoved = SolitudeSecondsRemovedBroken;
			}
			int num = Mathf.CeilToInt(SolitudeTimeRemainingSeconds);
			if (SolitudeTimeRemainingSeconds <= 10f && _solitude_ShownWarning < 20 - num)
			{
				if (num == 1)
				{
					SwaggiFunc.DisplayBigMessage($"{num} SECOND LEFT!", "{clock}", 1f, Color.red, Color.yellow);
				}
				else
				{
					SwaggiFunc.DisplayBigMessage($"{num} SECONDS LEFT!", "{clock}", 1f, Color.red, Color.yellow);
				}
				_solitude_ShownWarning = (byte)(20 - num);
			}
			else if (SolitudeTimeRemainingSeconds <= 60f && _solitude_ShownWarning <= 2)
			{
				SwaggiFunc.DisplayBigMessage("1 MINUTE LEFT!", "{clock}", 4f, Color.red, Color.yellow);
				_solitude_ShownWarning = 3;
			}
			else if (SolitudeTimeRemainingSeconds <= 300f && _solitude_ShownWarning <= 1)
			{
				if (SolitudeTimeLimitSeconds > 300f)
				{
					SwaggiFunc.DisplayBigMessage("5 MINUTES LEFT!", "{clock}", 4f, Color.yellow, Color.white);
				}
				_solitude_ShownWarning = 2;
			}
			else if (SolitudeTimeRemainingSeconds <= 600f && _solitude_ShownWarning <= 0)
			{
				if (SolitudeTimeLimitSeconds > 600f)
				{
					SwaggiFunc.DisplayBigMessage("10 MINUTES LEFT!", "{clock}", 4f, Color.yellow, Color.white);
				}
				_solitude_ShownWarning = 1;
			}
		}

		public static void Solitude_TimerOut(State state)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			if (_solitude_ShownWarning >= 100)
			{
				return;
			}
			if ((int)state != 2)
			{
				if ((int)state != 6)
				{
					SwaggiFunc.DisplayBigMessage("EXTRACTION STALLED", "{clock}", 0.2f, Color.red, Color.yellow);
				}
				return;
			}
			_solitude_ShownWarning = 100;
			if (GameManager.Multiplayer() && SemiFunc.IsMasterClient())
			{
				LevelStatsSyncing instance = LevelStatsSyncing.instance;
				if (instance != null)
				{
					PhotonView photonView = instance.photonView;
					if (photonView != null)
					{
						photonView.RPC("Solitude_TimesUpSequenceRPC", (RpcTarget)0, Array.Empty<object>());
					}
				}
			}
			else
			{
				LevelStatsSyncing.instance?.Solitude_TimesUpSequenceRPC();
			}
		}

		[IteratorStateMachine(typeof(<Solitude_TimesUp>d__45))]
		public static IEnumerator Solitude_TimesUp()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Solitude_TimesUp>d__45(0);
		}

		public static void Solitude_KillSelf()
		{
			//IL_000f: 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)
			SwaggiFunc.DisplayBigMessage("NOT ENOUGH VALUABLES,\nTRY HARDER NEXT TIME.", "{!}", 4f, Color.white, Color.red);
			if (!Traverse.Create((object)PlayerAvatar.instance).Field("isDisabled").GetValue<bool>())
			{
				PlayerAvatar.instance.PlayerDeath(-1);
			}
		}

		public static bool Solitude_ShouldRevivePlayer()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			if (Helpers.AllExtractionPointsCompleted)
			{
				return false;
			}
			ExtractionPoint extractionPointCurrent = Helpers.ExtractionPointCurrent;
			if ((Object)(object)extractionPointCurrent != (Object)null)
			{
				if (_solitudeGameOverSequence)
				{
					return false;
				}
				if (_solitudeCompletedSequence)
				{
					return true;
				}
				if ((int)Traverse.Create((object)extractionPointCurrent).Field("currentState").GetValue<State>() != 2)
				{
					return true;
				}
				return SolitudeTimeRemainingSeconds > 90f;
			}
			return false;
		}

		public static void Solitude_RevivePlayer(PlayerAvatar player)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player.playerDeathHead == (Object)null || !Traverse.Create((object)player).Field("isDisabled").GetValue<bool>() || !SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			Helpers.DeepLog("[Solitude] Reviving player!");
			PhysGrabObject value = Traverse.Create((object)player.playerDeathHead).Field("physGrabObject").GetValue<PhysGrabObject>();
			if (solitudeDeathTimers[player] < 40f)
			{
				if (value.playerGrabbing.Count > 0)
				{
					return;
				}
				Vector3 velocity = value.rb.velocity;
				if (((Vector3)(ref velocity)).magnitude > 0.01f)
				{
					return;
				}
			}
			player.Revive(false);
			if (GameManager.Multiplayer() && SemiFunc.IsMasterClient())
			{
				LevelStatsSyncing instance = LevelStatsSyncing.instance;
				if (instance != null)
				{
					PhotonView photonView = instance.photonView;
					if (photonView != null)
					{
						photonView.RPC("Solitude_PlayerRevivedRPC", (RpcTarget)0, Array.Empty<object>());
					}
				}
			}
			else
			{
				LevelStatsSyncing.instance?.Solitude_PlayerRevivedRPC();
			}
		}

		private static void Solitude_HandleDeadPlayers()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if (!Traverse.Create((object)player).Field("isDisabled").GetValue<bool>())
				{
					if (solitudeDeathTimers.ContainsKey(player))
					{
						solitudeDeathTimers.Remove(player);
					}
				}
				else if (!solitudeDeathTimers.ContainsKey(player))
				{
					solitudeDeathTimers.Add(player, 0f);
				}
			}
			foreach (PlayerAvatar item in solitudeDeathTimers.Keys.ToList())
			{
				if (solitudeDeathTimers[item] >= 10f)
				{
					Solitude_RevivePlayer(item);
				}
			}
			if (!Solitude_ShouldRevivePlayer() || Helpers.AllExtractionPointsCompleted)
			{
				return;
			}
			foreach (PlayerAvatar item2 in solitudeDeathTimers.Keys.ToList())
			{
				solitudeDeathTimers[item2] += Time.deltaTime;
			}
		}
	}
	[HarmonyPatch(typeof(ExtractionPoint))]
	internal class ExtractionPointPatch
	{
		private static int TotalMapValueAtStartOfRound;

		[HarmonyPatch("HaulGoalSet")]
		[HarmonyPrefix]
		private static void HaulGoalSetPrefix(ref int value)
		{
			Traverse obj = Traverse.Create((object)RoundDirector.instance);
			int value2 = obj.Field("haulGoalMax").GetValue<int>();
			int value3 = obj.Field("extractionPoints").GetValue<int>();
			int value4 = obj.Field("extractionPointsCompleted").GetValue<int>();
			if (value4 == 0)
			{
				TotalMapValueAtStartOfRound = value2;
			}
			float num = 1f;
			if (Helpers.GetConfig<bool>(Plugin.Modify_HaulGoal))
			{
				num = SwaggiFunc.DetermineBaseQuotaDifficulty(Helpers.CurrentLevel);
				if (MalfunctionManager.IsMalfunctionActive(MalfunctionManager.MalfunctionType.SingleExtraction))
				{
					num *= 1.2f;
				}
			}
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.HighQuota))
			{
				float num2 = Mathf.Abs(1f - num);
				num += Mathf.Clamp(num2 / 2f, 0.05f, 0.4f);
			}
			if (Helpers.GetConfig<bool>(Plugin.Modify_HaulGoal))
			{
				value = SwaggiFunc.DetermineQuota(value4, value3, TotalMapValueAtStartOfRound, num);
			}
			else
			{
				value = Mathf.RoundToInt((float)value * num);
			}
			if (Plugin.DeepLog)
			{
				Helpers.DeepLog("[ExtractionPoint HaulGoalSet]\n" + $"total map value = {value2:n0}\n" + $"extractions     = {value3} / {value4}\n" + $"difficulty      = {num:0.000}\n" + $"final quota     = {value:n0}");
			}
		}

		[HarmonyPatch("ActivateTheFirstExtractionPointAutomaticallyWhenAPlayerLeaveTruck")]
		[HarmonyPostfix]
		private static void ActivateTheFirstExtractionPointAutomaticallyWhenAPlayerLeaveTruckP()
		{
			LevelStatsManager.firstExtractionOpenedThisLevel = true;
		}

		[HarmonyPatch("DestroyTheFirstPhysObjectsInHaulList")]
		[HarmonyPrefix]
		private static void DestroyTheFirstPhysObjectsInHaulListP()
		{
			if (!SemiFunc.IsMasterClientOrSingleplayer() || RoundDirector.instance.dollarHaulList.Count == 0 || !Object.op_Implicit((Object)(object)RoundDirector.instance.dollarHaulList[0]))
			{
				return;
			}
			ValuableObject component = RoundDirector.instance.dollarHaulList[0].GetComponent<ValuableObject>();
			SurplusValuable component2 = RoundDirector.instance.dollarHaulList[0].GetComponent<SurplusValuable>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (!Traverse.Create((object)component).Field("discovered").GetValue<bool>())
				{
					LevelStatsManager.nonDiscoveredValuablesBroken++;
				}
				float value = Traverse.Create((object)component).Field("dollarValueCurrent").GetValue<float>();
				SwaggiFunc.SharedDurability_HealAllPlayers(value, value >= 10000f);
				if (!Object.op_Implicit((Object)(object)component2))
				{
					LevelStatsManager.AddValueExtracted(value);
					RunStatsManager.instance.totalValueExtracted += value;
				}
			}
		}

		[HarmonyPatch("DestroyAllPhysObjectsInHaulList")]
		[HarmonyPrefix]
		private static void DestroyAllPhysObjectsInHaulListP()
		{
			GlobalStatsManager.AddExtractionCompleted();
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			float num = 0f;
			foreach (GameObject dollarHaul in RoundDirector.instance.dollarHaulList)
			{
				ValuableObject component = dollarHaul.GetComponent<ValuableObject>();
				SurplusValuable component2 = dollarHaul.GetComponent<SurplusValuable>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (!Traverse.Create((object)component).Field("discovered").GetValue<bool>())
					{
						LevelStatsManager.nonDiscoveredValuablesBroken++;
					}
					float value = Traverse.Create((object)component).Field("dollarValueCurrent").GetValue<float>();
					num += value;
					if (!Object.op_Implicit((Object)(object)component2))
					{
						LevelStatsManager.AddValueExtracted(value);
					}
				}
			}
			SwaggiFunc.SharedDurability_HealAllPlayers(num, forceHealEffect: true);
			if (SemiFunc.RunIsLevel())
			{
				RunStatsManager.instance.extractionPointsCompleted++;
			}
			if (!MalfunctionManager.IsMalfunctionActive(MalfunctionManager.MalfunctionType.SingleExtraction))
			{
				return;
			}
			foreach (PlayerAvatar item in MalfunctionManager.solitudeDeathTimers.Keys.ToList())
			{
				MalfunctionManager.solitudeDeathTimers[item] = 999f;
			}
		}

		[HarmonyPatch("SpawnTaxReturn")]
		[HarmonyPrefix]
		private static void SpawnTaxReturnP()
		{
			int value = Traverse.Create((object)RoundDirector.instance).Field("extractionPointSurplus").GetValue<int>();
			if (value > 0)
			{
				LevelStatsManager._valueFromSurplus += value;
				RunStatsManager.instance.largestSurplusValue = Mathf.Max(value, RunStatsManager.instance.largestSurplusValue);
				GlobalStatsManager.SetLargestSurplusValue(value);
			}
		}

		[HarmonyPatch("SetHaulText")]
		[HarmonyPostfix]
		private static void SetHaulTextP(ref ExtractionPoint __instance, ref bool ___isShop, ref float ___haulBarTargetScale)
		{
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.HiddenInformation) && !Plugin.ClientSideMode && !___isShop)
			{
				((TMP_Text)__instance.haulGoalScreen).text = "<color=#bd4300>$</color>?????";
				___haulBarTargetScale = 1f;
				Traverse.Create((object)__instance).Method("SetEmojiScreen", new object[2] { "<sprite name=:)>", false }).GetValue();
			}
		}

		[HarmonyPatch("CancelExtraction")]
		[HarmonyPrefix]
		private static bool CancelExtractionP(ref ExtractionPoint __instance, ref int ___haulCurrent)
		{
			if (!MalfunctionManager.IsMalfunctionActive(MalfunctionManager.MalfunctionType.SingleExtraction))
			{
				return true;
			}
			if (!SemiFunc.RunIsLevel())
			{
				return true;
			}
			if (MalfunctionManager._solitude_ShownWarning != byte.MaxValue)
			{
				return true;
			}
			int value = Traverse.Create((object)RoundDirector.instance).Field("currentHaul").GetValue<int>();
			Traverse.Create((object)RoundDirector.instance).Field("extractionHaulGoal").SetValue((object)value);
			__instance.haulGoal = value;
			___haulCurrent = value;
			return false;
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	internal class LevelGeneratorPatch
	{
		public static int modulesSpawned;

		public static int modulesTotal;

		public static int CurrentLevel => RunManager.instance.levelsCompleted + 1;

		public static int CurrentModCount => Traverse.Create((object)LevelGenerator.Instance).Field("ModuleAmount").GetValue<int>();

		public static int CurrentExtCount => Traverse.Create((object)LevelGenerator.Instance).Field("ExtractionAmount").GetValue<int>();

		[HarmonyPatch("SpawnModule")]
		[HarmonyPostfix]
		private static void SpawnModuleP()
		{
			modulesSpawned++;
		}

		[HarmonyPatch("ModuleGeneration")]
		[HarmonyPrefix]
		private static void ModuleGenerationP(ref LevelGenerator __instance, ref Tile[,] ___LevelGrid)
		{
			modulesTotal = 0;
			for (int i = 0; i < __instance.LevelWidth; i++)
			{
				for (int j = 0; j < __instance.LevelHeight; j++)
				{
					if (___LevelGrid[i, j].active)
					{
						modulesTotal++;
					}
				}
			}
		}

		private static int GetNewModuleCount()
		{
			if (!SemiFunc.RunIsLevel())
			{
				return CurrentModCount;
			}
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.HiddenInformation))
			{
				return Random.Range(5, 9);
			}
			int num = CurrentModCount;
			if (Helpers.GetConfig<bool>(Plugin.Modify_ModuleCount))
			{
				num = SwaggiFunc.DetermineNumberOfModules(CurrentLevel, GameDirector.instance.PlayerList.Count, RunManager.instance.levelCurrent.NarrativeName);
			}
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.LargeMap))
			{
				num += Mathf.Clamp(Mathf.RoundToInt((float)num * 0.4f), 6, 12);
			}
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.FoggyLevel))
			{
				num = Mathf.Max(3, Mathf.CeilToInt((float)num / 2.33f));
			}
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.NoMap))
			{
				num = Mathf.Max(3, Mathf.RoundToInt((float)num * 0.9f));
			}
			if (Plugin.DeepLog)
			{
				Helpers.DeepLog($"[ModuleCount] {num}");
			}
			return num;
		}

		private static int GetNewExtractionCount()
		{
			if (!SemiFunc.RunIsLevel())
			{
				return CurrentExtCount;
			}
			int num = (Helpers.GetConfig<bool>(Plugin.Modify_ExtractionCount) ? SwaggiFunc.DetermineNumberOfExtractions(CurrentLevel, GameDirector.instance.PlayerList.Count) : CurrentExtCount);
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.HiddenInformation))
			{
				num = Random.Range(1, 3);
			}
			if (ChallengeManager.IsChallengeActive(ChallengeManager.ChallengeType.LargeMap))
			{
				num++;
			}
			if (MalfunctionManager.IsMalfunctionActive(MalfunctionManager.MalfunctionType.SingleExtraction))
			{
				num = 0;
			}
			if (Plugin.DeepLog)
			{
				Helpers.DeepLog($"[ExtractionCount] {num}");
			}
			return num;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> TileGenerationTranspiler(IEnumerable<CodeInstruction> inst)
		{
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(inst);
			if (list.Count <= 20)
			{
				Plugin.loggy.LogError((object)"Less than 20 instructions were found in TileGeneration, this is abnormal.");
				return list;
			}
			int num = -1;
			for (int i = 3; i < list.Count - 1; i++)
			{
				if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == AccessTools.Field(typeof(LevelGenerator), "ModuleAmount") && list[i + 1].opcode == OpCodes.Ldc_I4_3)
				{
					num = i - 3;
					break;
				}
			}
			if (num == -1)
			{
				Plugin.loggy.LogError((object)"Never found an insertion point for ModuleCount, unable to patch TileGeneration.");
				return list;
			}
			int num2 = -1;
			for (int j = 1; j < list.Count - 1; j++)
			{
				if (list[j].opcode == OpCodes.Ldarg_0 && list[j + 1].opcode == OpCodes.Ldc_I4_M1 && list[j + 4].opcode == OpCodes.Ldfld && (FieldInfo)list[j + 4].operand == AccessTools.Field(typeof(LevelGenerator), "ExtractionAmount"))
				{
					num2 = j - 1;
					break;
				}
			}
			if (num2 == -1)
			{
				Plugin.loggy.LogError((object)"Never found an insertion point for ExtractionCount, unable to patch TileGeneration.");
				return list;
			}
			List<CodeInstruction> collection = new List<CodeInstruction>
			{
				new CodeInstruction(OpCodes.Ldloc_1, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LevelGeneratorPatch), "GetNewModuleCount", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(LevelGenerator), "ModuleAmount"))
			};
			List<CodeInstruction> collection2 = new List<CodeInstruction>
			{
				new CodeInstruction(OpCodes.Ldloc_1, (object)null),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LevelGeneratorPatch), "GetNewExtractionCount", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(LevelGenerator), "ExtractionAmount"))
			};
			list.InsertRange(num2, collection2);
			list.InsertRange(num, collection);
			return list;
		}

		[HarmonyPatch("Generate")]
		[HarmonyPrefix]
		private static void GenerateP()
		{
			modulesSpawned = 0;
		}
	}
	[BepInPlugin("Swaggies.LevelScaling", "LevelScaling", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public enum ExtractedUIDisplayType
		{
			AlwaysTotalMapValue,
			AlwaysCurrentMapValue,
			Alternate
		}

		public enum FoundUIDisplayType
		{
			AlwaysTotal,
			AlwaysCurrent,
			Alternate
		}

		public enum HaulGoalRoundingOptions
		{
			RoundToOne,
			RoundToTen,
			RoundToHundred,
			RoundToThousand
		}

		private const string _guid = "Swaggies.LevelScaling";

		private const string _name = "LevelScaling";

		public const string _ver = "1.1.0";

		private readonly Harmony harmony = new Harmony("Swaggies.LevelScaling");

		public static ManualLogSource loggy;

		public static bool ClientSideMode;

		public static bool LevelSimulationDisabled;

		public static bool Compatibility_SpawnConfig;

		public static ConfigEntry<bool> StatsUIShow_Base;

		public static ConfigEntry<bool> StatsUIShow_Map;

		public static ConfigEntry<bool> StatsUIShow_EndOfLevel;

		public static ConfigEntry<bool> StatsUIShow_Shop;

		public static ConfigEntry<bool> StatsUI_Flash;

		public static ConfigEntry<ExtractedUIDisplayType> StatsUIShow_ExtractedUI;

		public static ConfigEntry<FoundUIDisplayType> StatsUIShow_FoundUI;

		public static ConfigEntry<bool> StatsUIDisplay_Challenge;

		public static ConfigEntry<bool> StatsUIDisplay_Malfunction;

		public static ConfigEntry<bool> StatsUIDisplay_Time;

		public static ConfigEntry<bool> StatsUIDisplay_Deaths;

		public static ConfigEntry<bool> StatsUIDisplay_OrbDrops;

		public static ConfigEntry<bool> StatsUIDisplay_Extracted;

		public static ConfigEntry<bool> StatsUIDisplay_Broken;

		public static ConfigEntry<bool> StatsUIDisplay_Found;

		public static ConfigEntry<bool> StatsUIDisplay_Explored;

		public static ConfigEntry<int> StatsUI_YOffset;

		public static ConfigEntry<bool> ShowOldOvercharge;

		public static ConfigEntry<bool> DisableServerSideSyncing;

		public static ConfigEntry<bool> EnableCustomValueUI;

		public static ConfigEntry<bool> UseAlternateStaminaDisplay;

		public static ConfigEntry<bool> DetailedLoadingScreen;

		public static ConfigEntry<bool> ShowMenuButton_MainMenu;

		public static ConfigEntry<bool> ShowMenuButton_PauseScreen;

		public static ConfigEntry<bool> ShowMenuButton_LobbyMenu;

		public static ConfigEntry<bool> ShowVersionOnMainMenu;

		public static ConfigEntry<bool> DisableLevelSimulationMenu;

		public static ConfigEntry<bool> DeepLogging;

		public static ConfigEntry<bool> ChallengeGuarantee;

		public static ConfigEntry<bool> ChallengeDisableMoonPhase;

		public static ConfigEntry<float> ChallengeChanceMultiplier;

		public static ConfigEntry<bool> ChallengeDisableLevelRequirements;

		public static ConfigEntry<bool> ChallengeTutorials;

		public static ConfigEntry<int> ChallengeChanceMultiplier_LightsOut;

		public static ConfigEntry<int> ChallengeChanceMultiplier_HighQuota;

		public static ConfigEntry<int> ChallengeChanceMultiplier_LargeMap;

		public static ConfigEntry<int> ChallengeChanceMultiplier_FoggyLevel;

		public static ConfigEntry<int> ChallengeChanceMultiplier_IncreasedDamage;

		public static ConfigEntry<int> ChallengeChanceMultiplier_FragileValuables;

		public static ConfigEntry<int> ChallengeChanceMultiplier_OverOvercharge;

		public static ConfigEntry<int> ChallengeChanceMultiplier_NoMap;

		public static ConfigEntry<int> ChallengeChanceMultiplier_EnemyRush;

		public static ConfigEntry<int> ChallengeChanceMultiplier_HiddenInformation;

		public static ConfigEntry<int> ChallengeChanceMultiplier_DangerZone;

		public static ConfigEntry<int> ChallengeChanceMultiplier_SharedDurability;

		public static ConfigEntry<int> ChallengeStartingLevel_LightsOut;

		public static ConfigEntry<int> ChallengeStartingLevel_HighQuota;

		public static ConfigEntry<int> ChallengeStartingLevel_LargeMap;

		public static ConfigEntry<int> ChallengeStartingLevel_FoggyLevel;

		public static ConfigEntry<int> ChallengeStartingLevel_IncreasedDamage;

		public static ConfigEntry<int> ChallengeStartingLevel_FragileValuables;

		public static ConfigEntry<int> ChallengeStartingLevel_OverOvercharge;

		public static ConfigEntry<int> ChallengeStartingLevel_NoMap;

		public static ConfigEntry<int> ChallengeStartingLevel_EnemyRush;

		public static ConfigEntry<int> ChallengeStartingLevel_HiddenInformation;

		public static ConfigEntry<int> ChallengeStartingLevel_DangerZone;

		public static ConfigEntry<int> ChallengeStartingLevel_SharedDurability;

		public static ConfigEntry<bool> Modify_ModuleCount;

		public static ConfigEntry<int> ModuleCountBase_Level1;

		public static ConfigEntry<int> ModuleCountBase_Level5;

		public static ConfigEntry<int> ModuleCountBase_Level10;

		public static ConfigEntry<int> ModuleCountBase_Level20;

		public static ConfigEntry<int> ModuleCountBase_Level50;

		public static ConfigEntry<int> ModuleCountBase_Level100;

		public static ConfigEntry<int> ModuleCount_RandomMin;

		public static ConfigEntry<int> ModuleCount_RandomMax;

		public static ConfigEntry<int> ModuleCount_PerPlayer;

		public static ConfigEntry<int> ModuleCount_PerPlayerMax;

		public static ConfigEntry<float> ModuleCountMultiplier_HeadmanManor;

		public static ConfigEntry<float> ModuleCountMultiplier_McJannekStation;

		public static ConfigEntry<float> ModuleCountMultiplier_SwiftbroomAcademy;

		public static ConfigEntry<float> ModuleCountMultiplier_MuseumOfHumanArt;

		public static ConfigEntry<Helpers.RoundingOptions> ModuleCount_Rounding;

		public static ConfigEntry<bool> Modify_ExtractionCount;

		public static ConfigEntry<int> ExtractionCountBase_Level1;

		public static ConfigEntry<int> ExtractionCountBase_Level5;

		public static ConfigEntry<int> ExtractionCountBase_Level10;

		public static ConfigEntry<int> ExtractionCountBase_Level20;

		public static ConfigEntry<int> ExtractionCountBase_Level50;

		public static ConfigEntry<int> ExtractionCountBase_Level100;

		public static ConfigEntry<int> ExtractionCount_RandomMin;

		public static ConfigEntry<int> ExtractionCount_RandomMax;

		public static ConfigEntry<int> ExtractionCount_PerPlayer;

		public static ConfigEntry<int> ExtractionCount_PerPlayerMax;

		public static ConfigEntry<Helpers.RoundingOptions> ExtractionCount_Rounding;

		public static ConfigEntry<bool> Modify_HaulGoal;

		public static ConfigEntry<float> HaulGoalBase_Level1;

		public static ConfigEntry<float> HaulGoalBase_Level5;

		public static ConfigEntry<float> HaulGoalBase_Level10;

		public static ConfigEntry<float> HaulGoalBase_Level20;

		public static ConfigEntry<float> HaulGoalBase_Level50;

		public static ConfigEntry<float> HaulGoalBase_Level100;

		public static ConfigEntry<float> HaulGoal_ExtractionModifier;

		public static ConfigEntry<HaulGoalRoundingOptions> HaulGoal_RoundingOptions;

		public static ConfigEntry<Helpers.RoundingOptions> HaulGoal_Rounding;

		public static ConfigEntry<bool> Modify_TotalMapValue;

		public static ConfigEntry<int> TotalMapValueBase_Level1;

		public static ConfigEntry<int> TotalMapValueBase_Level5;

		public static ConfigEntry<int> TotalMapValueBase_Level10;

		public static ConfigEntry<int> TotalMapValueBase_Level20;

		public static ConfigEntry<int> TotalMapValueBase_Level50;

		public static ConfigEntry<int> TotalMapValueBase_Level100;

		public static ConfigEntry<float> TotalMapValue_RandomMin;

		public static ConfigEntry<float> TotalMapValue_RandomMax;

		public static ConfigEntry<float> TotalMapValue_PerPlayer;

		public static ConfigEntry<int> TotalMapValue_PerPlayerMax;

		public static ConfigEntry<bool> Modify_EnemyTier1;

		public static ConfigEntry<int> EnemyTier1_Level1;

		public static ConfigEntry<int> EnemyTier1_Level5;

		public static ConfigEntry<int> EnemyTier1_Level10;

		public static ConfigEntry<int> EnemyTier1_Level20;

		public static ConfigEntry<int> EnemyTier1_Level50;

		public static ConfigEntry<int> EnemyTier1_Level100;

		public static ConfigEntry<Helpers.RoundingOptions> EnemyTier1_Rounding;

		public static ConfigEntry<bool> Modify_EnemyTier2;

		public static ConfigEntry<int> EnemyTier2_Level1;

		public static ConfigEntry<int> EnemyTier2_Level5;

		public static ConfigEntry<int> EnemyTier2_Level10;

		public static ConfigEntry<int> EnemyTier2_Level20;

		public static ConfigEntry<int> EnemyTier2_Level50;

		public static ConfigEntry<int> EnemyTier2_Level100;

		public static ConfigEntry<Helpers.RoundingOptions> EnemyTier2_Rounding;

		public static ConfigEntry<bool> Modify_EnemyTier3;

		public static ConfigEntry<int> EnemyTier3_Level1;

		public static ConfigEntry<int> EnemyTier3_Level5;

		public static ConfigEntry<int> EnemyTier3_Level10;

		public static ConfigEntry<int> EnemyTier3_Level20;

		public static ConfigEntry<int> EnemyTier3_Level50;

		public static ConfigEntry<int> EnemyTier3_Level100;

		public static ConfigEntry<Helpers.RoundingOptions> EnemyTier3_Rounding;

		public static ConfigEntry<bool> Modify_EnemyHealth;

		public static ConfigEntry<int> EnemyHealth_Level1;

		public static ConfigEntry<int> EnemyHealth_Level5;

		public static ConfigEntry<int> EnemyHealth_Level10;

		public static ConfigEntry<int> EnemyHealth_Level20;

		public static ConfigEntry<int> EnemyHealth_Level50;

		public static ConfigEntry<int> EnemyHealth_Level100;

		public static ConfigEntry<int> EnemyHealth_PerPlayer;

		public static ConfigEntry<int> EnemyHealth_PerPlayerMax;

		public static ConfigEntry<Helpers.RoundingOptions> EnemyHealth_Rounding;

		public static bool DeepLog => DeepLogging.Value;

		private void Awake()
		{
			loggy = Logger.CreateLogSource("Swaggies.LevelScaling");
			CreateConfig();
			if (DisableServerSideSyncing.Value)
			{
				ClientSideMode = true;
				loggy.LogMessage((object)"Networking is disabled in config - running in client-side mode!");
			}
			if (DisableLevelSimulationMenu.Value)
			{
				LevelSimulationDisabled = true;
				loggy.LogMessage((object)"Level Simulation menu disabled.");
			}
			foreach (string key in Chainloader.PluginInfos.Keys)
			{
				if (key == "Index154.SpawnConfig")
				{
					Compatibility_SpawnConfig = true;
				}
			}
			if (Compatibility_SpawnConfig)
			{
				loggy.LogWarning((object)"Warning! Some Challenges and Malfunctions will be disabled as SpawnConfig is installed.");
				ChallengeManager._blacklistedChallenges.Add(ChallengeManager.ChallengeType.EnemyRush);
			}
			harmony.PatchAll(Assembly.GetExecutingAssembly());
			loggy.LogMessage((object)"LevelScaling's up and runnin' on 1.1.0");
			GlobalStatsManager.LoadGlobalStats();
			MalfunctionManager.Setup();
		}

		private void CreateConfig()
		{
			CreateStatsUIConfig();
			CreateMiscConfig();
			CreateChallengeConfig();
			CreateModuleConfig();
			CreateExtractionConfig();
			CreateHaulGoalConfig();
			CreateTotalMapValueConfig();
			CreateEnemyAmountsConfig();
			CreateEnemyHealthMultiplierConfig();
		}

		private void CreateStatsUIConfig()
		{
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			StatsUIShow_Base = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Show always", true, "Whether the level stats are always displayed on screen (applies when changed)");
			StatsUIShow_Map = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Show when map is open", true, "Whether the level stats are displayed with the map open (if not, they will be hidden with the map open, overriding other settings) (applies when changed)");
			StatsUIShow_EndOfLevel = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Show at end of level", true, "Whether the level stats will be shown at the end of a level (overriden by Always Show and Show With Map) (applies when changed)");
			StatsUIShow_Shop = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Show in shop", true, "Whether the level stats are shown in the shop (overriden by all other settings) (applies when changed)");
			StatsUI_Flash = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Flash on value change", true, "Make stats pop out by flashing them if their value changes (applies when changed)");
			StatsUIShow_ExtractedUI = ((BaseUnityPlugin)this).Config.Bind<ExtractedUIDisplayType>("Level Stats UI", "Extracted Value Display Type", ExtractedUIDisplayType.Alternate, "If the \"extracted value\" stats displays the total map value, or current remaining map value (taking broken valuables into account). Set to Alternate for automatically swapping between them every few seconds in-game (applies when changed)");
			StatsUIShow_FoundUI = ((BaseUnityPlugin)this).Config.Bind<FoundUIDisplayType>("Level Stats UI", "Found Amount Display Type", FoundUIDisplayType.Alternate, "If the \"found valuables\" stat displays the total amount, or current remaining amount (subtracting broken valuables that have not been found yet). Set to Alternate for automatically swapping between them every few seconds in-game (applies when changed)");
			StatsUIDisplay_Malfunction = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Active Malfunction", true, "Whether to display the active malfunction on the UI (applies when changed)");
			StatsUIDisplay_Challenge = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Active Challenge", true, "Whether to display the active challenge on the UI (applies when changed)");
			StatsUIDisplay_Time = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Level Timer", true, "Whether to display the level stopwatch on the UI (applies when changed)");
			StatsUIDisplay_Deaths = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Shop Death Count", true, "Whether to display the number of shop deaths on the UI (applies when changed)");
			StatsUIDisplay_OrbDrops = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Orb Drops Count", true, "Whether to display the number of orbs dropped from killed enemies on the UI (applies when changed)");
			StatsUIDisplay_Extracted = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Value Extracted", true, "Whether to display the amount of value extracted on the UI (applies when changed)");
			StatsUIDisplay_Broken = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Value Broken", true, "Whether to display the amount of value broken on the UI (applies when changed)");
			StatsUIDisplay_Found = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Valuables Found", true, "Whether to display the number of valuables found on the UI (applies when changed)");
			StatsUIDisplay_Explored = ((BaseUnityPlugin)this).Config.Bind<bool>("Level Stats UI", "Display Modules Explored", true, "Whether to display the number of modules explored on the UI (applies when changed)");
			StatsUI_YOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Level Stats UI", "Y Offset", 0, new ConfigDescription("Change where to display the stats UI vertically (applies when stats ui is loaded)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-150, 150), Array.Empty<object>()));
		}

		private void CreateMiscConfig()
		{
			DisableServerSideSyncing = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Disable server-side syncing", false, "Whether to disable networking between clients. Disabling will allow Level Scaling to be compatible with vanilla clients, and/or without the need for the host to have the mod. This will disable challenge levels and Malfunctions completely, as those require networking. (applies when the game initially starts up)");
			ShowOldOvercharge = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Show old Overcharge UI", true, "Whether to enable the old Overcharge UI (number at the top left under the stamina meter - seen in old videos with overcharge) (applies at the start of each level)");
			EnableCustomValueUI = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Show custom value UI", true, "Whether to enable the stylized value UI - when holding a valuable, the text color will fade from green to red depending on the amount of damage to the valuable. Disable to keep vanilla behaviour (only dark green text). (applies when changed)");
			UseAlternateStaminaDisplay = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Use alternate stamina display", false, "Whether to portray stamina as a percentage, starting at 100 with no upgrades and adding 25 per upgrade, whilst keeping stamina functionally the same as vanilla. All this does is multiply the display value to make it feel more consistent with health. (applies when changed)");
			DetailedLoadingScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Detailed loading screen", false, "Whether to show what the game is actively doing whilst loading a new level. (applies when changed) (HOST ONLY)");
			ShowMenuButton_MainMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Show Level Scaling button (Main Menu)", true, "Whether to show Level Scaling's menu button on the Main Menu. (applies when the main menu is loaded)");
			ShowMenuButton_LobbyMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Show Level Scaling button (Lobby Menu)", true, "Whether to show Level Scaling's menu button on the multiplayer Lobby Menu. (applies when the game initially starts up)");
			ShowMenuButton_PauseScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Show Level Scaling button (Pause Menu)", true, "Whether to show Level Scaling's menu button on the pause screen in-game. (applies when the game initially starts up)");
			ShowVersionOnMainMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Show Mod Version on Main Menu", true, "Whether to show Level Scaling's current version next to REPO's version in the main menu. (applies when the main menu is loaded)");
			DisableLevelSimulationMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Disable Level Simulation Menu", false, "Whether to disable the Level Simulation button (in case you want to prevent spoilers or something). (applies when the game initially starts up)");
			DeepLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Deep logging", false, "When enabled, Level Scaling will log a lot of information relating to the changes and patches that the mod makes. This will FLOOD your log file and likely lag your game a bit, but may help with debugging stuff. Keep this off if you're just using Level Scaling normally. (applies when changed)");
		}

		private void CreateChallengeConfig()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Expected O, but got Unknown
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Expected O, but got Unknown
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Expected O, but got Unknown
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Expected O, but got Unknown
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Expected O, but got Unknown
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Expected O, but got Unknown
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Expected O, but got Unknown
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Expected O, but got Unknown
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Expected O, but got Unknown
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Expected O, but got Unknown
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Expected O, but got Unknown
			ChallengeChanceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge Levels", "Chance multiplier", 1f, new ConfigDescription("Adjust the multiplier for the chance of a challenge level appearing. Set to 0 to disable challenges completely. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			ChallengeGuarantee = ((BaseUnityPlugin)this).Config.Bind<bool>("Challenge Levels", "Guaranteed challenge levels", false, "Guarantees that every level will be a challenge level. Make sure Chance Multiplier is ABOVE 0. (applies before the start of each level) (HOST ONLY)");
			ChallengeDisableMoonPhase = ((BaseUnityPlugin)this).Config.Bind<bool>("Challenge Levels", "Prevent on new moon phases", true, "When enabled, challenge levels cannot appear on levels when the moon phase switches. (applies before the start of each level) (HOST ONLY)");
			ChallengeDisableLevelRequirements = ((BaseUnityPlugin)this).Config.Bind<bool>("Challenge Levels", "Disable level requirements", false, "When enabled, any challenge level can appear on any level number. (applies before the start of each level) (HOST ONLY)");
			ChallengeTutorials = ((BaseUnityPlugin)this).Config.Bind<bool>("Challenge Levels", "Show tutorials", true, "When a challenge appears, info about it will be shown at the start of the level. (applies when changed)");
			ChallengeChanceMultiplier_LightsOut = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Lights Out Weight", 30, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_HighQuota = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Overtime Weight", 50, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_LargeMap = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Enlarged Level Weight", 20, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_FoggyLevel = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Dense Fog Weight", 20, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_IncreasedDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Increased Damage Weight", 30, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_FragileValuables = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Fragile Valuables Weight", 50, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_OverOvercharge = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Over-Overcharge Weight", 50, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_NoMap = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Broken Map Weight", 40, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_EnemyRush = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Enemy Rush Weight", 35, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_HiddenInformation = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Hidden Information Weight", 15, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_DangerZone = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Danger Zone Weight", 20, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeChanceMultiplier_SharedDurability = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Shared Durability Weight", 15, new ConfigDescription("Adjust the chance for this challenge to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ChallengeStartingLevel_LightsOut = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Lights Out Starting Level", 3, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_HighQuota = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Overtime Starting Level", 7, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_LargeMap = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Enlarged Level Starting Level", 12, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_FoggyLevel = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Dense Fog Starting Level", 15, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_IncreasedDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Increased Damage Starting Level", 5, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_FragileValuables = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Fragile Valuables Starting Level", 15, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_OverOvercharge = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Over-Overcharge Starting Level", 10, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_NoMap = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Broken Map Starting Level", 7, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_EnemyRush = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Enemy Rush Starting Level", 10, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_HiddenInformation = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Hidden Information Starting Level", 10, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_DangerZone = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Danger Zone Starting Level", 5, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			ChallengeStartingLevel_SharedDurability = ((BaseUnityPlugin)this).Config.Bind<int>("Challenge Levels", "Shared Durability Starting Level", 12, new ConfigDescription("Adjust which level this challenge can begin to appear. (applies before the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
		}

		private void CreateModuleConfig()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: 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_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Expected O, but got Unknown
			Modify_ModuleCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Modules", "Modify Module Count", true, "Whether Level Scaling should apply its progressive module counts for levels. If disabled, vanilla behaviour will take over, and all of the following config options will be ignored. (applies at the start of each level) (HOST ONLY)");
			ModuleCountBase_Level1 = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Module Count - Level 1", 4, new ConfigDescription("Number of modules at this level. Modules between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 32), Array.Empty<object>()));
			ModuleCountBase_Level5 = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Module Count - Level 5", 6, new ConfigDescription("Number of modules at this level. Modules between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 32), Array.Empty<object>()));
			ModuleCountBase_Level10 = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Module Count - Level 10", 8, new ConfigDescription("Number of modules at this level. Modules between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 32), Array.Empty<object>()));
			ModuleCountBase_Level20 = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Module Count - Level 20", 15, new ConfigDescription("Number of modules at this level. Modules between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 32), Array.Empty<object>()));
			ModuleCountBase_Level50 = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Module Count - Level 50", 20, new ConfigDescription("Number of modules at this level. Modules between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 32), Array.Empty<object>()));
			ModuleCountBase_Level100 = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Module Count - Level 100", 25, new ConfigDescription("Number of modules at this level. Modules between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 32), Array.Empty<object>()));
			ModuleCount_RandomMin = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Random Min", 0, new ConfigDescription("Minimum number of modules to randomly add to the base amount on each level. Negative numbers can make the map smaller. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-10, 10), Array.Empty<object>()));
			ModuleCount_RandomMax = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Random Max", 0, new ConfigDescription("Maximum number of modules to randomly add to the base amount on each level. Negative numbers can make the map smaller. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-10, 10), Array.Empty<object>()));
			ModuleCount_PerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Modules Added Per Player", 0, new ConfigDescription("Number of added modules per player in the lobby. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-3, 3), Array.Empty<object>()));
			ModuleCount_PerPlayerMax = ((BaseUnityPlugin)this).Config.Bind<int>("Modules", "Accounted Players", 6, new ConfigDescription("Maximum number of players to account for when adding modules per player. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9), Array.Empty<object>()));
			ModuleCountMultiplier_HeadmanManor = ((BaseUnityPlugin)this).Config.Bind<float>("Modules", "Multiplier - Headman Manor", 1f, new ConfigDescription("Module count multiplier for this specific level type. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			ModuleCountMultiplier_McJannekStation = ((BaseUnityPlugin)this).Config.Bind<float>("Modules", "Multiplier - McJannek Station", 1f, new ConfigDescription("Module count multiplier for this specific level type. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			ModuleCountMultiplier_SwiftbroomAcademy = ((BaseUnityPlugin)this).Config.Bind<float>("Modules", "Multiplier - Swiftbroom Academy", 1f, new ConfigDescription("Module count multiplier for this specific level type. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			ModuleCountMultiplier_MuseumOfHumanArt = ((BaseUnityPlugin)this).Config.Bind<float>("Modules", "Multiplier - Museum Of Human Art", 1f, new ConfigDescription("Module count multiplier for this specific level type. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			ModuleCount_Rounding = ((BaseUnityPlugin)this).Config.Bind<Helpers.RoundingOptions>("Modules", "Interpolation Rounding", Helpers.RoundingOptions.Floor, "How to round the module count when interpolating between level numbers. Floor will always round down, Ceil will always round up.");
		}

		private void CreateExtractionConfig()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			Modify_ExtractionCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Extractions", "Modify Extraction Count", true, "Whether Level Scaling should apply its progressive extraction counts for levels. If disabled, vanilla behaviour will take over, and all of the following config options will be ignored. (applies at the start of each level) (HOST ONLY)");
			ExtractionCountBase_Level1 = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Extraction Count - Level 1", 1, new ConfigDescription("Number of extractions at this level. Extractions between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			ExtractionCountBase_Level5 = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Extraction Count - Level 5", 3, new ConfigDescription("Number of extractions at this level. Extractions between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			ExtractionCountBase_Level10 = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Extraction Count - Level 10", 4, new ConfigDescription("Number of extractions at this level. Extractions between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			ExtractionCountBase_Level20 = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Extraction Count - Level 20", 5, new ConfigDescription("Number of extractions at this level. Extractions between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			ExtractionCountBase_Level50 = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Extraction Count - Level 50", 7, new ConfigDescription("Number of extractions at this level. Extractions between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			ExtractionCountBase_Level100 = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Extraction Count - Level 100", 10, new ConfigDescription("Number of extractions at this level. Extractions between level configs will be interpolated and rounded down. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			ExtractionCount_RandomMin = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Random Min", 0, new ConfigDescription("Minimum number of extractions to randomly add to the base amount on each level. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-5, 5), Array.Empty<object>()));
			ExtractionCount_RandomMax = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Random Max", 0, new ConfigDescription("Maximum number of extractions to randomly add to the base amount on each level. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-5, 5), Array.Empty<object>()));
			ExtractionCount_PerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Added Per Player", 0, new ConfigDescription("Number of added extractions per player in the lobby. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-3, 3), Array.Empty<object>()));
			ExtractionCount_PerPlayerMax = ((BaseUnityPlugin)this).Config.Bind<int>("Extractions", "Accounted Players", 3, new ConfigDescription("Maximum number of players to account for when adding extractions per player. (applies at the start of each level) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>()));
			ExtractionCount_Rounding = ((BaseUnityPlugin)this).Config.Bind<Helpers.RoundingOptions>("Extractions", "Interpolation Rounding", Helpers.RoundingOptions.Floor, "How to round the extraction count when interpolating between level numbers. Floor will always round down, Ceil will always round up.");
		}

		private void CreateHaulGoalConfig()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			Modify_HaulGoal = ((BaseUnityPlugin)this).Config.Bind<bool>("Haul Goal", "Modify Haul Goal", true, "Whether Level Scaling should apply its progressive quotas for extraction points in levels. If disabled, vanilla behaviour will take over, and all of the following config options will be ignored. (applies when an extraction point is activated) (HOST ONLY)");
			HaulGoalBase_Level1 = ((BaseUnityPlugin)this).Config.Bind<float>("Haul Goal", "Quota Difficulty - Level 1", 0.25f, new ConfigDescription("Haul Goal difficulty for this level. The difficulty determines the percentage of map value required to complete all extractions (eg. 0.7 = 70% of map value). Values between level configs will be interpolated. (applies when an extraction point is activated) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
			HaulGoalBase_Level5 = ((BaseUnityPlugin)this).Config.Bind<float>("Haul Goal", "Quota Difficulty - Level 5", 0.45f, new ConfigDescription("Haul Goal difficulty for this level. The difficulty determines the percentage of map value required to complete all extractions (eg. 0.7 = 70% of map value). Values between level configs will be interpolated. (applies when an extraction point is activated) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
			HaulGoalBase_Level10 = ((BaseUnityPlugin)this).Config.Bind<float>("Haul Goal", "Quota Difficulty - Level 10", 0.55f, new ConfigDescription("Haul Goal difficulty for this level. The difficulty determines the percentage of map value required to complete all extractions (eg. 0.7 = 70% of map value). Values between level configs will be interpolated. (applies when an extraction point is activated) (HOST ONLY)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
			HaulGoalBase_Level20 = ((BaseUnityPlugin)this).Config.Bind<float>("Haul Goal", "Quota Difficulty - Level 20", 0.7f, new ConfigDescription("Haul Goal difficulty for this level. The difficulty determines the percentage of map value required to compl