Decompiled source of BonkTuner v1.0.3

BonkTuner.dll

Decompiled 16 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Assets.Scripts.Actors.Player;
using Assets.Scripts.Game.Other;
using Assets.Scripts.Game.Spawning.New;
using Assets.Scripts.Game.Spawning.New.Summoners;
using Assets.Scripts.Game.Spawning.New.Timelines;
using Assets.Scripts.Inventory__Items__Pickups.Stats;
using Assets.Scripts.Inventory__Items__Pickups.Upgrades;
using Assets.Scripts.Managers;
using Assets.Scripts.Saves___Serialization.Progression.Stats;
using Assets.Scripts.UI.InGame.Rewards;
using Assets.Scripts._Data.MapsAndStages;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BonkTuner.Configs;
using BonkTuner.Configs.EnemySpawnModifiers;
using BonkTuner.Configs.MapConfigs;
using BonkTuner.Services;
using BonkTuner.UI;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Text;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BonkTuner")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Customize game difficulty with map modifiers, enemy spawn presets, shrine multipliers, and more. Features an in-game UI for real-time configuration.")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+edfcb1cbe66a194294359f6b861c492cd66f757e")]
[assembly: AssemblyProduct("BonkTuner")]
[assembly: AssemblyTitle("BonkTuner")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
namespace BonkTuner
{
	internal static class Constants
	{
		public const string MODNAME = "BonkTuner";

		public const string AUTHOR = "ZeusesNeckMeat";

		public const string GUID = "ZeusesNeckMeat_BonkTuner";

		public const string VERSION = "1.0.0";
	}
	internal enum MultiplyStatFrequency
	{
		Disabled,
		PerPlayerLevel,
		PerShrineCharged,
		PerStageCompleted,
		PerBossDefeated,
		PerMiniBossAndBossDefeated,
		PerEliteKilled,
		PerPowerupsUsed,
		PerPotsBroken,
		PerChestsOpened,
		PerSilverEarnedInRun
	}
	internal enum EnemySpawnPreset
	{
		Normal,
		Casual,
		Intense,
		Swarm,
		Apocalypse
	}
	[BepInPlugin("ZeusesNeckMeat_BonkTuner", "BonkTuner", "1.0.0")]
	public class Main : BasePlugin
	{
		private static ManualLogSource _logger;

		public static ManualLogSource Logger => _logger;

		public Main()
		{
			_logger = ((BasePlugin)this).Log;
		}

		public override void Load()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00d4: Expected O, but got Unknown
			ManualLogSource logger = _logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BonkTuner");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" by ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ZeusesNeckMeat");
			}
			logger.LogInfo(val);
			new Harmony("ZeusesNeckMeat_BonkTuner").PatchAll();
			ConfigService.InitializeConfigs(((BasePlugin)this).Config);
			try
			{
				ClassInjector.RegisterTypeInIl2Cpp<MainWindow>();
				_logger.LogInfo((object)"MainWindow type registered with IL2CPP");
			}
			catch (Exception ex)
			{
				ManualLogSource logger2 = _logger;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(36, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to register MainWindow type: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				logger2.LogError(val2);
				return;
			}
			GameObject val3 = new GameObject("BonkTunerUI");
			val3.AddComponent<MainWindow>();
			Object.DontDestroyOnLoad((Object)val3);
			_logger.LogInfo((object)"UI initialized");
		}
	}
	[HarmonyPatch(typeof(EffectManager), "Awake")]
	internal class EffectManager_Awake_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(EffectManager __instance)
		{
			EnemyModifierService.TrySetEnemyChestDropChance(__instance);
		}
	}
	[HarmonyPatch(typeof(MapController), "StartNewMap")]
	internal static class MapGenerator_GenerateMap_2_Patch
	{
		[HarmonyPrefix]
		public static void Prefix(RunConfig newRunConfig)
		{
			MapDataService.TrySetMapDataOnNewMap(newRunConfig);
		}
	}
	[HarmonyPatch(typeof(ChargeShrine), "OnTriggerEnter")]
	internal static class ChargeShrine_OnTriggerEnter_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(BaseInteractable __instance)
		{
			ChargeShrineService.TryUpdateShrineChargeTime(__instance);
		}
	}
	[HarmonyPatch(typeof(EncounterUtility), "GetRandomStatOffers")]
	internal class EncounterUtility_GetRandomStatOffers_Patch
	{
		[HarmonyPostfix]
		public static void EncounterUtility_GetRandomStatOffers_Postfix(List<EncounterOffer> __result, int amount, bool forceLegendary, bool useShrineStats)
		{
			ChargeShrineService.TryUpdateShrineRewardOffers(__result, amount, useShrineStats);
		}
	}
	[HarmonyPatch(typeof(StageSummoner), "GetNumTargetEnemies")]
	internal static class StageSummoner_GetNumTargetEnemies_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref int __result)
		{
			__result = EnemyModifierService.GetModifiedTargetEnemies(__result);
		}
	}
	[HarmonyPatch(typeof(SummonerController), "AddSummoner")]
	internal static class SummonerController_AddSummoner_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(BaseSummoner summoner)
		{
			EnemyModifierService.TrySetBaseCreditsPerSecond(summoner);
		}
	}
	[HarmonyPatch(typeof(StageSummoner), "GetSummonInterval")]
	internal static class StageSummoner_GetSummonInterval_Patch
	{
		[HarmonyPostfix]
		public static void Postfix(ref float __result)
		{
			__result = EnemyModifierService.GetModifiedSpawnInterval(__result);
		}
	}
}
namespace BonkTuner.UI
{
	internal class CoreSettingsTab
	{
		public static string TabName => "Core";

		public static void Draw()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			GUILayout.Label("Core Settings", Styles.Header, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			bool isEnabled = ConfigService.Core.IsEnabled;
			bool flag = GUILayout.Toggle(isEnabled, " Mod Enabled", Styles.Toggle, (Il2CppReferenceArray<GUILayoutOption>)null);
			bool flag2 = default(bool);
			if (flag != isEnabled)
			{
				if (flag)
				{
					ConfigService.Core.EnableMod();
				}
				else
				{
					ConfigService.Core.DisableMod();
				}
				ManualLogSource logger = Main.Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Mod enabled changed to: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(flag);
				}
				logger.LogInfo(val);
			}
			bool isEnabledDuringChallenges = ConfigService.Core.IsEnabledDuringChallenges;
			bool flag3 = GUILayout.Toggle(isEnabledDuringChallenges, " Enable During Challenges", Styles.Toggle, (Il2CppReferenceArray<GUILayoutOption>)null);
			if (flag3 != isEnabledDuringChallenges)
			{
				if (flag3)
				{
					ConfigService.Core.EnableDuringChallenges();
				}
				else
				{
					ConfigService.Core.DisableDuringChallenges();
				}
				ManualLogSource logger2 = Main.Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Enable during challenges changed to: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(flag3);
				}
				logger2.LogInfo(val);
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(12f) });
			GUILayout.Label("Press F5 to toggle this menu", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
		}
	}
	internal class DrawHelper
	{
		public static void DrawSliderWithSteps(string label, float currentValue, float min, float max, float step, Action<float> onValueChanged)
		{
			GUILayout.BeginVertical(Styles.SliderBox, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label(label, Styles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			if (GUILayout.Button("-", Styles.SmallButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(30f),
				GUILayout.Height(24f)
			}))
			{
				float num = Mathf.Floor(currentValue / step) * step;
				if (Mathf.Abs(currentValue - num) < 1E-05f)
				{
					num -= step;
				}
				float obj = Mathf.Max(min, num);
				onValueChanged(obj);
			}
			float num2 = GUILayout.HorizontalSlider(currentValue, min, max, Styles.Slider, Styles.SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) });
			if (Math.Abs(num2 - currentValue) > 1E-05f)
			{
				onValueChanged(num2);
			}
			if (GUILayout.Button("+", Styles.SmallButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(30f),
				GUILayout.Height(24f)
			}))
			{
				float num3 = Mathf.Ceil(currentValue / step) * step;
				if (Mathf.Abs(currentValue - num3) < 1E-05f)
				{
					num3 += step;
				}
				float obj2 = Mathf.Min(max, num3);
				onValueChanged(obj2);
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		public static bool DrawEnabledHeaderWithReset(string label, bool isEnabled, Action onEnabled, Action onDisabled, Action onReset)
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			string value = (isEnabled ? "✓" : "✗");
			string value2 = (isEnabled ? "ENABLED" : "DISABLED");
			if (GUILayout.Button($"{value} {label} [{value2}]", isEnabled ? Styles.HeaderActive : Styles.HeaderInactive, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				if (!isEnabled)
				{
					onEnabled();
				}
				else
				{
					onDisabled();
				}
			}
			if (GUILayout.Button("Reset", Styles.SmallButton, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(60f),
				GUILayout.Height(33f)
			}))
			{
				onReset();
				ManualLogSource logger = Main.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(label);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" reset to default");
				}
				logger.LogInfo(val);
			}
			GUILayout.EndHorizontal();
			return isEnabled;
		}
	}
	internal class EnemyModifiersTab
	{
		public static string TabName => "Enemy Modifiers";

		public static void Draw()
		{
			if (DrawHelper.DrawEnabledHeaderWithReset("Enemy Drop Chance", ConfigService.EnemyModifiers.IsEnemyDropChanceModifierEnabled, ConfigService.EnemyModifiers.EnableEnemyDropChanceModifier, ConfigService.EnemyModifiers.DisableEnemyDropChanceModifier, ConfigService.EnemyModifiers.ResetEnemyChestDropChance))
			{
				GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
				DrawHelper.DrawSliderWithSteps($"Drop Chance: {ConfigService.EnemyModifiers.EnemyChestDropChance * 100f:F4}%", ConfigService.EnemyModifiers.EnemyChestDropChance, 0f, 0.1f, 0.0001f, ConfigService.EnemyModifiers.SetEnemyChestDropChance);
				GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(12f) });
				GUILayout.Label($"Actual: {ConfigService.EnemyModifiers.EnemyChestDropChance:F6} ({ConfigService.EnemyModifiers.EnemyChestDropChance * 100f:F4}%)", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(18f) });
			if (!DrawHelper.DrawEnabledHeaderWithReset("Enemy Spawn Presets", ConfigService.EnemyModifiers.IsEnemySpawnModifiersEnabled, ConfigService.EnemyModifiers.EnableEnemySpawnModifiers, ConfigService.EnemyModifiers.DisableEnemySpawnModifiers, ConfigService.EnemyModifiers.ResetEnemySpawnPreset))
			{
				return;
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Preset:", Styles.SectionLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			SpawnModifiersBase currentSpawnModifiers = ConfigService.EnemyModifiers.GetCurrentSpawnModifiers();
			string[] names = Enum.GetNames(typeof(EnemySpawnPreset));
			int preset = (int)currentSpawnModifiers.Preset;
			for (int i = 0; i < names.Length; i++)
			{
				GUIStyle val = ((i == preset) ? Styles.ButtonActive : Styles.Button);
				if (GUILayout.Button(names[i], val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					ConfigService.EnemyModifiers.SetEnemySpawnPreset((EnemySpawnPreset)i);
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			GUILayout.Label(currentSpawnModifiers.Description, Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(12f) });
			GUILayout.BeginVertical(Styles.Box, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Preset Effects:", Styles.LabelBold, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label($"  • Target Enemy Count: {currentSpawnModifiers.TargetSpawnsMultiplier:F1}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label($"  • Credit Gain Speed: {currentSpawnModifiers.CreditMultiplier:F1}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label($"  • Spawn Interval: {currentSpawnModifiers.SpawnIntervalMultiplier:F1}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.EndVertical();
		}
	}
	internal class MainWindow : MonoBehaviour
	{
		private static bool _isGuiOpen;

		private Rect _windowRect = new Rect(500f, 250f, 650f, 750f);

		private Vector2 _scrollPosition = Vector2.zero;

		private int _selectedTab;

		private readonly string[] _tabNames = new string[4]
		{
			CoreSettingsTab.TabName,
			MapModifiersTab.TabName,
			ShrineSettingsTab.TabName,
			EnemyModifiersTab.TabName
		};

		private readonly Dictionary<int, Action> _tabDrawActions = new Dictionary<int, Action>
		{
			{
				0,
				CoreSettingsTab.Draw
			},
			{
				1,
				MapModifiersTab.Draw
			},
			{
				2,
				ShrineSettingsTab.Draw
			},
			{
				3,
				EnemyModifiersTab.Draw
			}
		};

		public MainWindow(IntPtr ptr)
			: base(ptr)
		{
		}//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)


		private void Start()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			_isGuiOpen = ConfigService.UI.StartOpen;
			ManualLogSource logger = Main.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(57, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MainWindow");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] MainWindow initialized and set to not destroy on load.");
			}
			logger.LogInfo(val);
		}

		private void Update()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			if (Input.GetKeyDown(ConfigService.UI.ToggleKey))
			{
				_isGuiOpen = !_isGuiOpen;
				ManualLogSource logger = Main.Logger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MainWindow");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] UI toggled: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_isGuiOpen);
				}
				logger.LogInfo(val);
			}
		}

		private void OnGUI()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Styles.Initialize();
			if (_isGuiOpen)
			{
				_windowRect = GUI.Window(234432, _windowRect, WindowFunction.op_Implicit((Action<int>)DrawWindow), "BonkTuner Configuration", Styles.Window);
			}
		}

		private void DrawWindow(int windowID)
		{
			//IL_003e: 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_00d1: 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)
			GUILayout.BeginVertical((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal(Styles.DragHandle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("═══ Drag to Move ═══", Styles.DragLabel, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.EndHorizontal();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 40f));
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			for (int i = 0; i < _tabNames.Length; i++)
			{
				GUIStyle val = ((_selectedTab == i) ? Styles.ButtonActive : Styles.Button);
				if (GUILayout.Button(_tabNames[i], val, Array.Empty<GUILayoutOption>()))
				{
					_selectedTab = i;
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(12f) });
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(600f) });
			if (_tabDrawActions.TryGetValue(_selectedTab, out var value))
			{
				value();
			}
			GUILayout.EndScrollView();
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(12f) });
			if (GUILayout.Button("Close", Styles.Button, Array.Empty<GUILayoutOption>()))
			{
				_isGuiOpen = false;
			}
			GUILayout.EndVertical();
		}
	}
	internal class MapModifiersTab
	{
		public static string TabName => "Map Modifiers";

		public static void Draw()
		{
			DrawMapModifier("Desert", ConfigService.GetMapModifiers((EMap)2));
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(18f) });
			DrawMapModifier("Forest", ConfigService.GetMapModifiers((EMap)1));
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(18f) });
			DrawMapModifier("Graveyard", ConfigService.GetMapModifiers((EMap)8));
		}

		private static void DrawMapModifier(string mapName, MapConfigBase modifiers)
		{
			if (modifiers != null && DrawHelper.DrawEnabledHeaderWithReset(" " + mapName + " Settings", modifiers.IsEnabled, modifiers.Enable, modifiers.Disable, modifiers.ResetToDefaults))
			{
				GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
				DrawHelper.DrawSliderWithSteps($"Stage Duration: {modifiers.StageDurationSeconds:F0}s", modifiers.StageDurationSeconds, 0f, 3600f, 10f, modifiers.SetStageDurationSeconds);
				DrawHelper.DrawSliderWithSteps($"Chest Spawn: {modifiers.ChestSpawnMultiplier:F2}x", modifiers.ChestSpawnMultiplier, 0f, 20f, 0.1f, modifiers.SetChestSpawnMultiplier);
				DrawHelper.DrawSliderWithSteps($"Shrine Spawn: {modifiers.ShrineOnlySpawnMultiplier:F2}x", modifiers.ShrineOnlySpawnMultiplier, 0f, 20f, 0.1f, modifiers.SetShrineOnlySpawnMultiplier);
				DrawHelper.DrawSliderWithSteps($"Shrine & Pot: {modifiers.ShrineAndPotSpawnMultiplier:F2}x", modifiers.ShrineAndPotSpawnMultiplier, 0f, 20f, 0.1f, modifiers.SetShrineAndPotSpawnMultiplier);
			}
		}
	}
	internal class ShrineSettingsTab
	{
		public static string TabName => "Shrine Settings";

		public static void Draw()
		{
			if (DrawHelper.DrawEnabledHeaderWithReset("Shrine Reward Multiplier", ConfigService.ChargeShrine.IsRewardMultiplierEnabled, ConfigService.ChargeShrine.EnableRewardMultiplier, ConfigService.ChargeShrine.DisableRewardMultiplier, ConfigService.ChargeShrine.ResetRewardMultiplier))
			{
				DrawFrequencySelector("Frequency:", ConfigService.ChargeShrine.RewardMultiplierFrequency, delegate(MultiplyStatFrequency freq)
				{
					ConfigService.ChargeShrine.SetRewardMultiplierFrequency(freq);
				});
				DrawHelper.DrawSliderWithSteps($"Reward Multiplier: {ConfigService.ChargeShrine.RewardMultiplier:F2}x", ConfigService.ChargeShrine.RewardMultiplier, 0f, 10f, 0.01f, ConfigService.ChargeShrine.SetRewardMultiplier);
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(18f) });
			if (DrawHelper.DrawEnabledHeaderWithReset("Charge Rate Multiplier", ConfigService.ChargeShrine.IsChargeRateMultiplierEnabled, ConfigService.ChargeShrine.EnableChargeRateMultiplier, ConfigService.ChargeShrine.DisableChargeRateMultiplier, ConfigService.ChargeShrine.ResetChargeRateMultiplier))
			{
				DrawFrequencySelector("Frequency:", ConfigService.ChargeShrine.ChargeRateMultiplierFrequency, delegate(MultiplyStatFrequency freq)
				{
					ConfigService.ChargeShrine.SetChargeRateMultiplierFrequency(freq);
				});
				DrawHelper.DrawSliderWithSteps($"Charge Rate: {ConfigService.ChargeShrine.ChargeRateMultiplier:F2}x", ConfigService.ChargeShrine.ChargeRateMultiplier, 0f, 10f, 0.01f, delegate(float value)
				{
					ConfigService.ChargeShrine.SetChargeRateMultiplier(value);
				});
			}
		}

		private static void DrawFrequencySelector(string label, MultiplyStatFrequency currentFreq, Action<MultiplyStatFrequency> onFreqChanged)
		{
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label(label, Styles.SectionLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			GUILayout.EndHorizontal();
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(4f) });
			string[] names = Enum.GetNames(typeof(MultiplyStatFrequency));
			int num = (int)Math.Ceiling((float)names.Length / 3f);
			for (int i = 0; i < num; i++)
			{
				GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
				for (int j = 0; j < 3; j++)
				{
					int num2 = i * 3 + j;
					if (num2 < names.Length)
					{
						GUIStyle val = ((num2 == (int)currentFreq) ? Styles.ButtonActive : Styles.Button);
						if (GUILayout.Button(names[num2], val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
						{
							onFreqChanged((MultiplyStatFrequency)num2);
						}
					}
					else
					{
						GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
					}
				}
				GUILayout.EndHorizontal();
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
		}
	}
	internal class Styles
	{
		private static bool _isInitialized;

		public static Texture2D BackgroundTexture { get; private set; }

		public static Texture2D BoxTexture { get; private set; }

		public static Texture2D ButtonActiveTexture { get; private set; }

		public static Texture2D HeaderActiveTexture { get; private set; }

		public static Texture2D HeaderInactiveTexture { get; private set; }

		public static Texture2D DragHandleTexture { get; private set; }

		public static Texture2D SectionLabelTexture { get; private set; }

		public static Texture2D SliderBoxTexture { get; private set; }

		public static Texture2D SliderTrackTexture { get; private set; }

		public static Texture2D SliderThumbTexture { get; private set; }

		public static GUIStyle Window { get; private set; }

		public static GUIStyle Header { get; private set; }

		public static GUIStyle HeaderActive { get; private set; }

		public static GUIStyle HeaderInactive { get; private set; }

		public static GUIStyle Label { get; private set; }

		public static GUIStyle LabelBold { get; private set; }

		public static GUIStyle SectionLabel { get; private set; }

		public static GUIStyle Toggle { get; private set; }

		public static GUIStyle Button { get; private set; }

		public static GUIStyle ButtonActive { get; private set; }

		public static GUIStyle SmallButton { get; private set; }

		public static GUIStyle Slider { get; private set; }

		public static GUIStyle SliderThumb { get; private set; }

		public static GUIStyle Box { get; private set; }

		public static GUIStyle DragHandle { get; private set; }

		public static GUIStyle DragLabel { get; private set; }

		public static GUIStyle SliderBox { get; private set; }

		public static void Initialize()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0031: 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)
			//IL_005f: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Expected O, but got Unknown
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Expected O, but got Unknown
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			//IL_027a: 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_02a8: Expected O, but got Unknown
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Expected O, but got Unknown
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Expected O, but got Unknown
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Expected O, but got Unknown
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Expected O, but got Unknown
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Expected O, but got Unknown
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Expected O, but got Unknown
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Expected O, but got Unknown
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Expected O, but got Unknown
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Expected O, but got Unknown
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Expected O, but got Unknown
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0700: Expected O, but got Unknown
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_078c: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c1: Expected O, but got Unknown
			//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e4: Expected O, but got Unknown
			//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0811: Unknown result type (might be due to invalid IL or missing references)
			//IL_0816: Unknown result type (might be due to invalid IL or missing references)
			//IL_081e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_0831: Expected O, but got Unknown
			//IL_084a: Unknown result type (might be due to invalid IL or missing references)
			//IL_085e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0872: Unknown result type (might be due to invalid IL or missing references)
			//IL_087e: Expected O, but got Unknown
			//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Expected O, but got Unknown
			//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_090b: Expected O, but got Unknown
			//IL_0915: Unknown result type (might be due to invalid IL or missing references)
			//IL_091a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Expected O, but got Unknown
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0984: Unknown result type (might be due to invalid IL or missing references)
			//IL_0990: Expected O, but got Unknown
			//IL_09a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0d: Expected O, but got Unknown
			//IL_0a62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab7: Expected O, but got Unknown
			//IL_0ad0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b25: Expected O, but got Unknown
			//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b64: Expected O, but got Unknown
			//IL_0b69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8f: Expected O, but got Unknown
			//IL_0b99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba3: Expected O, but got Unknown
			//IL_0bcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bde: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf1: Expected O, but got Unknown
			//IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1d: Expected O, but got Unknown
			//IL_0c32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3c: Expected O, but got Unknown
			//IL_0c73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c99: Expected O, but got Unknown
			//IL_0c9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0caa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc5: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			if (_isInitialized)
			{
				return;
			}
			BackgroundTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			BackgroundTexture.SetPixel(0, 0, new Color(0.05f, 0.05f, 0.06f, 0.95f));
			BackgroundTexture.Apply();
			((Object)BackgroundTexture).hideFlags = (HideFlags)61;
			BoxTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			BoxTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.12f, 0.8f));
			BoxTexture.Apply();
			((Object)BoxTexture).hideFlags = (HideFlags)61;
			SliderBoxTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			SliderBoxTexture.SetPixel(0, 0, new Color(0.12f, 0.14f, 0.16f, 0.7f));
			SliderBoxTexture.Apply();
			((Object)SliderBoxTexture).hideFlags = (HideFlags)61;
			SliderTrackTexture = new Texture2D(1, 8, (TextureFormat)4, false);
			for (int i = 0; i < 8; i++)
			{
				SliderTrackTexture.SetPixel(0, i, new Color(0.2f, 0.2f, 0.22f, 1f));
			}
			SliderTrackTexture.Apply();
			((Object)SliderTrackTexture).hideFlags = (HideFlags)61;
			SliderThumbTexture = new Texture2D(12, 18, (TextureFormat)4, false);
			for (int j = 0; j < 12; j++)
			{
				for (int k = 0; k < 18; k++)
				{
					Color val = ((j == 0 || j == 11 || k == 0 || k == 17) ? new Color(0.5f, 0.7f, 0.5f, 1f) : new Color(0.3f, 0.6f, 0.3f, 1f));
					SliderThumbTexture.SetPixel(j, k, val);
				}
			}
			SliderThumbTexture.Apply();
			((Object)SliderThumbTexture).hideFlags = (HideFlags)61;
			SliderBox = new GUIStyle(GUI.skin.box);
			SliderBox.normal.background = SliderBoxTexture;
			SliderBox.padding = new RectOffset
			{
				left = 10,
				right = 10,
				top = 8,
				bottom = 8
			};
			SliderBox.margin = new RectOffset
			{
				left = 0,
				right = 0,
				top = 4,
				bottom = 4
			};
			ButtonActiveTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			ButtonActiveTexture.SetPixel(0, 0, new Color(0.2f, 0.5f, 0.2f, 1f));
			ButtonActiveTexture.Apply();
			((Object)ButtonActiveTexture).hideFlags = (HideFlags)61;
			HeaderActiveTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			HeaderActiveTexture.SetPixel(0, 0, new Color(0.15f, 0.35f, 0.15f, 0.6f));
			HeaderActiveTexture.Apply();
			((Object)HeaderActiveTexture).hideFlags = (HideFlags)61;
			HeaderInactiveTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			HeaderInactiveTexture.SetPixel(0, 0, new Color(0.25f, 0.1f, 0.1f, 0.4f));
			HeaderInactiveTexture.Apply();
			((Object)HeaderInactiveTexture).hideFlags = (HideFlags)61;
			DragHandleTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			DragHandleTexture.SetPixel(0, 0, new Color(0.08f, 0.12f, 0.15f, 0.9f));
			DragHandleTexture.Apply();
			((Object)DragHandleTexture).hideFlags = (HideFlags)61;
			SectionLabelTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			SectionLabelTexture.SetPixel(0, 0, new Color(0.12f, 0.15f, 0.18f, 0.5f));
			SectionLabelTexture.Apply();
			((Object)SectionLabelTexture).hideFlags = (HideFlags)61;
			RectOffset padding = new RectOffset
			{
				left = 12,
				right = 12,
				top = 28,
				bottom = 12
			};
			Window = new GUIStyle(GUI.skin.window);
			Window.normal.background = BackgroundTexture;
			Window.onNormal.background = BackgroundTexture;
			Window.active.background = BackgroundTexture;
			Window.focused.background = BackgroundTexture;
			Window.onFocused.background = BackgroundTexture;
			Window.normal.textColor = new Color(1f, 1f, 0.9f);
			Window.fontSize = 19;
			Window.fontStyle = (FontStyle)1;
			Window.padding = padding;
			DragHandle = new GUIStyle(GUI.skin.box);
			DragHandle.normal.background = DragHandleTexture;
			DragHandle.alignment = (TextAnchor)4;
			DragHandle.padding = new RectOffset
			{
				left = 4,
				right = 4,
				top = 6,
				bottom = 6
			};
			DragHandle.margin = new RectOffset
			{
				left = 0,
				right = 0,
				top = 0,
				bottom = 4
			};
			DragLabel = new GUIStyle(GUI.skin.label)
			{
				fontSize = 12,
				fontStyle = (FontStyle)2,
				alignment = (TextAnchor)4
			};
			DragLabel.normal.textColor = new Color(0.7f, 0.75f, 0.8f);
			Header = new GUIStyle(GUI.skin.label)
			{
				fontSize = 17,
				fontStyle = (FontStyle)1
			};
			Header.normal.textColor = new Color(1f, 0.95f, 0.7f);
			Header.onNormal.textColor = new Color(1f, 0.95f, 0.7f);
			Header.alignment = (TextAnchor)3;
			HeaderActive = new GUIStyle(GUI.skin.button)
			{
				fontSize = 17,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)3
			};
			HeaderActive.normal.background = HeaderActiveTexture;
			HeaderActive.hover.background = HeaderActiveTexture;
			HeaderActive.active.background = HeaderActiveTexture;
			HeaderActive.normal.textColor = new Color(0.7f, 1f, 0.7f);
			HeaderActive.hover.textColor = new Color(0.85f, 1f, 0.85f);
			HeaderActive.active.textColor = Color.white;
			HeaderActive.padding = new RectOffset
			{
				left = 8,
				right = 8,
				top = 6,
				bottom = 6
			};
			HeaderInactive = new GUIStyle(GUI.skin.button)
			{
				fontSize = 17,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)3
			};
			HeaderInactive.normal.background = HeaderInactiveTexture;
			HeaderInactive.hover.background = HeaderInactiveTexture;
			HeaderInactive.active.background = HeaderInactiveTexture;
			HeaderInactive.normal.textColor = new Color(1f, 0.6f, 0.6f);
			HeaderInactive.hover.textColor = new Color(1f, 0.75f, 0.75f);
			HeaderInactive.active.textColor = Color.white;
			HeaderInactive.padding = new RectOffset
			{
				left = 8,
				right = 8,
				top = 6,
				bottom = 6
			};
			Label = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				alignment = (TextAnchor)3
			};
			Label.normal.textColor = new Color(0.95f, 0.95f, 0.95f);
			LabelBold = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)3
			};
			LabelBold.normal.textColor = new Color(1f, 0.95f, 0.7f);
			SectionLabel = new GUIStyle(GUI.skin.box)
			{
				fontSize = 16,
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			SectionLabel.normal.background = SectionLabelTexture;
			SectionLabel.normal.textColor = new Color(0.85f, 0.9f, 1f);
			SectionLabel.padding = new RectOffset
			{
				left = 8,
				right = 8,
				top = 4,
				bottom = 4
			};
			SectionLabel.margin = new RectOffset
			{
				left = 4,
				right = 4,
				top = 0,
				bottom = 0
			};
			Toggle = new GUIStyle(GUI.skin.toggle)
			{
				fontSize = 13
			};
			Toggle.normal.textColor = new Color(0.95f, 0.95f, 0.95f);
			Toggle.onNormal.textColor = new Color(1f, 1f, 0.85f);
			Button = new GUIStyle(GUI.skin.button)
			{
				fontSize = 13,
				fontStyle = (FontStyle)1
			};
			Button.normal.textColor = new Color(0.95f, 0.95f, 0.95f);
			Button.hover.textColor = new Color(0.5f, 1f, 0.5f);
			Button.active.textColor = Color.white;
			ButtonActive = new GUIStyle(GUI.skin.button)
			{
				fontSize = 13,
				fontStyle = (FontStyle)1
			};
			ButtonActive.normal.background = ButtonActiveTexture;
			ButtonActive.hover.background = ButtonActiveTexture;
			ButtonActive.active.background = ButtonActiveTexture;
			ButtonActive.normal.textColor = new Color(0.7f, 1f, 0.7f);
			ButtonActive.hover.textColor = Color.white;
			ButtonActive.active.textColor = Color.white;
			SmallButton = new GUIStyle(GUI.skin.button)
			{
				fontSize = 11,
				fontStyle = (FontStyle)1
			};
			SmallButton.normal.textColor = new Color(0.9f, 0.9f, 0.9f);
			SmallButton.hover.textColor = new Color(0.5f, 1f, 0.5f);
			SmallButton.active.textColor = Color.white;
			Box = new GUIStyle(GUI.skin.box);
			Box.normal.background = BoxTexture;
			Box.padding = new RectOffset
			{
				left = 8,
				right = 8,
				top = 8,
				bottom = 8
			};
			Box.margin = new RectOffset
			{
				left = 4,
				right = 4,
				top = 4,
				bottom = 4
			};
			Slider = new GUIStyle(GUI.skin.horizontalSlider);
			Slider.normal.background = SliderTrackTexture;
			Slider.fixedHeight = 8f;
			Slider.padding = new RectOffset
			{
				left = 0,
				right = 0,
				top = 0,
				bottom = 0
			};
			Slider.margin = new RectOffset
			{
				left = 0,
				right = 0,
				top = 12,
				bottom = 0
			};
			Slider.alignment = (TextAnchor)4;
			SliderThumb = new GUIStyle(GUI.skin.horizontalSliderThumb);
			SliderThumb.normal.background = SliderThumbTexture;
			SliderThumb.fixedWidth = 12f;
			SliderThumb.fixedHeight = 18f;
			SliderThumb.padding = new RectOffset
			{
				left = 0,
				right = 0,
				top = 0,
				bottom = 0
			};
			SliderThumb.overflow = new RectOffset
			{
				left = 0,
				right = 0,
				top = 9,
				bottom = 0
			};
			_isInitialized = true;
		}
	}
}
namespace BonkTuner.Services
{
	internal class ChargeShrineService : ServiceBase
	{
		public static void TryUpdateShrineChargeTime(BaseInteractable baseInteractable)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			if (!ServiceBase.CanContinue() || !ConfigService.ChargeShrine.IsChargeRateMultiplierEnabled)
			{
				return;
			}
			bool flag = default(bool);
			if ((Object)(object)baseInteractable == (Object)null || ((Il2CppObjectBase)baseInteractable).WasCollected)
			{
				ManualLogSource logger = Main.Logger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(88, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ChargeShrineService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TryUpdateShrineChargeTime");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] BaseInteractable is null or was already collected. Cannot update shrine charge time.");
				}
				logger.LogWarning(val);
				return;
			}
			ChargeShrine val2 = ((Il2CppObjectBase)baseInteractable).TryCast<ChargeShrine>();
			if (!((Object)(object)val2 == (Object)null) && StatService.TryGetStatValue(ConfigService.ChargeShrine.ChargeRateMultiplierFrequency, out var value) && value != 0)
			{
				float chargeRateMultiplier = ConfigService.ChargeShrine.ChargeRateMultiplier;
				float totalMultiplier = GetTotalMultiplier(chargeRateMultiplier, value);
				float chargeTime = val2.chargeTime;
				val2.currentChargeTime = chargeTime / totalMultiplier;
				ManualLogSource logger2 = Main.Logger;
				BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(104, 7, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("ChargeShrineService");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("TryUpdateShrineChargeTime");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Updated shrine charge time. Original: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(chargeTime, "F2");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("s, New: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(val2.currentChargeTime, "F2");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("s, StatValue: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(value);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", ConfigMultiplier: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(chargeRateMultiplier);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", TotalMultiplier: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(totalMultiplier, "F2");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("x");
				}
				logger2.LogDebug(val3);
			}
		}

		public static void TryUpdateShrineRewardOffers(List<EncounterOffer> randomStatOffersResult, int amount, bool useShrineStats)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			if (!useShrineStats || !ServiceBase.CanContinue() || !ConfigService.ChargeShrine.IsRewardMultiplierEnabled || !StatService.TryGetStatValue(ConfigService.ChargeShrine.RewardMultiplierFrequency, out var value) || value == 0)
			{
				return;
			}
			float rewardMultiplier = ConfigService.ChargeShrine.RewardMultiplier;
			float totalMultiplier = GetTotalMultiplier(rewardMultiplier, value);
			ManualLogSource logger = Main.Logger;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(75, 5, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ChargeShrineService");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TryUpdateShrineRewardOffers");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Applying reward multiplier: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(totalMultiplier);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x (frequency count: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(value);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", config multiplier: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(rewardMultiplier);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("x)");
			}
			logger.LogDebug(val);
			for (int i = 0; i < amount; i++)
			{
				EncounterOffer val2 = randomStatOffersResult[i];
				for (int j = 0; j < ((Il2CppArrayBase<EffectStat>)(object)val2.effects).Count; j++)
				{
					EffectStat val3 = ((Il2CppArrayBase<EffectStat>)(object)val2.effects)[j];
					float modification = val3.statModifier.modification;
					StatModifier statModifier = val3.statModifier;
					statModifier.modification *= totalMultiplier;
					ManualLogSource logger2 = Main.Logger;
					val = new BepInExDebugLogInterpolatedStringHandler(17, 5, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ChargeShrineService");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TryUpdateShrineRewardOffers");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Effect ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(j + 1);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(modification, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(val3.statModifier.modification, "F2");
					}
					logger2.LogDebug(val);
				}
			}
		}

		private static float GetTotalMultiplier(float configMultiplier, float statValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			float num = configMultiplier - 1f;
			float num2 = 1f + statValue * num;
			if (num2 <= 0.01f)
			{
				ManualLogSource logger = Main.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(50, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ChargeShrineService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("GetTotalMultiplier");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Total multiplier too low (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num2);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), clamping to 0.01x");
				}
				logger.LogWarning(val);
				num2 = 0.01f;
			}
			return num2;
		}
	}
	internal static class ConfigService
	{
		private static readonly Dictionary<EMap, MapConfigBase> _mapModifiers = new Dictionary<EMap, MapConfigBase>();

		public static UIConfig UI => UIConfig.Instance;

		public static CoreConfig Core => CoreConfig.Instance;

		public static EnemyModifiersConfig EnemyModifiers => EnemyModifiersConfig.Instance;

		public static ChargeShrineConfig ChargeShrine => ChargeShrineConfig.Instance;

		public static DesertConfig Desert => DesertConfig.Instance;

		public static ForestConfig Forest => ForestConfig.Instance;

		public static GraveyardConfig Graveyard => GraveyardConfig.Instance;

		public static void InitializeConfigs(ConfigFile config)
		{
			UIConfig.Instance.Init(config);
			CoreConfig.Instance.Init(config);
			EnemyModifiersConfig.Instance.Init(config);
			ChargeShrineConfig.Instance.Init(config);
			DesertConfig.Instance.Init(config);
			ForestConfig.Instance.Init(config);
			GraveyardConfig.Instance.Init(config);
			_mapModifiers[(EMap)2] = DesertConfig.Instance;
			_mapModifiers[(EMap)1] = ForestConfig.Instance;
			_mapModifiers[(EMap)8] = GraveyardConfig.Instance;
		}

		public static MapConfigBase GetMapModifiers(EMap map)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (!_mapModifiers.TryGetValue(map, out var value))
			{
				return null;
			}
			return value;
		}
	}
	internal class EnemyModifierService : ServiceBase
	{
		public static void TrySetEnemyChestDropChance(EffectManager effectManager)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			if (!ServiceBase.CanContinue() || !ConfigService.EnemyModifiers.IsEnemyDropChanceModifierEnabled)
			{
				return;
			}
			bool flag = default(bool);
			if ((Object)(object)effectManager == (Object)null || ((Il2CppObjectBase)effectManager).WasCollected)
			{
				ManualLogSource logger = Main.Logger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(81, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("EnemyModifierService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TrySetEnemyChestDropChance");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] EffectManager is null or was already collected. Cannot set chest drop chance.");
				}
				logger.LogWarning(val);
				return;
			}
			float baseChestDropChance = effectManager.baseChestDropChance;
			float enemyChestDropChance = ConfigService.EnemyModifiers.EnemyChestDropChance;
			ManualLogSource logger2 = Main.Logger;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(40, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("EnemyModifierService");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("TrySetEnemyChestDropChance");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Updating chest drop chance from ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(baseChestDropChance);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(enemyChestDropChance);
			}
			logger2.LogInfo(val2);
			effectManager.baseChestDropChance = enemyChestDropChance;
		}

		public static int GetModifiedTargetEnemies(int originalTarget)
		{
			if (!ServiceBase.CanContinue() || !ConfigService.EnemyModifiers.IsEnemySpawnModifiersEnabled)
			{
				return originalTarget;
			}
			SpawnModifiersBase currentSpawnModifiers = ConfigService.EnemyModifiers.GetCurrentSpawnModifiers();
			return Mathf.RoundToInt((float)originalTarget * currentSpawnModifiers.TargetSpawnsMultiplier);
		}

		public static void TrySetBaseCreditsPerSecond(BaseSummoner newSummoner)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			if (!ServiceBase.CanContinue() || !ConfigService.EnemyModifiers.IsEnemySpawnModifiersEnabled)
			{
				return;
			}
			bool flag = default(bool);
			if (newSummoner == null || ((Il2CppObjectBase)newSummoner).WasCollected)
			{
				ManualLogSource logger = Main.Logger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(86, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("EnemyModifierService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TrySetBaseCreditsPerSecond");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] BaseSummoner is null or was already collected. Cannot set base credits per second.");
				}
				logger.LogWarning(val);
				return;
			}
			StageSummoner val2 = ((Il2CppObjectBase)newSummoner).TryCast<StageSummoner>();
			if (val2 != null)
			{
				float capReduction = val2.capReduction;
				float creditMultiplier = ConfigService.EnemyModifiers.GetCurrentSpawnModifiers().CreditMultiplier;
				float num = capReduction * creditMultiplier;
				ManualLogSource logger2 = Main.Logger;
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(60, 5, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("EnemyModifierService");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("TrySetBaseCreditsPerSecond");
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Updating base credits per second from ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(capReduction);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" to ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(num);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (Modifier: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(creditMultiplier);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("x)");
				}
				logger2.LogInfo(val3);
				val2.capReduction = num;
			}
		}

		public static float GetModifiedSpawnInterval(float originalInterval)
		{
			if (!ServiceBase.CanContinue() || !ConfigService.EnemyModifiers.IsEnemySpawnModifiersEnabled)
			{
				return originalInterval;
			}
			SpawnModifiersBase currentSpawnModifiers = ConfigService.EnemyModifiers.GetCurrentSpawnModifiers();
			return originalInterval * currentSpawnModifiers.SpawnIntervalMultiplier;
		}
	}
	internal class MapDataService : ServiceBase
	{
		private class MapDataBackup
		{
			public float StageDuration { get; set; }

			public float NumChestsMultiplier { get; set; }

			public float NumShrinesMultiplier { get; set; }

			public float NumShrinesPotsAndOtherMultiplier { get; set; }
		}

		private class TimelineEventBackup
		{
			public int StageIndex { get; set; }

			public List<TimelineEvent> OriginalEvents { get; set; }

			public float OriginalStageTime { get; set; }
		}

		private static readonly Dictionary<int, MapDataBackup> _originalMapData = new Dictionary<int, MapDataBackup>();

		private static readonly Dictionary<int, List<TimelineEventBackup>> _originalTimelineEvents = new Dictionary<int, List<TimelineEventBackup>>();

		public static void TrySetMapDataOnNewMap(RunConfig newRunConfig)
		{
			//IL_0074: 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_002d: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Expected O, but got Unknown
			//IL_00db: 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_0206: Expected O, but got Unknown
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			RestoreOriginalMapData(newRunConfig);
			if (!ServiceBase.CanContinue(newRunConfig))
			{
				return;
			}
			bool flag = default(bool);
			if ((Object)(object)newRunConfig.mapData == (Object)null)
			{
				ManualLogSource logger = Main.Logger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(71, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MapDataService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("TrySetMapDataOnNewMap");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] MapData is null for the new run config. Cannot apply map modifiers.");
				}
				logger.LogWarning(val);
				return;
			}
			MapConfigBase mapModifiers = ConfigService.GetMapModifiers(newRunConfig.mapData.eMap);
			BepInExInfoLogInterpolatedStringHandler val2;
			if (mapModifiers != null && !mapModifiers.IsEnabled)
			{
				ManualLogSource logger2 = Main.Logger;
				val2 = new BepInExInfoLogInterpolatedStringHandler(54, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MapDataService");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("TrySetMapDataOnNewMap");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Map modifiers disabled for ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<EMap>(newRunConfig.mapData.eMap);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", using original values");
				}
				logger2.LogInfo(val2);
				return;
			}
			BackupOriginalMapData(newRunConfig);
			ManualLogSource logger3 = Main.Logger;
			val2 = new BepInExInfoLogInterpolatedStringHandler(31, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MapDataService");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("TrySetMapDataOnNewMap");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Applying map modifiers for ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<EMap>(newRunConfig.mapData.eMap);
			}
			logger3.LogInfo(val2);
			ManualLogSource logger4 = Main.Logger;
			val2 = new BepInExInfoLogInterpolatedStringHandler(36, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Stage Duration Change | From ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(newRunConfig.mapData.stageDuration);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(mapModifiers.StageDurationSeconds);
			}
			logger4.LogInfo(val2);
			ManualLogSource logger5 = Main.Logger;
			val2 = new BepInExInfoLogInterpolatedStringHandler(44, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Chest Spawn Multiplier Change | From ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(newRunConfig.mapData.numChestsMultiplier);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(mapModifiers.ChestSpawnMultiplier);
			}
			logger5.LogInfo(val2);
			ManualLogSource logger6 = Main.Logger;
			val2 = new BepInExInfoLogInterpolatedStringHandler(50, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Shrine Only Spawn Multiplier Change | From ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(newRunConfig.mapData.numShrinesMultiplier);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(mapModifiers.ShrineOnlySpawnMultiplier);
			}
			logger6.LogInfo(val2);
			ManualLogSource logger7 = Main.Logger;
			val2 = new BepInExInfoLogInterpolatedStringHandler(53, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Shrine and Pot Spawn Multiplier Change | From ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(newRunConfig.mapData.numShrinesPotsAndOtherMultiplier);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" to ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(mapModifiers.ShrineAndPotSpawnMultiplier);
			}
			logger7.LogInfo(val2);
			newRunConfig.mapData.stageDuration = mapModifiers.StageDurationSeconds;
			newRunConfig.mapData.numChestsMultiplier = mapModifiers.ChestSpawnMultiplier;
			newRunConfig.mapData.numShrinesMultiplier = mapModifiers.ShrineOnlySpawnMultiplier;
			newRunConfig.mapData.numShrinesPotsAndOtherMultiplier = mapModifiers.ShrineAndPotSpawnMultiplier;
			for (int i = 0; i < ((Il2CppArrayBase<StageData>)(object)newRunConfig.mapData.stages).Count; i++)
			{
				UpdateTimelineEvents(((Il2CppArrayBase<StageData>)(object)newRunConfig.mapData.stages)[i].stageTimeline, mapModifiers.StageDurationSeconds, i);
			}
		}

		private static void BackupOriginalMapData(RunConfig newRunConfig)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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_01b7: Expected O, but got Unknown
			int hashCode = ((Object)newRunConfig.mapData).GetHashCode();
			bool flag = default(bool);
			if (_originalMapData.ContainsKey(hashCode))
			{
				ManualLogSource logger = Main.Logger;
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(29, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MapDataService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BackupOriginalMapData");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] MapData already backed up");
				}
				logger.LogDebug(val);
				return;
			}
			ManualLogSource logger2 = Main.Logger;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MapDataService");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("BackupOriginalMapData");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Backing up original MapData values");
			}
			logger2.LogInfo(val2);
			_originalMapData[hashCode] = new MapDataBackup
			{
				StageDuration = newRunConfig.mapData.stageDuration,
				NumChestsMultiplier = newRunConfig.mapData.numChestsMultiplier,
				NumShrinesMultiplier = newRunConfig.mapData.numShrinesMultiplier,
				NumShrinesPotsAndOtherMultiplier = newRunConfig.mapData.numShrinesPotsAndOtherMultiplier
			};
			List<TimelineEventBackup> list = new List<TimelineEventBackup>();
			for (int i = 0; i < ((Il2CppArrayBase<StageData>)(object)newRunConfig.mapData.stages).Count; i++)
			{
				StageData val3 = ((Il2CppArrayBase<StageData>)(object)newRunConfig.mapData.stages)[i];
				object obj;
				if (val3 == null)
				{
					obj = null;
				}
				else
				{
					StageTimeline stageTimeline = val3.stageTimeline;
					obj = ((stageTimeline != null) ? stageTimeline.events : null);
				}
				if (obj != null)
				{
					List<TimelineEvent> list2 = new List<TimelineEvent>();
					for (int j = 0; j < val3.stageTimeline.events.Count; j++)
					{
						TimelineEvent val4 = val3.stageTimeline.events[j];
						list2.Add(new TimelineEvent
						{
							eTimelineEvent = val4.eTimelineEvent,
							duration = val4.duration,
							enemies = val4.enemies,
							timeMinutes = val4.timeMinutes
						});
					}
					list.Add(new TimelineEventBackup
					{
						StageIndex = i,
						OriginalEvents = list2,
						OriginalStageTime = val3.stageTimeline.stageTime
					});
				}
			}
			_originalTimelineEvents[hashCode] = list;
		}

		private static void RestoreOriginalMapData(RunConfig newRunConfig)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			int hashCode = ((Object)newRunConfig.mapData).GetHashCode();
			bool flag = default(bool);
			if (!_originalMapData.TryGetValue(hashCode, out var value))
			{
				ManualLogSource logger = Main.Logger;
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(31, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MapDataService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RestoreOriginalMapData");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] No backup found for MapData");
				}
				logger.LogDebug(val);
				return;
			}
			ManualLogSource logger2 = Main.Logger;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(37, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MapDataService");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("RestoreOriginalMapData");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Restoring original MapData values");
			}
			logger2.LogInfo(val2);
			newRunConfig.mapData.stageDuration = value.StageDuration;
			newRunConfig.mapData.numChestsMultiplier = value.NumChestsMultiplier;
			newRunConfig.mapData.numShrinesMultiplier = value.NumShrinesMultiplier;
			newRunConfig.mapData.numShrinesPotsAndOtherMultiplier = value.NumShrinesPotsAndOtherMultiplier;
			if (!_originalTimelineEvents.TryGetValue(hashCode, out var value2))
			{
				return;
			}
			foreach (TimelineEventBackup item in value2)
			{
				if (item.StageIndex >= ((Il2CppArrayBase<StageData>)(object)newRunConfig.mapData.stages).Count)
				{
					continue;
				}
				StageData val3 = ((Il2CppArrayBase<StageData>)(object)newRunConfig.mapData.stages)[item.StageIndex];
				if (((val3 != null) ? val3.stageTimeline : null) == null)
				{
					continue;
				}
				val3.stageTimeline.events.Clear();
				foreach (TimelineEvent originalEvent in item.OriginalEvents)
				{
					val3.stageTimeline.events.Add(originalEvent);
				}
				val3.stageTimeline.stageTime = item.OriginalStageTime;
			}
		}

		private static void UpdateTimelineEvents(StageTimeline stageTimeline, float newDurationSeconds, int stageIndex)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			//IL_0220: 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_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Expected O, but got Unknown
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			if (stageTimeline == null || ((Il2CppObjectBase)stageTimeline).WasCollected)
			{
				ManualLogSource logger = Main.Logger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(76, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MapDataService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("UpdateTimelineEvents");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] StageTimeline is null for stage ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(stageIndex);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". Cannot apply stage duration modifiers.");
				}
				logger.LogWarning(val);
				return;
			}
			if (stageTimeline.events == null || stageTimeline.events.Count == 0)
			{
				ManualLogSource logger2 = Main.Logger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(111, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("MapDataService");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("UpdateTimelineEvents");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] StageTimeline events are null or empty for stage ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(stageIndex);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". Cannot update timeline events for stage duration change.");
				}
				logger2.LogWarning(val);
				return;
			}
			ManualLogSource logger3 = Main.Logger;
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(68, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("MapDataService");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("UpdateTimelineEvents");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Updating timeline events for stage ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(stageIndex);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" duration change to ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(newDurationSeconds);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" seconds.");
			}
			logger3.LogInfo(val2);
			stageTimeline.stageTime = newDurationSeconds;
			int num = Mathf.RoundToInt(newDurationSeconds / 60f);
			Dictionary<ETimelineEvent, TimelineEvent> dictionary = new Dictionary<ETimelineEvent, TimelineEvent>();
			float num2 = 0f;
			List<TimelineEvent> events = stageTimeline.events;
			for (int i = 0; i < events.Count; i++)
			{
				ETimelineEvent eTimelineEvent = events[i].eTimelineEvent;
				if (!dictionary.ContainsKey(eTimelineEvent))
				{
					ManualLogSource logger4 = Main.Logger;
					val2 = new BepInExInfoLogInterpolatedStringHandler(47, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Found first event of type ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<ETimelineEvent>(eTimelineEvent);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" at time ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(events[i].GetTimeSeconds());
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" seconds.");
					}
					logger4.LogInfo(val2);
					dictionary[eTimelineEvent] = events[i];
				}
			}
			Dictionary<ETimelineEvent, TimelineEvent> dictionary2 = new Dictionary<ETimelineEvent, TimelineEvent>();
			for (int num3 = events.Count - 1; num3 >= 0; num3--)
			{
				ETimelineEvent eTimelineEvent2 = events[num3].eTimelineEvent;
				if (!dictionary2.ContainsKey(eTimelineEvent2))
				{
					ManualLogSource logger5 = Main.Logger;
					val2 = new BepInExInfoLogInterpolatedStringHandler(46, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Found last event of type ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<ETimelineEvent>(eTimelineEvent2);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" at time ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(events[num3].GetTimeSeconds());
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" seconds.");
					}
					logger5.LogInfo(val2);
					dictionary2[eTimelineEvent2] = events[num3];
				}
			}
			foreach (TimelineEvent value in dictionary.Values)
			{
				num2 = dictionary2[value.eTimelineEvent].timeMinutes;
				float timeMinutes = value.timeMinutes;
				while (num2 + timeMinutes < (float)num)
				{
					num2 += timeMinutes;
					TimelineEvent val3 = new TimelineEvent
					{
						eTimelineEvent = value.eTimelineEvent,
						duration = value.duration,
						enemies = value.enemies,
						timeMinutes = num2
					};
					stageTimeline.events.Add(val3);
					ManualLogSource logger6 = Main.Logger;
					val2 = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" - Added new event of type ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<ETimelineEvent>(value.eTimelineEvent);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" at time ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(val3.GetTimeSeconds());
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" seconds.");
					}
					logger6.LogInfo(val2);
				}
			}
		}
	}
	internal abstract class ServiceBase
	{
		public static bool CanContinue()
		{
			if (ConfigService.Core.IsEnabled)
			{
				if (!ConfigService.Core.IsEnabledDuringChallenges)
				{
					RunConfig runConfig = MapController.runConfig;
					return (Object)(object)((runConfig != null) ? runConfig.challenge : null) == (Object)null;
				}
				return true;
			}
			return false;
		}

		public static bool CanContinue(RunConfig newRunConfig)
		{
			if (ConfigService.Core.IsEnabled)
			{
				if (!ConfigService.Core.IsEnabledDuringChallenges)
				{
					return (Object)(object)((newRunConfig != null) ? newRunConfig.challenge : null) == (Object)null;
				}
				return true;
			}
			return false;
		}
	}
	internal class StatService
	{
		public static bool TryGetStatValue(MultiplyStatFrequency stat, out int value)
		{
			value = 0;
			switch (stat)
			{
			case MultiplyStatFrequency.PerPlayerLevel:
				value = MyPlayer.Instance.inventory.GetCharacterLevel();
				break;
			case MultiplyStatFrequency.PerShrineCharged:
				value = RunStats.GetStat((EMyStat)16);
				break;
			case MultiplyStatFrequency.PerStageCompleted:
				value = MapController.GetStageIndex();
				break;
			case MultiplyStatFrequency.PerBossDefeated:
				value = RunStats.GetStat((EMyStat)6);
				break;
			case MultiplyStatFrequency.PerMiniBossAndBossDefeated:
				value = RunStats.GetStat((EMyStat)6) + RunStats.GetStat((EMyStat)21);
				break;
			case MultiplyStatFrequency.PerEliteKilled:
				value = RunStats.GetStat((EMyStat)5);
				break;
			case MultiplyStatFrequency.PerPowerupsUsed:
				value = RunStats.GetStat((EMyStat)31);
				break;
			case MultiplyStatFrequency.PerPotsBroken:
				value = RunStats.GetStat((EMyStat)13);
				break;
			case MultiplyStatFrequency.PerChestsOpened:
				value = RunStats.GetStat((EMyStat)3);
				break;
			case MultiplyStatFrequency.PerSilverEarnedInRun:
				value = RunStats.GetStat((EMyStat)23);
				break;
			default:
				return false;
			}
			return true;
		}
	}
}
namespace BonkTuner.Configs
{
	internal class ChargeShrineConfig
	{
		private static ChargeShrineConfig _instance;

		private ConfigEntry<bool> _isRewardMultiplierEnabled;

		private ConfigEntry<MultiplyStatFrequency> _rewardMultiplierFrequency;

		private ConfigEntry<float> _rewardMultiplier;

		private ConfigEntry<bool> _isChargeRateMultiplierEnabled;

		private ConfigEntry<MultiplyStatFrequency> _chargeRateMultiplierFrequency;

		private ConfigEntry<float> _chargeRateMultiplier;

		public static ChargeShrineConfig Instance => _instance ?? (_instance = new ChargeShrineConfig());

		public bool IsRewardMultiplierEnabled => _isRewardMultiplierEnabled.Value;

		public MultiplyStatFrequency RewardMultiplierFrequency => _rewardMultiplierFrequency.Value;

		public float RewardMultiplier => _rewardMultiplier.Value;

		public bool IsChargeRateMultiplierEnabled => _isChargeRateMultiplierEnabled.Value;

		public MultiplyStatFrequency ChargeRateMultiplierFrequency => _chargeRateMultiplierFrequency.Value;

		public float ChargeRateMultiplier => _chargeRateMultiplier.Value;

		private ChargeShrineConfig()
		{
		}

		public void DisableRewardMultiplier()
		{
			_isRewardMultiplierEnabled.Value = false;
		}

		public void EnableRewardMultiplier()
		{
			_isRewardMultiplierEnabled.Value = true;
		}

		public void SetRewardMultiplierFrequency(MultiplyStatFrequency frequency)
		{
			_rewardMultiplierFrequency.Value = frequency;
		}

		public void SetRewardMultiplier(float multiplier)
		{
			_rewardMultiplier.Value = multiplier;
		}

		public void ResetRewardMultiplier()
		{
			_rewardMultiplier.Value = (float)((ConfigEntryBase)_rewardMultiplier).DefaultValue;
		}

		public void DisableChargeRateMultiplier()
		{
			_isChargeRateMultiplierEnabled.Value = false;
		}

		public void EnableChargeRateMultiplier()
		{
			_isChargeRateMultiplierEnabled.Value = true;
		}

		public void SetChargeRateMultiplierFrequency(MultiplyStatFrequency frequency)
		{
			_chargeRateMultiplierFrequency.Value = frequency;
		}

		public void SetChargeRateMultiplier(float multiplier)
		{
			_chargeRateMultiplier.Value = multiplier;
		}

		public void ResetChargeRateMultiplier()
		{
			_chargeRateMultiplier.Value = (float)((ConfigEntryBase)_chargeRateMultiplier).DefaultValue;
		}

		public void Init(ConfigFile config)
		{
			_isRewardMultiplierEnabled = config.Bind<bool>("Charge Shrine Modifiers", "Is Reward Multiplier Enabled", true, "Enable or disable the charge shrine reward multiplier.");
			_rewardMultiplierFrequency = config.Bind<MultiplyStatFrequency>("Charge Shrine Modifiers", "Reward Multiplier Frequency", MultiplyStatFrequency.PerShrineCharged, "Frequency at which the reward multiplier is applied.");
			_rewardMultiplier = config.Bind<float>("Charge Shrine Modifiers", "Reward Multiplier", 1f, "Multiplier for shrine reward quality. The frequency stat value is multiplied by this multiplier. (1.0 = no change, 2.0 = double per frequency count, 0.5 = half per frequency count)");
			_isChargeRateMultiplierEnabled = config.Bind<bool>("Charge Shrine Modifiers", "Is Charge Rate Multiplier Enabled", true, "Enable or disable the charge shrine charge rate multiplier.");
			_chargeRateMultiplierFrequency = config.Bind<MultiplyStatFrequency>("Charge Shrine Modifiers", "Charge Rate Multiplier Frequency", MultiplyStatFrequency.PerShrineCharged, "Frequency at which the charge rate multiplier is applied.");
			_chargeRateMultiplier = config.Bind<float>("Charge Shrine Modifiers", "Charge Rate Multiplier", 1f, "Multiplier for shrine charge speed. The frequency stat value is multiplied by this multiplier. (1.0 = no change, 2.0 = charges twice as fast per frequency count, 0.5 = charges twice as slow per frequency count)");
		}
	}
	internal class CoreConfig
	{
		private static CoreConfig _instance;

		private ConfigEntry<bool> _isEnabled;

		private ConfigEntry<bool> _isEnabledDuringChallenges;

		public static CoreConfig Instance => _instance ?? (_instance = new CoreConfig());

		public bool IsEnabled => _isEnabled.Value;

		public bool IsEnabledDuringChallenges => _isEnabledDuringChallenges.Value;

		private CoreConfig()
		{
		}

		public void DisableMod()
		{
			_isEnabled.Value = false;
		}

		public void EnableMod()
		{
			_isEnabled.Value = true;
		}

		public void EnableDuringChallenges()
		{
			_isEnabledDuringChallenges.Value = true;
		}

		public void DisableDuringChallenges()
		{
			_isEnabledDuringChallenges.Value = false;
		}

		public void Init(ConfigFile config)
		{
			_isEnabled = config.Bind<bool>("Core", "Is Enabled", true, "Enable or disable the BonkTuner mod.");
			_isEnabledDuringChallenges = config.Bind<bool>("Core", "Is Enabled During Challenges", false, "Allow the mod's effects to be active during challenge runs. Enabling this may cause balance issues in certain challenges.");
		}
	}
	internal class EnemyModifiersConfig
	{
		private static EnemyModifiersConfig _instance;

		private ConfigEntry<bool> _isEnemyDropChanceModifierEnabled;

		private ConfigEntry<float> _enemyChestDropChance;

		private ConfigEntry<bool> _isEnemySpawnModifiersEnabled;

		private ConfigEntry<EnemySpawnPreset> _enemySpawnPreset;

		private static readonly Dictionary<EnemySpawnPreset, SpawnModifiersBase> _enemySpawnModifiers = new Dictionary<EnemySpawnPreset, SpawnModifiersBase>
		{
			{
				EnemySpawnPreset.Normal,
				new NormalSpawnModifiers()
			},
			{
				EnemySpawnPreset.Casual,
				new CasualSpawnModifiers()
			},
			{
				EnemySpawnPreset.Intense,
				new IntenseSpawnModifiers()
			},
			{
				EnemySpawnPreset.Swarm,
				new SwarmSpawnModifiers()
			},
			{
				EnemySpawnPreset.Apocalypse,
				new ApocalypseSpawnModifiers()
			}
		};

		public static EnemyModifiersConfig Instance => _instance ?? (_instance = new EnemyModifiersConfig());

		public bool IsEnemyDropChanceModifierEnabled => _isEnemyDropChanceModifierEnabled.Value;

		public float EnemyChestDropChance => _enemyChestDropChance.Value;

		public bool IsEnemySpawnModifiersEnabled => _isEnemySpawnModifiersEnabled.Value;

		public EnemySpawnPreset SpawnPreset => _enemySpawnPreset.Value;

		private EnemyModifiersConfig()
		{
		}

		public void DisableEnemyDropChanceModifier()
		{
			_isEnemyDropChanceModifierEnabled.Value = false;
		}

		public void EnableEnemyDropChanceModifier()
		{
			_isEnemyDropChanceModifierEnabled.Value = true;
		}

		public void SetEnemyChestDropChance(float chance)
		{
			_enemyChestDropChance.Value = chance;
		}

		public void ResetEnemyChestDropChance()
		{
			_enemyChestDropChance.Value = (float)((ConfigEntryBase)_enemyChestDropChance).DefaultValue;
		}

		public void DisableEnemySpawnModifiers()
		{
			_isEnemySpawnModifiersEnabled.Value = false;
		}

		public void EnableEnemySpawnModifiers()
		{
			_isEnemySpawnModifiersEnabled.Value = true;
		}

		public void SetEnemySpawnPreset(EnemySpawnPreset preset)
		{
			_enemySpawnPreset.Value = preset;
		}

		public void ResetEnemySpawnPreset()
		{
			_enemySpawnPreset.Value = EnemySpawnPreset.Normal;
		}

		public void Init(ConfigFile config)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			_isEnemyDropChanceModifierEnabled = config.Bind<bool>("Enemy Modifiers", "Is Enemy Drop Chance Modifier Enabled", true, "Enable or disable the enemy chest drop chance modifier.");
			_enemyChestDropChance = config.Bind<float>("Enemy Modifiers", "Enemy Chest Drop Chance", 0.0005f, "Base chance for enemies to drop chests (0.01 = 1%).");
			StringBuilder val = new StringBuilder("Preset options for enemy spawn rates:");
			val.AppendLine();
			foreach (SpawnModifiersBase value in _enemySpawnModifiers.Values)
			{
				val.AppendLine($" => {value.Preset}: {value.Description}");
			}
			_isEnemySpawnModifiersEnabled = config.Bind<bool>("Enemy Modifiers", "Is Enemy Spawn Modifiers Enabled", true, "Enable or disable the enemy spawn modifiers.");
			_enemySpawnPreset = config.Bind<EnemySpawnPreset>("Enemy Modifiers", "Enemy Spawn Preset", EnemySpawnPreset.Normal, ((Object)val).ToString());
		}

		public SpawnModifiersBase GetCurrentSpawnModifiers()
		{
			return _enemySpawnModifiers[SpawnPreset];
		}
	}
	internal class UIConfig
	{
		private static UIConfig _instance;

		private ConfigEntry<KeyCode> _toggleKey;

		private ConfigEntry<bool> _startOpen;

		public static UIConfig Instance => _instance ?? (_instance = new UIConfig());

		public KeyCode ToggleKey => _toggleKey.Value;

		public bool StartOpen => _startOpen.Value;

		private UIConfig()
		{
		}

		public void SetToggleKey(KeyCode key)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			_toggleKey.Value = key;
		}

		public void DisableStartOpen()
		{
			_startOpen.Value = false;
		}

		public void EnableStartOpen()
		{
			_startOpen.Value = true;
		}

		public void Init(ConfigFile config)
		{
			_toggleKey = config.Bind<KeyCode>("UI", "Toggle Key", (KeyCode)286, "Key to toggle the configuration UI window.");
			_startOpen = config.Bind<bool>("UI", "Start Open", false, "Whether the UI should be open when the game starts.");
		}
	}
}
namespace BonkTuner.Configs.MapConfigs
{
	internal class DesertConfig : MapConfigBase
	{
		private static DesertConfig _instance;

		public static DesertConfig Instance => _instance ?? (_instance = new DesertConfig());

		private DesertConfig()
			: base(600f, 1f, 1f, 1f)
		{
		}

		public override void Init(ConfigFile config)
		{
			base.IsEnabledEntry = config.Bind<bool>("Desert Map Modifiers", "Is Enabled", true, "Enable or disable Desert map modifiers.");
			base.StageDurationSecondsEntry = config.Bind<float>("Desert Map Modifiers", "Stage Duration Seconds", base.DefaultStageDurationSeconds, "Duration of each stage in seconds.");
			base.ChestSpawnMultiplierEntry = config.Bind<float>("Desert Map Modifiers", "Chest Spawn Multiplier", base.DefaultChestSpawnMultiplier, "Multiplier for chest spawn rates.");
			base.ShrineOnlySpawnMultiplierEntry = config.Bind<float>("Desert Map Modifiers", "Shrine Only Spawn Multiplier", base.DefaultShrineOnlySpawnMultiplier, "Multiplier for shrine spawn rates.");
			base.ShrineAndPotSpawnMultiplierEntry = config.Bind<float>("Desert Map Modifiers", "Shrine and Pot Spawn Multiplier", base.DefaultShrineAndPotSpawnMultiplier, "Multiplier for shrine and pot spawn rates.");
		}
	}
	internal class ForestConfig : MapConfigBase
	{
		private static ForestConfig _instance;

		public static ForestConfig Instance => _instance ?? (_instance = new ForestConfig());

		private ForestConfig()
			: base(600f, 1f, 1f, 1f)
		{
		}

		public override void Init(ConfigFile config)
		{
			base.IsEnabledEntry = config.Bind<bool>("Forest Map Modifiers"