Decompiled source of BonkTuner v1.1.1

BonkTuner.dll

Decompiled 2 weeks 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;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[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.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+be22bd041f84a27dab54f8c5cd72a4baa1e1a5bd")]
[assembly: AssemblyProduct("BonkTuner")]
[assembly: AssemblyTitle("BonkTuner")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00dd: Expected O, but got Unknown
			//IL_00e2: 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_00f3: 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>();
				ClassInjector.RegisterTypeInIl2Cpp<SettingsDisplayWindow>();
				_logger.LogInfo((object)"MainWindow type registered with IL2CPP");
			}
			catch (Exception ex)
			{
				ManualLogSource logger2 = _logger;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to register MainWindow types: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				logger2.LogError(val2);
				return;
			}
			GameObject val3 = new GameObject("BonkTunerUI");
			val3.AddComponent<MainWindow>();
			Object.DontDestroyOnLoad((Object)val3);
			GameObject val4 = new GameObject("BonkTunerSettingsDisplay");
			SettingsDisplayWindow settingsDisplayReference = val4.AddComponent<SettingsDisplayWindow>();
			Object.DontDestroyOnLoad((Object)val4);
			MainWindow.SetSettingsDisplayReference(settingsDisplayReference);
			_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
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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("UI Settings", Styles.Header, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			bool showSettingsDisplay = ConfigService.UI.ShowSettingsDisplay;
			bool flag4 = GUILayout.Toggle(showSettingsDisplay, " Show Settings Display", Styles.Toggle, (Il2CppReferenceArray<GUILayoutOption>)null);
			if (flag4 != showSettingsDisplay)
			{
				if (flag4)
				{
					ConfigService.UI.EnableSettingsDisplay();
				}
				else
				{
					ConfigService.UI.DisableSettingsDisplay();
				}
				ManualLogSource logger3 = Main.Logger;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Show settings display changed to: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(flag4);
				}
				logger3.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 static SettingsDisplayWindow _settingsDisplay;

		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)


		public static void SetSettingsDisplayReference(SettingsDisplayWindow settingsDisplay)
		{
			_settingsDisplay = settingsDisplay;
		}

		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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			if (Input.GetKeyDown(ConfigService.UI.ToggleKey))
			{
				_isGuiOpen = !_isGuiOpen;
				_settingsDisplay?.SetMainWindowState(_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;
				_settingsDisplay?.SetMainWindowState(isOpen: 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 SettingsDisplayWindow : MonoBehaviour
	{
		private Rect _windowRect = new Rect(50f, 50f, 280f, 700f);

		private bool _isMainWindowOpen;

		private float _cachedRewardMultiplier;

		private float _cachedChargeMultiplier;

		private readonly float _cacheUpdateInterval = 2f;

		private float _nextCacheUpdate;

		private bool _isInGame;

		private EMap _map;

		public SettingsDisplayWindow(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)


		private void Start()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			UpdateCache();
			ManualLogSource logger = Main.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SettingsDisplayWindow");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] SettingsDisplayWindow initialized.");
			}
			logger.LogInfo(val);
			SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)SceneManager_sceneLoaded);
		}

		private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (((Scene)(ref scene)).name == "MainMenu" || ((Scene)(ref scene)).name.Contains("Load", StringComparison.OrdinalIgnoreCase))
			{
				_isInGame = false;
				_map = (EMap)0;
			}
			else
			{
				_isInGame = true;
				_map = MapController.currentMap.eMap;
			}
		}

		public void SetMainWindowState(bool isOpen)
		{
			_isMainWindowOpen = isOpen;
			if (isOpen)
			{
				UpdateCache();
			}
		}

		private void Update()
		{
			if (ConfigService.UI.ShowSettingsDisplay && Time.unscaledTime >= _nextCacheUpdate)
			{
				UpdateCache();
				_nextCacheUpdate = Time.unscaledTime + _cacheUpdateInterval;
			}
		}

		private void UpdateCache()
		{
			_cachedRewardMultiplier = ChargeShrineService.GetTotalRewardMultiplier();
			_cachedChargeMultiplier = ChargeShrineService.GetTotalChargeMultiplier();
		}

		private void OnGUI()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Styles.Initialize();
			if (ConfigService.UI.ShowSettingsDisplay)
			{
				if (_isMainWindowOpen)
				{
					_windowRect = GUI.Window(234433, _windowRect, WindowFunction.op_Implicit((Action<int>)DrawWindow), "Settings Display", Styles.Window);
				}
				else if (_isInGame)
				{
					DrawTextOnly();
				}
			}
		}

		private void DrawWindow(int windowID)
		{
			//IL_003e: 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.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			DrawSettingsContent();
			GUILayout.EndVertical();
		}

		private void DrawTextOnly()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginArea(new Rect(((Rect)(ref _windowRect)).x, ((Rect)(ref _windowRect)).y, ((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height));
			GUILayout.BeginVertical(Styles.TransparentOverlay, Array.Empty<GUILayoutOption>());
			DrawSettingsContent();
			GUILayout.EndVertical();
			GUILayout.EndArea();
		}

		private void DrawSettingsContent()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Invalid comparison between Unknown and I4
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Invalid comparison between Unknown and I4
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			GUILayout.Label("=== CORE ===", Styles.LabelBold, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Mod: " + GetEnabledText(ConfigService.Core.IsEnabled), Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Challenges: " + GetEnabledText(ConfigService.Core.IsEnabledDuringChallenges), Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			GUILayout.Label("=== MAP MODIFIERS ===", Styles.LabelBold, (Il2CppReferenceArray<GUILayoutOption>)null);
			EMap map = _map;
			if ((int)map != 1)
			{
				if ((int)map != 2)
				{
					if ((int)map == 8)
					{
						DrawMapInfo("Graveyard", ConfigService.Graveyard);
					}
				}
				else
				{
					DrawMapInfo("Desert", ConfigService.Desert);
				}
			}
			else
			{
				DrawMapInfo("Forest", ConfigService.Forest);
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			GUILayout.Label("=== SHRINE ===", Styles.LabelBold, (Il2CppReferenceArray<GUILayoutOption>)null);
			if (ConfigService.ChargeShrine.IsRewardMultiplierEnabled)
			{
				GUILayout.Label($"Reward: {ConfigService.ChargeShrine.RewardMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Freq: {ConfigService.ChargeShrine.RewardMultiplierFrequency}", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Total: {_cachedRewardMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			else
			{
				GUILayout.Label("Reward: Disabled", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			if (ConfigService.ChargeShrine.IsChargeRateMultiplierEnabled)
			{
				GUILayout.Label($"Charge Rate: {ConfigService.ChargeShrine.ChargeRateMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Freq: {ConfigService.ChargeShrine.ChargeRateMultiplierFrequency}", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Total: {_cachedChargeMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			else
			{
				GUILayout.Label("Charge Rate: Disabled", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(8f) });
			GUILayout.Label("=== ENEMIES ===", Styles.LabelBold, (Il2CppReferenceArray<GUILayoutOption>)null);
			if (ConfigService.EnemyModifiers.IsEnemyDropChanceModifierEnabled)
			{
				GUILayout.Label($"Drop: {ConfigService.EnemyModifiers.EnemyChestDropChance * 100f:F4}%", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			else
			{
				GUILayout.Label("Drop: Disabled", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			if (ConfigService.EnemyModifiers.IsEnemySpawnModifiersEnabled)
			{
				SpawnModifiersBase currentSpawnModifiers = ConfigService.EnemyModifiers.GetCurrentSpawnModifiers();
				GUILayout.Label($"Preset: {currentSpawnModifiers.Preset}", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Target: {currentSpawnModifiers.TargetSpawnsMultiplier:F1}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Credit: {currentSpawnModifiers.CreditMultiplier:F1}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Interval: {currentSpawnModifiers.SpawnIntervalMultiplier:F1}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			else
			{
				GUILayout.Label("Spawns: Disabled", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
		}

		private static void DrawMapInfo(string mapName, MapConfigBase config)
		{
			if (config.IsEnabled)
			{
				GUILayout.Label(mapName + ":", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Duration: {config.StageDurationSeconds:F0}s", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Chest: {config.ChestSpawnMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  Shrine: {config.ShrineOnlySpawnMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"  S&P: {config.ShrineAndPotSpawnMultiplier:F2}x", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			else
			{
				GUILayout.Label(mapName + ": Disabled", Styles.Label, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
		}

		private static string GetEnabledText(bool isEnabled)
		{
			if (!isEnabled)
			{
				return "Disabled";
			}
			return "Enabled";
		}
	}
	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 Texture2D TransparentOverlayTexture { 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 GUIStyle TransparentOverlay { 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Expected O, but got Unknown
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Expected O, but got Unknown
			//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_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Expected O, but got Unknown
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Expected O, but got Unknown
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Expected O, but got Unknown
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_051c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Expected O, but got Unknown
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Expected O, but got Unknown
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Expected O, but got Unknown
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Expected O, but got Unknown
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Expected O, but got Unknown
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Expected O, but got Unknown
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: 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_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Expected O, but got Unknown
			//IL_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_0754: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Unknown result type (might be due to invalid IL or missing references)
			//IL_077c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0791: Unknown result type (might be due to invalid IL or missing references)
			//IL_079d: Expected O, but got Unknown
			//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Expected O, but got Unknown
			//IL_081c: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0853: Unknown result type (might be due to invalid IL or missing references)
			//IL_0862: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_086e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_087c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Expected O, but got Unknown
			//IL_0892: Unknown result type (might be due to invalid IL or missing references)
			//IL_0897: Unknown result type (might be due to invalid IL or missing references)
			//IL_089f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ab: Expected O, but got Unknown
			//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Expected O, but got Unknown
			//IL_0911: Unknown result type (might be due to invalid IL or missing references)
			//IL_0925: Unknown result type (might be due to invalid IL or missing references)
			//IL_092a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0932: Unknown result type (might be due to invalid IL or missing references)
			//IL_0939: Unknown result type (might be due to invalid IL or missing references)
			//IL_0945: Expected O, but got Unknown
			//IL_0972: Unknown result type (might be due to invalid IL or missing references)
			//IL_0981: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_098d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0994: Unknown result type (might be due to invalid IL or missing references)
			//IL_099b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a7: Expected O, but got Unknown
			//IL_09ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d2: Expected O, but got Unknown
			//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ee: Expected O, but got Unknown
			//IL_0a07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a57: Expected O, but got Unknown
			//IL_0a70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad4: Expected O, but got Unknown
			//IL_0b29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3d: 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_0b65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7e: Expected O, but got Unknown
			//IL_0b97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bec: Expected O, but got Unknown
			//IL_0c05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0a: 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_0c18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2b: Expected O, but got Unknown
			//IL_0c30: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c56: Expected O, but got Unknown
			//IL_0c60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6a: Expected O, but got Unknown
			//IL_0c92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb8: Expected O, but got Unknown
			//IL_0cbd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce4: Expected O, but got Unknown
			//IL_0cf9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d03: Expected O, but got Unknown
			//IL_0d3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d54: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d60: Expected O, but got Unknown
			//IL_0d65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d8c: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			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;
			TransparentOverlayTexture = new Texture2D(1, 1, (TextureFormat)4, false);
			TransparentOverlayTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.3f));
			TransparentOverlayTexture.Apply();
			((Object)TransparentOverlayTexture).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;
			TransparentOverlay = new GUIStyle(GUI.skin.box);
			TransparentOverlay.normal.background = TransparentOverlayTexture;
			TransparentOverlay.padding = new RectOffset
			{
				left = 8,
				right = 8,
				top = 8,
				bottom = 8
			};
			TransparentOverlay.margin = new RectOffset
			{
				left = 0,
				right = 0,
				top = 0,
				bottom = 0
			};
			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_0035: Expected O, but got Unknown
			if (!ServiceBase.CanContinue() || !ConfigService.ChargeShrine.IsChargeRateMultiplierEnabled)
			{
				return;
			}
			if ((Object)(object)baseInteractable == (Object)null || ((Il2CppObjectBase)baseInteractable).WasCollected)
			{
				ManualLogSource logger = Main.Logger;
				bool flag = default(bool);
				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);
			}
			else
			{
				ChargeShrine val2 = ((Il2CppObjectBase)baseInteractable).TryCast<ChargeShrine>();
				if (!((Object)(object)val2 == (Object)null))
				{
					float totalChargeMultiplier = GetTotalChargeMultiplier();
					float chargeTime = val2.chargeTime;
					val2.currentChargeTime = chargeTime / totalChargeMultiplier;
				}
			}
		}

		public static void TryUpdateShrineRewardOffers(List<EncounterOffer> randomStatOffersResult, int amount, bool useShrineStats)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			if (!useShrineStats || !ServiceBase.CanContinue() || !ConfigService.ChargeShrine.IsRewardMultiplierEnabled)
			{
				return;
			}
			float totalRewardMultiplier = GetTotalRewardMultiplier();
			bool flag = default(bool);
			for (int i = 0; i < amount; i++)
			{
				EncounterOffer val = randomStatOffersResult[i];
				for (int j = 0; j < ((Il2CppArrayBase<EffectStat>)(object)val.effects).Count; j++)
				{
					EffectStat val2 = ((Il2CppArrayBase<EffectStat>)(object)val.effects)[j];
					float modification = val2.statModifier.modification;
					StatModifier statModifier = val2.statModifier;
					statModifier.modification *= totalRewardMultiplier;
					ManualLogSource logger = Main.Logger;
					BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(17, 5, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("ChargeShrineService");
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(".");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("TryUpdateShrineRewardOffers");
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Effect ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(j + 1);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(modification, "F2");
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" -> ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(val2.statModifier.modification, "F2");
					}
					logger.LogDebug(val3);
				}
			}
		}

		public static float GetTotalRewardMultiplier()
		{
			if (StatService.TryGetStatValue(ConfigService.ChargeShrine.RewardMultiplierFrequency, out var value))
			{
				return GetTotalMultiplier(ConfigService.ChargeShrine.RewardMultiplier, value);
			}
			return 1f;
		}

		public static float GetTotalChargeMultiplier()
		{
			if (StatService.TryGetStatValue(ConfigService.ChargeShrine.ChargeRateMultiplierFrequency, out var value))
			{
				return GetTotalMultiplier(ConfigService.ChargeShrine.ChargeRateMultiplier, value);
			}
			return 1f;
		}

		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;
			if (MapController.IsMainMenu() || RunStats.stats == null || RunStats.stats.Count == 0)
			{
				return false;
			}
			MyPlayer instance = MyPlayer.Instance;
			if (((instance != null) ? instance.inventory : null) == null)
			{
				return false;
			}
			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.