Decompiled source of KnightInSilksong v0.6.7

KIS.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DebugMod;
using DebugMod.SaveStates;
using DebugMod.UI;
using DebugMod.UI.Canvas;
using GlobalEnums;
using GlobalSettings;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using InControl;
using KIS;
using KIS.Compatibility;
using KIS.Utils;
using Knight;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using PolyAndCode.UI;
using PrepatcherPlugin;
using Silksong.ModMenu;
using Silksong.ModMenu.Elements;
using Silksong.ModMenu.Internal;
using Silksong.ModMenu.Models;
using Silksong.ModMenu.Plugin;
using Silksong.ModMenu.Screens;
using TMProOld;
using TeamCherry.Localization;
using ToJ;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("DebugMod")]
[assembly: IgnoresAccessChecksTo("Knight")]
[assembly: IgnoresAccessChecksTo("Silksong.ModMenu")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KIS")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.6.7.0")]
[assembly: AssemblyInformationalVersion("0.6.7+47fc3ec7399a3c8aa2c3b10f258cb5c745bafce8")]
[assembly: AssemblyProduct("KIS")]
[assembly: AssemblyTitle("KnightInSilkSong")]
[assembly: NeutralResourcesLanguage("EN")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.6.7.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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;
		}
	}
}
public class SendDreamImpact : FsmStateAction
{
	public FsmOwnerDefault target = new FsmOwnerDefault
	{
		ownerOption = (OwnerDefaultOption)1
	};

	private NeedolinTextOwner needolinTextOwner;

	public DreamHelper dreamHelper = ((Component)HeroController.instance).GetComponent<DreamHelper>();

	public override void Reset()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		((FsmStateAction)this).Reset();
		target = new FsmOwnerDefault();
	}

	public override void OnEnter()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		((FsmStateAction)this).OnEnter();
		target.ownerOption = (OwnerDefaultOption)1;
		target.gameObject = base.fsm.GetVariable<FsmGameObject>("Collider");
		GameObject safe = FSMUtility.GetSafe(target, (FsmStateAction)(object)this);
		("ONENTER " + (object)safe).LogInfo();
		if ((Object)(object)safe != (Object)null)
		{
			HealthManager component = safe.GetComponent<HealthManager>();
			if ((Object)(object)component != (Object)null)
			{
				safe.LogInfo();
				if (!dreamHelper.Exist(component))
				{
					DoDreamImpact(safe);
					dreamHelper.Add(component);
				}
			}
		}
		((FsmStateAction)this).Finish();
	}

	public void DoDreamImpact(GameObject safe)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Expected O, but got Unknown
		int num = (PlayerData.instance.equippedCharm_30 ? 66 : 33);
		HeroController.instance.AddMPCharge(num);
		Recoil component = safe.GetComponent<Recoil>();
		if ((Object)(object)component != (Object)null)
		{
			bool flag = HeroController.instance.transform.localScale.x <= 0f;
			component.RecoilByDirection((!flag) ? 2 : 0, 2f);
		}
		SpriteFlash component2 = safe.GetComponent<SpriteFlash>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.flashDreamImpact();
		}
		needolinTextOwner = safe.GetComponent<NeedolinTextOwner>();
		if ((Object)(object)needolinTextOwner != (Object)null)
		{
			needolinTextOwner.OnAddText.AddListener(new UnityAction(RemoveText));
			needolinTextOwner.AddNeedolinText();
		}
	}

	private void RemoveText()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		needolinTextOwner.RemoveNeedolinText();
		needolinTextOwner.OnAddText.RemoveListener(new UnityAction(RemoveText));
	}

	public IEnumerator DelayText(NeedolinTextOwner needolinTextOwner)
	{
		if (!((Object)(object)needolinTextOwner == (Object)null))
		{
			needolinTextOwner.AddNeedolinText();
			yield return (object)new WaitForSeconds(0.2f);
			NeedolinMsgBox._instance.ClearAllText();
		}
	}
}
public static class GameObjectUtils
{
	public static T GetAddComponent<T>(this GameObject go) where T : Component
	{
		T val = go.GetComponent<T>();
		if ((Object)(object)val == (Object)null)
		{
			val = go.AddComponent<T>();
		}
		return val;
	}

	public static bool RemoveComponent<T>(this GameObject go) where T : Component
	{
		T component = go.GetComponent<T>();
		if ((Object)(object)component != (Object)null)
		{
			Object.DestroyImmediate((Object)(object)component);
			return true;
		}
		return false;
	}

	public static T copyComponent<T>(this GameObject to, GameObject from) where T : Component
	{
		if ((Object)(object)from == (Object)null)
		{
			return default(T);
		}
		T component = from.GetComponent<T>();
		T addComponent = to.GetAddComponent<T>();
		if ((Object)(object)component == (Object)null)
		{
			return default(T);
		}
		FieldInfo[] fields = typeof(T).GetFields(BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod | BindingFlags.CreateInstance | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.PutDispProperty | BindingFlags.PutRefDispProperty | BindingFlags.ExactBinding | BindingFlags.SuppressChangeType | BindingFlags.OptionalParamBinding | BindingFlags.IgnoreReturn);
		foreach (FieldInfo fieldInfo in fields)
		{
			fieldInfo.SetValue(addComponent, fieldInfo.GetValue(component));
		}
		return addComponent;
	}

	public static void SetScale(this GameObject gameObject, float scaleX, float scaleY)
	{
		//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)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		Vector3 localScale = gameObject.transform.localScale;
		localScale.x = scaleX;
		localScale.y = scaleY;
		gameObject.transform.localScale = localScale;
	}

	public static GameObject FindGameObjectInChildren(this GameObject gameObject, string name, bool useBaseName = false)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			return null;
		}
		Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (val.GetName(useBaseName) == name)
			{
				return ((Component)val).gameObject;
			}
		}
		return null;
	}

	public static List<GameObject> FindGameObjectsInChildren(this GameObject gameObject, string name, bool useBaseName = false)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			return null;
		}
		List<GameObject> list = new List<GameObject>();
		Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (val.GetName(useBaseName) == name)
			{
				list.Add(((Component)val).gameObject);
			}
		}
		return list;
	}

	public static void Log(this GameObject gameObject)
	{
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)gameObject == (Object)null)
		{
			return;
		}
		KnightInSilksong.logger.LogInfo((object)((Object)gameObject).GetName());
		KnightInSilksong.logger.LogInfo((object)gameObject.GetPath());
		KnightInSilksong.logger.LogInfo((object)("Layer : " + gameObject.layer));
		KnightInSilksong.logger.LogInfo((object)("Position : " + ((object)gameObject.transform.position/*cast due to .constrained prefix*/).ToString()));
		KnightInSilksong.logger.LogInfo((object)("Rotation : " + ((object)gameObject.transform.rotation/*cast due to .constrained prefix*/).ToString()));
		KnightInSilksong.logger.LogInfo((object)("Scale : " + ((object)gameObject.transform.localScale/*cast due to .constrained prefix*/).ToString()));
		Component[] components = gameObject.GetComponents<Component>();
		foreach (Component val in components)
		{
			KnightInSilksong.logger.LogInfo((object)("Component : " + ((object)val).GetType()));
			if (val is PlayMakerFSM)
			{
				KnightInSilksong.logger.LogInfo((object)("---- Fsm name :" + ((PlayMakerFSM)((val is PlayMakerFSM) ? val : null)).FsmName));
			}
		}
	}

	public static void LogWithChildren(this GameObject gameObject)
	{
		if (!((Object)(object)gameObject == (Object)null))
		{
			gameObject.Log();
			Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.Log();
			}
		}
	}

	public static void PrintAllActiveGameObjectsInScene()
	{
		GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0);
		for (int i = 0; i < array.Length; i++)
		{
			array[i].Log();
		}
	}

	public static GameObject Find(this GameObject go, string name)
	{
		for (int i = 0; i < go.transform.childCount; i++)
		{
			GameObject gameObject = ((Component)go.transform.GetChild(i)).gameObject;
			if (((Object)gameObject).name == name)
			{
				return gameObject;
			}
		}
		for (int j = 0; j < go.transform.childCount; j++)
		{
			GameObject val = ((Component)go.transform.GetChild(j)).gameObject.Find(name);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	public static void FindAllChildren(this GameObject go, List<GameObject> allGoList)
	{
		for (int i = 0; i < go.transform.childCount; i++)
		{
			allGoList.Add(((Component)go.transform.GetChild(i)).gameObject);
		}
		for (int j = 0; j < go.transform.childCount; j++)
		{
			((Component)go.transform.GetChild(j)).gameObject.FindAllChildren(allGoList);
		}
	}

	public static void DisableChildren(this GameObject go)
	{
		for (int i = 0; i < go.transform.childCount; i++)
		{
			((Component)go.transform.GetChild(i)).gameObject.SetActive(false);
		}
	}

	public static List<GameObject> GetAllGameObjects(this Scene scene)
	{
		List<GameObject> list = new List<GameObject>();
		GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
		foreach (GameObject val in rootGameObjects)
		{
			list.Add(val);
			val.FindAllChildren(list);
		}
		return list;
	}

	public static GameObject GetGameObjectByName(this Scene scene, string name, bool useBaseName = false)
	{
		GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
		foreach (GameObject val in rootGameObjects)
		{
			if (val.GetName(useBaseName) == name)
			{
				return val;
			}
			GameObject val2 = val.FindGameObjectInChildren(name, useBaseName);
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
		}
		return null;
	}

	public static GameObject[] GetRootGameObjects()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene = SceneManager.GetActiveScene();
		return ((Scene)(ref activeScene)).GetRootGameObjects();
	}

	public static GameObject GetGameObjectInScene(string name, bool useBaseName = false)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		return SceneManager.GetActiveScene().GetGameObjectByName(name, useBaseName);
	}

	public static List<GameObject> GetAllGameObjectsInScene()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		return SceneManager.GetActiveScene().GetAllGameObjects();
	}

	public static string GetName(this Transform transform, bool useBaseName = false)
	{
		return ((Component)transform).gameObject.GetName(useBaseName);
	}

	public static string GetName(this GameObject go, bool useBaseName = false)
	{
		string text = ((Object)go).name;
		if (useBaseName)
		{
			text = text.ToLower();
			text.Replace("(clone)", "");
			text = text.Trim();
			text.Replace("cln", "");
			text = text.Trim();
			text = Regex.Replace(text, "\\([0-9+]+\\)", "");
			text = text.Trim();
			text = Regex.Replace(text, "[0-9+]+$", "");
			text = text.Trim();
			text.Replace("(clone)", "");
			text = text.Trim();
		}
		return text;
	}

	public static string GetPath(this GameObject go, bool useBaseName = false)
	{
		string text = go.GetName(useBaseName);
		GameObject val = go;
		while ((Object)(object)val.transform.parent != (Object)null && (Object)(object)((Component)val.transform.parent).gameObject != (Object)null)
		{
			val = ((Component)val.transform.parent).gameObject;
			text = val.GetName(useBaseName) + "/" + text;
		}
		return text;
	}
}
public enum Tool
{
	Silk_Spear,
	Thread_Sphere,
	Parry,
	Silk_Charge,
	Silk_Bomb,
	Silk_Boss_Needle,
	Straight_Pin,
	Tri_Pin,
	Sting_Shard,
	Tack,
	Harpoon,
	Curve_Claws,
	Curve_Claws_Upgraded,
	Shakra_Ring,
	Pimpilo,
	Conch_Drill,
	WebShot_Forge,
	WebShot_Architect,
	WebShot_Weaver,
	Screw_Attack,
	Cogwork_Saw,
	Cogwork_Flier,
	Rosary_Cannon,
	Lightning_Rod,
	Flintstone,
	Silk_Snare,
	Flea_Brew,
	Lifeblood_Syringe,
	Extractor,
	Mosscreep_Tool_1,
	Mosscreep_Tool_2,
	Lava_Charm,
	Bell_Bind,
	Poison_Pouch,
	Fractured_Mask,
	Multibind,
	White_Ring,
	Brolly_Spike,
	Quickbind,
	Spool_Extender,
	Reserve_Bind,
	Dazzle_Bind,
	Dazzle_Bind_Upgraded,
	Revenge_Crystal,
	Thief_Claw,
	Zap_Imbuement,
	Quick_Sling,
	Maggot_Charm,
	Longneedle,
	Wisp_Lantern,
	Flea_Charm,
	Pinstress_Tool,
	Compass,
	Bone_Necklace,
	Rosary_Magnet,
	Weighted_Anklet,
	Barbed_Wire,
	Dead_Mans_Purse,
	Shell_Satchel,
	Magnetite_Dice,
	Scuttlebrace,
	Wallcling,
	Musician_Charm,
	Sprintmaster,
	Thief_Charm
}
public enum Charm
{
	WaywardCompass = 2,
	GatheringSwarm = 1,
	StalwartShell = 4,
	SoulCatcher = 20,
	ShamanStone = 19,
	SoulEater = 21,
	Dashmaster = 31,
	Sprintmaster = 37,
	Grubsong = 3,
	GrubberflysElegy = 35,
	UnbreakableHeart = 23,
	UnbreakableGreed = 24,
	UnbreakableStrength = 25,
	SpellTwister = 33,
	SteadyBody = 14,
	HeavyBlow = 15,
	QuickSlash = 32,
	Longnail = 18,
	MarkOfPride = 13,
	FuryOfTheFallen = 6,
	ThornsOfAgony = 12,
	BaldurShell = 5,
	Flukenest = 11,
	DefendersCrest = 10,
	GlowingWomb = 22,
	QuickFocus = 7,
	DeepFocus = 34,
	LifebloodHeart = 8,
	LifebloodCore = 9,
	JonisBlessing = 27,
	Hiveblood = 29,
	SporeShroom = 17,
	SharpShadow = 16,
	ShapeOfUnn = 28,
	NailmastersGlory = 26,
	Weaversong = 39,
	DreamWielder = 30,
	Dreamshield = 38,
	Grimmchild = 40,
	VoidHeart = 36
}
public enum Spell
{
	Scream,
	Fireball,
	Quake
}
public enum NailArt
{
	GREAT_SLASH,
	DASH_SLASH,
	CYCLONE
}
public static class KISHelper
{
	public static Action OnReturnToMenu = null;

	public static Action OnQuitApp = null;

	internal const HeroDeathCocoonTypes knight_death_cocoon = (HeroDeathCocoonTypes)1073741824;

	private static Dictionary<string, Texture2D> resourceTextures = new Dictionary<string, Texture2D>();

	public static string GetSaveDataDirectory(int slot)
	{
		return Path.Combine(Paths.ConfigPath, "shownyoung-KIS", "Slot" + slot);
	}

	public static Texture2D ResourceTexture(string name)
	{
		if (!resourceTextures.ContainsKey(name))
		{
			resourceTextures.Add(name, LoadTexture(Assembly.GetExecutingAssembly().GetManifestResourceStream("KIS.Resources.Sprites." + name + ".png")));
		}
		return resourceTextures[name];
	}

	private static Texture2D LoadTexture(Stream stream)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		stream.Close();
		Texture2D val = new Texture2D(2, 2);
		if (ImageConversion.LoadImage(val, array))
		{
			return val;
		}
		return null;
	}

	private static Texture2D LoadTexture(string path)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
		byte[] array = new byte[fileStream.Length];
		fileStream.Read(array, 0, array.Length);
		fileStream.Close();
		Texture2D val = new Texture2D(2, 2);
		if (ImageConversion.LoadImage(val, array))
		{
			return val;
		}
		return null;
	}

	public static GameObject GetCurrentHero()
	{
		return FsmVariables.GlobalVariables.FindFsmGameObject("Hero").Value;
	}

	public static Component GetComponent(GameObject gameObject, string type)
	{
		return gameObject.GetComponent(type);
	}

	public static Component GetAnyComponent<T1, T2>(this GameObject gameObject) where T1 : Component where T2 : Component
	{
		T1 component = gameObject.GetComponent<T1>();
		if ((Object)(object)component != (Object)null)
		{
			return (Component)(object)component;
		}
		T2 component2 = gameObject.GetComponent<T2>();
		if ((Object)(object)component2 != (Object)null)
		{
			return (Component)(object)component2;
		}
		return null;
	}

	public static Component GetAnotherComponent(this Component monoBehaviour)
	{
		bool flag = false;
		string? fullName = ((object)monoBehaviour).GetType().FullName;
		if (fullName.StartsWith("Knight"))
		{
			flag = true;
		}
		string text = fullName.Split(".").Last();
		if (!flag)
		{
			return ((Component)HeroController.instance).GetComponent(text);
		}
		return ((Component)HeroController.instance).GetComponent(text);
	}

	public static void LogInfo(this object msg)
	{
		if (KnightInSilksong.allowLog.Value)
		{
			KnightInSilksong.logger.LogInfo(msg);
		}
	}

	public static void LogWarning(this object msg)
	{
		if (KnightInSilksong.allowLog.Value)
		{
			KnightInSilksong.logger.LogWarning(msg);
		}
	}

	public static void LogError(this object msg)
	{
		if (KnightInSilksong.allowLog.Value)
		{
			KnightInSilksong.logger.LogError(msg);
		}
	}

	public static void LogDebug(this object msg)
	{
		if (KnightInSilksong.allowLog.Value)
		{
			KnightInSilksong.logger.LogDebug(msg);
		}
	}

	public static void LogFatal(this object msg)
	{
		if (KnightInSilksong.allowLog.Value)
		{
			KnightInSilksong.logger.LogFatal(msg);
		}
	}

	public static string GetToolName(this Tool tool)
	{
		return Enum.GetName(typeof(Tool), tool).Replace("_", " ");
	}

	public static string GetCharmName(this Charm charm)
	{
		int num = (int)charm;
		return "gotCharm_" + num;
	}

	public static void CheckForDamageHero(this HeroBox heroBox, GameObject gameObject)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected I4, but got Unknown
		//IL_0063: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		DamageHero component = gameObject.GetComponent<DamageHero>();
		if (!((Object)(object)component != (Object)null) || heroBox.heroCtrl.cState.shadowDashing)
		{
			return;
		}
		heroBox.damageDealt = component.damageDealt;
		heroBox.hazardType = (int)component.hazardType;
		heroBox.damagingObject = gameObject;
		if (component.OverrideCollisionSide)
		{
			heroBox.collisionSide = component.CollisionSide;
		}
		else
		{
			float num = gameObject.transform.position.x;
			float num2 = ((Component)heroBox).transform.position.x;
			if (component.InvertCollisionSide)
			{
				float num3 = num2;
				float num4 = num;
				num = num3;
				num2 = num4;
			}
			heroBox.collisionSide = (CollisionSide)((!(num > num2)) ? 1 : 2);
		}
		if (!HeroBox.IsHitTypeBuffered(heroBox.hazardType))
		{
			heroBox.ApplyBufferedHit();
		}
		else
		{
			heroBox.isHitBuffered = true;
		}
	}

	public static Type[] GetTypesSafely(this Assembly asm)
	{
		try
		{
			return asm.GetTypes();
		}
		catch (ReflectionTypeLoadException ex)
		{
			return ex.Types.Where((Type x) => (object)x != null).ToArray();
		}
	}

	public static bool IsAssignableFromSafely(this Type self, Type other)
	{
		try
		{
			return self.IsAssignableFrom(other);
		}
		catch
		{
			return false;
		}
	}

	public static string InGameKey(this LangKey langKey)
	{
		return MoreLanguge.GetInGameKey(langKey);
	}

	public static LocalisedString Localize(this LangKey key)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return new LocalisedString("Mods.io.github.shownyoung.knightinsilksong", MoreLanguge.GetInGameKey(key));
	}

	public static LocalisedString Localize(this Tool tool)
	{
		//IL_00bf: 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_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		return (LocalisedString)(tool switch
		{
			Tool.Curve_Claws_Upgraded => new LocalisedString("Tools", "CURVE_CLAWS_UPG_NAME"), 
			Tool.WebShot_Architect => LangKey.MM_SILKSHOT_ARCHITECT.Localize(), 
			Tool.WebShot_Forge => LangKey.MM_SILKSHOT_FORGE.Localize(), 
			Tool.WebShot_Weaver => LangKey.MM_SILKSHOT_WEAVER.Localize(), 
			Tool.Rosary_Cannon => new LocalisedString("Tools", "ROSARYCANNON_NAME"), 
			Tool.Silk_Snare => new LocalisedString("Tools", "SNARE_NAME"), 
			Tool.Lifeblood_Syringe => new LocalisedString("Tools", "SYRINGE_LIFEBLOOD_NAME"), 
			Tool.Brolly_Spike => new LocalisedString("Tools", "BROLLYSPIKE_NAME"), 
			Tool.Dazzle_Bind_Upgraded => new LocalisedString("Tools", "DAZZLE_BIND_UPG_NAME"), 
			Tool.Pinstress_Tool => new LocalisedString("Tools", "PINSTRESS_NAME"), 
			Tool.Screw_Attack => new LocalisedString("Tools", "SCREWATTACK_NAME"), 
			_ => new LocalisedString("Tools", tool.ToString().ToUpper() + "_NAME"), 
		});
	}

	public static LocalisedString Localize(this Charm charm)
	{
		//IL_002d: 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)
		if (charm == Charm.VoidHeart)
		{
			return new LocalisedString("Mods.io.github.shownyoung.knightinsilksong", "CHARM_NAME_36_C");
		}
		int num = (int)charm;
		return new LocalisedString("Mods.io.github.shownyoung.knightinsilksong", "CHARM_NAME_" + num);
	}

	public static string InGameKey(this Charm charm)
	{
		if (charm == Charm.VoidHeart)
		{
			return "CHARM_NAME_36_C";
		}
		int num = (int)charm;
		return "CHARM_NAME_" + num;
	}

	public static string PdGotField(this Charm charm)
	{
		return $"gotCharm_{(int)charm}";
	}

	public static bool IsFragileCharm(this Charm charm)
	{
		if (charm >= Charm.UnbreakableHeart)
		{
			return charm <= Charm.UnbreakableStrength;
		}
		return false;
	}

	public static string PdBrokenField(this Charm charm)
	{
		if (!charm.IsFragileCharm())
		{
			throw new ArgumentOutOfRangeException("charm", charm, "Not a fragile charm!");
		}
		return $"brokenCharm_{(int)charm}";
	}

	public static string PdUnbreakableField(this Charm charm)
	{
		return charm switch
		{
			Charm.UnbreakableHeart => "fragileHealth_unbreakable", 
			Charm.UnbreakableGreed => "fragileGreed_unbreakable", 
			Charm.UnbreakableStrength => "fragileStrength_unbreakable", 
			_ => throw new ArgumentOutOfRangeException("charm", charm, "Not a fragile charm!"), 
		};
	}

	public static string PdGotField(this NailArt nailArt)
	{
		return nailArt switch
		{
			NailArt.GREAT_SLASH => "hasDashSlash", 
			NailArt.DASH_SLASH => "hasUpwardSlash", 
			NailArt.CYCLONE => "hasCyclone", 
			_ => throw new ArgumentOutOfRangeException("nailArt", nailArt, "Not a nail art!"), 
		};
	}
}
public abstract class IModule
{
	public virtual void Init()
	{
	}

	public virtual void Unload()
	{
	}
}
internal static class ModuleManager
{
	private static Dictionary<Type, IModule> modules = new Dictionary<Type, IModule>();

	private static bool initialized = false;

	public static T GetInstance<T>() where T : IModule
	{
		if (modules.ContainsKey(typeof(T)))
		{
			return (T)modules[typeof(T)];
		}
		return null;
	}

	public static void Init()
	{
		if (!initialized)
		{
			foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypesSafely()
				where typeof(IModule).IsAssignableFromSafely(t) && !t.IsInterface && !t.IsAbstract
				select t)
			{
				try
				{
					modules.Add(item, (IModule)Activator.CreateInstance(item));
				}
				catch
				{
					KnightInSilksong.logger.LogError((object)("Fail to Create " + item.FullName));
				}
			}
			initialized = true;
		}
		foreach (KeyValuePair<Type, IModule> module in modules)
		{
			module.Value.Init();
		}
	}

	public static void Unload()
	{
		foreach (KeyValuePair<Type, IModule> module in modules)
		{
			module.Value.Unload();
		}
	}
}
internal class PreProcess : IModule
{
	public static PreProcess Instance;

	internal bool shader_initialized;

	private Dictionary<string, string> material_shader_map;

	private Dictionary<string, Shader> shaders = new Dictionary<string, Shader>();

	public Sprite charm_icon;

	public HashSet<AudioMixer> share_mixer_group = new HashSet<AudioMixer>();

	public PreProcess()
	{
		Instance = this;
	}

	public override void Init()
	{
		using (StreamReader streamReader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("KIS.Resources.MaterialShaderMap.json")))
		{
			string text = streamReader.ReadToEnd();
			material_shader_map = JsonConvert.DeserializeObject<Dictionary<string, string>>(text);
		}
		charm_icon = KnightInSilksong.Instance.hk.LoadAsset<Sprite>("GG_bound_charm_prompt");
		SceneManager.activeSceneChanged += CheckShaders;
		SSizeKnight();
		SSizeHud();
		SSizeCharm();
		SSizetk2dCollectionData();
		SetAuidoVolume();
	}

	private void SSizetk2dCollectionData()
	{
		foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos)
		{
			tk2dSpriteCollectionData[] componentsInChildren = loaded_go.Value.GetComponentsInChildren<tk2dSpriteCollectionData>(true);
			foreach (tk2dSpriteCollectionData obj in componentsInChildren)
			{
				obj.spriteCollectionName += "(Hollownest)";
				((Object)obj).name = obj.spriteCollectionName;
			}
		}
	}

	private void SSizeCharm()
	{
		if ((Object)(object)KnightInSilksong.Instance.charm == (Object)null)
		{
			return;
		}
		GameObject charm = KnightInSilksong.Instance.charm;
		Renderer[] componentsInChildren = charm.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer obj in componentsInChildren)
		{
			obj.sortingGroupID = 1048575;
			obj.sortingLayerID = 59515797;
		}
		BuildEquippedCharms componentInChildren = charm.GetComponentInChildren<BuildEquippedCharms>(true);
		if ((Object)(object)componentInChildren != (Object)null)
		{
			foreach (GameObject gameObject in componentInChildren.gameObjectList)
			{
				componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer obj2 in componentsInChildren)
				{
					obj2.sortingGroupID = 1048575;
					obj2.sortingLayerID = 59515797;
				}
			}
		}
		componentsInChildren = KnightInSilksong.loaded_gos["Charm Equip Msg"].GetComponentsInChildren<Renderer>(true);
		foreach (Renderer obj3 in componentsInChildren)
		{
			obj3.sortingGroupID = 1048575;
			obj3.sortingLayerID = 59515797;
		}
	}

	private void SSizeHud()
	{
		if (!((Object)(object)KnightInSilksong.Instance.hud_canvas == (Object)null))
		{
			GameObject hud_canvas = KnightInSilksong.Instance.hud_canvas;
			((Behaviour)FSMUtility.LocateMyFSM(hud_canvas, "Globalise")).enabled = true;
			hud_canvas.FindGameObjectInChildren("Geo Counter").SetActive(false);
		}
	}

	private void SSizeKnight()
	{
		if (!((Object)(object)KnightInSilksong.Instance.knight == (Object)null))
		{
			GameObject knight = KnightInSilksong.Instance.knight;
			SetErrorCollider2D();
			SetErrorFsm();
			knight.GetComponent<tk2dSpriteAnimator>().Library.GetClipByName("Prostrate Rise").frames[1].triggerEvent = true;
			knight.GetComponent<tk2dSpriteAnimator>().Library.GetClipByName("Prostrate Rise").frames[18].triggerEvent = true;
			knight.GetComponent<Rigidbody2D>().constraints = (RigidbodyConstraints2D)4;
			knight.AddComponent<KeepHornet>();
			knight.AddComponent<DreamHelper>();
			KnightInSilksong.loaded_gos["Grimmchild"].tag = "Grimmchild";
			KnightInSilksong.loaded_gos["Weaverling"].tag = "Weaverling";
			KnightInSilksong.loaded_gos["Knight Hatchling"].tag = "Knight Hatchling";
			KnightInSilksong.loaded_gos["Orbit Shield"].tag = "Orbit Shield";
		}
	}

	private void CheckShaders(Scene arg0, Scene arg1)
	{
		SetShaders();
	}

	private void SetShaders()
	{
		Shader[] array = Resources.FindObjectsOfTypeAll<Shader>();
		foreach (Shader val in array)
		{
			if ((Object)(object)val != (Object)null && val.isSupported && !shaders.ContainsKey(((Object)val).name))
			{
				KnightInSilksong.logger.LogInfo((object)(((Object)val).name + " " + val.isSupported));
				shaders.Add(((Object)val).name, val);
			}
		}
	}

	public void StopGetShader()
	{
		if (!shader_initialized)
		{
			shader_initialized = true;
			KnightInSilksong.logger.LogInfo((object)"Shader Find OK");
			SceneManager.activeSceneChanged -= CheckShaders;
			SetErrorShaders();
		}
	}

	public Shader GetShader(string name)
	{
		if (!shaders.ContainsKey(name))
		{
			return null;
		}
		return shaders[name];
	}

	private void SetErrorShaders()
	{
		_ = KnightInSilksong.Instance.hk;
		HashSet<Material> materials = new HashSet<Material>();
		HashSet<TMP_FontAsset> met_fonts = new HashSet<TMP_FontAsset>();
		foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos)
		{
			GameObject value = loaded_go.Value;
			SpriteRenderer[] componentsInChildren = value.GetComponentsInChildren<SpriteRenderer>(true);
			foreach (SpriteRenderer val in componentsInChildren)
			{
				materials.Add(((Renderer)val).sharedMaterial);
			}
			ParticleSystemRenderer[] componentsInChildren2 = value.GetComponentsInChildren<ParticleSystemRenderer>(true);
			foreach (ParticleSystemRenderer val2 in componentsInChildren2)
			{
				materials.Add(((Renderer)val2).sharedMaterial);
			}
			tk2dSpriteCollectionData[] componentsInChildren3 = value.GetComponentsInChildren<tk2dSpriteCollectionData>(true);
			for (int i = 0; i < componentsInChildren3.Length; i++)
			{
				Material[] materials2 = componentsInChildren3[i].materials;
				foreach (Material item in materials2)
				{
					materials.Add(item);
				}
			}
			ChangeFontByLanguage[] componentsInChildren4 = value.GetComponentsInChildren<ChangeFontByLanguage>(true);
			foreach (ChangeFontByLanguage obj in componentsInChildren4)
			{
				ProcessFont(obj.fontJA);
				ProcessFont(obj.fontKO);
				ProcessFont(obj.fontRU);
				ProcessFont(obj.fontZH);
				ProcessFont(obj.defaultFont);
			}
			TextMeshPro[] componentsInChildren5 = value.GetComponentsInChildren<TextMeshPro>(true);
			for (int i = 0; i < componentsInChildren5.Length; i++)
			{
				ProcessFont(((TMP_Text)componentsInChildren5[i]).font);
			}
			componentsInChildren5 = value.GetComponentsInChildren<TextMeshPro>(true);
			for (int i = 0; i < componentsInChildren5.Length; i++)
			{
				Material[] materials2 = ((TMP_Text)componentsInChildren5[i]).fontSharedMaterials;
				foreach (Material item2 in materials2)
				{
					materials.Add(item2);
				}
			}
		}
		foreach (Material item3 in materials)
		{
			if ((Object)(object)item3 == (Object)null)
			{
				"Null Material".LogInfo();
				continue;
			}
			if (!material_shader_map.ContainsKey(((Object)item3).name))
			{
				KnightInSilksong.logger.LogError((object)("Cant Find The Material " + ((Object)item3).name + " In Map"));
				continue;
			}
			Shader shader = GetShader(material_shader_map[((Object)item3).name]);
			if ((Object)(object)shader == (Object)null)
			{
				switch (material_shader_map[((Object)item3).name])
				{
				case "tk2d/BlendVertexColor":
					shader = GetShader("tk2d/BlendVertexColor (addressable)");
					break;
				case "UI/BlendModes/Lighten":
					shader = GetShader("UI/BlendModes/Screen");
					break;
				case "UI/BlendModes/Multiply":
					shader = GetShader("UI/BlendModes/Screen");
					break;
				case "UI/BlendModes/VividLight":
					shader = GetShader("UI/BlendModes/Screen");
					break;
				}
				if ((Object)(object)shader == (Object)null)
				{
					KnightInSilksong.logger.LogError((object)("Cant Find The Shader " + material_shader_map[((Object)item3).name] + " For " + ((Object)item3).name));
				}
			}
			item3.shader = shader;
		}
		void ProcessFont(TMP_FontAsset font)
		{
			if ((Object)(object)font == (Object)null || met_fonts.Contains(font))
			{
				return;
			}
			materials.Add(((TMP_Asset)font).material);
			met_fonts.Add(font);
			foreach (TMP_FontAsset fallbackFontAsset in font.fallbackFontAssets)
			{
				ProcessFont(fallbackFontAsset);
			}
		}
	}

	private void SetErrorCollider2D()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos)
		{
			Collider2D[] componentsInChildren = loaded_go.Value.GetComponentsInChildren<Collider2D>(true);
			foreach (Collider2D obj in componentsInChildren)
			{
				obj.callbackLayers = LayerMask.op_Implicit(-1);
				obj.contactCaptureLayers = LayerMask.op_Implicit(-1);
				obj.forceReceiveLayers = LayerMask.op_Implicit(-1);
				obj.forceSendLayers = LayerMask.op_Implicit(-1);
			}
		}
	}

	private void SetAuidoVolume()
	{
		foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos)
		{
			AudioSource[] componentsInChildren = loaded_go.Value.GetComponentsInChildren<AudioSource>(true);
			foreach (AudioSource val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)val.outputAudioMixerGroup != (Object)null && (Object)(object)val.outputAudioMixerGroup.audioMixer != (Object)null)
				{
					share_mixer_group.Add(val.outputAudioMixerGroup.audioMixer);
				}
			}
		}
	}

	private void SetErrorFsm()
	{
		foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos)
		{
			PlayMakerFSM[] componentsInChildren = loaded_go.Value.GetComponentsInChildren<PlayMakerFSM>(true);
			foreach (PlayMakerFSM val in componentsInChildren)
			{
				val.eventHandlerComponentsAdded = false;
				if (val.UsesTemplate)
				{
					val.fsmTemplate.fsm.GetAddVariable<FsmBool>("FromKnight", (object)true);
					val.fsmTemplate.fsm.preprocessed = false;
				}
				else
				{
					val.GetAddVariable<FsmBool>("FromKnight", (object)true);
					val.fsm.preprocessed = false;
				}
			}
		}
	}

	public static void SetDeathInfo()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_0056: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: 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_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		HeroCorpseMarkerProxy instance = HeroCorpseMarkerProxy.Instance;
		HeroController instance2 = HeroController.instance;
		if (Object.op_Implicit((Object)(object)instance))
		{
			PlayerDataAccess.HeroCorpseScene = instance.TargetSceneName;
			PlayerDataAccess.HeroCorpseMarkerGuid = instance.TargetGuid;
			PlayerDataAccess.HeroDeathScenePos = instance.TargetScenePos;
		}
		else
		{
			Vector3 position = instance2.transform.position;
			PlayerDataAccess.HeroCorpseScene = instance2.gm.GetSceneNameString();
			HeroCorpseMarker closest = HeroCorpseMarker.GetClosest(Vector2.op_Implicit(position));
			if (Object.op_Implicit((Object)(object)closest))
			{
				PlayerDataAccess.HeroCorpseMarkerGuid = closest.Guid.ToByteArray();
				PlayerDataAccess.HeroDeathScenePos = closest.Position;
			}
			else
			{
				PlayerDataAccess.HeroCorpseMarkerGuid = null;
				PlayerDataAccess.HeroDeathScenePos = Vector2.op_Implicit(position);
			}
		}
		tk2dTileMap tilemap = instance2.gm.tilemap;
		PlayerDataAccess.HeroDeathSceneSize = new Vector2((float)tilemap.width, (float)tilemap.height);
		instance2.gm.gameMap.PositionCompassAndCorpse();
		PlayerDataAccess.IsSilkSpoolBroken = true;
		PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)0;
		int num = PlayerData.instance.geoPool;
		bool isEquipped = ((ToolBase)Gameplay.DeadPurseTool).IsEquipped;
		if (isEquipped)
		{
			int num2 = Mathf.RoundToInt((float)num * Gameplay.DeadPurseHoldPercent);
			num -= num2;
			PlayerDataAccess.geo = num2;
		}
		else
		{
			PlayerDataAccess.geo = 0;
		}
		PlayerDataAccess.HeroCorpseMoneyPool = Mathf.RoundToInt((float)num);
		if (instance2.playerData.IsAnyCursed)
		{
			PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)(PlayerDataAccess.HeroCorpseType | 2);
		}
		if (isEquipped && PlayerDataAccess.HeroCorpseMoneyPool >= 10)
		{
			PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)(PlayerDataAccess.HeroCorpseType | 1);
		}
		PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)(PlayerDataAccess.HeroCorpseType | 0x40000000);
		PlayerData instance3 = PlayerData.instance;
		instance3.shadeScene = PlayerDataAccess.HeroCorpseScene;
		instance3.shadePositionX = PlayerDataAccess.HeroDeathScenePos.x;
		instance3.shadePositionY = PlayerDataAccess.HeroDeathScenePos.y;
		instance3.geoPool = PlayerDataAccess.HeroCorpseMoneyPool;
	}
}
[RequireComponent(typeof(SpriteRenderer))]
internal class CheckKnight : MonoBehaviour
{
	private SpriteRenderer render;

	private void Awake()
	{
		render = ((Component)this).GetComponent<SpriteRenderer>();
	}

	private void Update()
	{
		if (KnightInSilksong.IsKnight)
		{
			if ((Object)(object)render != (Object)null)
			{
				((Renderer)render).enabled = true;
			}
		}
		else if ((Object)(object)render != (Object)null)
		{
			((Renderer)render).enabled = false;
		}
	}
}
public class DoAction : MonoBehaviour
{
	public Action<DoAction> action;

	public void DoActionNow()
	{
		action?.Invoke(this);
	}
}
public class DreamHelper : MonoBehaviour
{
	public class DreamInfo
	{
		public HealthManager hm;

		public float cd;
	}

	public List<DreamInfo> dream_cds = new List<DreamInfo>();

	public const float general_cd = 0.2f;

	public bool Exist(HealthManager hm)
	{
		if ((Object)(object)hm == (Object)null)
		{
			return true;
		}
		foreach (DreamInfo dream_cd in dream_cds)
		{
			if ((Object)(object)dream_cd.hm == (Object)(object)hm)
			{
				return true;
			}
		}
		return false;
	}

	public void Add(HealthManager hm)
	{
		if (!((Object)(object)hm == (Object)null))
		{
			dream_cds.Add(new DreamInfo
			{
				hm = hm,
				cd = 0.2f
			});
		}
	}

	public void Update()
	{
		for (int num = dream_cds.Count - 1; num >= 0; num--)
		{
			if ((Object)(object)dream_cds[num].hm == (Object)null)
			{
				dream_cds.RemoveAt(num);
			}
			else
			{
				dream_cds[num].cd -= Time.deltaTime;
				if (dream_cds[num].cd < 0f)
				{
					dream_cds.RemoveAt(num);
				}
			}
		}
	}
}
internal class KeepHornet : MonoBehaviour
{
	private Vector3 offset;

	private Vector2 boxSize;

	private Vector2 boxOffset;

	private Rigidbody2D hornet_rb;

	private Vector2 scale;

	internal static bool test;

	internal GameObject Hornet => ((Component)HeroController.instance).gameObject;

	private void Awake()
	{
		hornet_rb = Hornet.GetComponent<Rigidbody2D>();
	}

	private void Start()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.position = Hornet.transform.position;
	}

	private void OnEnable()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_006f: 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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.position = Hornet.transform.position;
		BoxCollider2D component = Hornet.GetComponent<BoxCollider2D>();
		offset = Vector2.op_Implicit(((Collider2D)component).offset);
		boxSize = component.size;
		scale = new Vector2(Math.Abs(Extensions.GetScaleX(Hornet.transform)), Math.Abs(Extensions.GetScaleY(Hornet.transform)));
		component.size = ((Component)this).GetComponent<BoxCollider2D>().size;
		((Collider2D)component).offset = ((Collider2D)((Component)this).GetComponent<BoxCollider2D>()).offset;
		Extensions.SetScale2D(Hornet.transform, Vector2.op_Implicit(((Component)this).transform.localScale));
		((Behaviour)Hornet.GetComponent<HeroWaterController>()).enabled = false;
		foreach (string item in new List<string>(5) { "Slash", "AltSlash", "DownSlash", "UpSlash", "WallSlash" })
		{
			((Component)this).gameObject.FindGameObjectInChildren("Attacks").FindGameObjectInChildren(item).FindGameObjectInChildren("Clash Tink")
				.tag = "Nail Attack";
		}
	}

	private void Update()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Hornet.transform.position = ((Component)this).transform.position;
		LookingStateSync();
	}

	private void LookingStateSync()
	{
		HeroControllerStates cState = HeroController.instance.cState;
		HeroControllerStates cState2 = HeroController.instance.cState;
		cState2.lookingUp = cState.lookingUp;
		cState2.lookingUpAnim = cState.lookingUpAnim;
		cState2.lookingDown = cState.lookingDown;
		cState2.lookingDownAnim = cState.lookingDownAnim;
	}

	private void FixedUpdate()
	{
		if (Mathf.Abs(hornet_rb.linearVelocityY) > 1f)
		{
			hornet_rb.linearVelocityY = 0f;
		}
		if (Mathf.Abs(hornet_rb.linearVelocityX) > 1f)
		{
			hornet_rb.linearVelocityX = 0f;
		}
	}

	private void OnDisable()
	{
		//IL_000d: 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_001d: 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)
		BoxCollider2D component = Hornet.GetComponent<BoxCollider2D>();
		((Collider2D)component).offset = Vector2.op_Implicit(offset);
		component.size = boxSize;
		((Behaviour)Hornet.GetComponent<HeroWaterController>()).enabled = true;
		Extensions.SetScale2D(Hornet.transform, new Vector2((float)((Extensions.GetScaleX(Hornet.transform) > 0f) ? 1 : (-1)) * scale.x, scale.y));
	}
}
internal class TrueCharmDisable : MonoBehaviour
{
	private void OnDisable()
	{
		if (((Component)this).gameObject.activeSelf)
		{
			Patch_InventoryItemSelectableDirectional_Awake.ToggleCharm();
		}
	}
}
public class GeneralPatch
{
}
public class StartPatch
{
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_BounceBallon_Bounce : GeneralPatch
{
	public static bool Prefix()
	{
		if (KnightInSilksong.IsKnight)
		{
			HeroController.instance.ShroomBounce();
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(BouncePod), "DoBounceOff")]
public class Patch_BouncePod_DoBounceOff : GeneralPatch
{
	private static bool Prefix()
	{
		if (KnightInSilksong.IsKnight)
		{
			HeroController.instance.ShroomBounce();
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_BuildEquippedCharms_BuildCharmList : GeneralPatch
{
	public static bool Prefix(BuildEquippedCharms __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			__instance.equippedCharms = PlayerData.instance.equippedCharms;
		}
		return true;
	}

	public static void Postfix(BuildEquippedCharms __instance)
	{
		if (KnightInSilksong.IsKnight && PlayerData.instance.charmSlotsFilled >= PlayerData.instance.charmSlots)
		{
			try
			{
				__instance.instanceList.Remove(__instance.nextDot);
			}
			catch
			{
			}
		}
	}
}
[HarmonyPatch(typeof(InventoryItemSelectableDirectional), "Awake")]
public class Patch_InventoryItemSelectableDirectional_Awake : GeneralPatch
{
	public static GameObject charmButton;

	private static DoAction button_action;

	public static void Postfix(InventoryItemSelectableDirectional __instance)
	{
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		if (!(((Object)((Component)__instance).gameObject).name == "Change Crest Button"))
		{
			return;
		}
		InventoryItemSelectableButtonEvent val = (InventoryItemSelectableButtonEvent)(object)((__instance is InventoryItemSelectableButtonEvent) ? __instance : null);
		if (val != null)
		{
			charmButton = Object.Instantiate<GameObject>(((Component)__instance).gameObject, ((Component)__instance).gameObject.transform.parent);
			Extensions.SetPosition2D(charmButton.transform, -7.8865f, -5.53f);
			((InventoryItemSelectableDirectional)val).Selectables[3] = (InventoryItemSelectable)(object)charmButton.GetComponent<InventoryItemSelectableDirectional>();
			charmButton.GetComponent<InventoryItemSelectableDirectional>().Selectables[2] = (InventoryItemSelectable)(object)__instance;
			Object.Destroy((Object)(object)charmButton.FindGameObjectInChildren("Change Crest Action"));
			GameObject gameObject = charmButton.FindGameObjectInChildren("Parent");
			GameObject val2 = gameObject.FindGameObjectInChildren("Button Icon Locked");
			GameObject obj = gameObject.FindGameObjectInChildren("Button Icon Regular");
			Object.Destroy((Object)(object)val2);
			((Object)obj).name = "Charm Icon";
			Extensions.SetScale2D(obj.transform, new Vector2(0.5f, 0.5f));
			obj.GetComponent<SpriteRenderer>().sprite = ModuleManager.GetInstance<PreProcess>().charm_icon;
			InventoryItemSelectableDirectional component = charmButton.GetComponent<InventoryItemSelectableDirectional>();
			InventoryItemSelectableButtonEvent val3 = (InventoryItemSelectableButtonEvent)(object)((component is InventoryItemSelectableButtonEvent) ? component : null);
			if (val3 != null)
			{
				button_action = charmButton.AddComponent<DoAction>();
				DoAction doAction = button_action;
				doAction.action = (Action<DoAction>)Delegate.Combine(doAction.action, new Action<DoAction>(ToggleCharm));
				val3.ButtonActivated = (Action)Delegate.Combine(val3.ButtonActivated, new Action(button_action.DoActionNow));
			}
			charmButton.SetActive(KnightInSilksong.IsKnight);
			KnightInSilksong instance = KnightInSilksong.Instance;
			instance.OnToggleKnight = (Action<bool>)Delegate.Combine(instance.OnToggleKnight, (Action<bool>)delegate(bool value)
			{
				charmButton.SetActive(value);
			});
		}
	}

	public static void ToggleCharm(DoAction doAction = null)
	{
		DoAction doAction2 = ((!((Object)(object)doAction == (Object)null)) ? doAction : button_action);
		GameObject gameObject = ((Component)doAction2).gameObject;
		InventoryItemToolManager component = ((Component)gameObject.transform.parent.parent).GetComponent<InventoryItemToolManager>();
		bool activeSelf = KnightInSilksong.Instance.charm_instance.activeSelf;
		component.FadeToolGroup(activeSelf);
		((Component)component).gameObject.FindGameObjectInChildren("Crest List").SetActive(activeSelf);
		((Component)gameObject.transform.parent).gameObject.SetActive(activeSelf);
		KnightInSilksong.Instance.charm_instance.SetActive(!activeSelf);
		if (!activeSelf)
		{
			PlayMakerFSM val = FSMUtility.LocateMyFSM(KnightInSilksong.Instance.charm_instance, "UI Charms");
			if (val.GetValidState("Inventory Closed").actions.Length == 0)
			{
				val.AddCustomAction("Inventory Closed", (Action)delegate
				{
					"Try Toggle Charm from Inventory Closed".LogInfo();
					ToggleCharm();
				});
				val.RemoveTransition("Left", "TO LEFT");
				val.RemoveTransition("Right", "TO RIGHT");
				val.InsertCustomAction("Left", delegate(PlayMakerFSM fsm)
				{
					if (fsm.GetVariable<FsmInt>("Collection Pos").value == 1)
					{
						fsm.SendEvent("FINISHED");
					}
				}, 1);
				val.InsertCustomAction("Right", delegate(PlayMakerFSM fsm)
				{
					if (fsm.GetVariable<FsmInt>("Collection Pos").value == 40)
					{
						fsm.SendEvent("FINISHED");
					}
				}, 1);
				KnightInSilksong.Instance.charm_instance.AddComponent<TrueCharmDisable>();
				((Component)KnightInSilksong.Instance.charm_instance.transform.Find("Equipped Charms/Next Dot/Sprite Next")).gameObject.SetActive(false);
			}
			val.FsmVariables.GetFsmInt("New Charm ID").value = 1;
		}
		FSMUtility.SendEventToGameObject(KnightInSilksong.Instance.charm_instance, "UP", true);
		FSMUtility.SendEventToGameObject(KnightInSilksong.Instance.charm_instance, "ACTIVATE", true);
		((Behaviour)((Component)component).GetComponent<InventoryPaneInput>()).enabled = false;
	}
}
[HarmonyPatch(typeof(CallMethodProper), "PreCache")]
internal class PatchCallMethodProper : GeneralPatch
{
	public static bool Prefix(CallMethodProper __instance)
	{
		return true;
	}

	public static void Postfix(CallMethodProper __instance)
	{
	}

	private static void Log(object msg)
	{
		KnightInSilksong.logger.LogInfo(msg);
	}

	private static void Orig_PreCache(CallMethodProper __instance)
	{
		GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.gameObject);
		if ((Object)(object)ownerDefaultTarget == (Object)null)
		{
			Log("ownerDefaultTarget is null ");
			return;
		}
		ref MonoBehaviour component = ref __instance.component;
		Component component2 = ownerDefaultTarget.GetComponent(__instance.behaviour.Value);
		component = (MonoBehaviour)(object)((component2 is MonoBehaviour) ? component2 : null);
		if ((Object)(object)__instance.component == (Object)null)
		{
			Log("component is null ");
			return;
		}
		__instance.cachedType = ((object)__instance.component).GetType();
		try
		{
			__instance.cachedMethodInfo = __instance.cachedType.GetMethod(__instance.methodName.Value);
		}
		catch (AmbiguousMatchException)
		{
			Type[] types = __instance.parameters.Select((FsmVar fsmVar) => fsmVar.RealType).ToArray();
			__instance.cachedMethodInfo = __instance.cachedType.GetMethod(__instance.methodName.Value, types);
		}
		if (__instance.cachedMethodInfo == null)
		{
			__instance.errorString = __instance.errorString + " CallMethodProper Method Name is invalid: " + __instance.behaviour.Value + "::" + __instance.methodName.Value + "\n";
		}
		else
		{
			__instance.cachedParameterInfo = __instance.cachedMethodInfo.GetParameters();
		}
	}
}
[HarmonyPatch(typeof(CallMethodProper), "DoMethodCall")]
internal class PatchDoMethodCall : GeneralPatch
{
	public static bool Prefix(CallMethodProper __instance)
	{
		try
		{
			Modified_DoMethodCall(__instance);
		}
		catch (Exception msg)
		{
			Log(((Object)((FsmStateAction)__instance).fsm.GameObject).name + " " + ((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " " + __instance.behaviour.value + __instance.methodName.value);
			Log(msg);
		}
		return false;
	}

	public static void Postfix(CallMethodProper __instance)
	{
	}

	private static void Log(object msg)
	{
		KnightInSilksong.logger.LogInfo(msg);
	}

	public static void WarpToDreamGate(GameManager gm)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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_0077: Expected O, but got Unknown
		gm.entryGateName = "dreamGate";
		gm.targetScene = PlayerData.instance.GetString("dreamGateScene");
		gm.entryDelay = 0f;
		gm.cameraCtrl.FreezeInPlace(false);
		gm.BeginSceneTransition(new SceneLoadInfo
		{
			AlwaysUnloadUnusedAssets = true,
			EntryGateName = "dreamGate",
			PreventCameraFadeOut = true,
			SceneName = PlayerData.instance.GetString("dreamGateScene"),
			Visualization = (SceneLoadVisualizations)2
		});
	}

	private static void Modified_DoMethodCall(CallMethodProper __instance)
	{
		//IL_074d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0753: Invalid comparison between Unknown and I4
		if (string.IsNullOrEmpty(__instance.behaviour.Value) || string.IsNullOrEmpty(__instance.methodName.Value))
		{
			((FsmStateAction)__instance).Finish();
			return;
		}
		if (__instance.behaviour.value == "CharmIconList" && __instance.methodName.value == "GetSprite")
		{
			if ((Object)(object)CharmIconList.Instance != (Object)null)
			{
				__instance.parameters[0].UpdateValue();
				__instance.storeResult.SetValue((object)CharmIconList.Instance.GetSprite(__instance.parameters[0].intValue));
			}
			((FsmStateAction)__instance).Finish();
			return;
		}
		if (KnightInSilksong.IsKnight)
		{
			FsmVar[] parameters = __instance.parameters;
			for (int i = 0; i < parameters.Length; i++)
			{
				parameters[i].UpdateValue();
			}
			if (__instance.behaviour.value == "HeroController")
			{
				if (__instance.methodName.value == "TakeQuickDamage")
				{
					bool isInvincible = PlayerData.instance.isInvincible;
					PlayerData.instance.isInvincible = false;
					__instance.parameters[0].UpdateValue();
					HeroController.instance.TakeDamage((GameObject)null, (CollisionSide)4, __instance.parameters[0].intValue, 4096);
					PlayerData.instance.isInvincible = isInvincible;
					((FsmStateAction)__instance).Finish();
					return;
				}
				if (__instance.methodName.value == "TakeQuickDamageSimple")
				{
					bool isInvincible2 = PlayerData.instance.isInvincible;
					PlayerData.instance.isInvincible = false;
					__instance.parameters[0].UpdateValue();
					HeroController.instance.TakeDamage((GameObject)null, (CollisionSide)4, __instance.parameters[0].intValue, 4096);
					PlayerData.instance.isInvincible = isInvincible2;
					((FsmStateAction)__instance).Finish();
					return;
				}
				if (__instance.methodName.value == "CancelDamageRecoilSimple")
				{
					__instance.methodName.value = "CancelDamageRecoil";
				}
				else
				{
					if (__instance.methodName.value == "WillDoBellBindHit")
					{
						__instance.storeResult.SetValue((object)false);
						((FsmStateAction)__instance).Finish();
						return;
					}
					if (__instance.methodName.value == "ActivateVoidAcid")
					{
						((FsmStateAction)__instance).Finish();
						return;
					}
					if (__instance.methodName.value == "CanTakeDamage")
					{
						bool flag = false;
						flag |= Traverse.Create((object)HeroController.instance).Method("CanTakeDamage", Array.Empty<object>()).GetValue<bool>();
						__instance.storeResult.SetValue((object)flag);
						((FsmStateAction)__instance).Finish();
						return;
					}
					if (__instance.methodName.value == "GetEntryGateName")
					{
						string entryGateName = GameManager.instance.GetEntryGateName();
						__instance.storeResult.SetValue((object)entryGateName);
						((FsmStateAction)__instance).Finish();
						return;
					}
					if (__instance.methodName.value == "AddSilk")
					{
						__instance.parameters[0].UpdateValue();
						__instance.parameters[1].UpdateValue();
						HeroController.instance.AddSilk(__instance.parameters[0].intValue, __instance.parameters[1].boolValue);
						((FsmStateAction)__instance).Finish();
						return;
					}
					if (__instance.methodName.value == "EnterUpdraft")
					{
						if (PlayerDataAccess.hasBrolly)
						{
							PlayerData.instance.SetBool("infiniteAirJump", true);
							HeroController.instance.airDashed = false;
							HeroController.instance.doubleJumped = false;
						}
					}
					else if (__instance.methodName.value == "ExitUpdraft")
					{
						if (PlayerDataAccess.hasBrolly)
						{
							PlayerData.instance.SetBool("infiniteAirJump", WithDebugMod.infinite_jump);
						}
					}
					else if (__instance.methodName.value == "StartAnimationControlToIdle")
					{
						HeroController.instance.StartAnimationControlToIdle();
					}
					else
					{
						if (__instance.methodName.value == "AddToMaxSilkRegen")
						{
							__instance.parameters[0].UpdateValue();
							HeroController.instance.AddToMaxSilkRegen(__instance.parameters[0].intValue);
							((FsmStateAction)__instance).Finish();
							return;
						}
						if (__instance.methodName.value == "CocoonBroken")
						{
							HeroController.instance.CocoonBroken();
							((FsmStateAction)__instance).Finish();
							return;
						}
						if (__instance.methodName.value == "AddGeo")
						{
							HeroController.instance.AddGeo(__instance.parameters[0].intValue);
							((FsmStateAction)__instance).Finish();
							return;
						}
						if (__instance.methodName.value == "AddGeoQuietly")
						{
							HeroController.instance.AddGeoQuietly(__instance.parameters[0].intValue);
							((FsmStateAction)__instance).Finish();
							return;
						}
						if (__instance.methodName.value == "AddGeoToCounter")
						{
							HeroController.instance.AddGeoToCounter(__instance.parameters[0].intValue);
							((FsmStateAction)__instance).Finish();
							return;
						}
					}
				}
			}
			if (__instance.behaviour.value == "GameManager" && __instance.methodName.value == "WarpToDreamGate")
			{
				WarpToDreamGate(GameManager.instance);
				((FsmStateAction)__instance).Finish();
				return;
			}
		}
		GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.gameObject);
		if ((Object)(object)ownerDefaultTarget == (Object)null)
		{
			return;
		}
		ref MonoBehaviour component = ref __instance.component;
		Component component2 = ownerDefaultTarget.GetComponent(__instance.behaviour.Value);
		component = (MonoBehaviour)(object)((component2 is MonoBehaviour) ? component2 : null);
		if ((Object)(object)__instance.component == (Object)null)
		{
			((FsmStateAction)__instance).LogWarning("CallMethodProper: " + ((Object)ownerDefaultTarget).name + " missing behaviour: " + __instance.behaviour.Value);
			return;
		}
		if (__instance.cachedMethodInfo == null || !__instance.cachedMethodInfo.Name.Equals(__instance.methodName.Value))
		{
			__instance.errorString = string.Empty;
			if (!__instance.DoCache())
			{
				Debug.LogError((object)__instance.errorString, (Object)(object)((FsmStateAction)__instance).Owner);
				((FsmStateAction)__instance).Finish();
				return;
			}
		}
		object value = null;
		if (__instance.cachedParameterInfo.Length == 0)
		{
			try
			{
				value = __instance.cachedMethodInfo.Invoke(__instance.component, null);
			}
			catch (TargetException)
			{
				value = __instance.cachedMethodInfo.Invoke(((Component)(object)__instance.component).GetAnotherComponent(), null);
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)("CallMethodProper error on " + ((FsmStateAction)__instance).Fsm.OwnerName + " -> " + ex2), (Object)(object)((FsmStateAction)__instance).Owner);
			}
		}
		else
		{
			for (int j = 0; j < __instance.parameters.Length; j++)
			{
				FsmVar val = __instance.parameters[j];
				val.UpdateValue();
				__instance.parametersArray[j] = val.GetValue();
			}
			try
			{
				value = __instance.cachedMethodInfo.Invoke(__instance.component, __instance.parametersArray);
			}
			catch (TargetParameterCountException)
			{
				ParameterInfo[] parameters2 = __instance.cachedMethodInfo.GetParameters();
				Debug.LogErrorFormat((Object)(object)((FsmStateAction)__instance).Owner, "Count did not match. Required: {0}, Was: {1}, Method: {2}", new object[3]
				{
					parameters2.Length,
					__instance.parametersArray.Length,
					__instance.cachedMethodInfo.Name
				});
			}
			catch (TargetException)
			{
				value = __instance.cachedMethodInfo.Invoke(((Component)(object)__instance.component).GetAnotherComponent(), __instance.parametersArray);
			}
			catch (Exception ex5)
			{
				Debug.LogError((object)("CallMethodProper error on " + ((FsmStateAction)__instance).Fsm.OwnerName + " -> " + ex5), (Object)(object)((FsmStateAction)__instance).Owner);
			}
		}
		if ((int)__instance.storeResult.Type != -1)
		{
			__instance.storeResult.SetValue(value);
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_CameraLockArea_IsInApplicableGameState : GeneralPatch
{
	public static bool Prefix(ref bool __result)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Invalid comparison between Unknown and I4
		if (KnightInSilksong.IsKnight && (Object)(object)GameManager.UnsafeInstance != (Object)null && (int)GameManager.UnsafeInstance.GameState == 6)
		{
			__result = true;
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_CharmDisplay_Start : GeneralPatch
{
	public static void Postfix(CharmDisplay __instance)
	{
		if (!KnightInSilksong.IsKnight)
		{
			return;
		}
		Sprite val = null;
		PlayerData instance = PlayerData.instance;
		switch (__instance.id)
		{
		case 23:
			if (instance.brokenCharm_23)
			{
				val = __instance.brokenGlassHP;
			}
			break;
		case 24:
			if (instance.brokenCharm_24)
			{
				val = __instance.brokenGlassGeo;
			}
			break;
		case 25:
			if (instance.brokenCharm_25)
			{
				val = __instance.brokenGlassAttack;
			}
			break;
		case 36:
			val = ((instance.royalCharmState <= 3) ? __instance.whiteCharm : __instance.blackCharm);
			break;
		}
		if ((Object)(object)val != (Object)null)
		{
			if (Object.op_Implicit((Object)(object)__instance.spriteRenderer))
			{
				__instance.spriteRenderer.sprite = val;
			}
			if (Object.op_Implicit((Object)(object)__instance.flashSpriteRenderer))
			{
				__instance.flashSpriteRenderer.sprite = val;
			}
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_CharmIconList_GetSprite : GeneralPatch
{
	public static bool Prefix(CharmIconList __instance, int id, ref Sprite __result)
	{
		if (KnightInSilksong.IsKnight)
		{
			PlayerData instance = PlayerData.instance;
			switch (id)
			{
			case 23:
				if (instance.fragileHealth_unbreakable)
				{
					__result = __instance.unbreakableHeart;
					return false;
				}
				break;
			case 24:
				if (instance.fragileGreed_unbreakable)
				{
					__result = __instance.unbreakableGreed;
					return false;
				}
				break;
			case 25:
				if (instance.fragileStrength_unbreakable)
				{
					__result = __instance.unbreakableStrength;
					return false;
				}
				break;
			case 40:
				switch (instance.grimmChildLevel)
				{
				case 1:
					__result = __instance.grimmchildLevel1;
					return false;
				case 2:
					__result = __instance.grimmchildLevel2;
					return false;
				case 3:
					__result = __instance.grimmchildLevel3;
					return false;
				case 4:
					__result = __instance.grimmchildLevel4;
					return false;
				case 5:
					__result = __instance.nymmCharm;
					return false;
				}
				break;
			}
		}
		return true;
	}
}
[HarmonyPatch(typeof(CheckHeroPerformanceRegion), "SendEvents")]
public class Patch_CheckHeroPerformanceRegion_SendEvents : GeneralPatch
{
	public static bool Prefix(AffectedState affectedState)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Invalid comparison between Unknown and I4
		if (!KnightInSilksong.IsKnight)
		{
			return true;
		}
		if ((int)affectedState == 2)
		{
			HeroPerformanceRegion.IsPerforming = false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(CheckHeroPerformanceRegionBase), "DoAction")]
public class Patch_CheckHeroPerformanceRegionBase_DoAction : GeneralPatch
{
	public static void Postfix(CheckHeroPerformanceRegionBase __instance)
	{
		if (KnightInSilksong.IsKnight && FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Dream Nail").ActiveStateName == "Slash")
		{
			HeroPerformanceRegion.IsPerforming = true;
			__instance.delay = 0.001f;
		}
	}
}
[HarmonyPatch(typeof(CheckHeroPerformanceRegionV2), "SendEvents")]
public class Patch_CheckHeroPerformanceRegionV2_SendEvents : GeneralPatch
{
	public static bool Prefix(AffectedState affectedState)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Invalid comparison between Unknown and I4
		if (!KnightInSilksong.IsKnight)
		{
			return true;
		}
		if ((int)affectedState == 2)
		{
			HeroPerformanceRegion.IsPerforming = false;
		}
		return true;
	}
}
[HarmonyPatch]
public class PatchCogMultiHitter : GeneralPatch
{
	private static DefaultDict<CogMultiHitter, HeroController> cog_hc_dict = new DefaultDict<CogMultiHitter, HeroController>(() => (HeroController)null);

	public static HeroController damagingKnight;

	[HarmonyPrefix]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static bool CogMultiHitter_OnTriggerEnter2D_Prefix(CogMultiHitter __instance, Collider2D other)
	{
		if (KnightInSilksong.IsKnight)
		{
			OnTriggerEnter2DForKnight(__instance, other);
			return false;
		}
		return true;
	}

	[HarmonyPrefix]
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static bool CogMultiHitter_CancelDelay_Prefix(CogMultiHitter __instance)
	{
		if (KnightInSilksong.IsKnight && Object.op_Implicit((Object)(object)cog_hc_dict[__instance]))
		{
			cog_hc_dict[__instance].OnHazardRespawn -= __instance.OnHeroHazardRespawn;
		}
		return true;
	}

	public static void OnTriggerEnter2DForKnight(CogMultiHitter __instance, Collider2D other)
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: 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)
		if (Time.timeAsDouble < __instance.canDamageTime || ((Component)other).gameObject.layer != 20)
		{
			return;
		}
		HeroController componentInParent = ((Component)other).GetComponentInParent<HeroController>();
		if (!componentInParent.isHeroInPosition || componentInParent.playerData.isInvincible)
		{
			return;
		}
		__instance.CancelDelay();
		cog_hc_dict[__instance] = componentInParent;
		componentInParent.OnHazardRespawn += __instance.OnHeroHazardRespawn;
		Vector3 position = ((Component)componentInParent).transform.position;
		float angleToTarget;
		if (__instance.useSelfForAngle)
		{
			angleToTarget = __instance.GetAngleToTarget(Vector2.op_Implicit(position), Vector2.op_Implicit(((Component)__instance).transform.position));
		}
		else
		{
			GameObject[] array = GameObject.FindGameObjectsWithTag("Cog Grind Marker");
			Transform val = null;
			float num = float.PositiveInfinity;
			GameObject[] array2 = array;
			foreach (GameObject val2 in array2)
			{
				if (!((Object)(object)val2 == (Object)(object)((Component)__instance).gameObject))
				{
					Transform transform = val2.transform;
					Vector3 val3 = position - transform.position;
					float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
					if (!(sqrMagnitude > num))
					{
						num = sqrMagnitude;
						val = transform;
					}
				}
			}
			angleToTarget = __instance.GetAngleToTarget(Vector2.op_Implicit(position), Vector2.op_Implicit(Object.op_Implicit((Object)(object)val) ? val.position : ((Component)__instance).transform.position));
		}
		EventRegister.SendEvent(EventRegisterEvents.CogDamage, ((Component)__instance).gameObject);
		ObjectPoolExtensions.Spawn(__instance.hitEffectPrefab, position);
		EventRegister.SendEvent(EventRegisterEvents.HeroDamaged, (GameObject)null);
		StaticVariableList.SetValue("Wound Sender Override", (object)((Component)__instance).gameObject, 0);
		FSMUtility.SendEventToGameObject(((Component)componentInParent).gameObject, "WOUND START", false);
		componentInParent.CancelAttack();
		componentInParent.CancelBounce();
		__instance.multiHitRumble.DoShake((Object)(object)__instance, false);
		if (Object.op_Implicit((Object)(object)__instance.jitter))
		{
			__instance.jitter.StartJitter();
		}
		if (Object.op_Implicit((Object)(object)__instance.cogAnimator))
		{
			__instance.cogAnimator.FreezePosition = true;
		}
		Extensions.SetPosition2D(__instance.heroGrindEffect, Vector2.op_Implicit(position));
		Extensions.SetRotation2D(__instance.heroGrindEffect, angleToTarget);
		((Component)__instance.heroGrindEffect).gameObject.SetActive(true);
		((AudioEvent)(ref __instance.heroDamageAudio)).SpawnAndPlayOneShot(position, (Action)null);
		__instance.delayRoutine = ((MonoBehaviour)__instance).StartCoroutine(DelayEndForKnight(__instance, componentInParent));
	}

	public static IEnumerator DelayEndForKnight(CogMultiHitter __instance, HeroController hc)
	{
		yield return (object)new WaitForSeconds(0.35f);
		__instance.multiHitRumble.CancelShake();
		if (Object.op_Implicit((Object)(object)__instance.jitter))
		{
			__instance.jitter.StopJitter();
		}
		DamageKnightDirectly(__instance, hc);
		yield return (object)new WaitForSeconds(0.2f);
		((Component)__instance.heroGrindEffect).gameObject.SetActive(false);
	}

	public static void DamageKnightDirectly(CogMultiHitter __instance, HeroController hc)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		hc.playerData.isInvincible = false;
		hc.cState.focusing = false;
		hc.TakeDamage(((Component)__instance).gameObject, (CollisionSide)((!(((Component)__instance).transform.position.x > ((Component)hc).transform.position.x)) ? 1 : 2), 1, 2);
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_ConveyorZone_OnTriggerEnter2D : GeneralPatch
{
	public static bool Prefix(ConveyorZone __instance, Collider2D collision)
	{
		if (KnightInSilksong.IsKnight)
		{
			if (!__instance.activated)
			{
				return true;
			}
			__instance.hasEntered = true;
			__instance.conveyorMovement = ((Component)collision).GetComponent<ConveyorMovement>();
			if (Object.op_Implicit((Object)(object)__instance.conveyorMovement))
			{
				__instance.conveyorMovement.StartConveyorMove(__instance.speed, 0f);
			}
			HeroController component = ((Component)collision).GetComponent<HeroController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (__instance.vertical)
				{
					((Component)component).GetComponent<ConveyorMovementHero>().StartConveyorMove(0f, __instance.speed);
					component.cState.onConveyorV = true;
				}
				else
				{
					component.SetConveyorSpeed(__instance.speed);
					component.cState.inConveyorZone = true;
				}
			}
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_ConveyorZone_OnTriggerExit2D : GeneralPatch
{
	public static bool Prefix(ConveyorZone __instance, Collider2D collision)
	{
		if (KnightInSilksong.IsKnight)
		{
			if (__instance.activated)
			{
				__instance.hasEntered = false;
				ConveyorMovement component = ((Component)collision).GetComponent<ConveyorMovement>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.StopConveyorMove();
				}
				HeroController component2 = ((Component)collision).GetComponent<HeroController>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					((Component)component2).GetComponent<ConveyorMovementHero>().StopConveyorMove();
					component2.cState.inConveyorZone = false;
					component2.cState.onConveyorV = false;
				}
			}
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_ConveyorZone_OnDisable : GeneralPatch
{
	public static bool Prefix(ConveyorZone __instance)
	{
		if (KnightInSilksong.IsKnight && __instance.hasEntered)
		{
			if (Object.op_Implicit((Object)(object)__instance.conveyorMovement))
			{
				__instance.conveyorMovement.StopConveyorMove();
			}
			HeroController instance = HeroController.instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				((Component)instance).GetComponent<ConveyorMovementHero>().StopConveyorMove();
				instance.cState.inConveyorZone = false;
				instance.cState.onConveyorV = false;
			}
			__instance.hasEntered = false;
			__instance.conveyorMovement = null;
			__instance.hc = null;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_CustomSceneManager_Start : GeneralPatch
{
	public static bool Prefix(CustomSceneManager __instance)
	{
		//IL_0000: 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)
		if ((PlayerDataAccess.HeroCorpseType & 0x40000000) != 0)
		{
			__instance.heroCorpsePrefab = KnightInSilksong.loaded_gos["Hollow Shade"];
		}
		return true;
	}

	public static void Postfix(CustomSceneManager __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_DamageEffectTicker_DoFlashOnEnemy : GeneralPatch
{
	public static void Postfix(DamageEffectTicker __instance, GameObject enemy)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		if (!KnightInSilksong.IsKnight || (int)__instance.enemySpriteFlash != 0)
		{
			return;
		}
		string name = ((Object)__instance).name;
		SpriteFlash component = enemy.GetComponent<SpriteFlash>();
		if ((Object)(object)component != (Object)null)
		{
			if (name.Contains("Spore"))
			{
				component.flashSporeQuick();
			}
			else if (name.Contains("Dung"))
			{
				component.flashDungQuick();
			}
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_DamageHero_TryClashTinkCollider : GeneralPatch
{
	public static bool Prefix(DamageHero __instance, Collider2D collision)
	{
		//IL_001d: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
		if (KnightInSilksong.IsKnight)
		{
			string tag = ((Component)collision).gameObject.tag;
			Transform transform = ((Component)collision).transform;
			Vector3 position = transform.position;
			if (!Object.op_Implicit((Object)(object)transform.parent))
			{
				return true;
			}
			if (tag == "Nail Attack")
			{
				if (!__instance.canClashTink || __instance.nailClashRoutine != null || __instance.preventClashTink || ((Component)collision).gameObject.layer != 16)
				{
					("Cant Clash " + ((Object)((Component)collision).gameObject).name + " " + ((Object)__instance).name).LogInfo();
					(!__instance.canClashTink + " " + (__instance.nailClashRoutine != null) + " " + __instance.preventClashTink).LogInfo();
					return false;
				}
				("Clash yes" + ((Object)((Component)collision).gameObject).name + " " + ((Object)__instance).name).LogInfo();
				HeroController instance = HeroController.instance;
				if (tag == "Nail Attack" && !__instance.noClashFreeze && instance.parryInvulnTimer < Mathf.Epsilon)
				{
					("try freeze " + ((Object)((Component)collision).gameObject).name).LogInfo();
					GameManager.instance.FreezeMoment((FreezeMomentTypes)3, (Action)null);
				}
				float num = 0f;
				PlayMakerFSM val = FSMUtility.LocateMyFSM(((Component)((Component)collision).gameObject.transform.parent).gameObject, "damages_enemy");
				if ((Object)(object)val != (Object)null)
				{
					num = val.GetVariable<FsmFloat>("direction").Value;
				}
				__instance.nailClashRoutine = ((MonoBehaviour)__instance).StartCoroutine(__instance.NailClash(num, tag, position));
				return false;
			}
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_DamageHero_OnDamaged : GeneralPatch
{
	public static bool Prefix(DamageHero __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_DamageHeroDirectly_OnEnter : GeneralPatch
{
	public static bool Prefix(DamageHeroDirectly __instance)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Expected I4, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected I4, but got Unknown
		if (KnightInSilksong.IsKnight)
		{
			GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.damager);
			if ((Object)(object)ownerDefaultTarget == (Object)null)
			{
				((FsmStateAction)__instance).Finish();
				return false;
			}
			PlayerData.instance.isInvincible = false;
			HazardType val = (HazardType)1;
			if (__instance.spikeHazard)
			{
				val = (HazardType)2;
			}
			else if (__instance.sinkHazard)
			{
				val = (HazardType)9;
			}
			if (ownerDefaultTarget.transform.position.x > ((Component)HeroController.instance).gameObject.transform.position.x)
			{
				HeroController.instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, (int)val);
			}
			else
			{
				HeroController.instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, (int)val);
			}
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_DamageHeroDirectlyV2_OnEnter : GeneralPatch
{
	public static bool Prefix(DamageHeroDirectlyV2 __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			ModifiedOnEnter(__instance);
			return false;
		}
		return true;
	}

	public static void ModifiedOnEnter(DamageHeroDirectlyV2 __instance)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Invalid comparison between Unknown and I4
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.damager);
		if ((Object)(object)ownerDefaultTarget == (Object)null)
		{
			return;
		}
		HeroController instance = HeroController.instance;
		PlayerDataAccess.isInvincible = false;
		_ = (HazardType)(object)__instance.hazardType.Value;
		if (((NamedVariable)__instance.overrideDirection).IsNone)
		{
			DamageDirection val = (DamageDirection)(object)__instance.damageDirection.Value;
			if ((int)val != 0)
			{
				if ((int)val == 1)
				{
					if (__instance.invertDirection.Value)
					{
						if (instance.transform.localScale.x > 0f)
						{
							instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
						}
						else
						{
							instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
						}
					}
					else if (instance.transform.localScale.x < 0f)
					{
						instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
					}
					else
					{
						instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
					}
				}
			}
			else if (__instance.invertDirection.Value)
			{
				if (ownerDefaultTarget.transform.position.x < ((Component)instance).gameObject.transform.position.x)
				{
					instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
				}
				else
				{
					instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
				}
			}
			else if (ownerDefaultTarget.transform.position.x > ((Component)instance).gameObject.transform.position.x)
			{
				instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
			}
			else
			{
				instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
			}
		}
		else
		{
			instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)(object)__instance.overrideDirection.Value, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt());
		}
		((FsmStateAction)__instance).Finish();
	}
}
[HarmonyPatch(typeof(Extensions), "SetPosition2D", new Type[]
{
	typeof(Transform),
	typeof(float),
	typeof(float)
})]
public class Patch_Extensions_SetPosition2D : GeneralPatch
{
	public static bool Prefix(Transform t, float x, float y)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		if (KnightInSilksong.IsKnight && (Object)(object)t == (Object)(object)HeroController.instance.transform)
		{
			Transform transform = HeroController.instance.transform;
			transform.position = new Vector3(x, y, transform.position.z);
		}
		return true;
	}
}
[HarmonyPatch(typeof(Extensions), "SetPosition2D", new Type[]
{
	typeof(Transform),
	typeof(Vector2)
})]
public class Patch_Extensions_SetPosition2D2 : GeneralPatch
{
	public static bool Prefix(Transform t, ref Vector2 position)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		if (KnightInSilksong.IsKnight && (Object)(object)t == (Object)(object)HeroController.instance.transform)
		{
			Transform transform = HeroController.instance.transform;
			transform.position = new Vector3(position.x, position.y, transform.position.z);
		}
		return true;
	}
}
[HarmonyPatch(typeof(FSMUtility), "SendEventToGameObject", new Type[]
{
	typeof(GameObject),
	typeof(FsmEvent),
	typeof(bool)
})]
public class Patch_FSMUtility_SendEventToGameObject : GeneralPatch
{
	public static bool Prefix(GameObject go, FsmEvent ev, bool isRecursive = false)
	{
		if (KnightInSilksong.IsKnight && (Object)(object)HeroController.instance != (Object)null && (Object)(object)go == (Object)(object)((Component)HeroController.instance).gameObject)
		{
			FSMUtility.SendEventToGameObject(((Component)HeroController.instance).gameObject, ev, isRecursive);
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GameCameras_HUDOut : GeneralPatch
{
	public static void Postfix(GameCameras __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			FSMUtility.SendEventToGameObject(KnightInSilksong.Instance.hud_instance, "OUT", false);
			"Hud OUT".LogInfo();
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GameCameras_HUDIn : GeneralPatch
{
	public static void Postfix(GameCameras __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			FSMUtility.SendEventToGameObject(KnightInSilksong.Instance.hud_instance, "IN", false);
			"Hud IN".LogInfo();
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GameManager_PositionHeroAtSceneEntrance : GeneralPatch
{
	public static void Postfix(GameManager __instance)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if (KnightInSilksong.IsKnight)
		{
			HeroController.instance.transform.position = HeroController.instance.transform.position;
		}
	}
}
[HarmonyPatch(typeof(GameManager), "SetIsInventoryOpen", new Type[] { typeof(bool) })]
public class Patch_GameManager_SetIsInventoryOpen : GeneralPatch
{
	public static void Postfix(GameManager __instance, bool value)
	{
		if (KnightInSilksong.IsKnight)
		{
			if (value)
			{
				__instance.SetTimeScale(1f);
				HeroController.instance.RelinquishControl();
			}
			else
			{
				HeroController.instance.RegainControl();
			}
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GameManager_ReturnToMainMenu : GeneralPatch
{
	public static bool Prefix(GameManager __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			KnightInSilksong.Instance.ToggleKnight();
			KnightInSilksong.return_to_main_menu = true;
			"return to Main Menu".LogInfo();
		}
		KISHelper.OnReturnToMenu?.Invoke();
		return true;
	}
}
[HarmonyPatch(typeof(GameManager), "StartNewGame", new Type[]
{
	typeof(bool),
	typeof(bool)
})]
public class Patch_GameManager_StartNewGame : GeneralPatch
{
	public static bool Prefix(GameManager __instance, bool permadeathMode, bool bossRushMode)
	{
		int profileID = __instance.profileID;
		if (profileID == 0)
		{
			return true;
		}
		KnightInSilksong.Instance.current_data = SlotData.CreateSave(profileID, KnightInSilksong.default_sync.Value);
		KnightInSilksong.Instance.current_data.LoadSave();
		return true;
	}

	public static void Postfix(GameManager __instance, bool permadeathMode, bool bossRushMode)
	{
	}
}
[HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[]
{
	typeof(SaveGameData),
	typeof(int)
})]
public class Patch_GameManager_SetLoadedGameData : GeneralPatch
{
	public static bool Prefix(GameManager __instance, SaveGameData saveGameData, int saveSlot)
	{
		if (saveSlot == 0)
		{
			return true;
		}
		KnightInSilksong.Instance.current_data = new SlotData(saveSlot);
		KnightInSilksong.Instance.current_data.LoadSave();
		return true;
	}

	public static void Postfix(GameManager __instance, SaveGameData saveGameData, int saveSlot)
	{
	}
}
[HarmonyPatch(typeof(GameManager), "SaveGame", new Type[]
{
	typeof(int),
	typeof(Action<bool>),
	typeof(bool),
	typeof(AutoSaveName)
})]
public class Patch_GameManager_SaveGame : GeneralPatch
{
	public static bool Prefix(GameManager __instance, int saveSlot, ref Action<bool> ogCallback, bool withAutoSave, AutoSaveName autoSaveName)
	{
		if (saveSlot == 0)
		{
			return true;
		}
		Action<bool> ogCallbackCopy = ogCallback;
		ogCallback = delegate(bool didSave)
		{
			ogCallbackCopy?.Invoke(didSave);
			if (didSave)
			{
				KnightInSilksong.Instance.current_data.SaveSave();
			}
		};
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GameManager_ClearSaveFile : GeneralPatch
{
	public static bool Prefix(GameManager __instance, int saveSlot, Action<bool> callback)
	{
		return true;
	}

	public static void Postfix(GameManager __instance, int saveSlot, Action<bool> callback)
	{
		SlotData.DeleteSave(saveSlot);
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GameSettings_LoadAudioSettings : GeneralPatch
{
	public static void Postfix(GameSettings __instance)
	{
		AudioMixer master = KnightInSilksong.Master;
		float masterVolume = __instance.masterVolume;
		float soundVolume = __instance.soundVolume;
		float num = Helper.LinearToDecibel(masterVolume / 10f);
		master.SetFloat("MasterVolume", num);
		num = Helper.LinearToDecibel(soundVolume / 10f);
		master.SetFloat("SFXVolume", num);
		"LoadAudioSettings OK".LogInfo();
	}
}
[HarmonyPatch(typeof(GameObject), "GetComponentByName")]
internal class PatchGetComponent : GeneralPatch
{
	public static bool Prefix(GameObject __instance, ref Component __result, ref string type)
	{
		switch (type)
		{
		case "HeroController":
			__result = __instance.GetAnyComponent<HeroController, HeroController>();
			return false;
		case "HeroAudioController":
			__result = __instance.GetAnyComponent<HeroAudioController, HeroAudioController>();
			return false;
		case "HeroAnimationController":
			__result = __instance.GetAnyComponent<HeroAnimationController, HeroAnimationController>();
			return false;
		case "HeroBox":
			__result = __instance.GetAnyComponent<HeroBox, HeroBox>();
			return false;
		case "NailSlash":
			__result = __instance.GetAnyComponent<NailSlash, NailSlash>();
			return false;
		default:
			return true;
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetHero_OnEnter : GeneralPatch
{
	public static HashSet<(string, string)> blacklist = new HashSet<(string, string)> { ("RestBench", "Bench Control") };

	public static bool Prefix(GetHero __instance)
	{
		return true;
	}

	public static void Postfix(GetHero __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetHeroCState_DoAction : GeneralPatch
{
	public static bool Prefix(GetHeroCState __instance)
	{
		if (KnightInSilksong.IsKnight && !((NamedVariable)__instance.VariableName).IsNone && !((NamedVariable)__instance.StoreValue).IsNone && __instance.VariableName.Value == "parrying")
		{
			bool flag = false;
			HeroController instance = HeroController.instance;
			flag = instance.playerData.equippedCharm_5 && instance.playerData.blockerHits > 0 && instance.cState.focusing;
			__instance.StoreValue.Value = flag;
			return false;
		}
		return true;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetNailDamage_OnEnter : GeneralPatch
{
	public static bool Prefix(GetNailDamage __instance)
	{
		if (KnightInSilksong.IsKnight)
		{
			KnightOnEnter(__instance);
			return false;
		}
		return true;
	}

	public static void KnightOnEnter(GetNailDamage __instance)
	{
		if (!((NamedVariable)__instance.storeValue).IsNone)
		{
			if (BossSequenceController.BoundNail)
			{
				__instance.storeValue.Value = Mathf.Min(PlayerData.instance.nailDamage, BossSequenceController.BoundNailDamage);
			}
			else
			{
				__instance.storeValue.Value = PlayerData.instance.nailDamage;
			}
		}
		((FsmStateAction)__instance).Finish();
	}
}
public static class KnightGetHornetPD
{
	private static HashSet<string> knight_get_hornet_pd_list = new HashSet<string> { "geo" };

	public static bool IsFromHornet(string name)
	{
		return knight_get_hornet_pd_list.Contains(name);
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetPlayerDataBool_OnEnter : GeneralPatch
{
	public static bool Prefix(GetPlayerDataBool __instance)
	{
		if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.boolName.Value))
		{
			if (__instance.boolName.value == "EncounteredLostLace")
			{
				(((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " GetPlayerDataBool").LogInfo();
			}
			__instance.storeValue.Value = PlayerData.instance.GetBool(__instance.boolName.Value);
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}

	public static void Postfix(GetPlayerDataBool __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetPlayerDataFloat_OnEnter : GeneralPatch
{
	public static bool Prefix(GetPlayerDataFloat __instance)
	{
		if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.floatName.Value))
		{
			__instance.storeValue.Value = PlayerData.instance.GetFloat(__instance.floatName.Value);
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}

	public static void Postfix(GetPlayerDataFloat __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetPlayerDataInt_OnEnter : GeneralPatch
{
	public static bool Prefix(GetPlayerDataInt __instance)
	{
		if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.intName.Value))
		{
			__instance.storeValue.Value = PlayerData.instance.GetInt(__instance.intName.Value);
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}

	public static void Postfix(GetPlayerDataInt __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetPlayerDataString_OnEnter : GeneralPatch
{
	public static bool Prefix(GetPlayerDataString __instance)
	{
		if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null && KnightGetHornetPD.IsFromHornet(__instance.stringName.Value))
		{
			__instance.storeValue.Value = PlayerData.instance.GetString(__instance.stringName.Value);
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}

	public static void Postfix(GetPlayerDataString __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_GetPlayerDataVector3_OnEnter : GeneralPatch
{
	public static bool Prefix(GetPlayerDataVector3 __instance)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.vector3Name.Value))
		{
			__instance.storeValue.Value = PlayerData.instance.GetVector3(__instance.vector3Name.Value);
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}

	public static void Postfix(GetPlayerDataVector3 __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_PlayerDataBoolTest_OnEnter : GeneralPatch
{
	private static List<string> in_knight_bool = new List<string> { "isInvincible" };

	public static bool Prefix(PlayerDataBoolTest __instance)
	{
		if (KnightInSilksong.IsKnight && (((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null || Extensions.IsAny(__instance.boolName.Value, in_knight_bool.ToArray())))
		{
			bool flag = PlayerData.instance.GetBool(__instance.boolName.Value);
			((FsmStateAction)__instance).fsm.Event(flag ? __instance.isTrue : __instance.isFalse);
			((FsmStateAction)__instance).Finish();
			return false;
		}
		return true;
	}

	public static void Postfix(PlayerDataBoolTest __instance)
	{
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Patch_PlayerDataBoolAllTrue_DoAllTrue : GeneralPatch
{
	public static bool Prefix(PlayerDataBoolAllTrue __instance)
	{
		if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null)
		{
			bool flag = true;
			for (int i = 0; i < __instance.stringVariables.Length; i++)
			{
				if (!PlayerData.instance.GetBool(__instance.stringVariables[i].Value))
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				((FsmStateAction)__instance).Fsm.Event(__instance.trueEvent);
			}
			else
			{
				((FsmStateAction)__instance).Fsm.Event(__instance.falseEvent);
			}
			__instance.storeResult.Va

Knight.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using GlobalEnums;
using HutongGames.PlayMaker;
using InControl;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("Knight")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+47fc3ec7399a3c8aa2c3b10f258cb5c745bafce8")]
[assembly: AssemblyProduct("Knight")]
[assembly: AssemblyTitle("Knight")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 Knight
{
	public class HeroAnimationController : MonoBehaviour
	{
		public tk2dSpriteAnimator animator;

		private HeroController heroCtrl;

		private HeroControllerStates cState;

		private PlayerData pd;

		[HideInInspector]
		public bool playLanding;

		private bool playRunToIdle;

		private bool playDashToIdle;

		private bool playBackDashToIdleEnd;

		public bool wasAttacking;

		private bool wasFacingRight;

		[HideInInspector]
		public bool setEntryAnim;

		private bool changedClipFromLastFrame;

		private bool attackComplete;

		public ActorStates actorState { get; private set; }

		public ActorStates prevActorState { get; private set; }

		public ActorStates stateBeforeControl { get; private set; }

		public bool controlEnabled { get; private set; }

		private void Awake()
		{
			animator = ((Component)this).GetComponent<tk2dSpriteAnimator>();
			heroCtrl = ((Component)this).GetComponent<HeroController>();
			cState = heroCtrl.cState;
		}

		private void Start()
		{
			//IL_0018: 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_0036: Invalid comparison between Unknown and I4
			pd = PlayerData.instance;
			ResetAll();
			actorState = heroCtrl.hero_state;
			if (controlEnabled)
			{
				if ((int)heroCtrl.hero_state == 3)
				{
					PlayFromFrame("Airborne", 7);
				}
				else
				{
					PlayIdle();
				}
			}
			else
			{
				animator.Stop();
			}
		}

		private void Update()
		{
			if (controlEnabled)
			{
				UpdateAnimation();
			}
			else if (cState.facingRight)
			{
				wasFacingRight = true;
			}
			else
			{
				wasFacingRight = false;
			}
			if (pd.betaEnd)
			{
				animator.Play("Run");
			}
		}

		private void ResetAll()
		{
			playLanding = false;
			playRunToIdle = false;
			playDashToIdle = false;
			wasFacingRight = false;
			controlEnabled = true;
		}

		private void ResetPlays()
		{
			playLanding = false;
			playRunToIdle = false;
			playDashToIdle = false;
		}

		public void UpdateState(ActorStates newState)
		{
			//IL_0008: 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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			if (controlEnabled && newState != actorState)
			{
				if ((int)actorState == 3 && (int)newState == 1 && !playLanding)
				{
					playLanding = true;
				}
				if ((int)actorState == 2 && (int)newState == 1 && !playRunToIdle && !cState.inWalkZone && !cState.attacking)
				{
					playRunToIdle = true;
				}
				prevActorState = actorState;
				actorState = newState;
			}
		}

		public void PlayClip(string clipName)
		{
			if (controlEnabled)
			{
				if (clipName == "Exit Door To Idle")
				{
					animator.AnimationCompleted = AnimationCompleteDelegate;
				}
				Play(clipName);
			}
		}

		private void UpdateAnimation()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Invalid comparison between Unknown and I4
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Invalid comparison between Unknown and I4
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Invalid comparison between Unknown and I4
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Invalid comparison between Unknown and I4
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Invalid comparison between Unknown and I4
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Invalid comparison between Unknown and I4
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Invalid comparison between Unknown and I4
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Invalid comparison between Unknown and I4
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Invalid comparison between Unknown and I4
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Invalid comparison between Unknown and I4
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Invalid comparison between Unknown and I4
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Invalid comparison between Unknown and I4
			changedClipFromLastFrame = false;
			if (playLanding)
			{
				Play("Land");
				animator.AnimationCompleted = AnimationCompleteDelegate;
				playLanding = false;
			}
			if (playRunToIdle)
			{
				Play("Run To Idle");
				animator.AnimationCompleted = AnimationCompleteDelegate;
				playRunToIdle = false;
			}
			if (playBackDashToIdleEnd)
			{
				Play("Backdash Land 2");
				animator.AnimationCompleted = AnimationCompleteDelegate;
				playBackDashToIdleEnd = false;
			}
			if (playDashToIdle)
			{
				Play("Dash To Idle");
				animator.AnimationCompleted = AnimationCompleteDelegate;
				playDashToIdle = false;
			}
			if ((int)actorState == 7)
			{
				if (cState.recoilFrozen)
				{
					Play("Stun");
				}
				else if (cState.recoiling)
				{
					Play("Recoil");
				}
				else if (cState.transitioning)
				{
					if (cState.onGround)
					{
						if ((int)heroCtrl.transitionState == 1)
						{
							if (!animator.IsPlaying("Run"))
							{
								if (!pd.equippedCharm_37)
								{
									Play("Run");
								}
								else
								{
									Play("Sprint");
								}
							}
						}
						else if ((int)heroCtrl.transitionState == 3)
						{
							if (!pd.equippedCharm_37)
							{
								if (!animator.IsPlaying("Run"))
								{
									PlayFromFrame("Run", 3);
								}
							}
							else
							{
								Play("Sprint");
							}
						}
					}
					else if ((int)heroCtrl.transitionState == 1)
					{
						if (!animator.IsPlaying("Airborne"))
						{
							PlayFromFrame("Airborne", 7);
						}
					}
					else if ((int)heroCtrl.transitionState == 2)
					{
						if (!animator.IsPlaying("Airborne"))
						{
							PlayFromFrame("Airborne", 7);
						}
					}
					else if ((int)heroCtrl.transitionState == 3 && !setEntryAnim)
					{
						if ((int)heroCtrl.gatePosition == 0)
						{
							PlayFromFrame("Airborne", 7);
						}
						else if ((int)heroCtrl.gatePosition == 3)
						{
							PlayFromFrame("Airborne", 3);
						}
						setEntryAnim = true;
					}
				}
			}
			else if (setEntryAnim)
			{
				setEntryAnim = false;
			}
			else if (cState.dashing)
			{
				if (heroCtrl.dashingDown)
				{
					if (cState.shadowDashing)
					{
						if (pd.equippedCharm_16)
						{
							Play("Shadow Dash Down Sharp");
						}
						else
						{
							Play("Shadow Dash Down");
						}
					}
					else
					{
						Play("Dash Down");
					}
				}
				else if (cState.shadowDashing)
				{
					if (pd.equippedCharm_16)
					{
						Play("Shadow Dash Sharp");
					}
					else
					{
						Play("Shadow Dash");
					}
				}
				else
				{
					Play("Dash");
				}
			}
			else if (cState.backDashing)
			{
				Play("Back Dash");
			}
			else if (cState.attacking)
			{
				if (cState.upAttacking)
				{
					Play("UpSlash");
				}
				else if (cState.downAttacking)
				{
					Play("DownSlash");
				}
				else if (cState.wallSliding)
				{
					Play("Wall Slash");
				}
				else if (!cState.altAttack)
				{
					Play("Slash");
				}
				else
				{
					Play("SlashAlt");
				}
			}
			else if (cState.casting)
			{
				Play("Fireball");
			}
			else if (cState.wallSliding)
			{
				Play("Wall Slide");
			}
			else if ((int)actorState == 1)
			{
				if (cState.lookingUpAnim && !animator.IsPlaying("LookUp"))
				{
					Play("LookUp");
				}
				else if (CanPlayLookDown())
				{
					Play("LookDown");
				}
				else if (!cState.lookingUpAnim && !cState.lookingDownAnim && CanPlayIdle())
				{
					PlayIdle();
				}
			}
			else if ((int)actorState == 2)
			{
				if (!animator.IsPlaying("Turn"))
				{
					if (cState.inWalkZone)
					{
						if (!animator.IsPlaying("Walk"))
						{
							Play("Walk");
						}
					}
					else
					{
						PlayRun();
					}
				}
			}
			else if ((int)actorState == 3)
			{
				if (cState.swimming)
				{
					Play("Swim");
				}
				else if (heroCtrl.wallLocked)
				{
					Play("Walljump");
				}
				else if (cState.doubleJumping)
				{
					Play("Double Jump");
				}
				else if (cState.jumping)
				{
					if (!animator.IsPlaying("Airborne"))
					{
						PlayFromFrame("Airborne", 0);
					}
				}
				else if (cState.falling)
				{
					if (!animator.IsPlaying("Airborne"))
					{
						PlayFromFrame("Airborne", 5);
					}
				}
				else if (!animator.IsPlaying("Airborne"))
				{
					PlayFromFrame("Airborne", 3);
				}
			}
			else if ((int)actorState == 6)
			{
				Play("Dash Down Land");
			}
			else if ((int)actorState == 5)
			{
				Play("HardLand");
			}
			if (cState.facingRight)
			{
				if (!wasFacingRight && cState.onGround && canPlayTurn())
				{
					Play("Turn");
				}
				wasFacingRight = true;
			}
			else
			{
				if (wasFacingRight && cState.onGround && canPlayTurn())
				{
					Play("Turn");
				}
				wasFacingRight = false;
			}
			if (cState.attacking)
			{
				wasAttacking = true;
			}
			else
			{
				wasAttacking = false;
			}
			ResetPlays();
		}

		private bool CanPlayIdle()
		{
			if (!animator.IsPlaying("Land") && !animator.IsPlaying("Run To Idle") && !animator.IsPlaying("Dash To Idle") && !animator.IsPlaying("Backdash Land") && !animator.IsPlaying("Backdash Land 2") && !animator.IsPlaying("LookUpEnd") && !animator.IsPlaying("LookDownEnd") && !animator.IsPlaying("Exit Door To Idle") && !animator.IsPlaying("Wake Up Ground") && !animator.IsPlaying("Hazard Respawn"))
			{
				return true;
			}
			return false;
		}

		private bool CanPlayLookDown()
		{
			if (cState.lookingDownAnim && !animator.IsPlaying("Lookup"))
			{
				return true;
			}
			return false;
		}

		private bool canPlayTurn()
		{
			if (!animator.IsPlaying("Wake Up Ground") && !animator.IsPlaying("Hazard Respawn"))
			{
				return true;
			}
			return false;
		}

		private void AnimationCompleteDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
		{
			if (clip.name == "Land")
			{
				PlayIdle();
			}
			if (clip.name == "Run To Idle")
			{
				PlayIdle();
			}
			if (clip.name == "Backdash To Idle")
			{
				PlayIdle();
			}
			if (clip.name == "Dash To Idle")
			{
				PlayIdle();
			}
			if (clip.name == "Exit Door To Idle")
			{
				PlayIdle();
			}
		}

		public void PlayIdle()
		{
			if (pd.health == 1 && pd.healthBlue < 1)
			{
				if (pd.equippedCharm_6)
				{
					animator.Play("Idle");
				}
				else
				{
					animator.Play("Idle Hurt");
				}
			}
			else if (animator.IsPlaying("LookUp"))
			{
				animator.Play("LookUpEnd");
			}
			else if (animator.IsPlaying("LookDown"))
			{
				animator.Play("LookDownEnd");
			}
			else if (heroCtrl.wieldingLantern)
			{
				animator.Play("Lantern Idle");
			}
			else
			{
				animator.Play("Idle");
			}
		}

		private void PlayRun()
		{
			if (heroCtrl.wieldingLantern)
			{
				animator.Play("Lantern Run");
			}
			else if (pd.equippedCharm_37)
			{
				Play("Sprint");
			}
			else if (wasAttacking)
			{
				animator.PlayFromFrame("Run", 3);
			}
			else
			{
				animator.Play("Run");
			}
		}

		private void Play(string clipName)
		{
			if (clipName != animator.CurrentClip.name)
			{
				changedClipFromLastFrame = true;
			}
			animator.Play(clipName);
		}

		private void PlayFromFrame(string clipName, int frame)
		{
			if (clipName != animator.CurrentClip.name)
			{
				changedClipFromLastFrame = true;
			}
			animator.PlayFromFrame(clipName, frame);
		}

		public void StopControl()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (controlEnabled)
			{
				controlEnabled = false;
				stateBeforeControl = actorState;
			}
		}

		public void StartControl()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			actorState = heroCtrl.hero_state;
			controlEnabled = true;
			PlayIdle();
		}

		public void StartControlWithoutSettingState()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			controlEnabled = true;
			if ((int)stateBeforeControl == 2 && (int)actorState == 2)
			{
				actorState = (ActorStates)1;
			}
		}

		public void FinishedDash()
		{
			playDashToIdle = true;
		}

		public void StopAttack()
		{
			if (animator.IsPlaying("UpSlash") || animator.IsPlaying("DownSlash"))
			{
				animator.Stop();
			}
		}

		public float GetCurrentClipDuration()
		{
			return (float)animator.CurrentClip.frames.Length / animator.CurrentClip.fps;
		}

		public float GetClipDuration(string clipName)
		{
			if ((Object)(object)animator == (Object)null)
			{
				animator = ((Component)this).GetComponent<tk2dSpriteAnimator>();
			}
			tk2dSpriteAnimationClip clipByName = animator.GetClipByName(clipName);
			if (clipByName == null)
			{
				Debug.LogError((object)("HeroAnim: Could not find animation clip with the name " + clipName));
				return -1f;
			}
			return (float)clipByName.frames.Length / clipByName.fps;
		}
	}
	public class HeroAudioController : MonoBehaviour
	{
		private HeroController heroCtrl;

		[Header("Sound Effects")]
		public AudioSource softLanding;

		public AudioSource hardLanding;

		public AudioSource jump;

		public AudioSource takeHit;

		public AudioSource backDash;

		public AudioSource dash;

		public AudioSource footStepsRun;

		public AudioSource footStepsWalk;

		public AudioSource wallslide;

		public AudioSource nailArtCharge;

		public AudioSource nailArtReady;

		public AudioSource falling;

		public AudioSource walljump;

		private Coroutine fallingCo;

		private void Awake()
		{
			heroCtrl = ((Component)this).GetComponent<HeroController>();
		}

		public void PlaySound(HeroSounds soundEffect)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected I4, but got Unknown
			if (heroCtrl.cState.isPaused)
			{
				return;
			}
			switch ((int)soundEffect)
			{
			case 4:
				RandomizePitch(jump, 0.9f, 1.1f);
				softLanding.Play();
				break;
			case 5:
				hardLanding.Play();
				break;
			case 2:
				RandomizePitch(jump, 0.9f, 1.1f);
				jump.Play();
				break;
			case 3:
				RandomizePitch(walljump, 0.9f, 1.1f);
				walljump.Play();
				break;
			case 8:
				takeHit.Play();
				break;
			case 7:
				dash.Play();
				break;
			case 9:
				wallslide.Play();
				break;
			case 6:
				backDash.Play();
				break;
			case 0:
				if (!footStepsRun.isPlaying && !softLanding.isPlaying)
				{
					footStepsRun.Play();
				}
				break;
			case 1:
				if (!footStepsWalk.isPlaying && !softLanding.isPlaying)
				{
					footStepsWalk.Play();
				}
				break;
			case 10:
				nailArtCharge.Play();
				break;
			case 11:
				nailArtReady.Play();
				break;
			case 12:
				fallingCo = ((MonoBehaviour)this).StartCoroutine(FadeInVolume(falling, 0.7f));
				falling.Play();
				break;
			}
		}

		public void StopSound(HeroSounds soundEffect)
		{
			//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
			//IL_0007: 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)
			//IL_0020: Expected I4, but got Unknown
			if ((int)soundEffect != 0)
			{
				if ((int)soundEffect != 1)
				{
					switch (soundEffect - 9)
					{
					case 0:
						wallslide.Stop();
						break;
					case 1:
						nailArtCharge.Stop();
						break;
					case 2:
						nailArtReady.Stop();
						break;
					case 3:
						falling.Stop();
						if (fallingCo != null)
						{
							((MonoBehaviour)this).StopCoroutine(fallingCo);
						}
						break;
					}
				}
				else
				{
					footStepsWalk.Stop();
				}
			}
			else
			{
				footStepsRun.Stop();
			}
		}

		public void StopAllSounds()
		{
			softLanding.Stop();
			hardLanding.Stop();
			jump.Stop();
			takeHit.Stop();
			backDash.Stop();
			dash.Stop();
			footStepsRun.Stop();
			footStepsWalk.Stop();
			wallslide.Stop();
			nailArtCharge.Stop();
			nailArtReady.Stop();
			falling.Stop();
		}

		public void PauseAllSounds()
		{
			softLanding.Pause();
			hardLanding.Pause();
			jump.Pause();
			takeHit.Pause();
			backDash.Pause();
			dash.Pause();
			footStepsRun.Pause();
			footStepsWalk.Pause();
			wallslide.Pause();
			nailArtCharge.Pause();
			nailArtReady.Pause();
			falling.Pause();
		}

		public void UnPauseAllSounds()
		{
			softLanding.UnPause();
			hardLanding.UnPause();
			jump.UnPause();
			takeHit.UnPause();
			backDash.UnPause();
			dash.UnPause();
			footStepsRun.UnPause();
			footStepsWalk.UnPause();
			wallslide.UnPause();
			nailArtCharge.UnPause();
			nailArtReady.UnPause();
			falling.UnPause();
		}

		private void RandomizePitch(AudioSource src, float minPitch, float maxPitch)
		{
			float pitch = Random.Range(minPitch, maxPitch);
			src.pitch = pitch;
		}

		private void ResetPitch(AudioSource src)
		{
			src.pitch = 1f;
		}

		private IEnumerator FadeInVolume(AudioSource src, float duration)
		{
			float elapsedTime = 0f;
			src.volume = 0f;
			while (elapsedTime < duration)
			{
				elapsedTime += Time.deltaTime;
				float num = elapsedTime / duration;
				src.volume = Mathf.Lerp(0f, 1f, num);
				yield return null;
			}
		}
	}
	public class HeroBox : MonoBehaviour
	{
		public static bool inactive;

		private HeroController heroCtrl;

		private GameObject damagingObject;

		private bool isHitBuffered;

		private int damageDealt;

		private int hazardType;

		private CollisionSide collisionSide;

		private void Start()
		{
			heroCtrl = HeroController.instance;
		}

		private void OnTriggerEnter2D(Collider2D otherCollider)
		{
			if (!inactive)
			{
				CheckForDamage(otherCollider);
			}
		}

		private void OnTriggerStay2D(Collider2D otherCollider)
		{
			if (!inactive)
			{
				CheckForDamage(otherCollider);
			}
		}

		private void CheckForDamage(Collider2D otherCollider)
		{
			//IL_003f: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected I4, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (FSMUtility.ContainsFSM(((Component)otherCollider).gameObject, "damages_hero"))
			{
				PlayMakerFSM obj = FSMUtility.LocateFSM(((Component)otherCollider).gameObject, "damages_hero");
				int damageAmount = FSMUtility.GetInt(obj, "damageDealt");
				int num = FSMUtility.GetInt(obj, "hazardType");
				if (((Component)otherCollider).transform.position.x > ((Component)this).transform.position.x)
				{
					heroCtrl.TakeDamage(((Component)otherCollider).gameObject, (CollisionSide)2, damageAmount, num);
				}
				else
				{
					heroCtrl.TakeDamage(((Component)otherCollider).gameObject, (CollisionSide)1, damageAmount, num);
				}
				return;
			}
			DamageHero component = ((Component)otherCollider).gameObject.GetComponent<DamageHero>();
			if ((Object)(object)component != (Object)null && !heroCtrl.cState.shadowDashing)
			{
				damageDealt = component.damageDealt;
				hazardType = (int)component.hazardType;
				damagingObject = ((Component)otherCollider).gameObject;
				collisionSide = (CollisionSide)((!(damagingObject.transform.position.x > ((Component)this).transform.position.x)) ? 1 : 2);
				if (!IsHitTypeBuffered(hazardType))
				{
					ApplyBufferedHit();
				}
				else
				{
					isHitBuffered = true;
				}
			}
		}

		private static bool IsHitTypeBuffered(int hazardType)
		{
			return hazardType == 0;
		}

		private void LateUpdate()
		{
			if (isHitBuffered)
			{
				ApplyBufferedHit();
			}
		}

		private void ApplyBufferedHit()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			heroCtrl.TakeDamage(damagingObject, collisionSide, damageDealt, hazardType);
			isHitBuffered = false;
		}
	}
	public class HeroController : MonoBehaviour
	{
		public delegate void HeroInPosition(bool forceDirect);

		public delegate void TakeDamageEvent();

		public delegate void HeroDeathEvent();

		private bool verboseMode;

		public float RUN_SPEED;

		public float RUN_SPEED_CH;

		public float RUN_SPEED_CH_COMBO;

		public float WALK_SPEED;

		public float UNDERWATER_SPEED;

		public float JUMP_SPEED;

		public float JUMP_SPEED_UNDERWATER;

		public float MIN_JUMP_SPEED;

		public int JUMP_STEPS;

		public int JUMP_STEPS_MIN;

		public int JUMP_TIME;

		public int DOUBLE_JUMP_STEPS;

		public int WJLOCK_STEPS_SHORT;

		public int WJLOCK_STEPS_LONG;

		public float WJ_KICKOFF_SPEED;

		public int WALL_STICKY_STEPS;

		public float DASH_SPEED;

		public float DASH_SPEED_SHARP;

		public float DASH_TIME;

		public int DASH_QUEUE_STEPS;

		public float BACK_DASH_SPEED;

		public float BACK_DASH_TIME;

		public float SHADOW_DASH_SPEED;

		public float SHADOW_DASH_TIME;

		public float SHADOW_DASH_COOLDOWN;

		public float SUPER_DASH_SPEED;

		public float DASH_COOLDOWN;

		public float DASH_COOLDOWN_CH;

		public float BACKDASH_COOLDOWN;

		public float WALLSLIDE_SPEED;

		public float WALLSLIDE_DECEL;

		public float NAIL_CHARGE_TIME_DEFAULT;

		public float NAIL_CHARGE_TIME_CHARM;

		public float CYCLONE_HORIZONTAL_SPEED;

		public float SWIM_ACCEL;

		public float SWIM_MAX_SPEED;

		public float TIME_TO_ENTER_SCENE_BOT;

		public float TIME_TO_ENTER_SCENE_HOR;

		public float SPEED_TO_ENTER_SCENE_HOR;

		public float SPEED_TO_ENTER_SCENE_UP;

		public float SPEED_TO_ENTER_SCENE_DOWN;

		public float DEFAULT_GRAVITY;

		public float UNDERWATER_GRAVITY;

		public float ATTACK_DURATION;

		public float ATTACK_DURATION_CH;

		public float ALT_ATTACK_RESET;

		public float ATTACK_RECOVERY_TIME;

		public float ATTACK_COOLDOWN_TIME;

		public float ATTACK_COOLDOWN_TIME_CH;

		public float BOUNCE_TIME;

		public float BOUNCE_SHROOM_TIME;

		public float BOUNCE_VELOCITY;

		public float SHROOM_BOUNCE_VELOCITY;

		public float RECOIL_HOR_TIME;

		public float RECOIL_HOR_VELOCITY;

		public float RECOIL_HOR_VELOCITY_LONG;

		public float RECOIL_HOR_STEPS;

		public float RECOIL_DOWN_VELOCITY;

		public float RUN_PUFF_TIME;

		public float BIG_FALL_TIME;

		public float HARD_LANDING_TIME;

		public float DOWN_DASH_TIME;

		public float MAX_FALL_VELOCITY;

		public float MAX_FALL_VELOCITY_UNDERWATER;

		public float RECOIL_DURATION;

		public float RECOIL_DURATION_STAL;

		public float RECOIL_VELOCITY;

		public float DAMAGE_FREEZE_DOWN;

		public float DAMAGE_FREEZE_WAIT;

		public float DAMAGE_FREEZE_UP;

		public float INVUL_TIME;

		public float INVUL_TIME_STAL;

		public float INVUL_TIME_PARRY;

		public float INVUL_TIME_QUAKE;

		public float INVUL_TIME_CYCLONE;

		public float CAST_TIME;

		public float CAST_RECOIL_TIME;

		public float CAST_RECOIL_VELOCITY;

		public float WALLSLIDE_CLIP_DELAY;

		public int GRUB_SOUL_MP;

		public int GRUB_SOUL_MP_COMBO;

		private int JUMP_QUEUE_STEPS = 2;

		private int JUMP_RELEASE_QUEUE_STEPS = 2;

		private int DOUBLE_JUMP_QUEUE_STEPS = 10;

		private int ATTACK_QUEUE_STEPS = 5;

		private float DELAY_BEFORE_ENTER = 0.1f;

		private float LOOK_DELAY = 0.85f;

		private float LOOK_ANIM_DELAY = 0.25f;

		private float DEATH_WAIT = 2.85f;

		private float HAZARD_DEATH_CHECK_TIME = 3f;

		private float FLOATING_CHECK_TIME = 0.18f;

		private float NAIL_TERRAIN_CHECK_TIME = 0.12f;

		private float BUMP_VELOCITY = 4f;

		private float BUMP_VELOCITY_DASH = 5f;

		private int LANDING_BUFFER_STEPS = 5;

		private int LEDGE_BUFFER_STEPS = 2;

		private int HEAD_BUMP_STEPS = 3;

		private float MANTIS_CHARM_SCALE = 1.35f;

		private float FIND_GROUND_POINT_DISTANCE = 10f;

		private float FIND_GROUND_POINT_DISTANCE_EXT = 50f;

		public ActorStates hero_state;

		public ActorStates prev_hero_state;

		public HeroTransitionState transitionState;

		public DamageMode damageMode;

		public float move_input;

		public float vertical_input;

		public float controller_deadzone = 0.2f;

		public Vector2 current_velocity;

		private bool isGameplayScene;

		public bool isEnteringFirstLevel;

		public Vector2 slashOffset;

		public Vector2 upSlashOffset;

		public Vector2 downwardSlashOffset;

		public Vector2 spell1Offset;

		private int jump_steps;

		private int jumped_steps;

		private int doubleJump_steps;

		private float dash_timer;

		private float back_dash_timer;

		private float shadow_dash_timer;

		private float attack_time;

		private float attack_cooldown;

		private Vector2 transition_vel;

		private float altAttackTime;

		private float lookDelayTimer;

		private float bounceTimer;

		private float recoilHorizontalTimer;

		private float runPuffTimer;

		private float hardLandingTimer;

		private float dashLandingTimer;

		private float recoilTimer;

		private int recoilSteps;

		private int landingBufferSteps;

		private int dashQueueSteps;

		private bool dashQueuing;

		private float shadowDashTimer;

		private float dashCooldownTimer;

		private float nailChargeTimer;

		private int wallLockSteps;

		private float wallslideClipTimer;

		private float hardLandFailSafeTimer;

		private float hazardDeathTimer;

		private float floatingBufferTimer;

		private float attackDuration;

		public float parryInvulnTimer;

		[Space(6f)]
		[Header("Slash Prefabs")]
		public GameObject slashPrefab;

		public GameObject slashAltPrefab;

		public GameObject upSlashPrefab;

		public GameObject downSlashPrefab;

		public GameObject wallSlashPrefab;

		public NailSlash normalSlash;

		public NailSlash alternateSlash;

		public NailSlash upSlash;

		public NailSlash downSlash;

		public NailSlash wallSlash;

		public PlayMakerFSM normalSlashFsm;

		public PlayMakerFSM alternateSlashFsm;

		public PlayMakerFSM upSlashFsm;

		public PlayMakerFSM downSlashFsm;

		public PlayMakerFSM wallSlashFsm;

		[Space(6f)]
		[Header("Effect Prefabs")]
		public GameObject nailTerrainImpactEffectPrefab;

		public GameObject spell1Prefab;

		public GameObject takeHitPrefab;

		public GameObject takeHitDoublePrefab;

		public GameObject softLandingEffectPrefab;

		public GameObject hardLandingEffectPrefab;

		public GameObject runEffectPrefab;

		public GameObject backDashPrefab;

		public GameObject jumpEffectPrefab;

		public GameObject jumpTrailPrefab;

		public GameObject fallEffectPrefab;

		public ParticleSystem wallslideDustPrefab;

		public GameObject artChargeEffect;

		public GameObject artChargedEffect;

		public GameObject artChargedFlash;

		public tk2dSpriteAnimator artChargedEffectAnim;

		public GameObject shadowdashBurstPrefab;

		public GameObject shadowdashDownBurstPrefab;

		public GameObject dashParticlesPrefab;

		public GameObject shadowdashParticlesPrefab;

		public GameObject shadowRingPrefab;

		public GameObject shadowRechargePrefab;

		public GameObject dJumpWingsPrefab;

		public GameObject dJumpFlashPrefab;

		public ParticleSystem dJumpFeathers;

		public GameObject wallPuffPrefab;

		public GameObject sharpShadowPrefab;

		public GameObject grubberFlyBeamPrefabL;

		public GameObject grubberFlyBeamPrefabR;

		public GameObject grubberFlyBeamPrefabU;

		public GameObject grubberFlyBeamPrefabD;

		public GameObject grubberFlyBeamPrefabL_fury;

		public GameObject grubberFlyBeamPrefabR_fury;

		public GameObject grubberFlyBeamPrefabU_fury;

		public GameObject grubberFlyBeamPrefabD_fury;

		public GameObject carefreeShield;

		[Space(6f)]
		[Header("Hero Death")]
		public GameObject corpsePrefab;

		public GameObject spikeDeathPrefab;

		public GameObject acidDeathPrefab;

		public GameObject lavaDeathPrefab;

		public GameObject heroDeathPrefab;

		[Space(6f)]
		[Header("Hero Other")]
		public GameObject cutscenePrefab;

		private GameManager gm;

		private Rigidbody2D rb2d;

		private Collider2D col2d;

		private MeshRenderer renderer;

		private Transform transform;

		private HeroAnimationController animCtrl;

		public HeroControllerStates cState;

		public PlayerData playerData;

		private HeroAudioController audioCtrl;

		private AudioSource audioSource;

		[HideInInspector]
		public UIManager ui;

		private InputHandler inputHandler;

		public PlayMakerFSM damageEffectFSM;

		private ParticleSystem dashParticleSystem;

		private InvulnerablePulse invPulse;

		private SpriteFlash spriteFlash;

		public AudioSource footStepsRunAudioSource;

		public AudioSource footStepsWalkAudioSource;

		private float prevGravityScale;

		private Vector2 recoilVector;

		private Vector2 lastInputState;

		public GatePosition gatePosition;

		private bool runMsgSent;

		private bool hardLanded;

		private bool fallRumble;

		public bool acceptingInput;

		private bool fallTrailGenerated;

		private bool drainMP;

		private float drainMP_timer;

		private float drainMP_time;

		private float MP_drained;

		private float drainMP_seconds;

		private float focusMP_amount;

		private float dashBumpCorrection;

		public bool controlReqlinquished;

		public bool enterWithoutInput;

		public bool lookingUpAnim;

		public bool lookingDownAnim;

		public bool carefreeShieldEquipped;

		private int hitsSinceShielded;

		private EndBeta endBeta;

		private int jumpQueueSteps;

		private bool jumpQueuing;

		private int doubleJumpQueueSteps;

		private bool doubleJumpQueuing;

		private int jumpReleaseQueueSteps;

		private bool jumpReleaseQueuing;

		private int attackQueueSteps;

		private bool attackQueuing;

		public bool touchingWallL;

		public bool touchingWallR;

		public bool wallSlidingL;

		public bool wallSlidingR;

		private bool airDashed;

		public bool dashingDown;

		public bool wieldingLantern;

		private bool startWithWallslide;

		private bool startWithJump;

		private bool startWithFullJump;

		private bool startWithDash;

		private bool startWithAttack;

		private bool nailArt_cyclone;

		private bool wallSlashing;

		private bool doubleJumped;

		public bool inAcid;

		private bool wallJumpedR;

		private bool wallJumpedL;

		public bool wallLocked;

		private float currentWalljumpSpeed;

		private float walljumpSpeedDecel;

		private int wallUnstickSteps;

		private bool recoilLarge;

		public float conveyorSpeed;

		public float conveyorSpeedV;

		private bool enteringVertically;

		private bool playingWallslideClip;

		private bool playedMantisClawClip;

		public bool exitedSuperDashing;

		public bool exitedQuake;

		private bool fallCheckFlagged;

		private int ledgeBufferSteps;

		private int headBumpSteps;

		private float nailChargeTime;

		public bool takeNoDamage;

		private bool joniBeam;

		public bool fadedSceneIn;

		private bool stopWalkingOut;

		private bool boundsChecking;

		private bool blockerFix;

		[SerializeField]
		private Vector2[] positionHistory;

		private bool tilemapTestActive;

		private Vector2 groundRayOriginC;

		private Vector2 groundRayOriginL;

		private Vector2 groundRayOriginR;

		private Coroutine takeDamageCoroutine;

		private Coroutine tilemapTestCoroutine;

		public AudioClip footstepsRunDust;

		public AudioClip footstepsRunGrass;

		public AudioClip footstepsRunBone;

		public AudioClip footstepsRunSpa;

		public AudioClip footstepsRunMetal;

		public AudioClip footstepsRunWater;

		public AudioClip footstepsWalkDust;

		public AudioClip footstepsWalkGrass;

		public AudioClip footstepsWalkBone;

		public AudioClip footstepsWalkSpa;

		public AudioClip footstepsWalkMetal;

		public AudioClip nailArtCharge;

		public AudioClip nailArtChargeComplete;

		public AudioClip blockerImpact;

		public AudioClip shadowDashClip;

		public AudioClip sharpShadowClip;

		public AudioClip doubleJumpClip;

		public AudioClip mantisClawClip;

		private GameObject slash;

		private NailSlash slashComponent;

		private PlayMakerFSM slashFsm;

		private GameObject runEffect;

		private GameObject backDash;

		private GameObject jumpEffect;

		private GameObject fallEffect;

		private GameObject dashEffect;

		private GameObject grubberFlyBeam;

		private GameObject hazardCorpe;

		public PlayMakerFSM vignetteFSM;

		public SpriteRenderer heroLight;

		public SpriteRenderer vignette;

		public PlayMakerFSM dashBurst;

		public PlayMakerFSM superDash;

		public PlayMakerFSM fsm_thornCounter;

		public PlayMakerFSM spellControl;

		public PlayMakerFSM fsm_fallTrail;

		public PlayMakerFSM fsm_orbitShield;

		public VibrationData softLandVibration;

		public VibrationData wallJumpVibration;

		public VibrationPlayer wallSlideVibrationPlayer;

		public VibrationData dashVibration;

		public VibrationData shadowDashVibration;

		public VibrationData doubleJumpVibration;

		public bool isHeroInPosition = true;

		private bool jumpReleaseQueueingEnabled;

		private static HeroController _instance;

		private const float PreventCastByDialogueEndDuration = 0.3f;

		private float preventCastByDialogueEndTimer;

		private Vector2 oldPos = Vector2.zero;

		public float fallTimer { get; private set; }

		public PlayMakerFSM proxyFSM { get; private set; }

		public TransitionPoint sceneEntryGate { get; private set; }

		public bool IsDreamReturning
		{
			get
			{
				PlayMakerFSM val = PlayMakerFSM.FindFsmOnGameObject(((Component)this).gameObject, "Dream Return");
				if (Object.op_Implicit((Object)(object)val))
				{
					FsmBool val2 = val.FsmVariables.FindFsmBool("Dream Returning");
					if (val2 != null)
					{
						return val2.Value;
					}
				}
				return false;
			}
		}

		public static HeroController instance
		{
			get
			{
				HeroController silentInstance = SilentInstance;
				if (!Object.op_Implicit((Object)(object)silentInstance))
				{
					Debug.LogError((object)"Couldn't find a Hero, make sure one exists in the scene.");
				}
				return silentInstance;
			}
		}

		public static HeroController SilentInstance
		{
			get
			{
				if ((Object)(object)_instance == (Object)null)
				{
					_instance = Object.FindObjectOfType<HeroController>();
					if (Object.op_Implicit((Object)(object)_instance) && Application.isPlaying)
					{
						Object.DontDestroyOnLoad((Object)(object)((Component)_instance).gameObject);
					}
				}
				return _instance;
			}
		}

		public static HeroController UnsafeInstance => _instance;

		public event Action OnHazardRespawn;

		public event HeroInPosition heroInPosition;

		public event TakeDamageEvent OnTakenDamage;

		public event HeroDeathEvent OnDeath;

		private void Awake()
		{
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
				Object.DontDestroyOnLoad((Object)(object)this);
			}
			else if ((Object)(object)this != (Object)(object)_instance)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			SetupGameRefs();
			SetupPools();
		}

		private void Start()
		{
			heroInPosition += delegate
			{
				isHeroInPosition = true;
			};
			playerData = PlayerData.instance;
			ui = UIManager.instance;
			if ((Object)(object)superDash == (Object)null)
			{
				Debug.Log((object)"SuperDash came up null, locating manually");
				superDash = FSMUtility.LocateFSM(((Component)this).gameObject, "Superdash");
			}
			if ((Object)(object)fsm_thornCounter == (Object)null)
			{
				Debug.Log((object)"Thorn Counter came up null, locating manually");
				fsm_thornCounter = FSMUtility.LocateFSM(((Component)transform.Find("Charm Effects")).gameObject, "Thorn Counter");
			}
			if ((Object)(object)dashBurst == (Object)null)
			{
				Debug.Log((object)"DashBurst came up null, locating manually");
				dashBurst = FSMUtility.GetFSM(((Component)transform.Find("Effects").Find("Dash Burst")).gameObject);
			}
			if ((Object)(object)spellControl == (Object)null)
			{
				Debug.Log((object)"SpellControl came up null, locating manually");
				spellControl = FSMUtility.LocateFSM(((Component)this).gameObject, "Spell Control");
			}
			if (playerData.equippedCharm_26)
			{
				nailChargeTime = NAIL_CHARGE_TIME_CHARM;
			}
			else
			{
				nailChargeTime = NAIL_CHARGE_TIME_DEFAULT;
			}
			if (gm.IsGameplayScene())
			{
				isGameplayScene = true;
				((Renderer)vignette).enabled = true;
				if (this.heroInPosition != null)
				{
					this.heroInPosition(forceDirect: false);
				}
				FinishedEnteringScene();
			}
			else
			{
				isGameplayScene = false;
				Extensions.SetPositionY(transform, -2000f);
				((Renderer)vignette).enabled = false;
				AffectedByGravity(gravityApplies: false);
			}
			CharmUpdate();
			if (Object.op_Implicit((Object)(object)acidDeathPrefab))
			{
				ObjectPool.CreatePool(acidDeathPrefab, 1, false);
			}
			if (Object.op_Implicit((Object)(object)spikeDeathPrefab))
			{
				ObjectPool.CreatePool(spikeDeathPrefab, 1, false);
			}
		}

		public void SceneInit()
		{
			if (!((Object)(object)this == (Object)(object)_instance))
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)gm))
			{
				gm = GameManager.instance;
			}
			if (gm.IsGameplayScene())
			{
				isGameplayScene = true;
				HeroBox.inactive = false;
			}
			else
			{
				isGameplayScene = false;
				acceptingInput = false;
				SetState((ActorStates)7);
				Extensions.SetPositionY(transform, -2000f);
				((Renderer)vignette).enabled = false;
				AffectedByGravity(gravityApplies: false);
			}
			Extensions.SetPositionZ(transform, 0.004f);
			if (!blockerFix)
			{
				if (playerData.killedBlocker)
				{
					gm.SetPlayerDataInt("killsBlocker", 0);
				}
				blockerFix = true;
			}
			SetWalkZone(inWalkZone: false);
		}

		private void Update()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Invalid comparison between Unknown and I4
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Invalid comparison between Unknown and I4
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Invalid comparison between Unknown and I4
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Invalid comparison between Unknown and I4
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Invalid comparison between Unknown and I4
			//IL_0118: 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_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Invalid comparison between Unknown and I4
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Invalid comparison between Unknown and I4
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			if (Time.frameCount % 10 == 0)
			{
				Update10();
			}
			current_velocity = rb2d.velocity;
			FallCheck();
			FailSafeChecks();
			if ((int)hero_state == 2 && !cState.dashing && !cState.backDashing && !controlReqlinquished)
			{
				if (cState.inWalkZone)
				{
					audioCtrl.StopSound((HeroSounds)0);
					audioCtrl.PlaySound((HeroSounds)1);
				}
				else
				{
					audioCtrl.StopSound((HeroSounds)1);
					audioCtrl.PlaySound((HeroSounds)0);
				}
				if (runMsgSent && rb2d.velocity.x > -0.1f && rb2d.velocity.x < 0.1f)
				{
					runEffect.GetComponent<PlayMakerFSM>().SendEvent("RUN STOP");
					runEffect.transform.SetParent((Transform)null, true);
					runMsgSent = false;
				}
				if (!runMsgSent && (rb2d.velocity.x < -0.1f || rb2d.velocity.x > 0.1f))
				{
					runEffect = ObjectPoolExtensions.Spawn(runEffectPrefab);
					runEffect.transform.SetParent(((Component)this).gameObject.transform, false);
					runMsgSent = true;
				}
			}
			else
			{
				audioCtrl.StopSound((HeroSounds)0);
				audioCtrl.StopSound((HeroSounds)1);
				if (runMsgSent)
				{
					runEffect.GetComponent<PlayMakerFSM>().SendEvent("RUN STOP");
					runEffect.transform.SetParent((Transform)null, true);
					runMsgSent = false;
				}
			}
			if ((int)hero_state == 6)
			{
				dashLandingTimer += Time.deltaTime;
				if (dashLandingTimer > DOWN_DASH_TIME)
				{
					BackOnGround();
				}
			}
			if ((int)hero_state == 5)
			{
				hardLandingTimer += Time.deltaTime;
				if (hardLandingTimer > HARD_LANDING_TIME)
				{
					SetState((ActorStates)0);
					BackOnGround();
				}
			}
			else if ((int)hero_state == 7)
			{
				if (cState.recoiling)
				{
					if ((!playerData.equippedCharm_4 && recoilTimer < RECOIL_DURATION) || (playerData.equippedCharm_4 && recoilTimer < RECOIL_DURATION_STAL))
					{
						recoilTimer += Time.deltaTime;
					}
					else
					{
						CancelDamageRecoil();
						if (((int)prev_hero_state == 1 || (int)prev_hero_state == 2) && !CheckTouchingGround())
						{
							cState.onGround = false;
							SetState((ActorStates)3);
						}
						else
						{
							SetState((ActorStates)8);
						}
						fsm_thornCounter.SendEvent("THORN COUNTER");
					}
				}
			}
			else if ((int)hero_state != 7)
			{
				LookForInput();
				if (cState.recoiling)
				{
					cState.recoiling = false;
					AffectedByGravity(gravityApplies: true);
				}
				if (cState.attacking && !cState.dashing)
				{
					attack_time += Time.deltaTime;
					if (attack_time >= attackDuration)
					{
						ResetAttacks();
						animCtrl.StopAttack();
					}
				}
				if (cState.bouncing)
				{
					if (bounceTimer < BOUNCE_TIME)
					{
						bounceTimer += Time.deltaTime;
					}
					else
					{
						CancelBounce();
						rb2d.velocity = new Vector2(rb2d.velocity.x, 0f);
					}
				}
				if (cState.shroomBouncing && current_velocity.y <= 0f)
				{
					cState.shroomBouncing = false;
				}
				if ((int)hero_state == 1)
				{
					if (!controlReqlinquished && !gm.isPaused)
					{
						if (((OneAxisInputControl)inputHandler.inputActions.Up).IsPressed || ((OneAxisInputControl)inputHandler.inputActions.RsUp).IsPressed)
						{
							cState.lookingDown = false;
							cState.lookingDownAnim = false;
							if (lookDelayTimer >= LOOK_DELAY || (((OneAxisInputControl)inputHandler.inputActions.RsUp).IsPressed && !cState.jumping && !cState.dashing))
							{
								cState.lookingUp = true;
							}
							else
							{
								lookDelayTimer += Time.deltaTime;
							}
							if (lookDelayTimer >= LOOK_ANIM_DELAY || ((OneAxisInputControl)inputHandler.inputActions.RsUp).IsPressed)
							{
								cState.lookingUpAnim = true;
							}
							else
							{
								cState.lookingUpAnim = false;
							}
						}
						else if (((OneAxisInputControl)inputHandler.inputActions.Down).IsPressed || ((OneAxisInputControl)inputHandler.inputActions.RsDown).IsPressed)
						{
							cState.lookingUp = false;
							cState.lookingUpAnim = false;
							if (lookDelayTimer >= LOOK_DELAY || (((OneAxisInputControl)inputHandler.inputActions.RsDown).IsPressed && !cState.jumping && !cState.dashing))
							{
								cState.lookingDown = true;
							}
							else
							{
								lookDelayTimer += Time.deltaTime;
							}
							if (lookDelayTimer >= LOOK_ANIM_DELAY || ((OneAxisInputControl)inputHandler.inputActions.RsDown).IsPressed)
							{
								cState.lookingDownAnim = true;
							}
							else
							{
								cState.lookingDownAnim = false;
							}
						}
						else
						{
							ResetLook();
						}
					}
					runPuffTimer = 0f;
				}
			}
			LookForQueueInput();
			if (drainMP)
			{
				drainMP_timer += Time.deltaTime;
				drainMP_seconds += Time.deltaTime;
				while (drainMP_timer >= drainMP_time)
				{
					MP_drained += 1f;
					drainMP_timer -= drainMP_time;
					TakeMP(1);
					gm.soulOrb_fsm.SendEvent("MP DRAIN");
					if (MP_drained == focusMP_amount)
					{
						MP_drained -= drainMP_time;
						proxyFSM.SendEvent("HeroCtrl-FocusCompleted");
					}
				}
			}
			if (cState.wallSliding)
			{
				if (airDashed)
				{
					airDashed = false;
				}
				if (doubleJumped)
				{
					doubleJumped = false;
				}
				if (cState.onGround)
				{
					FlipSprite();
					CancelWallsliding();
				}
				if (!cState.touchingWall)
				{
					FlipSprite();
					CancelWallsliding();
				}
				if (!CanWallSlide())
				{
					CancelWallsliding();
				}
				if (!playedMantisClawClip)
				{
					audioSource.PlayOneShot(mantisClawClip, 1f);
					playedMantisClawClip = true;
				}
				if (!playingWallslideClip)
				{
					if (wallslideClipTimer <= WALLSLIDE_CLIP_DELAY)
					{
						wallslideClipTimer += Time.deltaTime;
					}
					else
					{
						wallslideClipTimer = 0f;
						audioCtrl.PlaySound((HeroSounds)9);
						playingWallslideClip = true;
					}
				}
			}
			else if (playedMantisClawClip)
			{
				playedMantisClawClip = false;
			}
			if (!cState.wallSliding && playingWallslideClip)
			{
				audioCtrl.StopSound((HeroSounds)9);
				playingWallslideClip = false;
			}
			if (!cState.wallSliding && wallslideClipTimer > 0f)
			{
				wallslideClipTimer = 0f;
			}
			if (wallSlashing && !cState.wallSliding)
			{
				CancelAttack();
			}
			if (attack_cooldown > 0f)
			{
				attack_cooldown -= Time.deltaTime;
			}
			if (dashCooldownTimer > 0f)
			{
				dashCooldownTimer -= Time.deltaTime;
			}
			if (shadowDashTimer > 0f)
			{
				shadowDashTimer -= Time.deltaTime;
				if (shadowDashTimer <= 0f)
				{
					spriteFlash.FlashShadowRecharge();
				}
			}
			preventCastByDialogueEndTimer -= Time.deltaTime;
			if (!gm.isPaused)
			{
				if (((OneAxisInputControl)inputHandler.inputActions.Attack).IsPressed && CanNailCharge())
				{
					cState.nailCharging = true;
					nailChargeTimer += Time.deltaTime;
				}
				else if (cState.nailCharging || nailChargeTimer != 0f)
				{
					artChargeEffect.SetActive(false);
					cState.nailCharging = false;
					audioCtrl.StopSound((HeroSounds)10);
				}
				if (cState.nailCharging && nailChargeTimer > 0.5f && !artChargeEffect.activeSelf && nailChargeTimer < nailChargeTime)
				{
					artChargeEffect.SetActive(true);
					audioCtrl.PlaySound((HeroSounds)10);
				}
				if (artChargeEffect.activeSelf && (!cState.nailCharging || nailChargeTimer > nailChargeTime))
				{
					artChargeEffect.SetActive(false);
					audioCtrl.StopSound((HeroSounds)10);
				}
				if (!artChargedEffect.activeSelf && nailChargeTimer >= nailChargeTime)
				{
					artChargedEffect.SetActive(true);
					artChargedFlash.SetActive(true);
					artChargedEffectAnim.PlayFromFrame(0);
					GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake");
					audioSource.PlayOneShot(nailArtChargeComplete, 1f);
					audioCtrl.PlaySound((HeroSounds)11);
					cState.nailCharging = true;
				}
				if (artChargedEffect.activeSelf && (nailChargeTimer < nailChargeTime || !cState.nailCharging))
				{
					artChargedEffect.SetActive(false);
					audioCtrl.StopSound((HeroSounds)11);
				}
			}
			if (gm.isPaused && !((OneAxisInputControl)inputHandler.inputActions.Attack).IsPressed)
			{
				cState.nailCharging = false;
				nailChargeTimer = 0f;
			}
			if (cState.swimming && !CanSwim())
			{
				cState.swimming = false;
			}
			if (parryInvulnTimer > 0f)
			{
				parryInvulnTimer -= Time.deltaTime;
			}
		}

		private void FixedUpdate()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Invalid comparison between Unknown and I4
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Invalid comparison between Unknown and I4
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Invalid comparison between Unknown and I4
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Invalid comparison between Unknown and I4
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Invalid comparison between Unknown and I4
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Invalid comparison between Unknown and I4
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_099f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09af: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_0798: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_07be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a08: Unknown result type (might be due to invalid IL or missing references)
			//IL_096d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_081f: Unknown result type (might be due to invalid IL or missing references)
			//IL_082f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0845: Unknown result type (might be due to invalid IL or missing references)
			//IL_0855: Unknown result type (might be due to invalid IL or missing references)
			//IL_07dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: 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_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0941: Unknown result type (might be due to invalid IL or missing references)
			//IL_094b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0950: Unknown result type (might be due to invalid IL or missing references)
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: 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_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7c: Invalid comparison between Unknown and I4
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b13: Invalid comparison between Unknown and I4
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b40: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a92: Invalid comparison between Unknown and I4
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ade: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4f: Unknown result type (might be due to invalid IL or missing references)
			if (cState.recoilingLeft || cState.recoilingRight)
			{
				if ((float)recoilSteps <= RECOIL_HOR_STEPS)
				{
					recoilSteps++;
				}
				else
				{
					CancelRecoilHorizontal();
				}
			}
			if (cState.dead)
			{
				rb2d.velocity = new Vector2(0f, 0f);
			}
			if (((int)hero_state == 5 && !cState.onConveyor) || (int)hero_state == 6)
			{
				ResetMotion();
			}
			else if ((int)hero_state == 7)
			{
				if (cState.transitioning)
				{
					if ((int)transitionState == 1)
					{
						AffectedByGravity(gravityApplies: false);
						if (!stopWalkingOut)
						{
							rb2d.velocity = new Vector2(transition_vel.x, transition_vel.y + rb2d.velocity.y);
						}
					}
					else if ((int)transitionState == 3)
					{
						rb2d.velocity = transition_vel;
					}
					else if ((int)transitionState == 4)
					{
						rb2d.velocity = new Vector2(transition_vel.x, rb2d.velocity.y);
					}
				}
				else if (cState.recoiling)
				{
					AffectedByGravity(gravityApplies: false);
					rb2d.velocity = recoilVector;
				}
			}
			else if ((int)hero_state != 7)
			{
				if ((int)hero_state == 2)
				{
					if (move_input > 0f)
					{
						if (CheckForBump((CollisionSide)2))
						{
							rb2d.velocity = new Vector2(rb2d.velocity.x, BUMP_VELOCITY);
						}
					}
					else if (move_input < 0f && CheckForBump((CollisionSide)1))
					{
						rb2d.velocity = new Vector2(rb2d.velocity.x, BUMP_VELOCITY);
					}
				}
				if (!cState.backDashing && !cState.dashing)
				{
					Move(move_input);
					if ((!cState.attacking || !(attack_time < ATTACK_RECOVERY_TIME)) && !cState.wallSliding && !wallLocked)
					{
						if (move_input > 0f && !cState.facingRight)
						{
							FlipSprite();
							CancelAttack();
						}
						else if (move_input < 0f && cState.facingRight)
						{
							FlipSprite();
							CancelAttack();
						}
					}
					if (cState.recoilingLeft)
					{
						float num = ((!recoilLarge) ? RECOIL_HOR_VELOCITY : RECOIL_HOR_VELOCITY_LONG);
						if (rb2d.velocity.x > 0f - num)
						{
							rb2d.velocity = new Vector2(0f - num, rb2d.velocity.y);
						}
						else
						{
							rb2d.velocity = new Vector2(rb2d.velocity.x - num, rb2d.velocity.y);
						}
					}
					if (cState.recoilingRight)
					{
						float num2 = ((!recoilLarge) ? RECOIL_HOR_VELOCITY : RECOIL_HOR_VELOCITY_LONG);
						if (rb2d.velocity.x < num2)
						{
							rb2d.velocity = new Vector2(num2, rb2d.velocity.y);
						}
						else
						{
							rb2d.velocity = new Vector2(rb2d.velocity.x + num2, rb2d.velocity.y);
						}
					}
				}
				if ((cState.lookingUp || cState.lookingDown) && Mathf.Abs(move_input) > 0.6f)
				{
					ResetLook();
				}
				if (cState.jumping)
				{
					Jump();
				}
				if (cState.doubleJumping)
				{
					DoubleJump();
				}
				if (cState.dashing)
				{
					Dash();
				}
				if (cState.casting)
				{
					if (cState.castRecoiling)
					{
						if (cState.facingRight)
						{
							rb2d.velocity = new Vector2(0f - CAST_RECOIL_VELOCITY, 0f);
						}
						else
						{
							rb2d.velocity = new Vector2(CAST_RECOIL_VELOCITY, 0f);
						}
					}
					else
					{
						rb2d.velocity = Vector2.zero;
					}
				}
				if (cState.bouncing)
				{
					rb2d.velocity = new Vector2(rb2d.velocity.x, BOUNCE_VELOCITY);
				}
				_ = cState.shroomBouncing;
				if (wallLocked)
				{
					if (wallJumpedR)
					{
						rb2d.velocity = new Vector2(currentWalljumpSpeed, rb2d.velocity.y);
					}
					else if (wallJumpedL)
					{
						rb2d.velocity = new Vector2(0f - currentWalljumpSpeed, rb2d.velocity.y);
					}
					wallLockSteps++;
					if (wallLockSteps > WJLOCK_STEPS_LONG)
					{
						wallLocked = false;
					}
					currentWalljumpSpeed -= walljumpSpeedDecel;
				}
				if (cState.wallSliding)
				{
					if (wallSlidingL && ((OneAxisInputControl)inputHandler.inputActions.Right).IsPressed)
					{
						wallUnstickSteps++;
					}
					else if (wallSlidingR && ((OneAxisInputControl)inputHandler.inputActions.Left).IsPressed)
					{
						wallUnstickSteps++;
					}
					else
					{
						wallUnstickSteps = 0;
					}
					if (wallUnstickSteps >= WALL_STICKY_STEPS)
					{
						CancelWallsliding();
					}
					if (wallSlidingL)
					{
						if (!CheckStillTouchingWall((CollisionSide)1))
						{
							FlipSprite();
							CancelWallsliding();
						}
					}
					else if (wallSlidingR && !CheckStillTouchingWall((CollisionSide)2))
					{
						FlipSprite();
						CancelWallsliding();
					}
				}
			}
			if (rb2d.velocity.y < 0f - MAX_FALL_VELOCITY && !inAcid && !controlReqlinquished && !cState.shadowDashing && !cState.spellQuake)
			{
				rb2d.velocity = new Vector2(rb2d.velocity.x, 0f - MAX_FALL_VELOCITY);
			}
			if (jumpQueuing)
			{
				jumpQueueSteps++;
			}
			if (doubleJumpQueuing)
			{
				doubleJumpQueueSteps++;
			}
			if (dashQueuing)
			{
				dashQueueSteps++;
			}
			if (attackQueuing)
			{
				attackQueueSteps++;
			}
			if (cState.wallSliding && !cState.onConveyorV)
			{
				if (rb2d.velocity.y > WALLSLIDE_SPEED)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(rb2d.velocity.x, rb2d.velocity.y - WALLSLIDE_DECEL));
					if (rb2d.velocity.y < WALLSLIDE_SPEED)
					{
						rb2d.velocity = Vector2.op_Implicit(new Vector3(rb2d.velocity.x, WALLSLIDE_SPEED));
					}
				}
				if (rb2d.velocity.y < WALLSLIDE_SPEED)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(rb2d.velocity.x, rb2d.velocity.y + WALLSLIDE_DECEL));
					if (rb2d.velocity.y < WALLSLIDE_SPEED)
					{
						rb2d.velocity = Vector2.op_Implicit(new Vector3(rb2d.velocity.x, WALLSLIDE_SPEED));
					}
				}
			}
			if (nailArt_cyclone)
			{
				if (((OneAxisInputControl)inputHandler.inputActions.Right).IsPressed && !((OneAxisInputControl)inputHandler.inputActions.Left).IsPressed)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(CYCLONE_HORIZONTAL_SPEED, rb2d.velocity.y));
				}
				else if (((OneAxisInputControl)inputHandler.inputActions.Left).IsPressed && !((OneAxisInputControl)inputHandler.inputActions.Right).IsPressed)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(0f - CYCLONE_HORIZONTAL_SPEED, rb2d.velocity.y));
				}
				else
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(0f, rb2d.velocity.y));
				}
			}
			if (cState.swimming)
			{
				rb2d.velocity = Vector2.op_Implicit(new Vector3(rb2d.velocity.x, rb2d.velocity.y + SWIM_ACCEL));
				if (rb2d.velocity.y > SWIM_MAX_SPEED)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(rb2d.velocity.x, SWIM_MAX_SPEED));
				}
			}
			if (cState.superDashOnWall && !cState.onConveyorV)
			{
				rb2d.velocity = Vector2.op_Implicit(new Vector3(0f, 0f));
			}
			if (cState.onConveyor && ((cState.onGround && !cState.superDashing) || (int)hero_state == 5))
			{
				if (cState.freezeCharge || (int)hero_state == 5 || controlReqlinquished)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(0f, 0f));
				}
				rb2d.velocity = new Vector2(rb2d.velocity.x + conveyorSpeed, rb2d.velocity.y);
			}
			if (cState.inConveyorZone)
			{
				if (cState.freezeCharge || (int)hero_state == 5)
				{
					rb2d.velocity = Vector2.op_Implicit(new Vector3(0f, 0f));
				}
				rb2d.velocity = new Vector2(rb2d.velocity.x + conveyorSpeed, rb2d.velocity.y);
				superDash.SendEvent("SLOPE CANCEL");
			}
			if (cState.slidingLeft && rb2d.velocity.x > -5f)
			{
				rb2d.velocity = new Vector2(-5f, rb2d.velocity.y);
			}
			if (landingBufferSteps > 0)
			{
				landingBufferSteps--;
			}
			if (ledgeBufferSteps > 0)
			{
				ledgeBufferSteps--;
			}
			if (headBumpSteps > 0)
			{
				headBumpSteps--;
			}
			if (jumpReleaseQueueSteps > 0)
			{
				jumpReleaseQueueSteps--;
			}
			positionHistory[1] = positionHistory[0];
			positionHistory[0] = Vector2.op_Implicit(transform.position);
			cState.wasOnGround = cState.onGround;
		}

		private void Update10()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (isGameplayScene)
			{
				OutOfBoundsCheck();
			}
			float scaleX = Extensions.GetScaleX(transform);
			if (scaleX < -1f)
			{
				Extensions.SetScaleX(transform, -1f);
			}
			if (scaleX > 1f)
			{
				Extensions.SetScaleX(transform, 1f);
			}
			if (transform.position.z != 0.004f)
			{
				Extensions.SetPositionZ(transform, 0.004f);
			}
		}

		private void OnLevelUnload()
		{
			if ((Object)(object)transform.parent != (Object)null)
			{
				SetHeroParent(null);
			}
		}

		private void OnDisable()
		{
			if ((Object)(object)gm != (Object)null)
			{
				gm.UnloadingLevel -= OnLevelUnload;
			}
		}

		private void Move(float move_direction)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			if (cState.onGround)
			{
				SetState((ActorStates)0);
			}
			if (acceptingInput && !cState.wallSliding)
			{
				if (cState.inWalkZone)
				{
					rb2d.velocity = new Vector2(move_direction * WALK_SPEED, rb2d.velocity.y);
				}
				else if (inAcid)
				{
					rb2d.velocity = new Vector2(move_direction * UNDERWATER_SPEED, rb2d.velocity.y);
				}
				else if (playerData.equippedCharm_37 && cState.onGround && playerData.equippedCharm_31)
				{
					rb2d.velocity = new Vector2(move_direction * RUN_SPEED_CH_COMBO, rb2d.velocity.y);
				}
				else if (playerData.equippedCharm_37 && cState.onGround)
				{
					rb2d.velocity = new Vector2(move_direction * RUN_SPEED_CH, rb2d.velocity.y);
				}
				else
				{
					rb2d.velocity = new Vector2(move_direction * RUN_SPEED, rb2d.velocity.y);
				}
			}
		}

		private void Jump()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			if (jump_steps <= JUMP_STEPS)
			{
				if (inAcid)
				{
					rb2d.velocity = new Vector2(rb2d.velocity.x, JUMP_SPEED_UNDERWATER);
				}
				else
				{
					rb2d.velocity = new Vector2(rb2d.velocity.x, JUMP_SPEED);
				}
				jump_steps++;
				jumped_steps++;
				ledgeBufferSteps = 0;
			}
			else
			{
				CancelJump();
			}
		}

		private void DoubleJump()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (doubleJump_steps <= DOUBLE_JUMP_STEPS)
			{
				if (doubleJump_steps > 3)
				{
					rb2d.velocity = new Vector2(rb2d.velocity.x, JUMP_SPEED * 1.1f);
				}
				doubleJump_steps++;
			}
			else
			{
				CancelDoubleJump();
			}
			if (cState.onGround)
			{
				CancelDoubleJump();
			}
		}

		private void Attack(AttackDirection attackDir)
		{
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected I4, but got Unknown
			//IL_0851: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Invalid comparison between Unknown and I4
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b9: Invalid comparison between Unknown and I4
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: 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_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			if (Time.timeSinceLevelLoad - altAttackTime > ALT_ATTACK_RESET)
			{
				cState.altAttack = false;
			}
			cState.attacking = true;
			if (playerData.equippedCharm_32)
			{
				attackDuration = ATTACK_DURATION_CH;
			}
			else
			{
				attackDuration = ATTACK_DURATION;
			}
			if (cState.wallSliding)
			{
				wallSlashing = true;
				slashComponent = wallSlash;
				slashFsm = wallSlashFsm;
				if (playerData.equippedCharm_35)
				{
					if ((playerData.health == playerData.CurrentMaxHealth && !playerData.equippedCharm_27) || (joniBeam && playerData.equippedCharm_27))
					{
						if (transform.localScale.x > 0f)
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabR, transform.position);
						}
						else
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabL, transform.position);
						}
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, MANTIS_CHARM_SCALE);
						}
						else
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, 1f);
						}
					}
					if (playerData.health == 1 && playerData.equippedCharm_6 && playerData.healthBlue < 1)
					{
						if (transform.localScale.x > 0f)
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabR_fury, transform.position);
						}
						else
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabL_fury, transform.position);
						}
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, MANTIS_CHARM_SCALE);
						}
						else
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, 1f);
						}
					}
				}
			}
			else
			{
				wallSlashing = false;
				switch ((int)attackDir)
				{
				case 0:
					if (!cState.altAttack)
					{
						slashComponent = normalSlash;
						slashFsm = normalSlashFsm;
						cState.altAttack = true;
					}
					else
					{
						slashComponent = alternateSlash;
						slashFsm = alternateSlashFsm;
						cState.altAttack = false;
					}
					if (!playerData.equippedCharm_35)
					{
						break;
					}
					if ((playerData.health >= playerData.CurrentMaxHealth && !playerData.equippedCharm_27) || (joniBeam && playerData.equippedCharm_27))
					{
						if (transform.localScale.x < 0f)
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabR, transform.position);
						}
						else
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabL, transform.position);
						}
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, MANTIS_CHARM_SCALE);
						}
						else
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, 1f);
						}
					}
					if (playerData.health == 1 && playerData.equippedCharm_6 && playerData.healthBlue < 1)
					{
						if (transform.localScale.x < 0f)
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabR_fury, transform.position);
						}
						else
						{
							grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabL_fury, transform.position);
						}
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, MANTIS_CHARM_SCALE);
						}
						else
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, 1f);
						}
					}
					break;
				case 1:
					slashComponent = upSlash;
					slashFsm = upSlashFsm;
					cState.upAttacking = true;
					if (!playerData.equippedCharm_35)
					{
						break;
					}
					if ((playerData.health >= playerData.CurrentMaxHealth && !playerData.equippedCharm_27) || (joniBeam && playerData.equippedCharm_27))
					{
						grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabU, transform.position);
						Extensions.SetScaleY(grubberFlyBeam.transform, transform.localScale.x);
						grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 270f);
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, grubberFlyBeam.transform.localScale.y * MANTIS_CHARM_SCALE);
						}
					}
					if (playerData.health == 1 && playerData.equippedCharm_6 && playerData.healthBlue < 1)
					{
						grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabU_fury, transform.position);
						Extensions.SetScaleY(grubberFlyBeam.transform, transform.localScale.x);
						grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 270f);
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, grubberFlyBeam.transform.localScale.y * MANTIS_CHARM_SCALE);
						}
					}
					break;
				case 2:
					slashComponent = downSlash;
					slashFsm = downSlashFsm;
					cState.downAttacking = true;
					if (!playerData.equippedCharm_35)
					{
						break;
					}
					if ((playerData.health >= playerData.CurrentMaxHealth && !playerData.equippedCharm_27) || (joniBeam && playerData.equippedCharm_27))
					{
						grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabD, transform.position);
						Extensions.SetScaleY(grubberFlyBeam.transform, transform.localScale.x);
						grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, grubberFlyBeam.transform.localScale.y * MANTIS_CHARM_SCALE);
						}
					}
					if (playerData.health == 1 && playerData.equippedCharm_6 && playerData.healthBlue < 1)
					{
						grubberFlyBeam = ObjectPoolExtensions.Spawn(grubberFlyBeamPrefabD_fury, transform.position);
						Extensions.SetScaleY(grubberFlyBeam.transform, transform.localScale.x);
						grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
						if (playerData.equippedCharm_13)
						{
							Extensions.SetScaleY(grubberFlyBeam.transform, grubberFlyBeam.transform.localScale.y * MANTIS_CHARM_SCALE);
						}
					}
					break;
				}
			}
			if (cState.wallSliding)
			{
				if (cState.facingRight)
				{
					slashFsm.FsmVariables.GetFsmFloat("direction").Value = 180f;
				}
				else
				{
					slashFsm.FsmVariables.GetFsmFloat("direction").Value = 0f;
				}
			}
			else if ((int)attackDir == 0 && cState.facingRight)
			{
				slashFsm.FsmVariables.GetFsmFloat("direction").Value = 0f;
			}
			else if ((int)attackDir == 0 && !cState.facingRight)
			{
				slashFsm.FsmVariables.GetFsmFloat("direction").Value = 180f;
			}
			else if ((int)attackDir != 1)
			{
				if ((int)attackDir == 2)
				{
					slashFsm.FsmVariables.GetFsmFloat("direction").Value = 270f;
				}
			}
			else
			{
				slashFsm.FsmVariables.GetFsmFloat("direction").Value = 90f;
			}
			altAttackTime = Time.timeSinceLevelLoad;
			slashComponent.StartSlash();
			if (playerData.equippedCharm_38)
			{
				fsm_orbitShield.SendEvent("SLASH");
			}
		}

		private void Dash()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			AffectedByGravity(gravityApplies: false);
			ResetHardLandingTimer();
			if (dash_timer > DASH_TIME)
			{
				FinishedDashing();
				return;
			}
			float num = ((!playerData.equippedCharm_16 || !cState.shadowDashing) ? DASH_SPEED : DASH_SPEED_SHARP);
			if (dashingDown)
			{
				rb2d.velocity = new Vector2(0f, 0f - num);
			}
			else if (cState.facingRight)
			{
				if (CheckForBump((CollisionSide)2))
				{
					rb2d.velocity = new Vector2(num, cState.onGround ? BUMP_VELOCITY : BUMP_VELOCITY_DASH);
				}
				else
				{
					rb2d.velocity = new Vector2(num, 0f);
				}
			}
			else if (CheckForBump((CollisionSide)1))
			{
				rb2d.velocity = new Vector2(0f - num, cState.onGround ? BUMP_VELOCITY : BUMP_VELOCITY_DASH);
			}
			else
			{
				rb2d.velocity = new Vector2(0f - num, 0f);
			}
			dash_timer += Time.deltaTime;
		}

		private void BackDash()
		{
		}

		private void ShadowDash()
		{
		}

		private void SuperDash()
		{
		}

		public void FaceRight()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			cState.facingRight = true;
			Vector3 localScale = transform.localScale;
			localScale.x = -1f;
			transform.localScale = localScale;
		}

		public void FaceLeft()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			cState.facingRight = false;
			Vector3 localScale = transform.localScale;
			localScale.x = 1f;
			transform.localScale = localScale;
		}

		public void StartMPDrain(float time)
		{
			drainMP = true;
			drainMP_timer = 0f;
			MP_drained = 0f;
			drainMP_time = time;
			focusMP_amount = playerData.GetInt("focusMP_amount");
		}

		public void StopMPDrain()
		{
			drainMP = false;
		}

		public void SetBackOnGround()
		{
			cState.onGround = true;
		}

		public void SetStartWithWallslide()
		{
			startWithWallslide = true;
		}

		public void SetStartWithJump()
		{
			startWithJump = true;
		}

		public void SetStartWithFullJump()
		{
			startWithFullJump = true;
		}

		public void SetStartWithDash()
		{
			startWithDash = true;
		}

		public void SetStartWithAttack()
		{
			startWithAttack = true;
		}

		public void SetSuperDashExit()
		{
			exitedSuperDashing = true;
		}

		public void SetQuakeExit()
		{
			exitedQuake = true;
		}

		public void SetTakeNoDamage()
		{
			takeNoDamage = true;
		}

		public void EndTakeNoDamage()
		{
			takeNoDamage = false;
		}

		public void SetHeroParent(Transform newParent)
		{
			transform.parent = newParent;
			if ((Object)(object)newParent == (Object)null)
			{
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
		}

		public void IsSwimming()
		{
			cState.swimming = true;
		}

		public void NotSwimming()
		{
			cState.swimming = false;
		}

		public void EnableRenderer()
		{
			((Renderer)renderer).enabled = true;
		}

		public void ResetAirMoves()
		{
			doubleJumped = false;
			airDashed = false;
		}

		public void SetConveyorSpeed(float speed)
		{
			conveyorSpeed = speed;
		}

		public void SetConveyorSpeedV(float speed)
		{
			conveyorSpeedV = speed;
		}

		public void EnterWithoutInput(bool flag)
		{
			enterWithoutInput = flag;
		}

		public void SetDarkness(int darkness)
		{
			if (darkness > 0 && playerData.hasLantern)
			{
				wieldingLantern = true;
			}
			else
			{
				wieldingLantern = false;
			}
		}

		public void CancelHeroJump()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (cState.jumping)
			{
				CancelJump();
				CancelDoubleJump();
				if (rb2d.velocity.y > 0f)
				{
					rb2d.velocity = new Vector2(rb2d.velocity.x, 0f);
				}
			}
		}

		public void CharmUpdate()
		{
			if (playerData.equippedCharm_26)
			{
				nailChargeTime = NAIL_CHARGE_TIME_CHARM;
			}
			else
			{
				nailChargeTime = NAIL_CHARGE_TIME_DEFAULT;
			}
			if (playerData.equippedCharm_23 && !playerData.brokenCharm_23)
			{
				playerData.maxHealth = playerData.maxHealthBase + 2;
				MaxHealth();
			}
			else
			{
				playerData.maxHealth = playerData.maxHealthBase;
				MaxHealth();
			}
			if (playerData.equippedCharm_27)
			{
				playerData.joniHealthBlue = (int)((float)playerData.maxHealth * 1.4f);
				playerData.maxHealth = 1;
				MaxHealth();
				joniBeam = true;
			}
			else
			{
				playerData.joniHealthBlue = 0;
			}
			if (playerData.equippedCharm_40 && playerData.grimmChildLevel == 5)
			{
				carefreeShieldEquipped = true;
			}
			else
			{
				carefreeShieldEquipped = false;
			}
			playerData.UpdateBlueHealth();
		}

		public void checkEnvironment()
		{
			if (playerData.environmentType == 0)
			{
				footStepsRunAudioSource.clip = footstepsRunDust;
				footStepsWalkAudioSource.clip = footstepsWalkDust;
			}
			else if (playerData.environmentType == 1)
			{
				footStepsRunAudioSource.clip = footstepsRunGrass;
				footStepsWalkAudioSource.clip = footstepsWalkGrass;
			}
			else if (playerData.environmentType == 2)
			{
				footStepsRunAudioSource.clip = footstepsRunBone;
				footStepsWalkAudioSource.clip = footstepsWalkBone;
			}
			else if (playerData.environmentType == 3)
			{
				footStepsRunAudioSource.clip = footstepsRunSpa;
				footStepsWalkAudioSource.clip = footstepsWalkSpa;
			}
			else if (playerData.environmentType == 4)
			{
				footStepsRunAudioSource.clip = footstepsRunMetal;
				footStepsWalkAudioSource.clip = footstepsWalkMetal;
			}
			else if (playerData.environmentType == 6)
			{
				footStepsRunAudioSource.clip = footstepsRunWater;
				footStepsWalkAudioSource.clip = footstepsRunWater;
			}
			else if (playerData.environmentType == 7)
			{
				footStepsRunAudioSource.clip = footstepsRunGrass;
				footStepsWalkAudioSource.clip = footstepsWalkGrass;
			}
		}

		public void SetBenchRespawn(string spawnMarker, string sceneName, int spawnType, bool facingRight)
		{
			playerData.SetBenchRespawn(spawnMarker, sceneName, spawnType, facingRight);
		}

		public void SetHazardRespawn(Vector3 position, bool facingRight)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			playerData.SetHazardRespawn(position, facingRight);
		}

		public bool CanInput()
		{
			return acceptingInput;
		}

		public bool CanTalk()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			bool result = false;
			if (CanInput() && (int)hero_state != 7 && !controlReqlinquished && cState.onGround && !cState.attacking && !cState.dashing)
			{
				result = true;
			}
			return result;
		}

		public void FlipSprite()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			cState.facingRight = !cState.facingRight;
			Vector3 localScale = transform.localScale;
			localScale.x *= -1f;
			transform.localScale = localScale;
		}

		public void NailParry()
		{
			parryInvulnTimer = INVUL_TIME_PARRY;
		}

		public void NailParryRecover()
		{
			attackDuration = 0f;
			attack_cooldown = 0f;
			CancelAttack();
		}

		public void QuakeInvuln()
		{
			parryInvulnTimer = INVUL_TIME_QUAKE;
		}

		public void CancelParryInvuln()
		{
			parryInvulnTimer = 0f;
		}

		public void CycloneInvuln()
		{
			parryInvulnTimer = INVUL_TIME_CYCLONE;
		}

		public void SetWieldingLantern(bool set)
		{
			wieldingLantern = set;
		}

		public void TakeDamage(GameObject go, CollisionSide damageSide, int damageAmount, int hazardType)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			bool spawnDamageEffect = true;
			if (damageAmount <= 0)
			{
				return;
			}
			if (BossSceneController.IsBossScene)
			{
				switch (BossSceneController.Instance.BossLevel)
				{
				case 1:
					damageAmount *= 2;
					break;
				case 2:
					damageAmount = 9999;
					break;
				}
			}
			if (CanTakeDamage())
			{
				if (((int)damageMode == 1 && hazardType == 1) || (cState.shadowDashing && hazardType == 1) || (parryInvulnTimer > 0f && hazardType == 1))
				{
					return;
				}
				VibrationMixer mixer = VibrationManager.GetMixer();
				if (mixer != null)
				{
					mixer.StopAllEmissionsWithTag("heroAction");
				}
				bool flag = false;
				if (carefreeShieldEquipped && hazardType == 1)
				{
					if (hitsSinceShielded > 7)
					{
						hitsSinceShielded = 7;
					}
					switch (hitsSinceShielded)
					{
					case 1:
						if ((float)Random.Range(1, 100) <= 10f)
						{
							flag = true;
						}
						break;
					case 2:
						if ((float)Random.Range(1, 100) <= 20f)
						{
							flag = true;
						}
						break;
					case 3:
						if ((float)Random.Range(1, 100) <= 30f)
						{
							flag = true;
						}
						break;
					case 4:
						if ((float)Random.Range(1, 100) <= 50f)
						{
							flag = true;
						}
						break;
					case 5:
						if ((float)Random.Range(1, 100) <= 70f)
						{
							flag = true;
						}
						break;
					case 6:
						if ((float)Random.Range(1, 100) <= 80f)
						{
							flag = true;
						}
						break;
					case 7:
						if ((float)Random.Range(1, 100) <= 90f)
						{
							flag = true;
						}
						break;
					default:
						flag = false;
						break;
					}
					if (flag)
					{
						hitsSinceShielded = 0;
						carefreeShield.SetActive(true);
						damageAmount = 0;
						spawnDamageEffect = false;
					}
					else
					{
						hitsSinceShielded++;
					}
				}
				if (playerData.equippedCharm_5 && playerData.blockerHits > 0 && hazardType == 1 && cState.focusing && !flag)
				{
					proxyFSM.SendEvent("HeroCtrl-TookBlockerHit");
					audioSource.PlayOneShot(blockerImpact, 1f);
					spawnDamageEffect = false;
					damageAmount = 0;
				}
				else
				{
					proxyFSM.SendEvent("HeroCtrl-HeroDamaged");
				}
				CancelAttack();
				if (cState.wallSliding)
				{
					cState.wallSliding = false;
					wallSlideVibrationPlayer.Stop();
				}
				if (cState.touchingWall)
				{
					cState.touchingWall = false;
				}
				if (cState.recoilingLeft || cState.recoilingRight)
				{
					CancelRecoilHorizontal();
				}
				if (cState.bouncing)
				{
					CancelBounce();
					rb2d.velocity = new Vector2(rb2d.velocity.x, 0f);
				}
				if (cState.shroomBouncing)
				{
					CancelBounce();
					rb2d.velocity = new Vector2(rb2d.velocity.x, 0f);
				}
				if (!flag)
				{
					audioCtrl.PlaySound((HeroSounds)8);
				}
				if (!takeNoDamage && !playerData.invinciTest)
				{
					if (playerData.overcharmed)
					{
						playerData.TakeHealth(damageAmount * 2);
					}
					else
					{
						playerData.TakeHealth(damageAmount);
					}
				}
				if (playerData.equippedCharm_3 && damageAmount > 0)
				{
					if (playerData.equippedCharm_35)
					{
						AddMPCharge(GRUB_SOUL_MP_COMBO);
					}
					else
					{
						AddMPCharge(GRUB_SOUL_MP);
					}
				}
				if (joniBeam && damageAmount > 0)
				{
					joniBeam = false;
				}
				if (cState.nailCharging || nailChargeTimer != 0f)
				{
					cState.nailCharging = false;
					nailChargeTimer = 0f;
				}
				if (damageAmount > 0 && this.OnTakenDamage != null)
				{
					this.OnTakenDamage();
				}
				if (playerData.health == 0)
				{
					((MonoBehaviour)this).StartCoroutine(Die());
					return;
				}
				switch (hazardType)
				{
				case 2:
					((MonoBehaviour)this).StartCoroutine(DieFromHazard((HazardType)2, ((Object)(object)go != (Object)null) ? go.transform.rotation.z : 0f));
					break;
				case 3:
					((MonoBehaviour)this).StartCoroutine(DieFromHazard((HazardType)3, 0f));
					break;
				case 4:
					Debug.Log((object)"Lava death");
					break;
				case 5:
					((MonoBehaviour)this).StartCoroutine(DieFromHazard((HazardType)5, 0f));
					break;
				default:
					((MonoBehaviour)this).StartCoroutine(StartRecoil(damageSide, spawnDamageEffect, damageAmount));
					break;
				}
			}
			else
			{
				if (!cState.invulnerable || cState.hazardDeath || playerData.isInvincible)
				{
					return;
				}
				switch (hazardType)
				{
				case 2:
					if (!takeNoDamage)
					{
						playerData.TakeHealth(damageAmount);
					}
					proxyFSM.SendEvent("HeroCtrl-HeroDamaged");
					if (playerData.health == 0)
					{
						((MonoBehaviour)this).StartCoroutine(Die());
						break;
					}
					audioCtrl.PlaySound((HeroSounds)8);
					((MonoBehaviour)this).StartCoroutine(DieFromHazard((HazardType)2, ((Object)(object)go != (Object)null) ? go.transform.rotation.z : 0f));
					break;
				case 3:
					playerData.TakeHealth(damageAmount);
					proxyFSM.SendEvent("HeroCtrl-HeroDamaged");
					if (playerData.health == 0)
					{
						((MonoBehaviour)this).StartCoroutine(Die());
					}
					else
					{
						((MonoBehaviour)this).StartCoroutine(DieFromHazard((HazardType)3, 0f));
					}
					break;
				case 4:
					Debug.Log((object)"Lava damage");
					break;
				}
			}
		}

		public string GetEntryGateName()
		{
			if ((Object)(object)sceneEntryGate != (Object)null)
			{
				return ((Object)sceneEntryGate).name;
			}
			return "";
		}

		public void AddMPCharge(int amount)
		{
			int mPReserve = playerData.MPReserve;
			playerData.AddMPCharge(amount);
			GameCameras.instance.soulOrbFSM.SendEvent("MP GAIN");
			if (playerData.MPReserve != mPReserve && Object.op_Implicit((Object)(object)gm) && Object.op_Implicit((Object)(object)gm.soulVessel_fsm))
			{
				gm.soulVessel_fsm.SendEvent("MP RESERVE UP");
			}
		}

		public void SoulGain()
		{
			int num;
			if (playerData.MPCharge < playerData.maxMP)
			{
				num = 11;
				if (playerData.equippedCharm_20)
				{
					num += 3;
				}
				if (playerData.equippedCharm_21)
				{
					num += 8;
				}
			}
			else
			{
				num = 6;
				if (playerData.equippedCharm_20)
				{
					num += 2;
				}
				if (playerData.equippedCharm_21)
				{
					num += 6;
				}
			}
			int mPReserve = playerData.MPReserve;
			playerData.AddMPCharge(num);
			GameCameras.instance.soulOrbFSM.SendEvent("MP GAIN");
			if (playerData.MPReserve != mPReserve)
			{
				gm.soulVessel_fsm.SendEvent("MP RESERVE UP");
			}
		}

		public void AddMPChargeSpa(int amount)
		{
			TryAddMPChargeSpa(amount);
		}

		public bool TryAddMPChargeSpa(int amount)
		{
			int mPReserve = playerData.MPReserve;
			bool result = playerData.AddMPCharge(amount);
			gm.soulOrb_fsm.SendEvent("MP GAIN SPA");
			if (playerData.MPReserve != mPReserve)
			{
				gm.soulVessel_fsm.SendEvent("MP RESERVE UP");
			}
			return result;
		}

		public void SetMPCharge(int amount)
		{
			playerData.MPCharge = amount;
			GameCameras.instance.soulOrbFSM.SendEvent("MP SET");
		}

		public void TakeMP(int amount)
		{
			if (playerData.MPCharge > 0)
			{
				playerData.TakeMP(amount);
				if (amount > 1)
				{
					GameCameras.instance.soulOrbFSM.SendEvent("MP LOSE");
				}
			}
		}

		public void TakeMPQuick(int amount)
		{
			if (playerData.MPCharge > 0)
			{
				playerData.TakeMP(amount);
				if (amount > 1)
				{
					GameCameras.instance.soulOrbFSM.SendEvent("MP DRAIN");
				}
			}
		}

		public void TakeReserveMP(int amount)
		{
			playerData.TakeReserveMP(amount);
			gm.soulVessel_fsm.SendEvent("MP RESERVE DOWN");
		}

		public void AddHealth(int amount)
		{
			playerData.AddHealth(amount);
			proxyFSM.SendEvent("HeroCtrl-Healed");
		}

		public void TakeHealth(int amount)
		{
			playerData.TakeHealth(amount);
			proxyFSM.SendEvent("HeroCtrl-HeroDamaged");
		}

		public void MaxHealth()
		{
			proxyFSM.SendEvent("HeroCtrl-MaxHealth");
			playerData.MaxHealth();
		}

		public void MaxHealthKeepBlue()
		{
			int healthBlue = playerData.healthBlue;
			playerData.MaxHealth();
			playerData.healthBlue = healthBlue;
			proxyFSM.SendEvent("HeroCtrl-Healed");
		}

		public void AddToMaxHealth(int amount)
		{
			playerData.AddToMaxHealth(amount);
			gm.AwardAchievement("PROTECTED");
			if (playerData.maxHealthBase == playerData.maxHealthCap)
			{
				gm.AwardAchievement("MASKED");
			}
		}

		public void ClearMP()
		{
			playerData.ClearMP();
		}

		public void ClearMPSendEvents()
		{
			ClearMP();
			GameManager.instance.soulOrb_fsm.SendEvent("MP LOSE");
			GameManager.instance.soulVessel_fsm.SendEvent("MP RESERVE DOWN");
		}

		public void AddToMaxMPReserve(int amount)
		{
			playerData.AddToMaxMPReserve(amount);
			gm.AwardAchievement("SOULFUL");
			if (playerData.MPReserveMax == playerData.MPReserveCap)
			{
				gm.AwardAchievement("WORLDSOUL");
			}
		}

		public void Bounce()
		{
			if (!cState.bouncing && !cState.shroomBouncing && !controlReqlinquished)
			{
				doubleJumped = false;
				airDashed = false;
				cState.bouncing = true;
			}
		}

		public void BounceHigh()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (!cState.bouncing && !controlReqlinquished)
			{
				doubleJumped = false;
				airDashed = false;
				cState.bouncing = true;
				bounceTimer = -0.03f;
				rb2d.velocity = new Vector2(rb2d.velocity.x, BOUNCE_VELOCITY);
			}
		}

		public void ShroomBounce()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			doubleJumped = false;
			airDashed = false;
			cState.bouncing = false;
			cState.shroomBouncing = true;
			rb2d.velocity = new Vector2(rb2d.velocity.x, SHROOM_BOUNCE_VELOCITY);
		}

		public void RecoilLeft()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if (!cState.recoilingLeft && !cState.recoilingRight && !playerData.equippedCharm_14 && !controlReqlinquished)
			{
				CancelDash();
				recoilSteps = 0;
				cState.recoilingLeft = true;
				cState.recoilingRight = false;
				recoilLarge = false;
				rb2d.velocity = new Vector2(0f - RECOIL_HOR_VELOCITY, rb2d.velocity.y);
			}
		}

		public void RecoilRight()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (!cState.recoilingLeft && !cState.recoilingRight && !playerData.equippedCharm_14 && !controlReqlinquished)
			{
				CancelDash();
				recoilSteps = 0;
				cState.recoilingRight = true;
				cState.recoilingLeft = false;
				recoilLarge = false;
				rb2d.velocity = new Vector2(RECOIL_HOR_VELOCITY, rb2d.velocity.y);
			}
		}

		public void RecoilRightLong()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (!cState.recoilingLeft && !cState.recoilingRight && !controlReqlinquished)
			{
				CancelDash();
				ResetAttacks();
				recoilSteps = 0;
				cState.recoilingRight = true;
				cState.recoilingLeft = false;
				recoilLarge = true;
				rb2d.velocity = new Vector2(RECOIL_HOR_VELOCITY_LONG, rb2d.velocity.y);
			}
		}

		public void RecoilLeftLong()
		{
			//IL_006c: 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)
			if (!cState.recoilingLeft && !cState.recoilingRight && !controlReqlinquished)
			{
				CancelDash();
				ResetAttacks();
				recoilSteps = 0;
				cState.recoilingRight = false;
				cState.recoilingLeft = true;
				recoilLarge = tru