Decompiled source of REPOConomyPlus v1.6.0

plugins/REPOConomyPlus.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Photon.Pun;
using Photon.Realtime;
using REPOConomyMod;
using REPOConomyPlus;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("REPOConomyPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPOConomyPlus")]
[assembly: AssemblyTitle("REPOConomyPlus")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace REPOConomyPlus
{
	public static class LevelScalingImprovements
	{
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		public static class Patch_LevelGenerator_TileGeneration_Transpiler
		{
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Expected O, but got Unknown
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_020d: Expected O, but got Unknown
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: 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_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0276: Expected O, but got Unknown
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_029a: Expected O, but got Unknown
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				if (list.Count <= 20)
				{
					REPOConomyPlugin.Logger.LogError((object)"[Transpiler] Less than 20 instructions found - cannot patch!");
					return list;
				}
				int num = -1;
				int num2 = -1;
				for (int i = 3; i < list.Count - 1; i++)
				{
					if (list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo fieldInfo && fieldInfo.Name == "ModuleAmount" && i + 1 < list.Count && list[i + 1].opcode == OpCodes.Ldc_I4_3)
					{
						num = i - 3;
						REPOConomyPlugin.Logger.LogInfo((object)$"[Transpiler] Found ModuleAmount insert point at index {num}");
						break;
					}
				}
				for (int j = 1; j < list.Count - 4; j++)
				{
					if (list[j].opcode == OpCodes.Ldarg_0 && j + 1 < list.Count && list[j + 1].opcode == OpCodes.Ldc_I4_M1 && j + 4 < list.Count && list[j + 4].opcode == OpCodes.Ldfld && list[j + 4].operand is FieldInfo fieldInfo2 && fieldInfo2.Name == "ExtractionAmount")
					{
						num2 = j - 1;
						REPOConomyPlugin.Logger.LogInfo((object)$"[Transpiler] Found ExtractionAmount insert point at index {num2}");
						break;
					}
				}
				if (num == -1)
				{
					REPOConomyPlugin.Logger.LogError((object)"[Transpiler] Failed to find ModuleAmount insertion point!");
					return list;
				}
				if (num2 == -1)
				{
					REPOConomyPlugin.Logger.LogError((object)"[Transpiler] Failed to find ExtractionAmount insertion point!");
					return list;
				}
				List<CodeInstruction> list2 = new List<CodeInstruction>
				{
					new CodeInstruction(OpCodes.Ldloc_1, (object)null),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LevelScalingImprovements), "GetNewModuleCount", (Type[])null, (Type[])null)),
					new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(LevelGenerator), "ModuleAmount"))
				};
				list.InsertRange(num, list2);
				List<CodeInstruction> collection = new List<CodeInstruction>
				{
					new CodeInstruction(OpCodes.Ldloc_1, (object)null),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LevelScalingImprovements), "GetNewExtractionCount", (Type[])null, (Type[])null)),
					new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(LevelGenerator), "ExtractionAmount"))
				};
				list.InsertRange(num2 + list2.Count, collection);
				REPOConomyPlugin.Logger.LogInfo((object)"[Transpiler] Successfully patched TileGeneration!");
				return list;
			}
		}

		private static int GetVanillaModuleAmount(int levelsCompleted)
		{
			int num = Mathf.Min(5 + levelsCompleted, 10);
			if (levelsCompleted >= 10)
			{
				num += Mathf.Min(levelsCompleted - 9, 5);
			}
			return num;
		}

		private static int GetVanillaExtractionAmount(int levelsCompleted)
		{
			int vanillaModuleAmount = GetVanillaModuleAmount(levelsCompleted);
			if (vanillaModuleAmount >= 15)
			{
				return 4;
			}
			if (vanillaModuleAmount >= 10)
			{
				return 3;
			}
			if (vanillaModuleAmount >= 8)
			{
				return 2;
			}
			if (vanillaModuleAmount >= 6)
			{
				return 1;
			}
			return 0;
		}

		public static int GetScaledModuleAmount(int levelsCompleted)
		{
			if (!REPOConfig.EnableLevelScaling.Value)
			{
				return GetVanillaModuleAmount(levelsCompleted);
			}
			int num = Mathf.Min(levelsCompleted, REPOConfig.LevelScalingMaxModulesLevel.Value);
			int value = REPOConfig.LevelScalingModulesInterval.Value;
			float num2 = REPOConfig.LevelScalingModulesPerInterval.Value;
			if (REPOConfig.EnableMultiplicativeScaling.Value)
			{
				int num3 = Mathf.FloorToInt((float)(num + 1) / (float)value);
				int num4 = 0;
				for (int i = 0; i < num3; i++)
				{
					num4 += (int)Mathf.Pow(num2, (float)i);
				}
				return REPOConfig.LevelScalingMinModules.Value + num4;
			}
			return REPOConfig.LevelScalingMinModules.Value + Mathf.FloorToInt((float)(num + 1) / (float)value) * (int)num2;
		}

		public static int GetScaledExtractionAmount(int levelsCompleted)
		{
			if (!REPOConfig.EnableLevelScaling.Value)
			{
				return GetVanillaExtractionAmount(levelsCompleted);
			}
			int value = REPOConfig.LevelScalingExtractionsInterval.Value;
			int value2 = REPOConfig.LevelScalingExtractionsPerInterval.Value;
			if (REPOConfig.EnableMultiplicativeScaling.Value)
			{
				int num = (levelsCompleted + 1) / value;
				int num2 = 0;
				for (int i = 0; i < num; i++)
				{
					num2 += (int)Mathf.Pow((float)value2, (float)i);
				}
				return Mathf.Min(REPOConfig.LevelScalingBaseExtractions.Value + num2, REPOConfig.LevelScalingMaxExtractions.Value);
			}
			return Mathf.Min(REPOConfig.LevelScalingBaseExtractions.Value + (levelsCompleted + 1) / value * value2, REPOConfig.LevelScalingMaxExtractions.Value);
		}

		public static float GetScaledHaulMultiplier(int levelsCompleted)
		{
			if (!REPOConfig.EnableLevelScaling.Value)
			{
				return 0.7f;
			}
			int num = Mathf.Min(levelsCompleted, REPOConfig.LevelScalingMaxHaulLevel.Value);
			if (REPOConfig.EnableMultiplicativeScaling.Value)
			{
				return Mathf.Min(REPOConfig.LevelScalingBaseHaulMultiplier.Value * Mathf.Pow(1f + REPOConfig.LevelScalingHaulIncreasePerLevel.Value, (float)num), REPOConfig.LevelScalingMaxHaulMultiplier.Value);
			}
			return Mathf.Min(REPOConfig.LevelScalingBaseHaulMultiplier.Value + (float)num * REPOConfig.LevelScalingHaulIncreasePerLevel.Value, REPOConfig.LevelScalingMaxHaulMultiplier.Value);
		}

		private static int GetNewModuleCount()
		{
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				return 6;
			}
			if (SemiFunc.RunIsArena() || SemiFunc.RunIsShop() || SemiFunc.MenuLevel() || SemiFunc.RunIsLobby())
			{
				return 6;
			}
			int levelsCompleted = RunManager.instance.levelsCompleted;
			int scaledModuleAmount = GetScaledModuleAmount(levelsCompleted);
			REPOConomyPlugin.Logger.LogInfo((object)$"[LevelScaling] New ModuleCount: {scaledModuleAmount} for level {levelsCompleted + 1}");
			return scaledModuleAmount;
		}

		private static int GetNewExtractionCount()
		{
			if ((Object)(object)RunManager.instance == (Object)null)
			{
				return 1;
			}
			if (SemiFunc.RunIsArena() || SemiFunc.RunIsShop() || SemiFunc.MenuLevel() || SemiFunc.RunIsLobby())
			{
				return 0;
			}
			int levelsCompleted = RunManager.instance.levelsCompleted;
			int scaledExtractionAmount = GetScaledExtractionAmount(levelsCompleted);
			REPOConomyPlugin.Logger.LogInfo((object)$"[LevelScaling] New ExtractionCount: {scaledExtractionAmount} for level {levelsCompleted + 1}");
			return scaledExtractionAmount;
		}
	}
	[HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")]
	public static class Patch_RoundDirector_StartRoundLogic
	{
		public static bool IsHaulScaled;

		private static void Prefix(RoundDirector __instance, ref int value)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)RunManager.instance == (Object)null) && !((Object)(object)__instance == (Object)null) && !SemiFunc.RunIsArena() && !SemiFunc.RunIsShop() && !SemiFunc.MenuLevel() && !SemiFunc.RunIsLobby())
			{
				if (IsHaulScaled)
				{
					REPOConomyPlugin.Logger.LogInfo((object)"[LevelScaling] Haul already scaled, skipping double apply.");
				}
				else if (REPOConfig.EnableLevelScaling.Value)
				{
					float scaledHaulMultiplier = LevelScalingImprovements.GetScaledHaulMultiplier(RunManager.instance.levelsCompleted);
					float num = value;
					value = Mathf.RoundToInt(num * (scaledHaulMultiplier / 0.7f));
					IsHaulScaled = true;
					REPOConomyPlugin.Logger.LogInfo((object)$"[LevelScaling] Haul goal scaled: {value} (original: {num}, multiplier: {scaledHaulMultiplier:F2})");
				}
			}
		}
	}
}
namespace REPOConomyMod
{
	[Serializable]
	public class CustomEconomyData
	{
		public string id;

		public string name_en;

		public string name_ru;

		public string name_ko;

		public string desc_en;

		public string desc_ru;

		public string desc_ko;

		public float[] color;

		public float min;

		public float max;

		public bool useDelta;
	}
	public static class CustomEconomyLoader
	{
		public static List<CustomEconomyData> CustomEvents = new List<CustomEconomyData>();

		public static void LoadCustomEvents()
		{
			string text = Path.Combine(Paths.ConfigPath, "CustomEvents");
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
				REPOConomyPlugin.Logger.LogInfo((object)("[REPOConomy] Created folder for custom events: " + text));
			}
			string[] files = Directory.GetFiles(text, "*.json", SearchOption.TopDirectoryOnly);
			int num = 0;
			int num2 = 0;
			string[] array = files;
			foreach (string text2 in array)
			{
				try
				{
					List<CustomEconomyData> list = JsonConvert.DeserializeObject<List<CustomEconomyData>>(File.ReadAllText(text2));
					if (list != null)
					{
						foreach (CustomEconomyData item in list)
						{
							if (!string.IsNullOrEmpty(item.id))
							{
								CustomEvents.Add(item);
								REPOConomyPlugin.Logger.LogInfo((object)("[REPOConomy] Loaded custom event: " + item.name_en + " (" + text2 + ")"));
								num++;
							}
							else
							{
								REPOConomyPlugin.Logger.LogWarning((object)("[REPOConomy] Invalid custom event in file: " + text2 + " (missing ID)"));
								num2++;
							}
						}
					}
					else
					{
						REPOConomyPlugin.Logger.LogWarning((object)("[REPOConomy] JSON file does not contain a valid event list: " + text2));
						num2++;
					}
				}
				catch (Exception ex)
				{
					REPOConomyPlugin.Logger.LogWarning((object)("[REPOConomy] Failed to load custom event from " + text2 + ": " + ex.Message));
					num2++;
				}
			}
			REPOConomyPlugin.Logger.LogInfo((object)$"[REPOConomy] Loaded {num} custom events. Failed: {num2}");
		}
	}
	public class EconomyController : MonoBehaviour
	{
		public static EconomyController Instance;

		public static bool UIShownOnce;

		public static bool ShowChancesInLevel;

		public static bool ShopEconomyUIShownOnce;

		private bool economyResetPending = true;

		private bool showGUI;

		private float displayTimer = 20f;

		private string lastSceneType = "";

		private bool showShopGUI;

		private float shopDisplayTimer = 15f;

		private Vector2 scrollPosition = Vector2.zero;

		private float scrollSpeed = 100f;

		private float autoScrollTimer;

		private float autoScrollDelay = 1.5f;

		private bool autoScrollActive;

		private float autoScrollSpeed = 30f;

		private float cachedContentHeight;

		private float cachedScrollableHeight;

		private float fadeAlpha;

		private float targetFadeAlpha;

		private float glowPulse;

		private Texture2D bgTexture;

		private Texture2D gradientTexture;

		private Texture2D glowTexture;

		private Texture2D separatorTexture;

		private GUIStyle noScrollbarStyle;

		private void Awake()
		{
			Instance = this;
			InitializeTextures();
			InitializeStyles();
		}

		private void InitializeStyles()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			noScrollbarStyle = new GUIStyle();
		}

		private void InitializeTextures()
		{
			//IL_0018: 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)
			bgTexture = MakeTexture(2, 2, new Color(0.05f, 0.05f, 0.08f, 0.95f));
			gradientTexture = MakeGradientTexture();
			glowTexture = MakeGlowTexture();
			separatorTexture = MakeTexture(2, 2, new Color(0.3f, 0.6f, 1f, 0.3f));
		}

		private Texture2D MakeTexture(int width, int height, Color col)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private Texture2D MakeGradientTexture()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_002c: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			int num = 256;
			Texture2D val = new Texture2D(1, num);
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / (float)num;
				Color val2 = Color.Lerp(new Color(0.1f, 0.15f, 0.25f, 0.9f), new Color(0.05f, 0.05f, 0.08f, 0.95f), num2);
				val.SetPixel(0, i, val2);
			}
			val.Apply();
			return val;
		}

		private Texture2D MakeGlowTexture()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			int num = 64;
			Texture2D val = new Texture2D(num, num);
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = ((float)j - (float)num / 2f) / ((float)num / 2f);
					float num3 = ((float)i - (float)num / 2f) / ((float)num / 2f);
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					float num5 = Mathf.Max(0f, 1f - num4) * 0.5f;
					val.SetPixel(j, i, new Color(0.3f, 0.6f, 1f, num5));
				}
			}
			val.Apply();
			return val;
		}

		private void Update()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			fadeAlpha = Mathf.Lerp(fadeAlpha, targetFadeAlpha, Time.deltaTime * 8f);
			glowPulse = Mathf.Sin(Time.time * 2f) * 0.3f + 0.7f;
			string currentSceneType = GetCurrentSceneType();
			if (Input.GetKeyDown(REPOConfig.UIToggleHotkey.Value))
			{
				if (currentSceneType == "Shop")
				{
					showShopGUI = !showShopGUI;
					if (showShopGUI)
					{
						shopDisplayTimer = 15f;
					}
				}
				else
				{
					showGUI = !showGUI;
					targetFadeAlpha = (showGUI ? 1f : 0f);
					displayTimer = 20f;
					scrollPosition = Vector2.zero;
					autoScrollTimer = 0f;
					autoScrollActive = false;
				}
			}
			string text = lastSceneType;
			if (currentSceneType != lastSceneType)
			{
				lastSceneType = currentSceneType;
				switch (currentSceneType)
				{
				case "Level":
					economyResetPending = true;
					UIShownOnce = false;
					showGUI = false;
					targetFadeAlpha = 0f;
					autoScrollTimer = 0f;
					autoScrollActive = false;
					if (text == "Shop")
					{
						showShopGUI = false;
						ShopEconomyUIShownOnce = false;
					}
					break;
				case "Lobby":
					if (text == "Shop")
					{
						showShopGUI = false;
						ShopEconomyUIShownOnce = false;
					}
					break;
				case "Shop":
					showGUI = false;
					targetFadeAlpha = 0f;
					autoScrollTimer = 0f;
					autoScrollActive = false;
					break;
				}
			}
			bool flag = economyResetPending;
			if (flag)
			{
				bool flag2 = ((currentSceneType == "Level" || currentSceneType == "Lobby") ? true : false);
				flag = flag2;
			}
			if (flag)
			{
				REPOConomyPlugin.ResetEconomy();
				economyResetPending = false;
			}
			if (showGUI && (REPOConomyPlugin.HasEconomy || currentSceneType == "Lobby"))
			{
				displayTimer -= Time.deltaTime;
				if (displayTimer <= 0f)
				{
					showGUI = false;
					targetFadeAlpha = 0f;
					autoScrollTimer = 0f;
					autoScrollActive = false;
				}
				bool flag3 = false;
				float num = Mathf.Max(0f, cachedContentHeight - cachedScrollableHeight);
				if (Input.GetKey((KeyCode)274))
				{
					scrollPosition.y += scrollSpeed * Time.deltaTime;
					scrollPosition.y = Mathf.Min(scrollPosition.y, num);
					flag3 = true;
					autoScrollTimer = 0f;
					autoScrollActive = false;
				}
				if (Input.GetKey((KeyCode)273))
				{
					scrollPosition.y -= scrollSpeed * Time.deltaTime;
					scrollPosition.y = Mathf.Max(0f, scrollPosition.y);
					flag3 = true;
					autoScrollTimer = 0f;
					autoScrollActive = false;
				}
				if (!flag3)
				{
					if (!autoScrollActive)
					{
						autoScrollTimer += Time.deltaTime;
						if (autoScrollTimer >= autoScrollDelay)
						{
							autoScrollActive = true;
						}
					}
					else
					{
						scrollPosition.y += autoScrollSpeed * Time.deltaTime;
						scrollPosition.y = Mathf.Min(scrollPosition.y, num);
						if (scrollPosition.y >= num)
						{
							autoScrollActive = false;
						}
					}
				}
			}
			if (showShopGUI && REPOConomyPlugin.HasShopEconomy)
			{
				shopDisplayTimer -= Time.deltaTime;
				if (shopDisplayTimer <= 0f)
				{
					showShopGUI = false;
				}
			}
		}

		private string GetCurrentSceneType()
		{
			if (SemiFunc.RunIsLevel())
			{
				return "Level";
			}
			if (SemiFunc.RunIsLobby())
			{
				return "Lobby";
			}
			if (SemiFunc.RunIsShop())
			{
				return "Shop";
			}
			return "Other";
		}

		public void ResetGUI()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			showGUI = true;
			targetFadeAlpha = 1f;
			displayTimer = 20f;
			scrollPosition = Vector2.zero;
			autoScrollTimer = 0f;
			autoScrollActive = false;
		}

		public void ShowGUI()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			showGUI = true;
			targetFadeAlpha = 1f;
			displayTimer = 20f;
			scrollPosition = Vector2.zero;
			autoScrollTimer = 0f;
			autoScrollActive = false;
		}

		public void ShowShopEconomyGUI()
		{
			showShopGUI = true;
			shopDisplayTimer = 15f;
		}

		private void OnGUI()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			if (showShopGUI && REPOConomyPlugin.HasShopEconomy && SemiFunc.RunIsShop())
			{
				DrawShopEconomyGUI();
			}
			if (!(fadeAlpha < 0.01f) && showGUI && (REPOConomyPlugin.HasEconomy || SemiFunc.RunIsLobby()) && (SemiFunc.RunIsLevel() || SemiFunc.RunIsLobby()))
			{
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, fadeAlpha);
				int currentLevel = REPOConomyPlugin.GetCurrentLevel();
				float num = (float)Screen.width / 2f;
				float num2 = (float)Screen.height * 0.12f;
				float num3 = Mathf.Min((float)Screen.width * 0.45f, 700f);
				float num4 = 500f;
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(num - num3 / 2f, num2, num3, num4);
				DrawGlowEffect(val);
				DrawModernBackground(val);
				DrawHeaderSection(val);
				DrawContentSection(val);
				DrawFooterSection(val, currentLevel);
				GUI.color = color;
			}
		}

		private void DrawShopEconomyGUI()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: 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_0208: Expected O, but got Unknown
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Expected O, but got Unknown
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Expected O, but got Unknown
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			bool num = value == "Russian";
			ShopEconomyType currentShopEconomy = REPOConomyPlugin.CurrentShopEconomy;
			string shopEconomyName = ShopEconomyManager.GetShopEconomyName(currentShopEconomy, value);
			string shopEconomyDescription = ShopEconomyManager.GetShopEconomyDescription(currentShopEconomy, value);
			string priceModifierText = ShopEconomyManager.GetPriceModifierText(value);
			Color shopEconomyColor = ShopEconomyManager.GetShopEconomyColor(currentShopEconomy);
			float num2 = Mathf.Clamp01(shopDisplayTimer / 2f);
			float num3 = ((shopDisplayTimer > 13f) ? ((15f - shopDisplayTimer) / 2f) : num2);
			num3 = Mathf.Clamp01(num3);
			float num4 = Mathf.Min((float)Screen.width * 0.4f, 500f);
			float num5 = 180f;
			float num6 = (float)Screen.width / 2f;
			float num7 = (float)Screen.height * 0.08f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num6 - num4 / 2f, num7, num4, num5);
			GUI.color = new Color(0.05f, 0.05f, 0.08f, 0.9f * num3);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			GUI.color = new Color(shopEconomyColor.r, shopEconomyColor.g, shopEconomyColor.b, 0.6f * num3);
			float num8 = 2f;
			GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, num8), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + ((Rect)(ref val)).height - num8, ((Rect)(ref val)).width, num8), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, num8, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - num8, ((Rect)(ref val)).y, num8, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			val2.normal.textColor = new Color(0.7f, 0.7f, 0.7f, num3);
			string text = (num ? "\ud83d\udcb0 ЭКОНОМИКА МАГАЗИНА" : "\ud83d\udcb0 SHOP ECONOMY");
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width, 25f), text, val2);
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 22,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			val3.normal.textColor = new Color(shopEconomyColor.r, shopEconomyColor.g, shopEconomyColor.b, num3);
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 40f, ((Rect)(ref val)).width, 35f), shopEconomyName, val3);
			GUIStyle val4 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 13,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)2,
				wordWrap = true
			};
			val4.normal.textColor = new Color(0.8f, 0.8f, 0.8f, num3);
			GUI.Label(new Rect(((Rect)(ref val)).x + 15f, ((Rect)(ref val)).y + 80f, ((Rect)(ref val)).width - 30f, 35f), shopEconomyDescription, val4);
			GUIStyle val5 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 16,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			Color textColor = default(Color);
			if (REPOConomyPlugin.ShopPriceMultiplier < 1f)
			{
				((Color)(ref textColor))..ctor(0.3f, 0.9f, 0.3f, num3);
			}
			else if (REPOConomyPlugin.ShopPriceMultiplier > 1f)
			{
				((Color)(ref textColor))..ctor(0.9f, 0.3f, 0.3f, num3);
			}
			else
			{
				((Color)(ref textColor))..ctor(0.7f, 0.7f, 0.7f, num3);
			}
			val5.normal.textColor = textColor;
			string text2 = (num ? "Цены: " : "Prices: ");
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 125f, ((Rect)(ref val)).width, 30f), text2 + priceModifierText, val5);
			GUIStyle val6 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 10,
				alignment = (TextAnchor)4
			};
			val6.normal.textColor = new Color(0.5f, 0.5f, 0.5f, num3 * 0.7f);
			string text3 = (num ? $"[{REPOConfig.UIToggleHotkey.Value}] для закрытия" : $"Press [{REPOConfig.UIToggleHotkey.Value}] to close");
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + num5 - 25f, ((Rect)(ref val)).width, 20f), text3, val6);
			GUI.color = Color.white;
		}

		private void DrawGlowEffect(Rect rect)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			float num = 30f * glowPulse;
			Rect val = new Rect(((Rect)(ref rect)).x - num, ((Rect)(ref rect)).y - num, ((Rect)(ref rect)).width + num * 2f, ((Rect)(ref rect)).height + num * 2f);
			GUI.color = new Color(0.3f, 0.6f, 1f, 0.15f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)glowTexture, (ScaleMode)0);
			GUI.color = Color.white;
		}

		private void DrawModernBackground(Rect rect)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			Rect val = new Rect(((Rect)(ref rect)).x - 2f, ((Rect)(ref rect)).y - 2f, ((Rect)(ref rect)).width + 4f, ((Rect)(ref rect)).height + 4f);
			GUI.color = new Color(0.3f, 0.6f, 1f, 0.4f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			GUI.color = new Color(1f, 1f, 1f, fadeAlpha);
			GUI.DrawTexture(rect, (Texture)(object)gradientTexture, (ScaleMode)0);
			DrawBorder(rect, new Color(0.2f, 0.4f, 0.8f, 0.6f * fadeAlpha), 1f);
		}

		private void DrawBorder(Rect rect, Color color, float thickness)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			GUI.color = color;
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, thickness), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - thickness, ((Rect)(ref rect)).width, thickness), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, thickness, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - thickness, ((Rect)(ref rect)).y, thickness, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
		}

		private void DrawHeaderSection(Rect mainRect)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Expected O, but got Unknown
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			KeyCode value2 = REPOConfig.UIToggleHotkey.Value;
			string text = ((object)(KeyCode)(ref value2)).ToString();
			string currentSceneType = GetCurrentSceneType();
			string text3;
			if (currentSceneType == "Lobby" || (currentSceneType == "Level" && ShowChancesInLevel))
			{
				string text2 = ((value == "Korean") ? "이벤트 확률" : ((!(value == "Russian")) ? "EVENT DROP CHANCES" : "ШАНСЫ ВЫПАДЕНИЯ СОБЫТИЙ"));
				text3 = text2;
			}
			else
			{
				string text2 = ((value == "Korean") ? "활성 이벤트" : ((!(value == "Russian")) ? "ACTIVE EVENTS" : "АКТИВНЫЕ СОБЫТИЯ"));
				text3 = text2;
			}
			string text4 = text3;
			Rect val = new Rect(((Rect)(ref mainRect)).x, ((Rect)(ref mainRect)).y, ((Rect)(ref mainRect)).width, 60f);
			GUI.color = new Color(0.15f, 0.25f, 0.4f, 0.5f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			GUI.color = Color.white;
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 28,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			val2.normal.textColor = new Color(0.7f, 0.9f, 1f, fadeAlpha);
			GUIStyle val3 = val2;
			GUI.color = new Color(0f, 0f, 0f, 0.5f * fadeAlpha);
			GUI.Label(new Rect(((Rect)(ref mainRect)).x + 2f, ((Rect)(ref mainRect)).y + 12f, ((Rect)(ref mainRect)).width, 40f), text4, val3);
			GUI.color = new Color(1f, 1f, 1f, fadeAlpha);
			GUI.Label(new Rect(((Rect)(ref mainRect)).x, ((Rect)(ref mainRect)).y + 10f, ((Rect)(ref mainRect)).width, 40f), text4, val3);
			GUIStyle val4 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 12,
				alignment = (TextAnchor)4
			};
			val4.normal.textColor = new Color(0.6f, 0.8f, 1f, 0.7f * fadeAlpha);
			GUIStyle val5 = val4;
			text3 = ((value == "Korean") ? ("[" + text + "] 키를 눌러 전환") : ((!(value == "Russian")) ? ("Press [" + text + "] to toggle") : ("Нажмите [" + text + "] для переключения")));
			string text5 = text3;
			GUI.Label(new Rect(((Rect)(ref mainRect)).x, ((Rect)(ref mainRect)).y + 40f, ((Rect)(ref mainRect)).width, 20f), text5, val5);
			Rect val6 = new Rect(((Rect)(ref mainRect)).x, ((Rect)(ref mainRect)).y + 58f, ((Rect)(ref mainRect)).width, 2f);
			GUI.color = new Color(0.3f, 0.6f, 1f, 0.6f * fadeAlpha * glowPulse);
			GUI.DrawTexture(val6, (Texture)(object)Texture2D.whiteTexture);
		}

		private void DrawContentSection(Rect mainRect)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref mainRect)).x + 15f, ((Rect)(ref mainRect)).y + 70f, ((Rect)(ref mainRect)).width - 30f, ((Rect)(ref mainRect)).height - 130f);
			cachedScrollableHeight = ((Rect)(ref val)).height;
			string currentSceneType = GetCurrentSceneType();
			cachedContentHeight = CalculateActualContentHeight(((Rect)(ref val)).width - 20f, currentSceneType);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref val)).width - 20f, cachedContentHeight);
			GUI.color = new Color(0.08f, 0.08f, 0.12f, 0.6f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			GUI.color = Color.white;
			scrollPosition = GUI.BeginScrollView(val, scrollPosition, val2, false, false, GUIStyle.none, GUIStyle.none);
			float yOffset = 10f;
			if (currentSceneType == "Lobby" || (currentSceneType == "Level" && ShowChancesInLevel))
			{
				yOffset = DrawChancesContent(val2, yOffset);
			}
			else
			{
				yOffset = DrawActiveEventsContent(val2, yOffset);
			}
			GUI.EndScrollView();
			if (cachedContentHeight > cachedScrollableHeight)
			{
				DrawScrollIndicator(val);
			}
		}

		private void DrawScrollIndicator(Rect area)
		{
			//IL_005c: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(1f, cachedContentHeight - cachedScrollableHeight);
			float num2 = scrollPosition.y / num;
			float num3 = 40f;
			float num4 = ((Rect)(ref area)).y + num2 * (((Rect)(ref area)).height - num3);
			Rect val = new Rect(((Rect)(ref area)).x + ((Rect)(ref area)).width - 6f, num4, 4f, num3);
			GUI.color = new Color(0.3f, 0.6f, 1f, 0.7f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
		}

		private float CalculateActualContentHeight(float contentWidth, string sceneType)
		{
			float num = 10f;
			_ = REPOConfig.UILanguage.Value == "Russian";
			if (sceneType == "Lobby" || (sceneType == "Level" && ShowChancesInLevel))
			{
				if (REPOConfig.EnableSharedPool.Value)
				{
					num += 35f;
					Dictionary<EventType, float> dictionary = new Dictionary<EventType, float>();
					foreach (EventType value in Enum.GetValues(typeof(EventType)))
					{
						dictionary[value] = REPOEventManager.GetSharedPoolWeight(value);
					}
					num += (float)(dictionary.Count * 32);
					num += 15f;
				}
				else
				{
					EventCategory[] array = new EventCategory[4]
					{
						EventCategory.LootModifier,
						EventCategory.EnemyModifier,
						EventCategory.PlayerModifier,
						EventCategory.EnvironmentModifier
					};
					foreach (EventCategory category in array)
					{
						List<GameEvent> list = REPOEventManager.AllEvents.Where((GameEvent e) => e.category == category && REPOConfig.ModifierEnables["Enable " + e.id].Value).ToList();
						if (list.Count == 0)
						{
							continue;
						}
						num += 35f;
						Dictionary<EventType, float> dictionary2 = new Dictionary<EventType, float>();
						foreach (GameEvent item in list)
						{
							EventType eventType2 = item.eventType;
							if (!dictionary2.ContainsKey(eventType2))
							{
								dictionary2[eventType2] = 0f;
							}
							dictionary2[eventType2] += REPOEventManager.GetEventWeight(eventType2);
						}
						num += (float)(dictionary2.Count * 32);
						num += 10f;
					}
				}
			}
			else
			{
				num += 35f;
				num += 90f;
				if (REPOEventManager.ActiveEvents.Count > 0)
				{
					num += 35f;
					num += (float)(REPOEventManager.ActiveEvents.Count * 68);
					num += 10f;
				}
				if (sceneType == "Level" && (Object)(object)RunManager.instance != (Object)null && REPOConfig.EnableLevelScaling.Value)
				{
					num += 35f;
					num += 110f;
				}
				if (sceneType == "Level" && (Object)(object)RunManager.instance != (Object)null)
				{
					int level = RunManager.instance.levelsCompleted + 1;
					float num2 = CalculateScaling(level, REPOConfig.EnableEnemyHPScaling.Value, REPOConfig.EnemyHPStartLevel.Value, REPOConfig.EnemyHPMultiplier.Value, REPOConfig.EnemyHPUseExponentialScaling.Value, REPOConfig.EnemyHPMaxLevel.Value);
					float num3 = CalculateScaling(level, REPOConfig.EnableEnemyCapScaling.Value, REPOConfig.EnemyCapStartLevel.Value, REPOConfig.EnemyCapMultiplier.Value, REPOConfig.EnemyCapUseExponentialScaling.Value, REPOConfig.EnemyCapMaxLevel.Value);
					float num4 = CalculateScaling(level, REPOConfig.EnableMapValueScaling.Value, REPOConfig.MapValueStartLevel.Value, REPOConfig.MapValueMultiplier.Value, REPOConfig.MapValueUseExponentialScaling.Value, REPOConfig.MapValueMaxLevel.Value);
					if (num2 > 1f || num3 > 1f || num4 > 1f)
					{
						num += 35f;
						float num5 = 10f;
						if (num2 > 1f)
						{
							num5 += 25f;
						}
						if (num3 > 1f)
						{
							num5 += 25f;
						}
						if (num4 > 1f)
						{
							num5 += 25f;
						}
						num += num5 + 20f;
					}
				}
			}
			return num + 20f;
		}

		private float DrawChancesContent(Rect viewRect, float yOffset)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			bool isRu = REPOConfig.UILanguage.Value == "Russian";
			yOffset = ((!REPOConfig.EnableSharedPool.Value) ? DrawCategoryChances(viewRect, yOffset, isRu) : DrawSharedPoolChances(viewRect, yOffset, isRu));
			return yOffset;
		}

		private float DrawSharedPoolChances(Rect viewRect, float yOffset, bool isRu)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			string text = ((value == "Korean") ? "공유 풀" : ((!(value == "Russian")) ? "SHARED POOL" : "ОБЩИЙ ПУЛ"));
			string title = text;
			yOffset = DrawModernCategory(viewRect, yOffset, title, new Color(1f, 0.8f, 0.2f, fadeAlpha));
			Dictionary<EventType, float> dictionary = new Dictionary<EventType, float>();
			foreach (EventType value2 in Enum.GetValues(typeof(EventType)))
			{
				dictionary[value2] = REPOEventManager.GetSharedPoolWeight(value2);
			}
			float num = dictionary.Values.Sum();
			foreach (KeyValuePair<EventType, float> item in dictionary.OrderBy((KeyValuePair<EventType, float> k) => (int)k.Key))
			{
				EventType key = item.Key;
				float chance = item.Value / num * 100f;
				string eventIcon = GetEventIcon(key);
				string eventTypeName = GetEventTypeName(key, isRu);
				yOffset = DrawModernChanceItem(viewRect, yOffset, eventIcon, eventTypeName, chance, REPOEventManager.GetEventColor(key));
			}
			return yOffset + 15f;
		}

		private float DrawCategoryChances(Rect viewRect, float yOffset, bool isRu)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			EventCategory[] array = new EventCategory[4]
			{
				EventCategory.LootModifier,
				EventCategory.EnemyModifier,
				EventCategory.PlayerModifier,
				EventCategory.EnvironmentModifier
			};
			foreach (EventCategory category in array)
			{
				List<GameEvent> list = REPOEventManager.AllEvents.Where((GameEvent e) => e.category == category && REPOConfig.ModifierEnables["Enable " + e.id].Value).ToList();
				if (list.Count == 0)
				{
					continue;
				}
				string categoryName = GetCategoryName(category, isRu);
				yOffset = DrawModernCategory(viewRect, yOffset, categoryName, GetCategoryColor(category));
				Dictionary<EventType, float> dictionary = new Dictionary<EventType, float>();
				foreach (GameEvent item in list)
				{
					EventType eventType = item.eventType;
					if (!dictionary.ContainsKey(eventType))
					{
						dictionary[eventType] = 0f;
					}
					dictionary[eventType] += REPOEventManager.GetEventWeight(eventType);
				}
				float num = dictionary.Values.Sum();
				foreach (KeyValuePair<EventType, float> item2 in dictionary.OrderBy((KeyValuePair<EventType, float> k) => (int)k.Key))
				{
					EventType key = item2.Key;
					float chance = item2.Value / num * 100f;
					string eventIcon = GetEventIcon(key);
					string eventTypeName = GetEventTypeName(key, isRu);
					yOffset = DrawModernChanceItem(viewRect, yOffset, eventIcon, eventTypeName, chance, REPOEventManager.GetEventColor(key));
				}
				yOffset += 10f;
			}
			return yOffset;
		}

		private float DrawActiveEventsContent(Rect viewRect, float yOffset)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			bool isRu = REPOConfig.UILanguage.Value == "Russian";
			string currentSceneType = GetCurrentSceneType();
			yOffset = DrawEconomySection(viewRect, yOffset, isRu);
			yOffset = DrawModifiersSection(viewRect, yOffset, isRu);
			if (currentSceneType == "Level" && (Object)(object)RunManager.instance != (Object)null && REPOConfig.EnableLevelScaling.Value)
			{
				yOffset = DrawLevelScalingSection(viewRect, yOffset, isRu);
			}
			if (currentSceneType == "Level" && (Object)(object)RunManager.instance != (Object)null)
			{
				yOffset = DrawMapScalingSection(viewRect, yOffset, isRu);
			}
			return yOffset;
		}

		private float DrawEconomySection(Rect viewRect, float yOffset, bool isRu)
		{
			//IL_007a: 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)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			string economyName = REPOConomyPlugin.GetEconomyName();
			string economyFlavor = REPOConomyPlugin.GetEconomyFlavor();
			string text = REPOConomyPlugin.MinPercent.ToString("+#0.##;-#0.##;0");
			string text2 = REPOConomyPlugin.MaxPercent.ToString("+#0.##;-#0.##;0");
			string text3 = ((value == "Korean") ? "경제" : ((!(value == "Russian")) ? "ECONOMY" : "ЭКОНОМИКА"));
			string title = text3;
			yOffset = DrawModernCategory(viewRect, yOffset, title, new Color(0.2f, 0.8f, 0.4f, fadeAlpha));
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(10f, yOffset, ((Rect)(ref viewRect)).width - 20f, 80f);
			DrawModernCard(rect, REPOConomyPlugin.CurrentEconomyColor);
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 20,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)1
			};
			val.normal.textColor = new Color(1f, 1f, 1f, fadeAlpha);
			GUIStyle val2 = val;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 10f, ((Rect)(ref rect)).width - 20f, 25f), economyName ?? "", val2);
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 16,
				alignment = (TextAnchor)1
			};
			val3.normal.textColor = new Color(0.8f, 0.9f, 1f, fadeAlpha);
			GUIStyle val4 = val3;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 35f, ((Rect)(ref rect)).width - 20f, 20f), text + "% — " + text2 + "%", val4);
			GUIStyle val5 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 12,
				alignment = (TextAnchor)1
			};
			val5.normal.textColor = new Color(0.7f, 0.7f, 0.7f, fadeAlpha);
			val5.wordWrap = true;
			GUIStyle val6 = val5;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 55f, ((Rect)(ref rect)).width - 20f, 20f), economyFlavor, val6);
			return yOffset + 90f;
		}

		private float DrawModifiersSection(Rect viewRect, float yOffset, bool isRu)
		{
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			int count = REPOEventManager.ActiveEvents.Count;
			if (count == 0)
			{
				return yOffset;
			}
			int count2 = REPOEventManager.ForcedEvents.Count;
			int num = count - count2;
			string text = ((value == "Korean") ? "수정자" : ((!(value == "Russian")) ? "MODIFIERS" : "МОДИФИКАТОРЫ"));
			string text2 = text;
			if (count2 > 0)
			{
				text = ((value == "Korean") ? "선택됨" : ((!(value == "Russian")) ? "selected" : "выбрано"));
				string text3 = text;
				text = ((value == "Korean") ? "강제" : ((!(value == "Russian")) ? "forced" : "принудительно"));
				string text4 = text;
				text2 += $" ({num} {text3}, {count2} {text4})";
			}
			yOffset = DrawModernCategory(viewRect, yOffset, text2, new Color(0.8f, 0.3f, 1f, fadeAlpha));
			foreach (GameEvent activeEvent in REPOEventManager.ActiveEvents)
			{
				bool isForced = REPOEventManager.ForcedEvents.Contains(activeEvent);
				yOffset = DrawModifierCard(viewRect, yOffset, activeEvent, isRu, isForced);
			}
			return yOffset + 10f;
		}

		private float DrawModifierCard(Rect viewRect, float yOffset, GameEvent evt, bool isRu, bool isForced = false)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			string text = evt.GetName();
			string description = evt.GetDescription();
			if (isForced)
			{
				text = text ?? "";
			}
			float num = 60f;
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(10f, yOffset, ((Rect)(ref viewRect)).width - 20f, num);
			if (!isForced)
			{
				_ = evt.color;
			}
			else
			{
				new Color(evt.color.r * 0.7f, evt.color.g * 0.7f, evt.color.b * 0.7f, evt.color.a);
			}
			DrawModernCard(rect, evt.color);
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 16,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)0
			};
			val.normal.textColor = new Color(1f, 1f, 1f, fadeAlpha);
			GUIStyle val2 = val;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, ((Rect)(ref rect)).y + 8f, ((Rect)(ref rect)).width - 30f, 25f), text, val2);
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 12,
				alignment = (TextAnchor)0
			};
			val3.normal.textColor = new Color(0.8f, 0.8f, 0.8f, fadeAlpha);
			val3.wordWrap = true;
			GUIStyle val4 = val3;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, ((Rect)(ref rect)).y + 30f, ((Rect)(ref rect)).width - 30f, 26f), description, val4);
			return yOffset + num + 8f;
		}

		private float DrawLevelScalingSection(Rect viewRect, float yOffset, bool isRu)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			string text = ((value == "Korean") ? "레벨 스케일링" : ((!(value == "Russian")) ? "LEVEL SCALING" : "СКЕЙЛИНГ УРОВНЕЙ"));
			string title = text;
			yOffset = DrawModernCategory(viewRect, yOffset, title, new Color(0.2f, 0.6f, 1f, fadeAlpha));
			int levelsCompleted = RunManager.instance.levelsCompleted;
			int scaledModuleAmount = LevelScalingImprovements.GetScaledModuleAmount(levelsCompleted);
			int scaledExtractionAmount = LevelScalingImprovements.GetScaledExtractionAmount(levelsCompleted);
			float scaledHaulMultiplier = LevelScalingImprovements.GetScaledHaulMultiplier(levelsCompleted);
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(10f, yOffset, ((Rect)(ref viewRect)).width - 20f, 100f);
			DrawModernCard(rect, new Color(0.2f, 0.6f, 1f, 0.3f));
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				alignment = (TextAnchor)0
			};
			val.normal.textColor = new Color(0.9f, 0.9f, 1f, fadeAlpha);
			GUIStyle val2 = val;
			float num = ((Rect)(ref rect)).y + 10f;
			float num2 = 20f;
			text = ((value == "Korean") ? "레벨" : ((!(value == "Russian")) ? "Level" : "Уровень"));
			string arg = text;
			text = ((value == "Korean") ? "모듈" : ((!(value == "Russian")) ? "Modules" : "Модули"));
			string arg2 = text;
			text = ((value == "Korean") ? "추출" : ((!(value == "Russian")) ? "Extractions" : "Экстракции"));
			string arg3 = text;
			text = ((value == "Korean") ? "운반" : ((!(value == "Russian")) ? "Haul" : "Хаул"));
			string arg4 = text;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num, ((Rect)(ref rect)).width - 30f, num2), $"\ud83d\udcca {arg}: {levelsCompleted + 1}", val2);
			num += num2;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num, ((Rect)(ref rect)).width - 30f, num2), $"\ud83d\udd27 {arg2}: {scaledModuleAmount}", val2);
			num += num2;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num, ((Rect)(ref rect)).width - 30f, num2), $"\ud83d\udeaa {arg3}: {scaledExtractionAmount}", val2);
			num += num2;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num, ((Rect)(ref rect)).width - 30f, num2), $"\ud83d\udcb0 {arg4}: {scaledHaulMultiplier:F2}x", val2);
			return yOffset + 110f;
		}

		private float DrawMapScalingSection(Rect viewRect, float yOffset, bool isRu)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			int level = RunManager.instance.levelsCompleted + 1;
			float num = CalculateScaling(level, REPOConfig.EnableEnemyHPScaling.Value, REPOConfig.EnemyHPStartLevel.Value, REPOConfig.EnemyHPMultiplier.Value, REPOConfig.EnemyHPUseExponentialScaling.Value, REPOConfig.EnemyHPMaxLevel.Value);
			float num2 = CalculateScaling(level, REPOConfig.EnableEnemyCapScaling.Value, REPOConfig.EnemyCapStartLevel.Value, REPOConfig.EnemyCapMultiplier.Value, REPOConfig.EnemyCapUseExponentialScaling.Value, REPOConfig.EnemyCapMaxLevel.Value);
			float num3 = CalculateScaling(level, REPOConfig.EnableMapValueScaling.Value, REPOConfig.MapValueStartLevel.Value, REPOConfig.MapValueMultiplier.Value, REPOConfig.MapValueUseExponentialScaling.Value, REPOConfig.MapValueMaxLevel.Value);
			if (!(num > 1f) && !(num2 > 1f) && !(num3 > 1f))
			{
				return yOffset;
			}
			string text = ((value == "Korean") ? "맵 스케일링" : ((!(value == "Russian")) ? "MAP SCALING" : "СКЕЙЛИНГ КАРТЫ"));
			string title = text;
			yOffset = DrawModernCategory(viewRect, yOffset, title, new Color(1f, 0.4f, 0.4f, fadeAlpha));
			float num4 = 0f;
			if (num > 1f)
			{
				num4 += 25f;
			}
			if (num2 > 1f)
			{
				num4 += 25f;
			}
			if (num3 > 1f)
			{
				num4 += 25f;
			}
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(10f, yOffset, ((Rect)(ref viewRect)).width - 20f, num4 + 10f);
			DrawModernCard(rect, new Color(1f, 0.4f, 0.4f, 0.2f));
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 13,
				alignment = (TextAnchor)0
			};
			val.normal.textColor = new Color(1f, 0.9f, 0.9f, fadeAlpha);
			GUIStyle val2 = val;
			float num5 = ((Rect)(ref rect)).y + 8f;
			text = ((value == "Korean") ? "적 HP" : ((!(value == "Russian")) ? "Enemy HP" : "HP врагов"));
			string arg = text;
			text = ((value == "Korean") ? "적 한도" : ((!(value == "Russian")) ? "Enemy Cap" : "Лимит врагов"));
			string arg2 = text;
			text = ((value == "Korean") ? "맵 가치" : ((!(value == "Russian")) ? "Map Value" : "Стоимость карты"));
			string arg3 = text;
			if (num > 1f)
			{
				GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num5, ((Rect)(ref rect)).width - 30f, 22f), $"\ud83d\udc79 {arg}: x{num:F2} (+{(num - 1f) * 100f:F0}%)", val2);
				num5 += 25f;
			}
			if (num2 > 1f)
			{
				GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num5, ((Rect)(ref rect)).width - 30f, 22f), $"\ud83d\udc79 {arg2}: x{num2:F2} (+{(num2 - 1f) * 100f:F0}%)", val2);
				num5 += 25f;
			}
			if (num3 > 1f)
			{
				GUI.Label(new Rect(((Rect)(ref rect)).x + 15f, num5, ((Rect)(ref rect)).width - 30f, 22f), $"\ud83d\udc8e {arg3}: x{num3:F2} (+{(num3 - 1f) * 100f:F0}%)", val2);
			}
			return yOffset + num4 + 20f;
		}

		private float CalculateScaling(int level, bool enabled, int startLevel, float multiplier, bool exponential, int maxLevel)
		{
			if (!enabled || level < startLevel)
			{
				return 1f;
			}
			int num = Mathf.Min(level, maxLevel);
			if (exponential)
			{
				return Mathf.Pow(multiplier, (float)(num - startLevel + 1));
			}
			return 1f + (float)(num - startLevel) * (multiplier - 1f);
		}

		private void DrawModernCard(Rect rect, Color accentColor)
		{
			//IL_0028: 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_0078: 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)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			Rect val = new Rect(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height);
			GUI.color = new Color(0f, 0f, 0f, 0.3f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			GUI.color = new Color(0.1f, 0.12f, 0.15f, 0.9f * fadeAlpha);
			GUI.DrawTexture(rect, (Texture)(object)bgTexture);
			Rect val2 = new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 4f, ((Rect)(ref rect)).height);
			GUI.color = new Color(accentColor.r, accentColor.g, accentColor.b, 0.8f * fadeAlpha);
			GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
			DrawBorder(rect, new Color(0.3f, 0.3f, 0.4f, 0.5f * fadeAlpha), 1f);
			GUI.color = Color.white;
		}

		private float DrawModernCategory(Rect viewRect, float yOffset, string title, Color color)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0051: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 18,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)0
			};
			val.normal.textColor = new Color(color.r, color.g, color.b, fadeAlpha);
			GUIStyle val2 = val;
			GUI.color = new Color(color.r, color.g, color.b, 0.3f * fadeAlpha);
			GUI.Label(new Rect(12f, yOffset + 2f, ((Rect)(ref viewRect)).width - 20f, 25f), title, val2);
			GUI.color = Color.white;
			GUI.Label(new Rect(10f, yOffset, ((Rect)(ref viewRect)).width - 20f, 25f), title, val2);
			Rect val3 = new Rect(10f, yOffset + 27f, ((Rect)(ref viewRect)).width - 20f, 2f);
			GUI.color = new Color(color.r, color.g, color.b, 0.4f * fadeAlpha);
			GUI.DrawTexture(val3, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
			return yOffset + 35f;
		}

		private float DrawModernChanceItem(Rect viewRect, float yOffset, string icon, string name, float chance, Color color)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_0226: 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_0260: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(15f, yOffset, ((Rect)(ref viewRect)).width - 30f, 28f);
			GUI.color = new Color(0.08f, 0.1f, 0.12f, 0.7f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			float num = (((Rect)(ref viewRect)).width - 30f) * (chance / 100f);
			Rect val2 = new Rect(15f, yOffset, num, 28f);
			GUI.color = new Color(color.r * 0.3f, color.g * 0.3f, color.b * 0.3f, 0.4f * fadeAlpha);
			GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 16,
				alignment = (TextAnchor)3
			};
			val3.normal.textColor = new Color(1f, 1f, 1f, fadeAlpha);
			GUIStyle val4 = val3;
			GUI.color = Color.white;
			GUI.Label(new Rect(((Rect)(ref val)).x + 8f, ((Rect)(ref val)).y, 30f, ((Rect)(ref val)).height), icon, val4);
			GUIStyle val5 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				alignment = (TextAnchor)3
			};
			val5.normal.textColor = new Color(color.r, color.g, color.b, fadeAlpha);
			GUIStyle val6 = val5;
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 80f, ((Rect)(ref val)).height), name, val6);
			GUIStyle val7 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)5
			};
			val7.normal.textColor = new Color(1f, 1f, 1f, fadeAlpha);
			GUIStyle val8 = val7;
			GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 10f, ((Rect)(ref val)).height), $"{chance:F1}%", val8);
			DrawBorder(val, new Color(0.2f, 0.2f, 0.3f, 0.4f * fadeAlpha), 1f);
			return yOffset + 32f;
		}

		private void DrawFooterSection(Rect mainRect, int level)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			string value = REPOConfig.UILanguage.Value;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref mainRect)).x, ((Rect)(ref mainRect)).y + ((Rect)(ref mainRect)).height - 50f, ((Rect)(ref mainRect)).width, 50f);
			GUI.color = new Color(0.12f, 0.15f, 0.2f, 0.8f * fadeAlpha);
			GUI.DrawTexture(val, (Texture)(object)bgTexture);
			Rect val2 = new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 1f);
			GUI.color = new Color(0.3f, 0.6f, 1f, 0.5f * fadeAlpha);
			GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
			string text = ((value == "Korean") ? "난이도" : ((!(value == "Russian")) ? "Difficulty" : "Сложность"));
			string text2 = text;
			text = ((value == "Korean") ? "레벨" : ((!(value == "Russian")) ? "Level" : "Уровень"));
			string text3 = text;
			text = ((value == "Korean") ? "플레이어" : ((!(value == "Russian")) ? "Players" : "Игроки"));
			string text4 = text;
			string text5 = "Seed";
			REPODifficultyManager.GetDifficultyColor();
			string difficultyText = REPODifficultyManager.GetDifficultyText();
			string currentSeed = REPOSeedManager.CurrentSeed;
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				alignment = (TextAnchor)4
			};
			val3.normal.textColor = new Color(0.8f, 0.9f, 1f, fadeAlpha);
			GUIStyle val4 = val3;
			string text6 = $"{text2}: {difficultyText} ({REPODifficultyManager.CurrentDifficulty:F1}/{REPOConfig.DifficultyMaxCap.Value}) | {text3}: {level} | {text5}: {currentSeed} | {text4}: {GameDirector.instance.PlayerList.Count}";
			GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 15f, ((Rect)(ref val)).width - 20f, 30f), text6, val4);
		}

		private string GetEventIcon(EventType type)
		{
			return type switch
			{
				EventType.VeryGood => "\ud83d\udfe2", 
				EventType.Good => "\ud83d\udfe1", 
				EventType.Neutral => "⚪", 
				EventType.Bad => "\ud83d\udfe0", 
				EventType.VeryBad => "\ud83d\udd34", 
				_ => "⚫", 
			};
		}

		private string GetEventTypeName(EventType type, bool isRu)
		{
			string value = REPOConfig.UILanguage.Value;
			return type switch
			{
				EventType.VeryGood => (value == "Korean") ? "매우 좋음" : ((!(value == "Russian")) ? "Very Good" : "Очень Хорошо"), 
				EventType.Good => (value == "Korean") ? "좋음" : ((!(value == "Russian")) ? "Good" : "Хорошо"), 
				EventType.Neutral => (value == "Korean") ? "중립" : ((!(value == "Russian")) ? "Neutral" : "Нейтрально"), 
				EventType.Bad => (value == "Korean") ? "나쁨" : ((!(value == "Russian")) ? "Bad" : "Плохо"), 
				EventType.VeryBad => (value == "Korean") ? "매우 나쁨" : ((!(value == "Russian")) ? "Very Bad" : "Очень Плохо"), 
				_ => "Unknown", 
			};
		}

		private string GetCategoryName(EventCategory category, bool isRu)
		{
			string value = REPOConfig.UILanguage.Value;
			return category switch
			{
				EventCategory.LootModifier => (value == "Korean") ? "전리품" : ((!(value == "Russian")) ? "Loot" : "Лут"), 
				EventCategory.EnemyModifier => (value == "Korean") ? "적" : ((!(value == "Russian")) ? "Enemy" : "Враги"), 
				EventCategory.PlayerModifier => (value == "Korean") ? "플레이어" : ((!(value == "Russian")) ? "Player" : "Игрок"), 
				EventCategory.EnvironmentModifier => (value == "Korean") ? "환경" : ((!(value == "Russian")) ? "Environment" : "Окружение"), 
				_ => "Unknown", 
			};
		}

		private Color GetCategoryColor(EventCategory category)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(category switch
			{
				EventCategory.LootModifier => new Color(1f, 0.8f, 0.2f), 
				EventCategory.EnemyModifier => new Color(1f, 0.3f, 0.3f), 
				EventCategory.PlayerModifier => new Color(0.3f, 0.7f, 1f), 
				EventCategory.EnvironmentModifier => new Color(0.5f, 1f, 0.5f), 
				_ => Color.white, 
			});
		}
	}
	[HarmonyPatch(typeof(EnemyDirector))]
	public static class EnemyDirectorSeededPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void AwakePrefix()
		{
			REPOSeedManager.ResetEnemyRandom();
		}

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void StartPrefix()
		{
			Random.InitState(REPOSeedManager.EnemyNext());
		}

		[HarmonyPatch("PickEnemies")]
		[HarmonyPrefix]
		public static bool PickEnemiesPrefix(EnemyDirector __instance, List<EnemySetup> _enemiesList)
		{
			Random.InitState(REPOSeedManager.EnemyNext());
			List<EnemySetup> list = AccessTools.Field(typeof(EnemyDirector), "enemyList").GetValue(__instance) as List<EnemySetup>;
			List<EnemySetup> list2 = AccessTools.Field(typeof(EnemyDirector), "enemyListCurrent").GetValue(__instance) as List<EnemySetup>;
			int num = DataDirector.instance.SettingValueFetch((Setting)31);
			ListExtension.Shuffle<EnemySetup>((IList<EnemySetup>)_enemiesList);
			EnemySetup val = null;
			float num2 = -1f;
			foreach (EnemySetup _enemies in _enemiesList)
			{
				if ((_enemies.levelsCompletedCondition && (RunManager.instance.levelsCompleted < _enemies.levelsCompletedMin || (_enemies.levelsCompletedMax != 0 && RunManager.instance.levelsCompleted > _enemies.levelsCompletedMax))) || num < _enemies.runsPlayed)
				{
					continue;
				}
				int num3 = 0;
				foreach (EnemySetup item in RunManager.instance.enemiesSpawned)
				{
					if ((Object)(object)item == (Object)(object)_enemies)
					{
						num3++;
					}
				}
				int num4 = 0;
				foreach (EnemySetup item2 in list)
				{
					if ((Object)(object)item2 == (Object)(object)_enemies)
					{
						num4++;
					}
				}
				float num5 = 100f;
				if (Object.op_Implicit((Object)(object)_enemies.rarityPreset))
				{
					num5 = _enemies.rarityPreset.chance;
				}
				float num6 = Mathf.Max(1f, num5 - 30f * (float)num3 - 10f * (float)num4);
				float num7 = Random.Range(0f, num6);
				if (num7 > num2)
				{
					val = _enemies;
					num2 = num7;
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				list2.Add(val);
				list.Add(val);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(EnemyParent))]
	public static class EnemyParentSeededPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void AwakePrefix(EnemyParent __instance)
		{
			if (!REPOSeedManager.EnemyOrbSeeds.ContainsKey(__instance))
			{
				int value = REPOSeedManager.ValuableNext();
				REPOSeedManager.EnemyOrbSeeds.Add(__instance, value);
			}
		}

		[HarmonyPatch("Despawn")]
		[HarmonyPrefix]
		public static void DespawnPrefix(EnemyParent __instance)
		{
			if (REPOSeedManager.EnemyOrbSeeds.ContainsKey(__instance))
			{
				REPOSeedManager.ScheduledOrbSeed = REPOSeedManager.EnemyOrbSeeds[__instance];
				REPOSeedManager.EnemyOrbSeeds[__instance] = REPOSeedManager.ValuableNext();
			}
		}
	}
	public static class EnemyScaling
	{
		[HarmonyPatch(typeof(EnemyHealth), "OnSpawn")]
		public static class Patch_EnemyHealth_OnSpawn
		{
			private static Dictionary<EnemyHealth, int> originalHealthValues = new Dictionary<EnemyHealth, int>();

			private static readonly FieldInfo FI_healthCurrent = AccessTools.Field(typeof(EnemyHealth), "healthCurrent");

			public static void Reset()
			{
				originalHealthValues.Clear();
				REPOConomyPlugin.Logger.LogInfo((object)"[EnemyScaling] Dictionary cleared");
			}

			private static void Postfix(EnemyHealth __instance)
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer() || !REPOConfig.EnableEnemyHPScaling.Value || (Object)(object)RunManager.instance == (Object)null)
				{
					return;
				}
				int num = RunManager.instance.levelsCompleted + 1;
				int value = REPOConfig.EnemyHPStartLevel.Value;
				int value2 = REPOConfig.EnemyHPScalingLevelCap.Value;
				int num2 = Mathf.Min(num, value2);
				if (num2 >= value)
				{
					if (!originalHealthValues.ContainsKey(__instance))
					{
						originalHealthValues[__instance] = __instance.health;
						REPOConomyPlugin.Logger.LogInfo((object)$"[EnemyScaling] Saved original HP: {__instance.health} for enemy");
					}
					int num3 = originalHealthValues[__instance];
					float num4 = ((!REPOConfig.EnemyHPUseExponentialScaling.Value) ? (1f + (float)(num2 - value) * (REPOConfig.EnemyHPMultiplier.Value - 1f)) : Mathf.Pow(REPOConfig.EnemyHPMultiplier.Value, (float)(num2 - value + 1)));
					int num5 = (__instance.health = Mathf.RoundToInt((float)num3 * num4));
					FI_healthCurrent.SetValue(__instance, num5);
					REPOConomyPlugin.Logger.LogInfo((object)$"[EnemyScaling] Enemy HP scaled: {num5} (original: {num3}, multiplier: {num4:F3}, level: {num}, effective: {num2})");
				}
			}
		}

		[HarmonyPatch(typeof(EnemyDirector), "AmountSetup")]
		public static class Patch_EnemyDirector_AmountSetup
		{
			private static void Postfix(EnemyDirector __instance)
			{
				if (!SemiFunc.IsMasterClientOrSingleplayer() || !REPOConfig.EnableEnemyCapScaling.Value || (Object)(object)RunManager.instance == (Object)null)
				{
					return;
				}
				int num = RunManager.instance.levelsCompleted + 1;
				int value = REPOConfig.EnemyCapStartLevel.Value;
				int value2 = REPOConfig.EnemyCapScalingLevelCap.Value;
				int num2 = Mathf.Min(num, value2);
				if (num2 < value)
				{
					return;
				}
				int num3 = (int)FI_totalAmount.GetValue(__instance);
				float num4 = ((!REPOConfig.EnemyCapUseExponentialScaling.Value) ? (1f + (float)(num2 - value) * (REPOConfig.EnemyCapMultiplier.Value - 1f)) : Mathf.Pow(REPOConfig.EnemyCapMultiplier.Value, (float)(num2 - value + 1)));
				int num5 = Mathf.RoundToInt((float)num3 * num4);
				FI_totalAmount.SetValue(__instance, num5);
				List<EnemySetup> list = (List<EnemySetup>)AccessTools.Field(typeof(EnemyDirector), "enemyList").GetValue(__instance);
				int count = list.Count;
				int num6 = num5 - num3;
				if (count > 0)
				{
					for (int i = 0; i < num6; i++)
					{
						int index = REPOSeedManager.Range(0, count);
						list.Add(list[index]);
					}
				}
				REPOConomyPlugin.Logger.LogInfo((object)$"[EnemyScaling] Enemy cap scaled: {num5} (original: {num3}, multiplier: {num4:F3}, level: {num}, effective: {num2}), enemyList: {count} -> {list.Count}");
			}
		}

		private static readonly FieldInfo FI_totalAmount = AccessTools.Field(typeof(EnemyDirector), "totalAmount");
	}
	public static class ItemBundlesCompat
	{
		private static bool? _isInstalled;

		private static object _itemBundlesInstance;

		private static FieldInfo _itemDictionaryShopField;

		private static FieldInfo _blacklistField;

		public static bool IsInstalled
		{
			get
			{
				if (!_isInstalled.HasValue)
				{
					_isInstalled = Chainloader.PluginInfos.ContainsKey("SeroRonin.ItemBundles");
					if (_isInstalled.Value)
					{
						InitializeReflection();
					}
				}
				return _isInstalled.Value;
			}
		}

		private static void InitializeReflection()
		{
			try
			{
				Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ItemBundles");
				if (assembly != null)
				{
					Type type = assembly.GetType("ItemBundles.ItemBundles");
					if (type != null)
					{
						_itemBundlesInstance = AccessTools.Property(type, "Instance").GetValue(null);
						_itemDictionaryShopField = AccessTools.Field(type, "itemDictionaryShop");
						_blacklistField = AccessTools.Field(type, "itemDictionaryShopBlacklist");
						REPOConomyPlugin.Logger.LogInfo((object)"[ItemBundlesCompat] Compatibility initialized successfully.");
					}
				}
			}
			catch (Exception ex)
			{
				REPOConomyPlugin.Logger.LogError((object)("[ItemBundlesCompat] Init failed: " + ex.Message));
				_isInstalled = false;
			}
		}

		public static Dictionary<string, Item> GetShopItems()
		{
			if (!IsInstalled || _itemBundlesInstance == null)
			{
				return StatsManager.instance.itemDictionary;
			}
			try
			{
				Dictionary<string, Item> dictionary = _itemDictionaryShopField.GetValue(_itemBundlesInstance) as Dictionary<string, Item>;
				if (dictionary == null || dictionary.Count == 0)
				{
					REPOConomyPlugin.Logger.LogInfo((object)"[ItemBundlesCompat] Dictionary empty, populating manually...");
					dictionary = PopulateManually();
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				REPOConomyPlugin.Logger.LogError((object)$"[ItemBundlesCompat] Error getting items: {arg}");
				return StatsManager.instance.itemDictionary;
			}
		}

		private static Dictionary<string, Item> PopulateManually()
		{
			Dictionary<string, Item> dictionary = new Dictionary<string, Item>();
			Dictionary<string, Item> obj = _blacklistField.GetValue(_itemBundlesInstance) as Dictionary<string, Item>;
			List<string> list = obj?.Keys.ToList() ?? new List<string>();
			List<Item> list2 = obj?.Values.ToList() ?? new List<Item>();
			foreach (KeyValuePair<string, Item> item in StatsManager.instance.itemDictionary)
			{
				if (!list.Contains(item.Key) && !list2.Contains(item.Value))
				{
					dictionary.Add(item.Key, item.Value);
				}
			}
			return dictionary;
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	public static class LevelGeneratorSeededPatch
	{
		[HarmonyPatch("Generate")]
		[HarmonyPrefix]
		public static void GeneratePrefix()
		{
			REPOSeedManager.ResetLevelRandom();
			REPOSeedManager.ResetTruckRandom();
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void StartRoomGenerationPrefix()
		{
			Random.InitState(REPOSeedManager.LevelNext());
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void TileGenerationPrefix()
		{
			Random.InitState(REPOSeedManager.LevelNext());
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void ModuleGenerationPrefix()
		{
			Random.InitState(REPOSeedManager.LevelNext());
		}

		[HarmonyPatch("PlayerSpawn")]
		[HarmonyPrefix]
		public static void PlayerSpawnPrefix()
		{
			Random.InitState(REPOSeedManager.LevelNext());
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void EnemySetupPrefix()
		{
			Random.InitState(REPOSeedManager.EnemyNext());
		}
	}
	public static class MoreUpgradesCompat
	{
		private static bool? _isInstalled;

		private static object _muPluginInstance;

		private static FieldInfo _upgradeItemsField;

		private static FieldInfo _playerUpgradeField;

		private static MethodInfo _getConfigMethod;

		private static MethodInfo _apiMultiplierMethod;

		public static bool IsInstalled
		{
			get
			{
				if (!_isInstalled.HasValue)
				{
					_isInstalled = Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades");
					if (_isInstalled.Value)
					{
						InitializeReflection();
					}
				}
				return _isInstalled.Value;
			}
		}

		private static void InitializeReflection()
		{
			try
			{
				Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "MoreUpgrades");
				if (assembly != null)
				{
					Type type = assembly.GetType("MoreUpgrades.Plugin");
					if (type != null)
					{
						_muPluginInstance = AccessTools.Field(type, "instance").GetValue(null);
						_upgradeItemsField = AccessTools.Field(type, "upgradeItems");
					}
					Type type2 = assembly.GetType("MoreUpgrades.Classes.UpgradeItem");
					if (type2 != null)
					{
						_playerUpgradeField = AccessTools.Field(type2, "playerUpgrade");
						_getConfigMethod = AccessTools.Method(type2, "GetConfig", new Type[1] { typeof(string) }, new Type[1] { typeof(bool) });
					}
					Type type3 = assembly.GetType("MoreUpgrades.Classes.MoreUpgradesAPI");
					if (type3 != null)
					{
						_apiMultiplierMethod = AccessTools.Method(type3, "ItemValueMultiplier", new Type[1] { typeof(Item) }, (Type[])null);
					}
					REPOConomyPlugin.Logger.LogInfo((object)"[MoreUpgradesCompat] Compatibility initialized.");
				}
			}
			catch (Exception ex)
			{
				REPOConomyPlugin.Logger.LogError((object)("[MoreUpgradesCompat] Init failed: " + ex.Message));
				_isInstalled = false;
			}
		}

		public static IEnumerable<Item> FilterDisabledItems(IEnumerable<Item> incomingItems)
		{
			if (!IsInstalled || _muPluginInstance == null || _upgradeItemsField == null)
			{
				return incomingItems;
			}
			try
			{
				if (!(_upgradeItemsField.GetValue(_muPluginInstance) is IList list) || list.Count == 0)
				{
					return incomingItems;
				}
				HashSet<Item> disabledItems = new HashSet<Item>();
				foreach (object item in list)
				{
					if (item == null)
					{
						continue;
					}
					object value = _playerUpgradeField.GetValue(item);
					if (value == null)
					{
						continue;
					}
					FieldInfo fieldInfo = AccessTools.Field(value.GetType(), "Item");
					Item val = null;
					if (fieldInfo != null)
					{
						object? value2 = fieldInfo.GetValue(value);
						val = (Item)((value2 is Item) ? value2 : null);
					}
					else
					{
						PropertyInfo propertyInfo = AccessTools.Property(value.GetType(), "Item");
						if (propertyInfo != null)
						{
							object? value3 = propertyInfo.GetValue(value);
							val = (Item)((value3 is Item) ? value3 : null);
						}
					}
					if ((Object)(object)val == (Object)null || !(_getConfigMethod != null))
					{
						continue;
					}
					try
					{
						if (!(bool)_getConfigMethod.Invoke(item, new object[1] { "Enabled" }))
						{
							disabledItems.Add(val);
						}
					}
					catch
					{
					}
				}
				return incomingItems.Where((Item x) => !disabledItems.Contains(x));
			}
			catch (Exception arg)
			{
				REPOConomyPlugin.Logger.LogError((object)$"[MoreUpgradesCompat] Filter error: {arg}");
				return incomingItems;
			}
		}

		public static float GetItemPriceMultiplier(Item item, float globalDefault)
		{
			if (!IsInstalled || _apiMultiplierMethod == null)
			{
				return globalDefault;
			}
			try
			{
				return (float)_apiMultiplierMethod.Invoke(null, new object[1] { item });
			}
			catch
			{
				return globalDefault;
			}
		}
	}
	public static class PocketCartPlusCompat
	{
		private static bool? _isInstalled;

		private static FieldInfo _randField;

		private static object _pluginInstance;

		public static bool IsInstalled
		{
			get
			{
				if (!_isInstalled.HasValue)
				{
					_isInstalled = Chainloader.PluginInfos.ContainsKey("com.github.darmuh.PocketCartPlus");
					if (_isInstalled.Value)
					{
						InitializeReflection();
					}
				}
				return _isInstalled.Value;
			}
		}

		private static void InitializeReflection()
		{
			try
			{
				Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "com.github.darmuh.PocketCartPlus");
				if (assembly != null)
				{
					Type type = assembly.GetType("PocketCartPlus.Plugin");
					if (type != null)
					{
						_randField = AccessTools.Field(type, "Rand");
					}
					REPOConomyPlugin.Logger.LogInfo((object)"[PocketCartPlusCompat] Compatibility initialized.");
				}
			}
			catch (Exception ex)
			{
				REPOConomyPlugin.Logger.LogError((object)("[PocketCartPlusCompat] Init failed: " + ex.Message));
				_isInstalled = false;
			}
		}

		public static void ReseedRandom(int seed)
		{
			if (!IsInstalled || _randField == null)
			{
				return;
			}
			try
			{
				Random value = new Random(seed);
				_randField.SetValue(null, value);
				REPOConomyPlugin.Logger.LogInfo((object)$"[PocketCartPlusCompat] Reseeded with {seed}");
			}
			catch (Exception arg)
			{
				REPOConomyPlugin.Logger.LogError((object)$"[PocketCartPlusCompat] Reseed error: {arg}");
			}
		}
	}
	public static class REPOConfig
	{
		public static ConfigEntry<bool> EnableEnemyHPScaling;

		public static ConfigEntry<int> EnemyHPStartLevel;

		public static ConfigEntry<float> EnemyHPMultiplier;

		public static ConfigEntry<bool> EnemyHPUseExponentialScaling;

		public static ConfigEntry<int> EnemyHPMaxLevel;

		public static ConfigEntry<int> EnemyHPScalingLevelCap;

		public static ConfigEntry<bool> EnableEnemyCapScaling;

		public static ConfigEntry<int> EnemyCapStartLevel;

		public static ConfigEntry<float> EnemyCapMultiplier;

		public static ConfigEntry<bool> EnemyCapUseExponentialScaling;

		public static ConfigEntry<int> EnemyCapMaxLevel;

		public static ConfigEntry<int> EnemyCapScalingLevelCap;

		public static ConfigEntry<bool> EnableMapValueScaling;

		public static ConfigEntry<int> MapValueStartLevel;

		public static ConfigEntry<float> MapValueMultiplier;

		public static ConfigEntry<bool> MapValueUseExponentialScaling;

		public static ConfigEntry<int> MapValueMaxLevel;

		public static ConfigEntry<int> MapValueScalingLevelCap;

		public static ConfigEntry<float> DefaultBaseMin;

		public static ConfigEntry<float> DefaultBaseMax;

		public static ConfigEntry<float> LevelScaleMin;

		public static ConfigEntry<float> LevelScaleMax;

		public static ConfigEntry<float> MinClampLimit;

		public static ConfigEntry<float> MaxClampLimit;

		public static ConfigEntry<bool> ForceStableEconomy;

		public static ConfigEntry<int> EventStartLevel;

		public static ConfigEntry<bool> UseEventChance;

		public static ConfigEntry<int> EventChance;

		public static ConfigEntry<bool> ShowTotalMapValue;

		public static ConfigEntry<bool> UseSeparateModifiers;

		public static ConfigEntry<string> UILanguage;

		public static ConfigEntry<string> RollMode;

		public static ConfigEntry<bool> EnableCustomEvents;

		public static ConfigEntry<bool> DisableVanillaEvents;

		public static ConfigEntry<bool> UseCustomEventChance;

		public static ConfigEntry<int> CustomEventChance;

		public static ConfigEntry<float> DifficultyPerLevel;

		public static ConfigEntry<float> DifficultyPerPlayer;

		public static ConfigEntry<float> DifficultyPerValuable;

		public static ConfigEntry<float> DifficultyMaxCap;

		public static ConfigEntry<int> ModifierStartLevel;

		public static ConfigEntry<int> MinModifierCount;

		public static ConfigEntry<int> MaxModifierCount;

		public static ConfigEntry<bool> EnableLootModifiers;

		public static ConfigEntry<bool> EnableEnemyModifiers;

		public static ConfigEntry<bool> EnablePlayerModifiers;

		public static ConfigEntry<bool> EnableEnvironmentModifiers;

		public static ConfigEntry<bool> EnableSharedPool;

		public static ConfigEntry<float> GlobalUpgradesMultiplier;

		public static ConfigEntry<KeyCode> PlayerRevivalHotkey;

		public static ConfigEntry<KeyCode> UIToggleHotkey;

		public static ConfigEntry<bool> UIAutoShowOnLevelStart;

		public static ConfigEntry<bool> EnableLevelScaling;

		public static ConfigEntry<bool> EnableMultiplicativeScaling;

		public static ConfigEntry<int> LevelScalingMinModules;

		public static ConfigEntry<int> LevelScalingMaxModulesLevel;

		public static ConfigEntry<int> LevelScalingModulesInterval;

		public static ConfigEntry<int> LevelScalingModulesPerInterval;

		public static ConfigEntry<int> LevelScalingBaseExtractions;

		public static ConfigEntry<int> LevelScalingExtractionsInterval;

		public static ConfigEntry<int> LevelScalingExtractionsPerInterval;

		public static ConfigEntry<int> LevelScalingMaxExtractions;

		public static ConfigEntry<float> LevelScalingBaseHaulMultiplier;

		public static ConfigEntry<float> LevelScalingHaulIncreasePerLevel;

		public static ConfigEntry<int> LevelScalingMaxHaulLevel;

		public static ConfigEntry<float> LevelScalingMaxHaulMultiplier;

		public static Dictionary<string, ConfigEntry<bool>> EconomyEnables = new Dictionary<string, ConfigEntry<bool>>();

		public static Dictionary<string, ConfigEntry<bool>> ModifierEnables = new Dictionary<string, ConfigEntry<bool>>();

		public static Dictionary<string, ConfigEntry<bool>> ShopEconomyEnables = new Dictionary<string, ConfigEntry<bool>>();

		public static ConfigEntry<bool> EnableShopEconomy;

		public static ConfigEntry<bool> ForceNormalShopPrices;

		public static ConfigEntry<int> ShopEconomyChance;

		public static ConfigEntry<bool> RandomizeSeedEachLevel;

		public static ConfigEntry<bool> UseCustomSeed;

		public static ConfigEntry<string> CustomSeedValue;

		public static ConfigEntry<bool> UseLevelBasedSeed;

		public static ConfigEntry<bool> ForceScaleInCart;

		public static ConfigEntry<string> ScaleInCartSettings;

		public static ConfigEntry<bool> ForceExtractionShrink;

		public static ConfigEntry<string> ExtractionShrinkSettings;

		public static void Init(ConfigFile config)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be