Decompiled source of DebugMod v0.2.4

DebugMod.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DebugMod.Helpers;
using DebugMod.Hitbox;
using DebugMod.MonoBehaviours;
using DebugMod.SaveStates;
using DebugMod.UI;
using DebugMod.UI.Canvas;
using GlobalEnums;
using GlobalSettings;
using HarmonyLib;
using InControl;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.ModInterop;
using MonoMod.RuntimeDetour;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DebugMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.4.0")]
[assembly: AssemblyInformationalVersion("0.2.4+c2d3bca7956d6841efd25528d3f82f9ab981a092")]
[assembly: AssemblyProduct("DebugMod")]
[assembly: AssemblyTitle("DebugMod")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/hk-speedrunning/Silksong.DebugMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace DebugMod
{
	[HarmonyPatch]
	public static class BindableFunctions
	{
		[CompilerGenerated]
		private sealed class <AdvanceMyFrame>d__51 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					DebugMod.CurrentTimeScale = (Time.timeScale = 1f);
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					DebugMod.CurrentTimeScale = (Time.timeScale = 0f);
					return false;
				}
			}

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

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

		private static readonly FieldInfo TimeSlowed = typeof(GameManager).GetField("timeSlowed", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

		private static readonly FieldInfo IgnoreUnpause = typeof(UIManager).GetField("ignoreUnpause", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly FieldInfo cameraGameplayScene = typeof(CameraController).GetField("isGameplayScene", BindingFlags.Instance | BindingFlags.NonPublic);

		private static float TimeScaleDuringFrameAdvance = 0f;

		internal static int frameCounter = 0;

		private static string saveLevelStateAction;

		[BindableMethod(name = "Kill All", category = "Cheats")]
		public static void KillAll()
		{
			int num = 0;
			HealthManager[] array = Object.FindObjectsOfType<HealthManager>();
			foreach (HealthManager val in array)
			{
				if (!val.isDead)
				{
					val.Die((float?)null, (AttackTypes)1, true);
					num++;
				}
			}
			DebugMod.LogConsole($"Killing {num} HealthManagers in scene!");
		}

		[BindableMethod(name = "Infinite Jump", category = "Cheats")]
		public static void ToggleInfiniteJump()
		{
			PlayerData.instance.infiniteAirJump = !PlayerData.instance.infiniteAirJump;
			DebugMod.LogConsole("Infinite Jump set to " + PlayerData.instance.infiniteAirJump.ToString().ToUpper());
		}

		[BindableMethod(name = "Infinite Silk", category = "Cheats")]
		public static void ToggleInfiniteSilk()
		{
			DebugMod.infiniteSilk = !DebugMod.infiniteSilk;
			DebugMod.LogConsole("Infinite Silk set to " + DebugMod.infiniteSilk.ToString().ToUpper());
		}

		[BindableMethod(name = "Infinite HP", category = "Cheats")]
		public static void ToggleInfiniteHP()
		{
			DebugMod.infiniteHP = !DebugMod.infiniteHP;
			DebugMod.LogConsole("Infinite HP set to " + DebugMod.infiniteHP.ToString().ToUpper());
		}

		[BindableMethod(name = "Invincibility", category = "Cheats")]
		public static void ToggleInvincibility()
		{
			DebugMod.playerInvincible = !DebugMod.playerInvincible;
			DebugMod.LogConsole("Invincibility set to " + DebugMod.playerInvincible.ToString().ToUpper());
			PlayerData.instance.isInvincible = DebugMod.playerInvincible;
		}

		[BindableMethod(name = "Noclip", category = "Cheats")]
		public static void ToggleNoclip()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			DebugMod.noclip = !DebugMod.noclip;
			if (DebugMod.noclip)
			{
				DebugMod.LogConsole("Enabled noclip");
				DebugMod.noclipPos = DebugMod.RefKnight.transform.position;
			}
			else
			{
				DebugMod.LogConsole("Disabled noclip");
				Rigidbody2D component = DebugMod.RefKnight.GetComponent<Rigidbody2D>();
				component.constraints = (RigidbodyConstraints2D)(component.constraints & -4);
			}
		}

		[BindableMethod(name = "Toggle Hero Collider", category = "Cheats")]
		public static void ToggleHeroCollider()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)DebugMod.RefHeroCollider).enabled)
			{
				((Behaviour)DebugMod.RefHeroCollider).enabled = true;
				((Behaviour)DebugMod.RefHeroBox).enabled = true;
				DebugMod.LogConsole("Enabled hero collider" + (DebugMod.noclip ? " and disabled noclip" : ""));
				DebugMod.noclip = false;
			}
			else
			{
				((Behaviour)DebugMod.RefHeroCollider).enabled = false;
				((Behaviour)DebugMod.RefHeroBox).enabled = false;
				DebugMod.LogConsole("Disabled hero collider" + (DebugMod.noclip ? "" : " and enabled noclip"));
				DebugMod.noclip = true;
				DebugMod.noclipPos = DebugMod.RefKnight.transform.position;
			}
		}

		[BindableMethod(name = "Kill Self", category = "Cheats")]
		public static void KillSelf()
		{
			if (!HeroController.instance.cState.dead && !HeroController.instance.cState.transitioning)
			{
				((MonoBehaviour)HeroController.instance).StartCoroutine(HeroController.instance.Die(false, false));
				DebugMod.LogConsole("Killed player");
			}
		}

		[BindableMethod(name = "Give Rosaries", category = "Consumables")]
		public static void GiveRosaries()
		{
			HeroController.instance.AddGeo(1000);
			DebugMod.LogConsole("Giving player 1000 rosaries");
		}

		[BindableMethod(name = "Give Shell Shards", category = "Consumables")]
		public static void GiveShellShards()
		{
			HeroController.instance.AddShards(100);
			DebugMod.LogConsole("Giving player 100 shell shards");
		}

		private static void SetCollectable(string name, int amount)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			if (CollectableItemManager.IsInHiddenMode())
			{
				ManagerSingleton<CollectableItemManager>.Instance.AffectItemData(name, (ItemAffectingDelegate)delegate(ref Data data)
				{
					data.AmountWhileHidden = amount;
				});
			}
			else
			{
				ManagerSingleton<CollectableItemManager>.Instance.AffectItemData(name, (ItemAffectingDelegate)delegate(ref Data data)
				{
					data.Amount = amount;
				});
			}
		}

		[BindableMethod(name = "Give Memory Lockets", category = "Consumables")]
		public static void GiveMemoryLockets()
		{
			SetCollectable("Crest Socket Unlocker", 20);
			DebugMod.LogConsole("Set player memory lockets to 20");
		}

		[BindableMethod(name = "Give Craftmetal", category = "Consumables")]
		public static void GiveCraftmetal()
		{
			SetCollectable("Tool Metal", 8);
			DebugMod.LogConsole("Set player craftmetal to 8");
		}

		[BindableMethod(name = "Give Silkeater", category = "Consumables")]
		public static void GiveSilkeater()
		{
			CollectableItemManager.GetItemByName("Silk Grub").AddAmount(1);
			DebugMod.LogConsole("Giving player a silkeater");
		}

		[BindableMethod(name = "Toggle HP Bars", category = "Enemy Panel")]
		public static void ToggleEnemyHPBars()
		{
			EnemiesPanel.hpBars = !EnemiesPanel.hpBars;
			if (EnemiesPanel.hpBars)
			{
				DebugMod.LogConsole("Enabled HP bars");
			}
			else
			{
				DebugMod.LogConsole("Disabled HP bars");
			}
		}

		[BindableMethod(name = "Self Damage", category = "Enemy Panel")]
		public static void SelfDamage()
		{
			if (PlayerData.instance.health <= 0)
			{
				DebugMod.LogConsole("Cannot damage self: health <= 0");
				return;
			}
			if (HeroController.instance.cState.dead)
			{
				DebugMod.LogConsole("Cannot damage self: player is dead");
				return;
			}
			if (!GameManager.instance.IsGameplayScene())
			{
				DebugMod.LogConsole("Cannot damage self: not a gameplay scene");
				return;
			}
			if (HeroController.instance.cState.recoiling)
			{
				DebugMod.LogConsole("Cannot damage self: player is recoiling");
				return;
			}
			if (HeroController.instance.cState.invulnerable)
			{
				DebugMod.LogConsole("Cannot damage self: player is invulnerable");
				return;
			}
			HeroController.instance.DamageSelf(1);
			DebugMod.LogConsole("Attempting self damage");
		}

		[BindableMethod(name = "Increase Needle Damage", category = "Gameplay Altering")]
		public static void IncreaseNeedleDamage()
		{
			if (PlayerData.instance.nailDamage == 0)
			{
				PlayerData.instance.nailUpgrades = 0;
				DebugMod.extraNailDamage = 0;
				DebugMod.LogConsole("Resetting needle damage to 5");
			}
			else if (PlayerData.instance.nailUpgrades == 4 || DebugMod.extraNailDamage < 0)
			{
				DebugMod.extraNailDamage += 4;
				DebugMod.LogConsole("Adding 4 extra needle damage");
			}
			else
			{
				PlayerData instance = PlayerData.instance;
				instance.nailUpgrades++;
				DebugMod.LogConsole("Adding needle upgrade");
			}
			PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE");
		}

		[BindableMethod(name = "Decrease Needle Damage", category = "Gameplay Altering")]
		public static void DecreaseNeedleDamage()
		{
			if (PlayerData.instance.nailUpgrades == 0 || DebugMod.extraNailDamage > 0)
			{
				DebugMod.extraNailDamage -= 4;
				if (DebugMod.extraNailDamage < -5)
				{
					DebugMod.extraNailDamage = -5;
					DebugMod.LogConsole("Setting needle damage to 0");
				}
				else
				{
					DebugMod.LogConsole("Reducing nail damage by 4");
				}
			}
			else
			{
				PlayerData instance = PlayerData.instance;
				instance.nailUpgrades--;
				DebugMod.LogConsole("Removing needle upgrade");
			}
			PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE");
		}

		[BindableMethod(name = "Decrease Timescale", category = "Gameplay Altering")]
		public static void TimescaleDown()
		{
			if (DebugMod.GM.IsGamePaused())
			{
				DebugMod.LogConsole("Cannot change timescale when paused");
				return;
			}
			float timeScale = Time.timeScale;
			bool timeScaleActive = DebugMod.TimeScaleActive;
			Time.timeScale = (Time.timeScale = Mathf.Round(Time.timeScale * 10f - 1f) / 10f);
			DebugMod.CurrentTimeScale = Time.timeScale;
			DebugMod.TimeScaleActive = Math.Abs(DebugMod.CurrentTimeScale - 1f) > Mathf.Epsilon;
			if (DebugMod.TimeScaleActive)
			{
				if (!timeScaleActive && (Object)(object)((Component)GameManager.instance).GetComponent<TimeScale>() == (Object)null)
				{
					((Component)GameManager.instance).gameObject.AddComponent<TimeScale>();
				}
			}
			else if (timeScaleActive && (Object)(object)((Component)GameManager.instance).GetComponent<TimeScale>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)GameManager.instance).gameObject.GetComponent<TimeScale>());
			}
			DebugMod.LogConsole("New TimeScale value: " + DebugMod.CurrentTimeScale + " Old value: " + timeScale);
		}

		[BindableMethod(name = "Increase Timescale", category = "Gameplay Altering")]
		public static void TimescaleUp()
		{
			if (DebugMod.GM.IsGamePaused())
			{
				DebugMod.LogConsole("Cannot change timescale when paused");
				return;
			}
			float timeScale = Time.timeScale;
			bool timeScaleActive = DebugMod.TimeScaleActive;
			Time.timeScale = (Time.timeScale = Mathf.Round(Time.timeScale * 10f + 1f) / 10f);
			DebugMod.CurrentTimeScale = Time.timeScale;
			DebugMod.TimeScaleActive = Math.Abs(DebugMod.CurrentTimeScale - 1f) > Mathf.Epsilon;
			if (DebugMod.TimeScaleActive)
			{
				if (!timeScaleActive && (Object)(object)((Component)GameManager.instance).GetComponent<TimeScale>() == (Object)null)
				{
					((Component)GameManager.instance).gameObject.AddComponent<TimeScale>();
				}
			}
			else if (timeScaleActive && (Object)(object)((Component)GameManager.instance).GetComponent<TimeScale>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)GameManager.instance).gameObject.GetComponent<TimeScale>());
			}
			DebugMod.LogConsole("New TimeScale value: " + DebugMod.CurrentTimeScale + " Old value: " + timeScale);
		}

		[BindableMethod(name = "Freeze Game", category = "Gameplay Altering")]
		public static void PauseGameNoUI()
		{
			DebugMod.PauseGameNoUIActive = !DebugMod.PauseGameNoUIActive;
			if (DebugMod.PauseGameNoUIActive)
			{
				Time.timeScale = 0f;
				GameCameras.instance.StopCameraShake();
				SetAlwaysShowCursor();
				DebugMod.LogConsole("Game was Frozen");
				return;
			}
			GameCameras.instance.ResumeCameraShake();
			GameManager.instance.isPaused = false;
			GameManager.instance.ui.SetState((UIState)4);
			GameManager.instance.SetState((GameState)4);
			if ((Object)(object)HeroController.instance != (Object)null)
			{
				HeroController.instance.UnPause();
			}
			Time.timeScale = DebugMod.CurrentTimeScale;
			GameManager.instance.inputHandler.AllowPause();
			if (!DebugMod.settings.ShowCursorWhileUnpaused)
			{
				UnsetAlwaysShowCursor();
			}
			DebugMod.LogConsole("Game was Unfrozen");
		}

		[BindableMethod(name = "Reset settings", category = "Gameplay Altering")]
		public static void Reset()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			PlayerData instance = PlayerData.instance;
			HeroController instance2 = HeroController.instance;
			GameCameras instance3 = GameCameras.instance;
			DebugMod.extraNailDamage = 0;
			PlayerData.instance.nailUpgrades = 0;
			PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE");
			GameObject gameObject = ((Component)DebugMod.RefKnight.transform.Find("HeroLight")).gameObject;
			Color color = gameObject.GetComponent<SpriteRenderer>().color;
			color.a = 0.7f;
			gameObject.GetComponent<SpriteRenderer>().color = color;
			tk2dSprite component = DebugMod.RefKnight.GetComponent<tk2dSprite>();
			color = ((tk2dBaseSprite)component).color;
			color.a = 1f;
			((tk2dBaseSprite)component).color = color;
			if ((Object)(object)((Component)GameManager.instance).GetComponent<TimeScale>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)GameManager.instance).gameObject.GetComponent<TimeScale>());
			}
			instance3.tk2dCam.ZoomFactor = 1f;
			((Renderer)instance2.vignette).enabled = false;
			EnemiesPanel.hpBars = false;
			instance.infiniteAirJump = false;
			DebugMod.infiniteSilk = false;
			DebugMod.infiniteHP = false;
			instance.isInvincible = false;
			DebugMod.noclip = false;
		}

		[BindableMethod(name = "Give Mask", category = "Masks & Spools")]
		public static void GiveMask()
		{
			if (PlayerData.instance.maxHealthBase < 10)
			{
				HeroController.instance.MaxHealth();
				HeroController.instance.AddToMaxHealth(1);
				HudHelper.RefreshMasks();
				DebugMod.LogConsole("Added Mask");
			}
			else
			{
				DebugMod.LogConsole("You have the maximum number of masks");
			}
		}

		[BindableMethod(name = "Give Spool", category = "Masks & Spools")]
		public static void GiveSpool()
		{
			if (PlayerData.instance.silkMax < 18)
			{
				HeroController.instance.AddToMaxSilk(1);
				HudHelper.RefreshSpool();
				DebugMod.LogConsole("Added Spool");
			}
			else
			{
				DebugMod.LogConsole("You have the maximum number of spools");
			}
			PlayerData.instance.IsSilkSpoolBroken = false;
			EventRegister.SendEvent("SPOOL UNBROKEN", (GameObject)null);
		}

		[BindableMethod(name = "Take Away Mask", category = "Masks & Spools")]
		public static void TakeAwayMask()
		{
			if (PlayerData.instance.maxHealthBase > 1)
			{
				PlayerData instance = PlayerData.instance;
				instance.maxHealth--;
				PlayerData instance2 = PlayerData.instance;
				instance2.maxHealthBase--;
				PlayerData.instance.health = Math.Min(PlayerData.instance.health, PlayerData.instance.maxHealth);
				HudHelper.RefreshMasks();
				DebugMod.LogConsole("Took Away Mask");
			}
			else
			{
				DebugMod.LogConsole("You have the minimum number of masks");
			}
		}

		[BindableMethod(name = "Take Away Spool", category = "Masks & Spools")]
		public static void TakeAwaySpool()
		{
			if (PlayerData.instance.silkMax > 9)
			{
				PlayerData instance = PlayerData.instance;
				instance.silkMax--;
				PlayerData.instance.silk = Math.Min(PlayerData.instance.silk, PlayerData.instance.silkMax);
				HudHelper.RefreshSpool();
				DebugMod.LogConsole("Removed Spool");
			}
			else
			{
				DebugMod.LogConsole("You have the minimum number of spools");
			}
		}

		private static bool CanModifyHealth(int health)
		{
			if (health <= 0)
			{
				DebugMod.LogConsole("Cannot add/take health: health is too low");
				return false;
			}
			if (HeroController.instance.cState.dead)
			{
				DebugMod.LogConsole("Cannot add/take health: player is dead");
				return false;
			}
			if (!GameManager.instance.IsGameplayScene())
			{
				DebugMod.LogConsole("Cannot add/take health: not a gameplay scene");
				return false;
			}
			return true;
		}

		[BindableMethod(name = "Add Health", category = "Masks & Spools")]
		public static void AddHealth()
		{
			if (CanModifyHealth(PlayerData.instance.health + 1))
			{
				HeroController.instance.AddHealth(1);
				HudHelper.RefreshMasks();
				DebugMod.LogConsole("Added Health");
			}
		}

		[BindableMethod(name = "Take Health", category = "Masks & Spools")]
		public static void TakeHealth()
		{
			if (CanModifyHealth(PlayerData.instance.health - 1))
			{
				HeroController.instance.TakeHealth(1);
				HudHelper.RefreshMasks();
				DebugMod.LogConsole("Took health");
			}
		}

		[BindableMethod(name = "Add Silk", category = "Masks & Spools")]
		public static void AddSilk()
		{
			HeroController.instance.AddSilk(1, true);
			DebugMod.LogConsole("Added Silk");
		}

		[BindableMethod(name = "Take Silk", category = "Masks & Spools")]
		public static void TakeSilk()
		{
			HeroController.instance.TakeSilk(1);
			DebugMod.LogConsole("Attempting to take silk");
		}

		[BindableMethod(name = "Add Lifeblood", category = "Masks & Spools")]
		public static void Lifeblood()
		{
			EventRegister.SendEvent("ADD BLUE HEALTH", (GameObject)null);
			DebugMod.LogConsole("Attempting to add lifeblood");
		}

		[BindableMethod(name = "Force Pause", category = "Misc")]
		public static void ForcePause()
		{
			try
			{
				if ((PlayerData.instance.disablePause || (bool)TimeSlowed.GetValue(GameManager.instance) || (bool)IgnoreUnpause.GetValue(UIManager.instance)) && DebugMod.GetSceneName() != "Menu_Title" && DebugMod.GM.IsGameplayScene())
				{
					TimeSlowed.SetValue(GameManager.instance, false);
					IgnoreUnpause.SetValue(UIManager.instance, false);
					PlayerData.instance.disablePause = false;
					UIManager.instance.TogglePauseGame();
					DebugMod.LogConsole("Forcing Pause Menu because pause is disabled");
				}
				else
				{
					DebugMod.LogConsole("Game does not report that Pause is disabled, requesting it normally.");
					UIManager.instance.TogglePauseGame();
				}
			}
			catch (Exception ex)
			{
				DebugMod.LogConsole("Error while attempting to pause, check ModLog.txt");
				DebugMod.Log("Error while attempting force pause:\n" + ex);
			}
		}

		[BindableMethod(name = "Hazard Respawn", category = "Misc")]
		public static void Respawn()
		{
			if (GameManager.instance.IsGameplayScene() && !HeroController.instance.cState.dead && PlayerData.instance.health > 0)
			{
				if (((object)(UIState)(ref UIManager.instance.uiState)).ToString() == "PAUSED")
				{
					((MonoBehaviour)ManagerSingleton<InputHandler>.Instance).StartCoroutine(GameManager.instance.PauseGameToggle(false));
					GameManager.instance.HazardRespawn();
					DebugMod.LogConsole("Closing Pause Menu and respawning...");
				}
				else if (((object)(UIState)(ref UIManager.instance.uiState)).ToString() == "PLAYING")
				{
					HeroController.instance.RelinquishControl();
					GameManager.instance.HazardRespawn();
					HeroController.instance.RegainControl();
					DebugMod.LogConsole("Respawn signal sent");
				}
				else
				{
					DebugMod.LogConsole("Respawn requested in some weird conditions, abort, ABORT");
				}
			}
		}

		[BindableMethod(name = "Set Respawn", category = "Misc")]
		public static void SetHazardRespawn()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = DebugMod.RefKnight.transform.position;
			HeroController.instance.SetHazardRespawn(position, false);
			Vector3 val = position;
			DebugMod.LogConsole("Manual respawn point on this map set to" + ((object)(Vector3)(ref val)).ToString());
		}

		[BindableMethod(name = "Toggle Act 3", category = "Misc")]
		public static void ToggleAct3()
		{
			PlayerData.instance.blackThreadWorld = !PlayerData.instance.blackThreadWorld;
			DebugMod.LogConsole("Act 3 world is now " + (PlayerData.instance.blackThreadWorld ? "enabled" : "disabled"));
		}

		[BindableMethod(name = "Force Camera Follow", category = "Misc")]
		public static void ForceCameraFollow()
		{
			if (!DebugMod.cameraFollow)
			{
				DebugMod.LogConsole("Forcing camera follow");
				DebugMod.cameraFollow = true;
			}
			else
			{
				DebugMod.cameraFollow = false;
				cameraGameplayScene.SetValue(DebugMod.RefCamera, true);
				DebugMod.LogConsole("Returning camera to normal settings");
			}
		}

		[BindableMethod(name = "Clear White Screen", category = "Misc")]
		public static void ClearWhiteScreen()
		{
			PlayMakerFSM obj = FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Dream Return");
			obj.SetState("GET UP");
			obj.SendEvent("FINISHED");
			FSMUtility.LocateMyFSM(GameObject.Find("Blanker White"), "Blanker Control").SendEvent("FADE OUT");
			HeroController.instance.EnableRenderer();
		}

		[BindableMethod(name = "Reset Scene Data", category = "Misc")]
		public static void ResetCurrentScene()
		{
			saveLevelStateAction = GameManager.instance.GetSceneNameString();
			DebugMod.LogConsole("Clearing scene data from this scene, re-enter scene or warp to apply changes");
		}

		[BindableMethod(name = "Block Scene Data Changes", category = "Misc")]
		public static void BlockCurrentSceneChanges()
		{
			saveLevelStateAction = "block";
			DebugMod.LogConsole("Scene data changes made since entering this scene will not be saved");
		}

		[HarmonyPatch(typeof(GameManager), "SaveLevelState")]
		[HarmonyPrefix]
		private static bool GameManager_SaveLevelState_Prefix()
		{
			if (saveLevelStateAction == "block")
			{
				saveLevelStateAction = null;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(GameManager), "SaveLevelState")]
		[HarmonyPostfix]
		private static void GameManager_SaveLevelState_Postfix()
		{
			if (saveLevelStateAction != null && saveLevelStateAction != "block")
			{
				((PersistentItemDataCollection<bool, SerializableBoolData>)(object)SceneData.instance.persistentBools).scenes.Remove(saveLevelStateAction);
				((PersistentItemDataCollection<int, SerializableIntData>)(object)SceneData.instance.persistentInts).scenes.Remove(saveLevelStateAction);
				((PersistentItemDataCollection<int, SerializableIntData>)(object)SceneData.instance.geoRocks).scenes.Remove(saveLevelStateAction);
				saveLevelStateAction = null;
			}
		}

		[BindableMethod(name = "Break Cocoon", category = "Misc")]
		public static void BreakCocoon()
		{
			HeroController instance = HeroController.instance;
			if (instance != null)
			{
				instance.CocoonBroken();
			}
			EventRegister.SendEvent("BREAK HERO CORPSE", (GameObject)null);
		}

		[BindableMethod(name = "Start/End Frame Advance", category = "Misc")]
		public static void ToggleFrameAdvance()
		{
			frameCounter = 0;
			if (Time.timeScale != 0f)
			{
				if ((Object)(object)((Component)GameManager.instance).GetComponent<TimeScale>() == (Object)null)
				{
					((Component)GameManager.instance).gameObject.AddComponent<TimeScale>();
				}
				Time.timeScale = 0f;
				TimeScaleDuringFrameAdvance = DebugMod.CurrentTimeScale;
				DebugMod.CurrentTimeScale = 0f;
				DebugMod.TimeScaleActive = true;
				DebugMod.LogConsole("Starting frame by frame advance on keybind press");
			}
			else
			{
				DebugMod.CurrentTimeScale = TimeScaleDuringFrameAdvance;
				Time.timeScale = DebugMod.CurrentTimeScale;
				DebugMod.LogConsole("Stopping frame by frame advance on keybind press");
			}
		}

		[BindableMethod(name = "Advance Frame", category = "Misc")]
		public static void AdvanceFrame()
		{
			if (Time.timeScale != 0f)
			{
				ToggleFrameAdvance();
			}
			frameCounter++;
			((MonoBehaviour)GameManager.instance).StartCoroutine(AdvanceMyFrame());
		}

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

		[BindableMethod(name = "Reset Counter", category = "Misc")]
		public static void ResetCounter()
		{
			frameCounter = 0;
		}

		[BindableMethod(name = "Lock KeyBinds", category = "Misc")]
		public static void ToggleLockKeyBinds()
		{
			DebugMod.KeyBindLock = !DebugMod.KeyBindLock;
			DebugMod.LogConsole((DebugMod.KeyBindLock ? "Removing" : "Adding") + " the ability to use keybinds");
		}

		[BindableMethod(name = "Toggle All UI", category = "Mod UI", allowLock = false)]
		public static void ToggleAllPanels()
		{
			bool flag = !DebugMod.settings.HelpPanelVisible && !DebugMod.settings.InfoPanelVisible && !DebugMod.settings.EnemiesPanelVisible && !DebugMod.settings.TopMenuVisible && !DebugMod.settings.ConsoleVisible && !DebugMod.settings.SaveStatePanelVisible;
			DebugMod.settings.InfoPanelVisible = flag;
			DebugMod.settings.TopMenuVisible = flag;
			DebugMod.settings.EnemiesPanelVisible = flag;
			DebugMod.settings.ConsoleVisible = flag;
			DebugMod.settings.HelpPanelVisible = flag;
			if (!flag)
			{
				DebugMod.settings.ClearSaveStatePanel = true;
			}
		}

		[BindableMethod(name = "Toggle Binds", category = "Mod UI")]
		public static void ToggleHelpPanel()
		{
			DebugMod.settings.HelpPanelVisible = !DebugMod.settings.HelpPanelVisible;
		}

		[BindableMethod(name = "Toggle Info", category = "Mod UI")]
		public static void ToggleInfoPanel()
		{
			DebugMod.settings.InfoPanelVisible = !DebugMod.settings.InfoPanelVisible;
		}

		[BindableMethod(name = "Toggle Top Menu", category = "Mod UI")]
		public static void ToggleTopRightPanel()
		{
			DebugMod.settings.TopMenuVisible = !DebugMod.settings.TopMenuVisible;
		}

		[BindableMethod(name = "Toggle Console", category = "Mod UI")]
		public static void ToggleConsole()
		{
			DebugMod.settings.ConsoleVisible = !DebugMod.settings.ConsoleVisible;
		}

		[BindableMethod(name = "Toggle Enemy Panel", category = "Mod UI")]
		public static void ToggleEnemyPanel()
		{
			DebugMod.settings.EnemiesPanelVisible = !DebugMod.settings.EnemiesPanelVisible;
		}

		[BindableMethod(name = "Info Panel Switch", category = "Mod UI")]
		public static void SwitchActiveInfoPanel()
		{
			InfoPanel.ToggleActivePanel();
		}

		[BindableMethod(name = "Quickslot (save)", category = "Savestates")]
		public static void SaveState()
		{
			DebugMod.saveStateManager.SaveSaveState(SaveStateType.Memory);
		}

		[BindableMethod(name = "Quickslot (load)", category = "Savestates")]
		public static void LoadState()
		{
			DebugMod.saveStateManager.LoadSaveState(SaveStateType.Memory);
		}

		[BindableMethod(name = "Quickslot save to file", category = "Savestates")]
		public static void CurrentSaveStateToFile()
		{
			if (SaveStateManager.currentStateOperation != "Quickslot save to file")
			{
				DebugMod.saveStateManager.SaveSaveState(SaveStateType.File);
			}
			else
			{
				DebugMod.settings.ClearSaveStatePanel = true;
			}
		}

		[BindableMethod(name = "Load file to quickslot", category = "Savestates")]
		public static void CurrentSlotToSaveMemory()
		{
			if (SaveStateManager.currentStateOperation != "Load file to quickslot")
			{
				DebugMod.saveStateManager.LoadSaveState(SaveStateType.File);
			}
			else
			{
				DebugMod.settings.ClearSaveStatePanel = true;
			}
		}

		[BindableMethod(name = "Save new state to file", category = "Savestates")]
		public static void NewSaveStateToFile()
		{
			if (SaveStateManager.currentStateOperation != "Save new state to file")
			{
				DebugMod.saveStateManager.SaveSaveState(SaveStateType.SkipOne);
			}
			else
			{
				DebugMod.settings.ClearSaveStatePanel = true;
			}
		}

		[BindableMethod(name = "Load new state from file", category = "Savestates")]
		public static void LoadFromFile()
		{
			if (SaveStateManager.currentStateOperation != "Load new state from file")
			{
				DebugMod.saveStateManager.LoadSaveState(SaveStateType.SkipOne);
			}
			else
			{
				DebugMod.settings.ClearSaveStatePanel = true;
			}
		}

		[BindableMethod(name = "Next Save Page", category = "Savestates")]
		public static void NextStatePage()
		{
			if (SaveStateManager.inSelectSlotState)
			{
				SaveStateManager.currentStateFolder++;
				if (SaveStateManager.currentStateFolder >= SaveStateManager.savePages)
				{
					SaveStateManager.currentStateFolder = 0;
				}
				SaveStateManager.path = Path.Combine(SaveStateManager.saveStatesBaseDirectory, SaveStateManager.currentStateFolder.ToString());
				DebugMod.saveStateManager.RefreshStateMenu();
			}
		}

		[BindableMethod(name = "Prev Save Page", category = "Savestates")]
		public static void PrevStatePage()
		{
			if (SaveStateManager.inSelectSlotState)
			{
				SaveStateManager.currentStateFolder--;
				if (SaveStateManager.currentStateFolder < 0)
				{
					SaveStateManager.currentStateFolder = SaveStateManager.savePages - 1;
				}
				SaveStateManager.path = Path.Combine(SaveStateManager.saveStatesBaseDirectory, SaveStateManager.currentStateFolder.ToString());
				DebugMod.saveStateManager.RefreshStateMenu();
			}
		}

		[BindableMethod(name = "Load Savestate On Death", category = "Savestates")]
		public static void LoadStateOnDeath()
		{
			DebugMod.stateOnDeath = !DebugMod.stateOnDeath;
			DebugMod.LogConsole("Quickslot SaveState will now" + (DebugMod.stateOnDeath ? " be" : " no longer") + " loaded on death");
		}

		[BindableMethod(name = "Override Lockout", category = "Savestates")]
		public static void OverrideLoadLockout()
		{
			DebugMod.overrideLoadLockout = !DebugMod.overrideLoadLockout;
			DebugMod.LogConsole("SaveState Lockout set to " + DebugMod.overrideLoadLockout);
		}

		[BindableMethod(name = "Give All", category = "Skills")]
		public static void GiveAllSkills()
		{
			PlayerData.instance.silkRegenMax = 3;
			PlayerData.instance.hasDash = true;
			PlayerData.instance.hasBrolly = true;
			PlayerData.instance.hasWalljump = true;
			PlayerData.instance.hasHarpoonDash = true;
			PlayerData.instance.hasDoubleJump = true;
			PlayerData.instance.hasSuperJump = true;
			PlayerData.instance.hasNeedolin = true;
			PlayerData.instance.UnlockedFastTravelTeleport = true;
			PlayerData.instance.hasNeedolinMemoryPowerup = true;
			PlayerData.instance.hasChargeSlash = true;
			DebugMod.LogConsole("Giving player all skills");
		}

		[BindableMethod(name = "Give Silk Heart", category = "Skills")]
		public static void IncrementSilkHeart()
		{
			if (PlayerData.instance.silkRegenMax < 3)
			{
				PlayerData instance = PlayerData.instance;
				instance.silkRegenMax++;
				DebugMod.LogConsole($"Giving player Silk Heart (now {PlayerData.instance.silkRegenMax})");
			}
			else
			{
				PlayerData.instance.silkRegenMax = 0;
				DebugMod.LogConsole("Taking away all Silk Hearts");
			}
		}

		[BindableMethod(name = "Give Swift Step", category = "Skills")]
		public static void ToggleSwiftStep()
		{
			if (!PlayerData.instance.hasDash)
			{
				PlayerData.instance.hasDash = true;
				DebugMod.LogConsole("Giving player Swift Step");
			}
			else
			{
				PlayerData.instance.hasDash = false;
				DebugMod.LogConsole("Taking away Swift Step");
			}
		}

		[BindableMethod(name = "Increment Cloak", category = "Skills")]
		public static void IncrementCloak()
		{
			if (!PlayerData.instance.hasBrolly && !PlayerData.instance.hasDoubleJump)
			{
				PlayerData.instance.hasBrolly = true;
				DebugMod.LogConsole("Giving player Drifter's Cloak");
			}
			else if (PlayerData.instance.hasBrolly && !PlayerData.instance.hasDoubleJump)
			{
				PlayerData.instance.hasDoubleJump = true;
				DebugMod.LogConsole("Giving player Faydown Cloak");
			}
			else
			{
				PlayerData.instance.hasBrolly = false;
				PlayerData.instance.hasDoubleJump = false;
				DebugMod.LogConsole("Taking away cloak upgrades");
			}
		}

		[BindableMethod(name = "Give Cling Grip", category = "Skills")]
		public static void ToggleClingGrip()
		{
			if (!PlayerData.instance.hasWalljump)
			{
				PlayerData.instance.hasWalljump = true;
				DebugMod.LogConsole("Giving player Cling Grip");
			}
			else
			{
				PlayerData.instance.hasWalljump = false;
				DebugMod.LogConsole("Taking away Cling Grip");
			}
		}

		[BindableMethod(name = "Give Needolin", category = "Skills")]
		public static void ToggleNeedolin()
		{
			if (!PlayerData.instance.hasNeedolin)
			{
				PlayerData.instance.hasNeedolin = true;
				DebugMod.LogConsole("Giving player Needolin");
				return;
			}
			PlayerData.instance.hasNeedolin = false;
			PlayerData.instance.UnlockedFastTravelTeleport = false;
			PlayerData.instance.hasNeedolinMemoryPowerup = false;
			DebugMod.LogConsole("Taking away Needolin and any upgrades");
		}

		[BindableMethod(name = "Give Clawline", category = "Skills")]
		public static void ToggleClawline()
		{
			if (!PlayerData.instance.hasHarpoonDash)
			{
				PlayerData.instance.hasHarpoonDash = true;
				DebugMod.LogConsole("Giving player Clawline");
			}
			else
			{
				PlayerData.instance.hasHarpoonDash = false;
				DebugMod.LogConsole("Taking away Clawline");
			}
		}

		[BindableMethod(name = "Give Silk Soar", category = "Skills")]
		public static void ToggleSilkSoar()
		{
			if (!PlayerData.instance.hasSuperJump)
			{
				PlayerData.instance.hasSuperJump = true;
				DebugMod.LogConsole("Giving player Silk Soar");
			}
			else
			{
				PlayerData.instance.hasSuperJump = false;
				DebugMod.LogConsole("Taking away Silk Soar");
			}
		}

		[BindableMethod(name = "Give Beastling Call", category = "Skills")]
		public static void ToggleBeastlingCall()
		{
			if (!PlayerData.instance.hasNeedolin && !PlayerData.instance.UnlockedFastTravelTeleport)
			{
				PlayerData.instance.hasNeedolin = true;
				PlayerData.instance.UnlockedFastTravelTeleport = true;
				DebugMod.LogConsole("Giving player Needolin with Beastling Call");
			}
			else if (PlayerData.instance.hasNeedolin && !PlayerData.instance.UnlockedFastTravelTeleport)
			{
				PlayerData.instance.UnlockedFastTravelTeleport = true;
				DebugMod.LogConsole("Giving player Beastling Call");
			}
			else
			{
				PlayerData.instance.UnlockedFastTravelTeleport = false;
				DebugMod.LogConsole("Taking away Beastling Call");
			}
		}

		[BindableMethod(name = "Give Elegy of the Deep", category = "Skills")]
		public static void ToggleElegyOfTheDeep()
		{
			if (!PlayerData.instance.hasNeedolin && !PlayerData.instance.hasNeedolinMemoryPowerup)
			{
				PlayerData.instance.hasNeedolin = true;
				PlayerData.instance.hasNeedolinMemoryPowerup = true;
				DebugMod.LogConsole("Giving player Needolin with Elegy of the Deep");
			}
			else if (PlayerData.instance.hasNeedolin && !PlayerData.instance.hasNeedolinMemoryPowerup)
			{
				PlayerData.instance.hasNeedolinMemoryPowerup = true;
				DebugMod.LogConsole("Giving player Elegy of the Deep");
			}
			else
			{
				PlayerData.instance.hasNeedolinMemoryPowerup = false;
				DebugMod.LogConsole("Taking away Elegy of the Deep");
			}
		}

		[BindableMethod(name = "Give Needle Strike", category = "Skills")]
		public static void ToggleNeedleStrike()
		{
			if (!PlayerData.instance.hasChargeSlash)
			{
				PlayerData.instance.hasChargeSlash = true;
				DebugMod.LogConsole("Giving player Needle Strike");
			}
			else
			{
				PlayerData.instance.hasChargeSlash = false;
				DebugMod.LogConsole("Taking away Needle Strike");
			}
		}

		[BindableMethod(name = "Unlock All Tools", category = "Tools")]
		public static void UnlockAllTools()
		{
			ToolItemManager.UnlockAllTools();
			DebugMod.LogConsole("Unlocked all tools");
		}

		[BindableMethod(name = "Unlock All Crests", category = "Tools")]
		public static void UnlockAllCrests()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			ToolItemManager.UnlockAllCrests();
			if (Object.op_Implicit((Object)(object)ManagerSingleton<ToolItemManager>.Instance) && Object.op_Implicit((Object)(object)ManagerSingleton<ToolItemManager>.Instance.crestList))
			{
				foreach (ToolCrest item in (NamedScriptableObjectList<ToolCrest>)(object)ManagerSingleton<ToolItemManager>.Instance.crestList)
				{
					item.slots = item.slots.Select(delegate(SlotInfo slotInfo)
					{
						//IL_0000: Unknown result type (might be due to invalid IL or missing references)
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_000a: Unknown result type (might be due to invalid IL or missing references)
						SlotInfo result2 = slotInfo;
						result2.IsLocked = false;
						return result2;
					}).ToArray();
					Data saveData = item.SaveData;
					if (saveData.Slots != null)
					{
						saveData.Slots = saveData.Slots.Select(delegate(SlotData slot)
						{
							//IL_0000: Unknown result type (might be due to invalid IL or missing references)
							//IL_0001: Unknown result type (might be due to invalid IL or missing references)
							//IL_000a: Unknown result type (might be due to invalid IL or missing references)
							SlotData result = slot;
							result.IsUnlocked = true;
							return result;
						}).ToList();
					}
					item.SaveData = saveData;
				}
			}
			DebugMod.LogConsole("Unlocked all crests");
		}

		[BindableMethod(name = "Increment Tool Pouch", category = "Tools")]
		public static void IncrementPouches()
		{
			if (PlayerData.instance.ToolPouchUpgrades < 4)
			{
				PlayerData instance = PlayerData.instance;
				instance.ToolPouchUpgrades++;
				DebugMod.LogConsole($"Increasing tool pouch level (now {PlayerData.instance.ToolPouchUpgrades})");
			}
			else
			{
				PlayerData.instance.ToolPouchUpgrades = 0;
				DebugMod.LogConsole("Resetting tool pouch level");
			}
		}

		[BindableMethod(name = "Increment Crafting Kit", category = "Tools")]
		public static void IncrementKits()
		{
			if (PlayerData.instance.ToolKitUpgrades < 4)
			{
				PlayerData instance = PlayerData.instance;
				instance.ToolKitUpgrades++;
				DebugMod.LogConsole($"Increasing crafting kit level (now {PlayerData.instance.ToolKitUpgrades})");
			}
			else
			{
				PlayerData.instance.ToolKitUpgrades = 0;
				DebugMod.LogConsole("Resetting crafting kit level");
			}
		}

		[BindableMethod(name = "Infinite Tools", category = "Tools")]
		public static void ToggleInfiniteTools()
		{
			DebugMod.infiniteTools = !DebugMod.infiniteTools;
			DebugMod.LogConsole("Infinite Tools set to " + DebugMod.infiniteTools.ToString().ToUpper());
		}

		[BindableMethod(name = "Craft Tools", category = "Tools")]
		public static void CraftTools()
		{
			ToolItemManager.TryReplenishTools(true, (ReplenishMethod)0);
			DebugMod.LogConsole("Crafted new tools");
		}

		[BindableMethod(name = "Show Hitboxes", category = "Visual")]
		public static void ShowHitboxes()
		{
			if (++DebugMod.settings.ShowHitBoxes > 2)
			{
				DebugMod.settings.ShowHitBoxes = 0;
			}
			DebugMod.LogConsole("Toggled show hitboxes: " + DebugMod.settings.ShowHitBoxes);
		}

		[BindableMethod(name = "Preview Cocoon Position", category = "Visual")]
		public static void PreviewCocoonPosition()
		{
			CocoonPreviewer cocoonPreviewer = ((Component)GameManager.instance).GetComponent<CocoonPreviewer>() ?? ((Component)GameManager.instance).gameObject.AddComponent<CocoonPreviewer>();
			if (!cocoonPreviewer.previewEnabled)
			{
				cocoonPreviewer.previewEnabled = true;
				DebugMod.LogConsole("Enabled cocoon spawn point preview");
			}
			else
			{
				cocoonPreviewer.previewEnabled = false;
				DebugMod.LogConsole("Disabled cocoon spawn point preview");
			}
		}

		[BindableMethod(name = "Toggle Vignette", category = "Visual")]
		public static void ToggleVignette()
		{
			VisualMaskHelper.ToggleVignette();
		}

		[BindableMethod(name = "Deactivate Visual Masks", category = "Visual")]
		public static void DoDeactivateVisualMasks()
		{
			VisualMaskHelper.ToggleAllMasks();
		}

		[BindableMethod(name = "Toggle Hero Light", category = "Visual")]
		public static void ToggleHeroLight()
		{
			//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)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)DebugMod.RefKnight.transform.Find("HeroLight")).gameObject;
			Color color = gameObject.GetComponent<SpriteRenderer>().color;
			if (Math.Abs(color.a) > 0f)
			{
				color.a = 0f;
				gameObject.GetComponent<SpriteRenderer>().color = color;
				DebugMod.LogConsole("Rendering HeroLight invisible...");
			}
			else
			{
				color.a = 0.7f;
				gameObject.GetComponent<SpriteRenderer>().color = color;
				DebugMod.LogConsole("Rendering HeroLight visible...");
			}
		}

		[BindableMethod(name = "Toggle HUD", category = "Visual")]
		public static void ToggleHUD()
		{
			if (((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.activeInHierarchy)
			{
				((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.SetActive(false);
				DebugMod.LogConsole("Disabling HUD...");
			}
			else
			{
				((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.SetActive(true);
				DebugMod.LogConsole("Enabling HUD...");
			}
		}

		[BindableMethod(name = "Reset Camera Zoom", category = "Visual")]
		public static void ResetZoom()
		{
			GameCameras.instance.tk2dCam.ZoomFactor = 1f;
			DebugMod.LogConsole("Zoom factor was reset");
		}

		[BindableMethod(name = "Zoom In", category = "Visual")]
		public static void ZoomIn()
		{
			float zoomFactor = GameCameras.instance.tk2dCam.ZoomFactor;
			GameCameras.instance.tk2dCam.ZoomFactor = zoomFactor + zoomFactor * 0.05f;
			DebugMod.LogConsole("Zoom level increased to: " + GameCameras.instance.tk2dCam.ZoomFactor);
		}

		[BindableMethod(name = "Zoom Out", category = "Visual")]
		public static void ZoomOut()
		{
			float zoomFactor = GameCameras.instance.tk2dCam.ZoomFactor;
			GameCameras.instance.tk2dCam.ZoomFactor = zoomFactor - zoomFactor * 0.05f;
			DebugMod.LogConsole("Zoom level decreased to: " + GameCameras.instance.tk2dCam.ZoomFactor);
		}

		[BindableMethod(name = "Hide Hero", category = "Visual")]
		public static void HideHero()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			tk2dSprite component = DebugMod.RefKnight.GetComponent<tk2dSprite>();
			Color color = ((tk2dBaseSprite)component).color;
			if (Math.Abs(color.a) > 0f)
			{
				color.a = 0f;
				((tk2dBaseSprite)component).color = color;
				DebugMod.LogConsole("Rendering Hero sprite invisible...");
			}
			else
			{
				color.a = 1f;
				((tk2dBaseSprite)component).color = color;
				DebugMod.LogConsole("Rendering Hero sprite visible...");
			}
		}

		[BindableMethod(name = "Toggle Camera Shake", category = "Visual")]
		public static void ToggleCameraShake()
		{
			bool flag = !((Behaviour)GameCameras.instance.cameraShakeFSM).enabled;
			((Behaviour)GameCameras.instance.cameraShakeFSM).enabled = flag;
			DebugMod.LogConsole((flag ? "Enabling" : "Disabling") + " Camera Shake...");
		}

		[BindableMethod(name = "Toggle Cursor", category = "Visual")]
		public static void ToggleAlwaysShowCursor()
		{
			DebugMod.settings.ShowCursorWhileUnpaused = !DebugMod.settings.ShowCursorWhileUnpaused;
			if (DebugMod.settings.ShowCursorWhileUnpaused)
			{
				SetAlwaysShowCursor();
				DebugMod.LogConsole("Showing cursor while unpaused");
			}
			else
			{
				UnsetAlwaysShowCursor();
				DebugMod.LogConsole("Not showing cursor while unpaused");
			}
		}

		internal static void SetAlwaysShowCursor()
		{
			ModHooks.CursorHook -= CursorDisplayActive;
			ModHooks.CursorHook += CursorDisplayActive;
		}

		internal static void UnsetAlwaysShowCursor()
		{
			ModHooks.CursorHook -= CursorDisplayActive;
		}

		private static void CursorDisplayActive()
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	public class BindableMethod : Attribute
	{
		public string name;

		public string category;

		public bool allowLock = true;
	}
	public class BindAction
	{
		public string Name { get; }

		public string Category { get; }

		public bool AllowLock { get; }

		public Action Action { get; }

		public BindAction(string name, string category, bool allowLock, Action action)
		{
			Name = name;
			Category = category;
			AllowLock = allowLock;
			Action = action;
		}

		public BindAction(BindableMethod attribute, MethodInfo method)
		{
			Name = attribute.name;
			Category = attribute.category;
			AllowLock = attribute.allowLock;
			Action = (Action)Delegate.CreateDelegate(typeof(Action), method);
		}
	}
	public static class BossHandler
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass7_0
		{
			public SceneAdditiveLoadConditional bossLoader;
		}

		public static bool bossSub;

		public static Dictionary<string, KeyValuePair<bool, string>> bossData;

		public static Dictionary<string, string> ghostData;

		public static bool bossFound;

		public static bool ghostFound;

		public static void LookForBoss(string sceneName)
		{
			bossFound = false;
			ghostFound = false;
			if (bossData != null && bossData.ContainsKey(sceneName))
			{
				DebugMod.LogConsole("Found stored Boss in this scene, respawn available");
				bossFound = true;
			}
			if (ghostData != null && ghostData.ContainsKey(sceneName))
			{
				DebugMod.LogConsole("Found stored Ghost Boss in this scene, respawn available");
				ghostFound = true;
			}
		}

		public static void PopulateBossLists()
		{
			if (bossData == null)
			{
				bossData = new Dictionary<string, KeyValuePair<bool, string>>(16);
			}
			if (ghostData == null)
			{
				ghostData = new Dictionary<string, string>(7);
			}
			bossData.Clear();
			ghostData.Clear();
			bossData.Add("Ruins2_03", new KeyValuePair<bool, string>(key: true, "Battle Control"));
			bossData.Add("Crossroads_09", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Crossroads_04", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Fungus1_04", new KeyValuePair<bool, string>(key: false, "hornet1Defeated"));
			bossData.Add("Crossroads_10", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Fungus3_archive_02", new KeyValuePair<bool, string>(key: false, "defeatedMegaJelly"));
			bossData.Add("Fungus2_15", new KeyValuePair<bool, string>(key: false, "defeatedMantisLords"));
			bossData.Add("Waterways_12", new KeyValuePair<bool, string>(key: false, "flukeMotherDefeated"));
			bossData.Add("Waterways_05", new KeyValuePair<bool, string>(key: false, "defeatedDungDefender"));
			bossData.Add("Ruins1_24", new KeyValuePair<bool, string>(key: false, "mageLordDefeated"));
			bossData.Add("Deepnest_32", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Mines_18", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Mines_32", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Fungus3_23", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Ruins2_11", new KeyValuePair<bool, string>(key: true, "Battle Scene"));
			bossData.Add("Deepnest_East_Hornet", new KeyValuePair<bool, string>(key: false, "hornetOutskirtsDefeated"));
			bossData.Add("Grimm_Main_Tent", new KeyValuePair<bool, string>(key: false, "killedGrimm"));
			ghostData.Add("RestingGrounds_02", "xeroDefeated");
			ghostData.Add("Fungus1_35", "noEyesDefeated");
			ghostData.Add("Fungus2_32", "elderHuDefeated");
			ghostData.Add("Deepnest_East_10", "markothDefeated");
			ghostData.Add("Deepnest_40", "galienDefeated");
			ghostData.Add("Fungus3_40", "mumCaterpillarDefeated");
			ghostData.Add("Cliffs_02", "aladarSlugDefeated");
		}

		public static void RespawnBoss()
		{
			<>c__DisplayClass7_0 CS$<>8__locals0;
			if (bossFound)
			{
				if (bossData[DebugMod.GetSceneName()].Key)
				{
					CS$<>8__locals0 = new <>c__DisplayClass7_0();
					GameObject obj = GameObject.Find("BossLoader");
					CS$<>8__locals0.bossLoader = ((obj != null) ? obj.GetComponent<SceneAdditiveLoadConditional>() : null);
					if ((Object)(object)CS$<>8__locals0.bossLoader != (Object)null)
					{
						DebugMod.LogConsole(((object)CS$<>8__locals0.bossLoader).ToString());
						DebugMod.LogConsole(CS$<>8__locals0.bossLoader.sceneNameToLoad);
					}
					((MonoBehaviour)GameManager.instance).StartCoroutine(ResetBoss(((Object)(object)CS$<>8__locals0.bossLoader != (Object)null) ? CS$<>8__locals0.bossLoader.sceneNameToLoad : null));
				}
				else
				{
					((object)PlayerData.instance).GetType().GetField(bossData[DebugMod.GetSceneName()].Value).SetValue(PlayerData.instance, false);
					DebugMod.LogConsole("Boss control for this scene was reset, re-enter scene or warp");
				}
			}
			else
			{
				DebugMod.LogConsole("No boss in this scene to respawn");
			}
			[IteratorStateMachine(typeof(<>c__DisplayClass7_0.<<RespawnBoss>g__ResetBoss|0>d))]
			IEnumerator ResetBoss(string scene)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <>c__DisplayClass7_0.<<RespawnBoss>g__ResetBoss|0>d(0)
				{
					<>4__this = CS$<>8__locals0,
					scene = scene
				};
			}
		}
	}
	[ModExportName("DebugMod")]
	public static class DebugExport
	{
		public static void AddActionToKeyBindList(Action method, string name, string category)
		{
			DebugMod.AddActionToKeyBindList(method, name, category);
		}

		public static void AddActionToKeyBindList(Action method, string name, string category, bool allowLock)
		{
			DebugMod.AddActionToKeyBindList(method, name, category, allowLock);
		}

		public static void LogToConsole(string msg)
		{
			DebugMod.LogConsole(msg);
		}

		public static string GetStringForBool(bool b)
		{
			return InfoPanel.GetStringForBool(b);
		}

		public static void CreateCustomInfoPanel(string Name, bool ShowSprite)
		{
			InfoPanel.CreateCustomInfoPanel(Name, ShowSprite);
		}

		public static void AddInfoToPanel(string Name, float xLabel, float xInfo, float y, string label, Func<string> textFunc)
		{
			InfoPanel.AddInfoToPanel(Name, xLabel, xInfo, y, label, textFunc);
		}

		public static void CreateSimpleInfoPanel(string Name, float sep)
		{
			InfoPanel.CreateSimpleInfoPanel(Name, sep);
		}

		public static void AddInfoToSimplePanel(string Name, string label, Func<string> textFunc)
		{
			InfoPanel.AddInfoToSimplePanel(Name, label, textFunc);
		}

		public static void SetLockKeyBinds(bool value)
		{
			DebugMod.KeyBindLock = value;
		}
	}
	[BepInDependency("org.silksong-modding.modlist", "0.2.0")]
	[HarmonyPatch]
	[BepInPlugin("io.github.hk-speedrunning.debugmod", "DebugMod", "0.2.4")]
	public class DebugMod : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static LogCallback <>9__55_0;

			public static Action <>9__55_1;

			internal void <Awake>b__55_0(string condition, string stackTrace, LogType type)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Invalid comparison between Unknown and I4
				bool flag = (((int)type == 0 || (int)type == 4) ? true : false);
				if (flag && condition.Contains("Exception"))
				{
					LogError(("[UNITY] " + condition + "\n" + stackTrace).Trim());
				}
			}

			internal void <Awake>b__55_1()
			{
				BossHandler.PopulateBossLists();
				GUIController.Instance.BuildMenus();
				SceneWatcher.Init();
				LogConsole("New session started " + DateTime.Now);
			}
		}

		private static GameManager _gm;

		private static InputHandler _ih;

		private static HeroController _hc;

		private static GameObject _refKnight;

		private static PlayMakerFSM _refKnightSlash;

		private static CameraController _refCamera;

		private static PlayMakerFSM _refDreamNail;

		private static Collider2D _refHeroCollider;

		private static Collider2D _refHeroBox;

		internal static IEnumerator CurrentHazardCoro;

		internal static IEnumerator CurrentInvulnCoro;

		internal static DebugMod instance;

		public static readonly string ModBaseDirectory = Path.Combine(Application.persistentDataPath, "DebugModData");

		private static float _loadTime;

		private static float _unloadTime;

		private static bool _loadingChar;

		internal static HitInstance? lastHit;

		internal static int lastDamage;

		internal static float lastScaling;

		internal static bool stateOnDeath;

		internal static bool infiniteHP;

		internal static bool infiniteSilk;

		internal static bool infiniteTools;

		internal static bool playerInvincible;

		internal static bool noclip;

		internal static Vector3 noclipPos;

		internal static bool cameraFollow;

		internal static SaveStateManager saveStateManager;

		public static bool KeyBindLock;

		internal static bool TimeScaleActive;

		internal static float CurrentTimeScale = 1f;

		internal static bool PauseGameNoUIActive = false;

		internal static bool savestateFixes = true;

		public static bool overrideLoadLockout = false;

		internal static int extraNailDamage;

		internal static readonly Dictionary<string, BindAction> bindActions = new Dictionary<string, BindAction>();

		internal static readonly Dictionary<KeyCode, int> alphaKeyDict = new Dictionary<KeyCode, int>();

		public const string Id = "io.github.hk-speedrunning.debugmod";

		internal static GameManager GM
		{
			get
			{
				if (!((Object)(object)_gm != (Object)null))
				{
					return _gm = GameManager.instance;
				}
				return _gm;
			}
		}

		internal static InputHandler IH
		{
			get
			{
				if (!((Object)(object)_ih != (Object)null))
				{
					return _ih = GM.inputHandler;
				}
				return _ih;
			}
		}

		internal static HeroController HC
		{
			get
			{
				if (!((Object)(object)_hc != (Object)null))
				{
					return _hc = HeroController.instance;
				}
				return _hc;
			}
		}

		internal static GameObject RefKnight
		{
			get
			{
				if (!((Object)(object)_refKnight != (Object)null))
				{
					return _refKnight = ((Component)HC).gameObject;
				}
				return _refKnight;
			}
		}

		internal static CameraController RefCamera
		{
			get
			{
				if (!((Object)(object)_refCamera != (Object)null))
				{
					return _refCamera = GM.cameraCtrl;
				}
				return _refCamera;
			}
		}

		internal static Collider2D RefHeroCollider
		{
			get
			{
				if (!((Object)(object)_refHeroCollider != (Object)null))
				{
					return _refHeroCollider = RefKnight.GetComponent<Collider2D>();
				}
				return _refHeroCollider;
			}
		}

		internal static Collider2D RefHeroBox
		{
			get
			{
				if (!((Object)(object)_refHeroBox != (Object)null))
				{
					return _refHeroBox = ((Component)RefKnight.transform.Find("HeroBox")).GetComponent<Collider2D>();
				}
				return _refHeroBox;
			}
		}

		public static Settings settings { get; set; } = new Settings();


		public static string Name => "DebugMod";

		public static string Version => "0.2.4";

		public void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			LoadSettings();
			if (settings.LogUnityExceptions)
			{
				object obj = <>c.<>9__55_0;
				if (obj == null)
				{
					LogCallback val = delegate(string condition, string stackTrace, LogType type)
					{
						//IL_0000: Unknown result type (might be due to invalid IL or missing references)
						//IL_0003: Unknown result type (might be due to invalid IL or missing references)
						//IL_0005: Invalid comparison between Unknown and I4
						bool flag = (((int)type == 0 || (int)type == 4) ? true : false);
						if (flag && condition.Contains("Exception"))
						{
							LogError(("[UNITY] " + condition + "\n" + stackTrace).Trim());
						}
					};
					<>c.<>9__55_0 = val;
					obj = (object)val;
				}
				Application.logMessageReceived += (LogCallback)obj;
			}
			bindActions.Clear();
			MethodInfo[] methods = typeof(BindableFunctions).GetMethods(BindingFlags.Static | BindingFlags.Public);
			foreach (MethodInfo methodInfo in methods)
			{
				object[] customAttributes = methodInfo.GetCustomAttributes(typeof(BindableMethod), inherit: false);
				if (customAttributes.Any())
				{
					BindableMethod bindableMethod = (BindableMethod)customAttributes[0];
					bindActions.Add(bindableMethod.name, new BindAction(bindableMethod, methodInfo));
				}
			}
			if (settings.FirstRun || settings.binds == null)
			{
				Log("First run detected, setting default binds");
				settings.FirstRun = false;
				settings.binds = new Dictionary<string, KeyCode>();
				settings.binds.Add("Toggle All UI", (KeyCode)283);
			}
			int num = (settings.NumPadForSaveStates ? 256 : 48);
			alphaKeyDict.Clear();
			for (int j = 0; j < 10; j++)
			{
				alphaKeyDict.Add((KeyCode)(num + j), j);
			}
			saveStateManager = new SaveStateManager();
			new Harmony("io.github.hk-speedrunning.debugmod").PatchAll();
			SceneManager.activeSceneChanged += LevelActivated;
			ModHooks.AfterSavegameLoadHook += LoadCharacter;
			ModHooks.NewGameHook += NewCharacter;
			ModHooks.BeforeSceneLoadHook += OnLevelUnload;
			ModHooks.TakeHealthHook += PlayerDamaged;
			ModHooks.ApplicationQuitHook += SaveSettings;
			if (settings.ShowCursorWhileUnpaused)
			{
				BindableFunctions.SetAlwaysShowCursor();
			}
			ModHooks.FinishedLoadingModsHook += delegate
			{
				BossHandler.PopulateBossLists();
				GUIController.Instance.BuildMenus();
				SceneWatcher.Init();
				LogConsole("New session started " + DateTime.Now);
			};
			KeyBindLock = false;
			TimeScaleActive = false;
			Log("Initialized");
		}

		public DebugMod()
		{
			instance = this;
			ModInteropManager.ModInterop(typeof(DebugExport));
		}

		private void LoadSettings()
		{
			try
			{
				if (!Directory.Exists(ModBaseDirectory))
				{
					Directory.CreateDirectory(ModBaseDirectory);
				}
				string path = Path.Combine(ModBaseDirectory, "Settings.json");
				if (File.Exists(path))
				{
					settings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText(path));
					Log("Loaded settings");
				}
			}
			catch (Exception arg)
			{
				LogError($"Error loading settings: {arg}");
			}
		}

		private void SaveSettings()
		{
			try
			{
				File.WriteAllText(Path.Combine(ModBaseDirectory, "Settings.json"), JsonConvert.SerializeObject((object)settings, (Formatting)1));
				Log("Saved settings");
			}
			catch (Exception arg)
			{
				LogError($"Error saving settings: {arg}");
			}
		}

		private int PlayerDamaged(int damageAmount)
		{
			int num = ((!infiniteHP) ? damageAmount : 0);
			if (stateOnDeath && PlayerData.instance.health - num <= 0)
			{
				saveStateManager.LoadSaveState(SaveStateType.Memory);
				LogConsole("Lethal damage prevented, savestate loading");
				return 0;
			}
			return num;
		}

		[HarmonyPatch(typeof(HeroController), "HazardRespawn")]
		[HarmonyPostfix]
		public static void OnHazardRespawn(HeroController __instance, IEnumerator __result)
		{
			CurrentHazardCoro = __result;
		}

		[HarmonyPatch(typeof(HeroController), "Invulnerable")]
		[HarmonyPostfix]
		public static void OnInvulnerable(HeroController __instance, IEnumerator __result)
		{
			CurrentInvulnCoro = __result;
		}

		private void NewCharacter()
		{
			LoadCharacter(null);
		}

		private void LoadCharacter(SaveGameData saveGameData)
		{
			ConsolePanel.Reset();
			playerInvincible = false;
			infiniteHP = false;
			infiniteSilk = false;
			noclip = false;
			extraNailDamage = 0;
			lastHit = null;
			lastDamage = 0;
			lastScaling = 0f;
			_loadingChar = true;
		}

		private void LevelActivated(Scene sceneFrom, Scene sceneTo)
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Scene)(ref sceneTo)).name;
			if (_loadingChar)
			{
				TimeSpan timeSpan = TimeSpan.FromSeconds(PlayerData.instance.playTime);
				string text = $"{Math.Floor(timeSpan.TotalHours):00}.{timeSpan.Minutes:00}";
				int profileID = PlayerData.instance.profileID;
				LogConsole("New savegame loaded. Profile playtime " + text + " Completion: " + PlayerData.instance.completionPercentage + " Save slot: " + profileID + " Game Version: " + PlayerData.instance.version);
				_loadingChar = false;
			}
			if (Object.op_Implicit((Object)(object)GM) && GM.IsGameplayScene())
			{
				_loadTime = Time.realtimeSinceStartup;
				LogConsole("New scene loaded: " + name);
				PlayerDeathWatcher.Reset();
				BossHandler.LookForBoss(name);
				VisualMaskHelper.OnSceneChange(sceneTo);
			}
		}

		private string OnLevelUnload(string toScene)
		{
			_unloadTime = Time.realtimeSinceStartup;
			return toScene;
		}

		public static string GetSceneName()
		{
			if ((Object)(object)GM == (Object)null)
			{
				LogWarn("GameManager reference is null in GetSceneName");
				return "";
			}
			return GM.GetSceneNameString();
		}

		public static float GetLoadTime()
		{
			return (float)Math.Round(_loadTime - _unloadTime, 2);
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		private static int Get_NailDamage(int nailDamage)
		{
			return nailDamage + extraNailDamage;
		}

		[HarmonyPatch(typeof(HealthManager), "TakeDamage")]
		[HarmonyPrefix]
		private static void TakeDamage(HealthManager __instance, HitInstance hitInstance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			HitInstance val = __instance.ApplyDamageScaling(hitInstance);
			lastHit = val;
			lastDamage = (__instance.damageOverride ? 1 : Mathf.RoundToInt((float)val.DamageDealt * val.Multiplier));
			int num = hitInstance.DamageScalingLevel - 1;
			if (hitInstance.IsUsingNeedleDamageMult)
			{
				num = PlayerData.instance.nailUpgrades;
			}
			else if (Object.op_Implicit((Object)(object)hitInstance.RepresentingTool) && (int)hitInstance.RepresentingTool.Type != 3)
			{
				num = PlayerData.instance.ToolKitUpgrades;
			}
			lastScaling = __instance.damageScaling.GetMultFromLevel(num);
		}

		[HarmonyPatch(typeof(SurfaceWaterRegion), "OnTriggerEnter2D")]
		[HarmonyPrefix]
		private static void OnTriggerEnter2D_Prefix(Collider2D collision)
		{
			if (Object.op_Implicit((Object)(object)((Component)collision).gameObject.GetComponent<HeroController>()) && playerInvincible)
			{
				PlayerData.instance.isInvincible = false;
			}
		}

		[HarmonyPatch(typeof(SurfaceWaterRegion), "OnTriggerEnter2D")]
		[HarmonyPostfix]
		private static void OnTriggerEnter2D_Postfix()
		{
			if (playerInvincible)
			{
				PlayerData.instance.isInvincible = true;
			}
		}

		[HarmonyPatch(typeof(HeroWaterController), "TumbleOut")]
		[HarmonyPrefix]
		private static bool HeroWaterController_TumbleOut_Prefix(HeroWaterController __instance)
		{
			if (SaveState.loadingSavestate == null)
			{
				return true;
			}
			__instance.ExitedWater(true);
			return false;
		}

		[HarmonyPatch(typeof(HeroController), "TakeDamage")]
		[HarmonyPrefix]
		private static bool HeroController_TakeDamage(GameObject go, HazardType hazardType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if (playerInvincible && !noclip && (int)hazardType == 4 && ((Object)go).name.Contains("Lava Box"))
			{
				HeroController.instance.ShroomBounce();
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(HeroController), "DoSpecialDamage")]
		[HarmonyPrefix]
		private static bool HeroController_DoSpecialDamage()
		{
			return !playerInvincible;
		}

		[PublicAPI]
		public static void AddToKeyBindList(Type BindableFunctionsClass)
		{
			MethodInfo[] methods = BindableFunctionsClass.GetMethods(BindingFlags.Static | BindingFlags.Public);
			foreach (MethodInfo methodInfo in methods)
			{
				BindableMethod customAttribute = methodInfo.GetCustomAttribute<BindableMethod>(inherit: false);
				if (customAttribute != null)
				{
					Log("Recieved Action: " + customAttribute.name + " (from " + BindableFunctionsClass.Name + ")");
					bindActions.Add(customAttribute.name, new BindAction(customAttribute, methodInfo));
				}
			}
		}

		[PublicAPI]
		public static void AddActionToKeyBindList(Action method, string name, string category)
		{
			AddActionToKeyBindList(method, name, category, allowLock: true);
		}

		[PublicAPI]
		public static void AddActionToKeyBindList(Action method, string name, string category, bool allowLock)
		{
			Log("Received Action: " + name);
			bindActions.Add(name, new BindAction(name, category, allowLock, method));
		}

		public static void LogDebug(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogDebug((object)message);
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}

		public static void LogWarn(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogWarning((object)message);
		}

		public static void LogError(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogError((object)message);
		}

		public static void LogConsole(string message)
		{
			ConsolePanel.AddLine(message);
		}
	}
	public class GUIController : MonoBehaviour
	{
		public Font trajanBold;

		public Font trajanNormal;

		public Font arial;

		public Dictionary<string, Texture2D> images = new Dictionary<string, Texture2D>();

		public Vector3 hazardLocation;

		public string respawnSceneWatch;

		public static bool didInput;

		public static bool inputEsc;

		private static readonly HitboxViewer hitboxes = new HitboxViewer();

		private string textBoxText;

		private Action<string> textBoxCallback;

		public GameObject canvas;

		private static GUIController _instance;

		private readonly Array allKeyCodes = Enum.GetValues(typeof(KeyCode));

		private readonly List<KeyCode> UnbindableKeys = new List<KeyCode> { (KeyCode)323 };

		public static GUIController Instance
		{
			get
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					DebugMod.Log("Creating new GUIController");
					GameObject val = new GameObject("GUIController");
					_instance = val.AddComponent<GUIController>();
					Object.DontDestroyOnLoad((Object)val);
				}
				return _instance;
			}
		}

		public static bool ForceHideUI()
		{
			if (DebugMod.GM.IsNonGameplayScene())
			{
				return !DebugMod.GM.IsCinematicScene();
			}
			return false;
		}

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			hazardLocation = PlayerData.instance.hazardRespawnLocation;
			respawnSceneWatch = PlayerData.instance.respawnScene;
		}

		public void BuildMenus()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			LoadResources();
			canvas = new GameObject("DebugModCanvas");
			canvas.AddComponent<Canvas>().renderMode = (RenderMode)0;
			CanvasScaler obj = canvas.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			canvas.AddComponent<GraphicRaycaster>();
			SaveStatesPanel.BuildMenu(canvas);
			TopMenu.BuildMenu(canvas);
			EnemiesPanel.BuildMenu(canvas);
			ConsolePanel.BuildMenu(canvas);
			InfoPanel.BuildInfoPanels(canvas);
			KeyBindPanel.BuildMenu(canvas);
			Object.DontDestroyOnLoad((Object)(object)canvas);
		}

		private void LoadResources()
		{
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			Font[] array = Resources.FindObjectsOfTypeAll<Font>();
			string[] oSInstalledFontNames;
			foreach (Font val in array)
			{
				if ((Object)(object)val != (Object)null && ((Object)val).name == "TrajanPro-Bold")
				{
					trajanBold = val;
				}
				if ((Object)(object)val != (Object)null && ((Object)val).name == "TrajanPro-Regular")
				{
					trajanNormal = val;
				}
				if ((Object)(object)val != (Object)null && ((Object)val).name == "Perpetua")
				{
					arial = val;
				}
				oSInstalledFontNames = Font.GetOSInstalledFontNames();
				foreach (string text in oSInstalledFontNames)
				{
					if (text.ToLower().Contains("arial"))
					{
						arial = Font.CreateDynamicFontFromOSFont(text, 13);
						break;
					}
				}
			}
			if ((Object)(object)trajanBold == (Object)null || (Object)(object)trajanNormal == (Object)null || (Object)(object)arial == (Object)null)
			{
				DebugMod.LogError("Could not find game fonts");
			}
			oSInstalledFontNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
			foreach (string text2 in oSInstalledFontNames)
			{
				if (text2.StartsWith("DebugMod.Images."))
				{
					try
					{
						Stream? manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text2);
						byte[] array2 = new byte[manifestResourceStream.Length];
						manifestResourceStream.Read(array2, 0, array2.Length);
						Texture2D val2 = new Texture2D(1, 1);
						ImageConversion.LoadImage(val2, array2.ToArray());
						string text3 = text2.Split('.')[^2];
						images.Add(text3, val2);
						DebugMod.LogDebug("Loaded image: " + text3);
					}
					catch (Exception ex)
					{
						DebugMod.LogError("Failed to load image: " + text2 + "\n" + ex.ToString());
					}
				}
			}
		}

		public void Update()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Invalid comparison between Unknown and I4
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Invalid comparison between Unknown and I4
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)DebugMod.GM == (Object)null)
			{
				return;
			}
			SaveStatesPanel.Update();
			TopMenu.Update();
			EnemiesPanel.Update();
			ConsolePanel.Update();
			KeyBindPanel.Update();
			InfoPanel.Update();
			if (DebugMod.GetSceneName() == "Menu_Title")
			{
				return;
			}
			if (DebugMod.settings.ShowCursorWhileUnpaused && !ForceHideUI() && !UIManager.instance.inputModule.allowMouseInput)
			{
				ManagerSingleton<InputHandler>.Instance.StartUIInput();
			}
			for (int i = 0; i < DebugMod.settings.binds.Count; i++)
			{
				KeyValuePair<string, KeyCode> keyValuePair = DebugMod.settings.binds.ElementAt(i);
				string key = keyValuePair.Key;
				KeyCode value = keyValuePair.Value;
				if (!DebugMod.bindActions.ContainsKey(key))
				{
					continue;
				}
				if ((int)value == 0)
				{
					foreach (KeyCode allKeyCode in allKeyCodes)
					{
						if (!Input.GetKeyDown(allKeyCode) || UnbindableKeys.Contains(allKeyCode))
						{
							continue;
						}
						if (KeyBindPanel.keyWarning != allKeyCode)
						{
							foreach (string key2 in DebugMod.bindActions.Keys)
							{
								if (DebugMod.settings.binds.TryGetValue(key2, out var value2) && value2 == allKeyCode)
								{
									DebugMod.LogConsole($"{(object)allKeyCode} already bound to {key2}, press again to confirm");
									KeyBindPanel.keyWarning = allKeyCode;
								}
							}
							if (KeyBindPanel.keyWarning == allKeyCode)
							{
								break;
							}
						}
						KeyBindPanel.keyWarning = (KeyCode)0;
						if ((int)allKeyCode == 27)
						{
							DebugMod.settings.binds.Remove(key);
							i--;
							DebugMod.LogWarn("The key " + Enum.GetName(typeof(KeyCode), (object)allKeyCode) + " has been unbound from " + key);
						}
						else if ((int)allKeyCode != 27)
						{
							DebugMod.settings.binds[key] = allKeyCode;
						}
						KeyBindPanel.UpdateHelpText();
						break;
					}
				}
				else
				{
					if (!Input.GetKeyDown(value))
					{
						continue;
					}
					try
					{
						if (DebugMod.bindActions.TryGetValue(key, out BindAction value3) && (!DebugMod.KeyBindLock || (DebugMod.KeyBindLock && !value3.AllowLock)))
						{
							value3.Action();
						}
					}
					catch (Exception ex)
					{
						DebugMod.LogError("Error running keybind method " + key + ":\n" + ex.ToString());
					}
				}
			}
			if (SaveStateManager.inSelectSlotState && DebugMod.settings.SaveStatePanelVisible)
			{
				foreach (KeyValuePair<KeyCode, int> item in DebugMod.alphaKeyDict)
				{
					if (Input.GetKeyDown(item.Key))
					{
						if (DebugMod.alphaKeyDict.TryGetValue(item.Key, out var value4))
						{
							SaveStateManager.currentStateSlot = value4;
							didInput = true;
						}
						else
						{
							didInput = (inputEsc = true);
						}
						break;
					}
				}
			}
			if (DebugMod.infiniteSilk && PlayerData.instance.silk < PlayerData.instance.silkMax && PlayerData.instance.health > 0 && (Object)(object)HeroController.instance != (Object)null && !HeroController.instance.cState.dead && GameManager.instance.IsGameplayScene())
			{
				PlayerData.instance.silk = PlayerData.instance.silkMax;
				HeroController.instance.AddSilk(1, false);
			}
			if (DebugMod.infiniteTools && Object.op_Implicit((Object)(object)ManagerSingleton<ToolItemManager>.Instance) && Object.op_Implicit((Object)(object)ManagerSingleton<ToolItemManager>.Instance.toolItems))
			{
				foreach (ToolItem item2 in (NamedScriptableObjectList<ToolItem>)(object)ManagerSingleton<ToolItemManager>.Instance.toolItems)
				{
					if (Object.op_Implicit((Object)(object)item2))
					{
						Data savedData = item2.SavedData;
						int amountLeft = savedData.AmountLeft;
						savedData.AmountLeft = ToolItemManager.GetToolStorageAmount(item2);
						item2.SavedData = savedData;
						AttackToolBinding? attackToolBinding = ToolItemManager.GetAttackToolBinding(item2);
						if (attackToolBinding.HasValue && amountLeft != savedData.AmountLeft)
						{
							ToolItemManager.ReportBoundAttackToolUpdated(attackToolBinding.Value);
						}
					}
				}
			}
			if (DebugMod.playerInvincible && PlayerData.instance != null)
			{
				PlayerData.instance.isInvincible = true;
			}
			if (DebugMod.noclip)
			{
				Vector3 val2 = Vector3.zero;
				float num = (Input.GetKey((KeyCode)304) ? 40f : 20f) * DebugMod.settings.NoClipSpeedModifier * Time.deltaTime;
				if (((OneAxisInputControl)DebugMod.IH.inputActions.Left).IsPressed)
				{
					val2 += Vector3.left * num;
				}
				if (((OneAxisInputControl)DebugMod.IH.inputActions.Right).IsPressed)
				{
					val2 += Vector3.right * num;
				}
				if (((OneAxisInputControl)DebugMod.IH.inputActions.Up).IsPressed)
				{
					val2 += Vector3.up * num;
				}
				if (((OneAxisInputControl)DebugMod.IH.inputActions.Down).IsPressed)
				{
					val2 += Vector3.down * num;
				}
				DebugMod.noclipPos += val2;
				if ((int)HeroController.instance.transitionState == 0 && SaveState.loadingSavestate == null)
				{
					DebugMod.RefKnight.transform.position = DebugMod.noclipPos;
					Rigidbody2D component = DebugMod.RefKnight.GetComponent<Rigidbody2D>();
					component.constraints = (RigidbodyConstraints2D)(component.constraints | 3);
				}
				else
				{
					DebugMod.noclipPos = DebugMod.RefKnight.transform.position;
					Rigidbody2D component2 = DebugMod.RefKnight.GetComponent<Rigidbody2D>();
					component2.constraints = (RigidbodyConstraints2D)(component2.constraints & -4);
				}
			}
			if (DebugMod.cameraFollow)
			{
				BindableFunctions.cameraGameplayScene.SetValue(DebugMod.RefCamera, false);
				DebugMod.RefCamera.SnapTo(DebugMod.RefKnight.transform.position.x, DebugMod.RefKnight.transform.position.y);
			}
			if (PlayerData.instance.hazardRespawnLocation != hazardLocation)
			{
				hazardLocation = PlayerData.instance.hazardRespawnLocation;
				DebugMod.LogConsole("Hazard Respawn location updated: " + ((object)(Vector3)(ref hazardLocation)).ToString());
			}
			if (!string.IsNullOrEmpty(respawnSceneWatch) && respawnSceneWatch != PlayerData.instance.respawnScene)
			{
				respawnSceneWatch = PlayerData.instance.respawnScene;
				DebugMod.LogConsole("Save Respawn updated, new scene: " + PlayerData.instance.respawnScene.ToString() + ", Map Zone: " + GameManager.instance.GetCurrentMapZone() + ", Respawn Marker: " + PlayerData.instance.respawnMarkerName.ToString());
			}
			if (HitboxViewer.State != DebugMod.settings.ShowHitBoxes)
			{
				if (DebugMod.settings.ShowHitBoxes != 0)
				{
					hitboxes.Load();
				}
				else if (HitboxViewer.State != 0 && DebugMod.settings.ShowHitBoxes == 0)
				{
					hitboxes.Unload();
				}
			}
		}

		public void TextBox(string text, Action<string> callback)
		{
			textBoxText = text;
			textBoxCallback = callback;
		}

		public void OnGUI()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (textBoxCallback != null)
			{
				textBoxText = GUI.TextField(new Rect(860f, 550f, 200f, 20f), textBoxText);
				if (GUI.Button(new Rect(860f, 570f, 100f, 20f), "Rename"))
				{
					textBoxCallback(textBoxText);
					textBoxText = null;
					textBoxCallback = null;
				}
				else if (GUI.Button(new Rect(960f, 570f, 100f, 20f), "Cancel"))
				{
					textBoxText = null;
					textBoxCallback = null;
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class ModHooks
	{
		[CompilerGenerated]
		private sealed class <GameManager_LoadFirstScene>d__37 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IEnumerator orig;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = orig;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					ModHooks.NewGameHook?.Invoke();
					return false;
				}
			}

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

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

		private static bool finishedLoadingModsInvoked;

		public static event Action<SaveGameData> AfterSavegameLoadHook;

		public static event Action ApplicationQuitHook;

		public static event Action BeforePlayerDeadHook;

		public static event Func<string, string> BeforeSceneLoadHook;

		public static event Action<GameObject> ColliderCreateHook;

		public static event Action CursorHook;

		private static event Action finishedLoadingModsHook;

		public static event Action FinishedLoadingModsHook
		{
			add
			{
				finishedLoadingModsHook += value;
				if (finishedLoadingModsInvoked)
				{
					value();
				}
			}
			remove
			{
				finishedLoadingModsHook -= value;
			}
		}

		public static event Action NewGameHook;

		public static event Func<int, int> TakeHealthHook;

		[HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[]
		{
			typeof(SaveGameData),
			typeof(int)
		})]
		[HarmonyPostfix]
		private static void GameManager_SetLoadedGameData(SaveGameData saveGameData)
		{
			ModHooks.AfterSavegameLoadHook?.Invoke(saveGameData);
		}

		[HarmonyPatch(typeof(GameManager), "OnApplicationQuit")]
		[HarmonyPostfix]
		private static void GameManager_OnApplicationQuit()
		{
			ModHooks.ApplicationQuitHook?.Invoke();
		}

		[HarmonyPatch(typeof(GameManager), "PlayerDead")]
		[HarmonyPrefix]
		private static void GameManager_PlayerDead()
		{
			ModHooks.BeforePlayerDeadHook?.Invoke();
		}

		[HarmonyPatch(typeof(GameManager), "BeginSceneTransition")]
		[HarmonyPrefix]
		private static void GameManager_BeginSceneTransition(SceneLoadInfo info)
		{
			if (ModHooks.BeforeSceneLoadHook != null)
			{
				info.SceneName = ModHooks.BeforeSceneLoadHook(info.SceneName);
			}
		}

		[HarmonyPatch(typeof(GameManager), "LoadScene")]
		[HarmonyPrefix]
		private static void GameManager_LoadScene(ref string destScene)
		{
			if (ModHooks.BeforeSceneLoadHook != null)
			{
				destScene = ModHooks.BeforeSceneLoadHook(destScene);
			}
		}

		[HarmonyPatch(typeof(GameManager), "LoadSceneAdditive")]
		[HarmonyPrefix]
		private static void GameManager_LoadSceneAdditive(ref string destScene)
		{
			if (ModHooks.BeforeSceneLoadHook != null)
			{
				destScene = ModHooks.BeforeSceneLoadHook(destScene);
			}
		}

		[HarmonyPatch(typeof(PlayMakerUnity2DProxy), "Start")]
		[HarmonyPostfix]
		private static void PlayMakerUnity2DProxy_Start(PlayMakerUnity2DProxy __instance)
		{
			ModHooks.ColliderCreateHook?.Invoke(((Component)__instance).gameObject);
		}

		[HarmonyPatch(typeof(InputHandler), "Update")]
		[HarmonyPostfix]
		private static void InputHandler_Update()
		{
			ModHooks.CursorHook?.Invoke();
		}

		[HarmonyPatch(typeof(OnScreenDebugInfo), "Awake")]
		[HarmonyPrefix]
		private static void OnScreenDebugInfo_Awake()
		{
			if (!finishedLoadingModsInvoked)
			{
				finishedLoadingModsInvoked = true;
				ModHooks.finishedLoadingModsHook?.Invoke();
			}
		}

		[IteratorStateMachine(typeof(<GameManager_LoadFirstScene>d__37))]
		[HarmonyPatch(typeof(GameManager), "LoadFirstScene")]
		[HarmonyPostfix]
		private static IEnumerator GameManager_LoadFirstScene(IEnumerator orig)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GameManager_LoadFirstScene>d__37(0)
			{
				orig = orig
			};
		}

		[HarmonyPatch(typeof(GameManager), "OnWillActivateFirstLevel")]
		[HarmonyPostfix]
		private static void GameManager_OnWillActivateFirstLevel()
		{
			ModHooks.NewGameHook?.Invoke();
		}

		[HarmonyPatch(typeof(PlayerData), "TakeHealth")]
		[HarmonyPrefix]
		private static void PlayerData_TakeHealth(ref int amount)
		{
			if (ModHooks.TakeHealthHook != null)
			{
				amount = ModHooks.TakeHealthHook(amount);
			}
		}
	}
	public static class PlayerDeathWatcher
	{
		public static bool playerDead;

		static PlayerDeathWatcher()
		{
			ModHooks.BeforePlayerDeadHook += SetPlayerDead;
		}

		private static void SetPlayerDead()
		{
			playerDead = true;
			LogDeathDetails();
		}

		public static void Reset()
		{
			playerDead = false;
		}

		public static void LogDeathDetails()
		{
			DebugMod.LogConsole(string.Concat(new string[4]
			{
				"Hero death detected. Game playtime: ",
				PlayerData.instance.playTime.ToString(),
				" Respawn scene: ",
				PlayerData.instance.respawnScene.ToString()
			}));
		}
	}
	public class Settings
	{
		[JsonProperty(ItemConverterType = typeof(StringEnumConverter))]
		public Dictionary<string, KeyCode> binds = new Dictionary<string, KeyCode>();

		public bool ConsoleVisible = true;

		public bool EnemiesPanelVisible = true;

		public bool HelpPanelVisible = true;

		public bool InfoPanelVisible = true;

		public string CurrentInfoPanelName = "";

		public bool SaveStatePanelVisible = true;

		public bool TopMenuVisible = true;

		public bool FirstRun = true;

		public bool NumPadForSaveStates;

		public int ShowHitBoxes;

		public int MaxSaveStates = 10;

		public int MaxSavePages = 10;

		public float NoClipSpeedModifier = 1f;

		public bool ShowCursorWhileUnpaused;

		public bool SaveStateGlitchFixes = true;

		public bool ClearSaveStatePanel;

		public bool LogUnityExceptions = true;
	}
}
namespace DebugMod.UI
{
	public class BottomRightInfoPanel : InfoPanel
	{
		public override bool Active => true;

		public override void BuildPanel(GameObject canvas)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(1, 1);
			val.LoadRawTextureData(new byte[4]);
			val.Apply();
			panel = new CanvasPanel("BottomRightInfoPanel", null, new Vector2(0f, 223f), Vector2.zero, val, new Rect(0f, 0f, 1f, 1f));
			panel.AddText("Right1 Label", "Load\nHero Pos\nMove Raw", new Vector2(1285f, 747f), Vector2.zero, GUIController.Instance.arial, 13, (FontStyle)0, (TextAnchor)0);
			panel.AddText("Right1", "", new Vector2(1385f, 747f), Vector2.zero, GUIController.Instance.trajanNormal, 13, (FontStyle)0, (TextAnchor)0);
			panel.AddText("Right2 Label", "Move Vector\nKey Pressed\nMove Pressed", new Vector2(1525f, 747f), Vector2.zero, GUIController.Instance.arial, 13, (FontStyle)0, (TextAnchor)0);
			panel.AddText("Right2", "", new Vector2(1625f, 747f), Vector2.zero, GUIController.Instance.trajanNormal, 13, (FontStyle)0, (TextAnchor)0);
			panel.AddText("Right3 Label", "Frame Counter\nGame Time Elapsed\nSession Time", new Vector2(1670f, 747f), Vector2.zero, GUIController.Instance.arial, 13, (FontStyle)0, (TextAnchor)0);
			panel.AddText("Right3", "", new Vector2(1800f, 747f), Vector2.zero, GUIController.Instance.trajanNormal, 13, (FontStyle)0, (TextAnchor)0);
			panel.FixRenderOrder();
		}

		public override void UpdatePanel()
		{
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			TimeSpan timeSpan = TimeSpan.FromSeconds((double)BindableFunctions.frameCounter * 0.02);
			if (panel != null)
			{
				int num = Mathf.FloorToInt(Time.realtimeSinceStartup / 60f);
				int num2 = Mathf.FloorToInt(Time.realtimeSinceStartup - (float)(num * 60));
				panel.GetText("Right1").UpdateText(DebugMod.GetLoadTime() + "s\n" + InfoPanel.GetHeroPos() + "\n" + $"L: {((OneAxisInputControl)DebugMod.IH.inputActions.Left).RawValue} R: {((OneAxisInputControl)DebugMod.IH.inputActions.Right).RawValue} U: {((OneAxisInputControl)DebugMod.IH.inputActions.Up).RawValue} D: {((OneAxisInputControl)DebugMod.IH.inputActions.Down).RawValue}");
				panel.GetText("Right2").UpdateText(((TwoAxisInputControl)DebugMod.IH.inputActions.MoveVector).Vector.x + ", " + ((TwoAxisInputControl)DebugMod.IH.inputActions.MoveVector).Vector.y + "\n" + InfoPanel.GetStringForBool(InputManager.AnyKeyIsPressed) + "\n" + InfoPanel.GetStringForBool(((OneAxisInputControl)DebugMod.IH.inputActions.Left).IsPressed || ((OneAxisInputControl)DebugMod.IH.inputActions.Right).IsPressed));
				panel.GetText("Right3").UpdateText(BindableFunctions.frameCounter + "\n" + timeSpan.ToString("mm':'ss'.'ff") + "\n" + $"{num:00}:{num2:00}");
			}
		}
	}
	public static class ConsolePanel
	{
		private static CanvasPanel panel;

		private static List<string> history = new List<string>();

		private static Vector2 scrollPosition = Vector2.zero;

		public static void BuildMenu(GameObject canvas)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might b