Decompiled source of KnightInSilksong v0.5.2
KIS.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GlobalEnums; using GlobalSettings; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using InControl; using KIS; using KIS.Utils; using Knight; using Microsoft.CodeAnalysis; using Newtonsoft.Json; 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("KIS")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.5.1.0")] [assembly: AssemblyInformationalVersion("0.5.1+64444ccf756cfccbb45ca7f2199248fc167ee372")] [assembly: AssemblyProduct("KIS")] [assembly: AssemblyTitle("KnightInSilkSong")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.5.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown ((FsmStateAction)this).Reset(); target = new FsmOwnerDefault(); } public override void OnEnter() { //IL_000f: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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 = ((Component)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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(addComponent, fieldInfo.GetValue(component)); } return addComponent; } public static void SetScale(this GameObject gameObject, float scaleX, float scaleY) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) 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); Transform[] array = componentsInChildren; foreach (Transform val in array) { 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); Transform[] array = componentsInChildren; foreach (Transform val in array) { if (val.GetName(useBaseName) == name) { list.Add(((Component)val).gameObject); } } return list; } public static void Log(this GameObject gameObject) { //IL_0068: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) 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)); ManualLogSource logger = KnightInSilksong.logger; Vector3 val = gameObject.transform.position; logger.LogInfo((object)("Position : " + ((object)(Vector3)(ref val)).ToString())); ManualLogSource logger2 = KnightInSilksong.logger; Quaternion rotation = gameObject.transform.rotation; logger2.LogInfo((object)("Rotation : " + ((object)(Quaternion)(ref rotation)).ToString())); ManualLogSource logger3 = KnightInSilksong.logger; val = gameObject.transform.localScale; logger3.LogInfo((object)("Scale : " + ((object)(Vector3)(ref val)).ToString())); Component[] components = gameObject.GetComponents<Component>(); Component[] array = components; foreach (Component val2 in array) { KnightInSilksong.logger.LogInfo((object)("Component : " + ((object)val2).GetType())); if (val2 is PlayMakerFSM) { KnightInSilksong.logger.LogInfo((object)("---- Fsm name :" + ((PlayMakerFSM)((val2 is PlayMakerFSM) ? val2 : 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(); GameObject[] array = rootGameObjects; foreach (GameObject val in array) { 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(); GameObject[] array = rootGameObjects; foreach (GameObject val in array) { 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0001: Unknown result type (might be due to invalid IL or missing references) return SceneManager.GetActiveScene().GetGameObjectByName(name, useBaseName); } public static List<GameObject> GetAllGameObjectsInScene() { //IL_0001: 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 static class HelperFun { public static string GetPlayerDataPath() { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "PlayerData.json"); } public static void SavePlayerData() { PlayerData instance = PlayerData.instance; if (instance != null) { string contents = JsonUtility.ToJson((object)instance, true); File.WriteAllText(GetPlayerDataPath(), contents); } } public static bool LoadPlayerData() { string playerDataPath = GetPlayerDataPath(); if (File.Exists(playerDataPath)) { string text = File.ReadAllText(playerDataPath); try { PlayerData instance = PlayerData.instance; JsonUtility.FromJsonOverwrite(text, (object)instance); "Load OK".LogInfo(); } catch (Exception msg) { msg.LogError(); return false; } return true; } return false; } public static Texture2D LoadTexture(Stream stream) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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; } public static Texture2D LoadTexture(string path) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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 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 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) { IEnumerable<Type> enumerable = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IModule).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract select t; foreach (Type item in enumerable) { 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(); } } } public class MoreLanguge : IModule { public static Dictionary<(string, string), string> langs = new Dictionary<(string, string), string>(); public override void Init() { base.Init(); } } internal class PreProcess : IModule { public static PreProcess Instance; internal bool shader_initialized = false; 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(); SetAuidoVolume(); } 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 val in componentsInChildren) { val.sortingGroupID = 1048575; val.sortingLayerID = 59515797; } BuildEquippedCharms componentInChildren = charm.GetComponentInChildren<BuildEquippedCharms>(true); if ((Object)(object)componentInChildren != (Object)null) { foreach (GameObject gameObject in componentInChildren.gameObjectList) { Renderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren2) { val2.sortingGroupID = 1048575; val2.sortingLayerID = 59515797; } } } GameObject val3 = KnightInSilksong.loaded_gos["Charm Equip Msg"]; Renderer[] componentsInChildren3 = val3.GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren3) { val4.sortingGroupID = 1048575; val4.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<Rigidbody2D>().constraints = (RigidbodyConstraints2D)4; if (!HelperFun.LoadPlayerData()) { PlayerData.instance.AddGGPlayerDataOverrides(); PlayerData.instance.royalCharmState = 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(); if (shaders.ContainsKey("Sprites/Default-ColorFlash") && !shader_initialized) { shader_initialized = true; KnightInSilksong.logger.LogInfo((object)"Shader Find OK"); SceneManager.activeSceneChanged -= CheckShaders; SetErrorShaders(); } } 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 Shader GetShader(string name) { return shaders.ContainsKey(name) ? shaders[name] : null; } private void SetErrorShaders() { AssetBundle hk = KnightInSilksong.Instance.hk; HashSet<Material> hashSet = new HashSet<Material>(); 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) { hashSet.Add(((Renderer)val).sharedMaterial); } ParticleSystemRenderer[] componentsInChildren2 = value.GetComponentsInChildren<ParticleSystemRenderer>(true); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { hashSet.Add(((Renderer)val2).sharedMaterial); } tk2dSpriteCollectionData[] componentsInChildren3 = value.GetComponentsInChildren<tk2dSpriteCollectionData>(true); foreach (tk2dSpriteCollectionData val3 in componentsInChildren3) { Material[] materials = val3.materials; foreach (Material item in materials) { hashSet.Add(item); } } ChangeFontByLanguage[] componentsInChildren4 = value.GetComponentsInChildren<ChangeFontByLanguage>(true); foreach (ChangeFontByLanguage val4 in componentsInChildren4) { if ((Object)(object)val4.fontJA != (Object)null) { hashSet.Add(((TMP_Asset)val4.fontJA).material); } if ((Object)(object)val4.fontKO != (Object)null) { hashSet.Add(((TMP_Asset)val4.fontKO).material); } if ((Object)(object)val4.fontRU != (Object)null) { hashSet.Add(((TMP_Asset)val4.fontRU).material); } if ((Object)(object)val4.fontZH != (Object)null) { hashSet.Add(((TMP_Asset)val4.fontZH).material); } if ((Object)(object)val4.defaultFont != (Object)null) { hashSet.Add(((TMP_Asset)val4.defaultFont).material); } } TextMeshPro[] componentsInChildren5 = value.GetComponentsInChildren<TextMeshPro>(true); foreach (TextMeshPro val5 in componentsInChildren5) { Material[] fontSharedMaterials = ((TMP_Text)val5).fontSharedMaterials; foreach (Material item2 in fontSharedMaterials) { hashSet.Add(item2); } } } foreach (Material item3 in hashSet) { 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; } } private void SetErrorCollider2D() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos) { GameObject value = loaded_go.Value; Collider2D[] componentsInChildren = value.GetComponentsInChildren<Collider2D>(true); foreach (Collider2D val in componentsInChildren) { val.callbackLayers = LayerMask.op_Implicit(-1); val.contactCaptureLayers = LayerMask.op_Implicit(-1); val.forceReceiveLayers = LayerMask.op_Implicit(-1); val.forceSendLayers = LayerMask.op_Implicit(-1); } } } private void SetAuidoVolume() { foreach (KeyValuePair<string, GameObject> loaded_go in KnightInSilksong.loaded_gos) { GameObject value = loaded_go.Value; AudioSource[] componentsInChildren = 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) { GameObject value = loaded_go.Value; PlayMakerFSM[] componentsInChildren = 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; } } } } } [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; internal GameObject Hornet => ((Component)HeroController.instance).gameObject; private void Awake() { } private void Start() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = Hornet.transform.position; } private void OnEnable() { //IL_0012: 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_0030: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = Hornet.transform.position; BoxCollider2D component = Hornet.GetComponent<BoxCollider2D>(); offset = Vector2.op_Implicit(((Collider2D)component).offset); boxSize = component.size; component.size = ((Component)this).GetComponent<BoxCollider2D>().size; ((Collider2D)component).offset = ((Collider2D)((Component)this).GetComponent<BoxCollider2D>()).offset; ((Behaviour)Hornet.GetComponent<HeroWaterController>()).enabled = false; List<string> list = new List<string>(5) { "Slash", "AltSlash", "DownSlash", "UpSlash", "WallSlash" }; foreach (string item in list) { ((Component)this).gameObject.FindGameObjectInChildren("Attacks").FindGameObjectInChildren(item).FindGameObjectInChildren("Clash Tink") .tag = "Nail Attack"; } } private void Update() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Hornet.transform.position = ((Component)this).transform.position; } private void FixedUpdate() { } private void OnDisable() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) BoxCollider2D component = Hornet.GetComponent<BoxCollider2D>(); ((Collider2D)component).offset = Vector2.op_Implicit(offset); component.size = boxSize; ((Behaviour)Hornet.GetComponent<HeroWaterController>()).enabled = true; } } internal class TrueCharmDisable : MonoBehaviour { private void OnDisable() { if (((Component)this).gameObject.activeSelf) { Patch_InventoryItemSelectableDirectional_Awake.ToggleCharm(); } } } public class GeneralPatch { } [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 bool Prefix(InventoryItemSelectableDirectional __instance) { return true; } public static void Postfix(InventoryItemSelectableDirectional __instance) { //IL_00f3: 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 val3 = gameObject.FindGameObjectInChildren("Button Icon Regular"); Object.Destroy((Object)(object)val2); ((Object)val3).name = "Charm Icon"; Extensions.SetScale2D(val3.transform, new Vector2(0.5f, 0.5f)); val3.GetComponent<SpriteRenderer>().sprite = ModuleManager.GetInstance<PreProcess>().charm_icon; InventoryItemSelectableDirectional component = charmButton.GetComponent<InventoryItemSelectableDirectional>(); InventoryItemSelectableButtonEvent val4 = (InventoryItemSelectableButtonEvent)(object)((component is InventoryItemSelectableButtonEvent) ? component : null); if (val4 != null) { button_action = charmButton.AddComponent<DoAction>(); DoAction doAction = button_action; doAction.action = (Action<DoAction>)Delegate.Combine(doAction.action, new Action<DoAction>(ToggleCharm)); val4.ButtonActivated = (Action)Delegate.Combine(val4.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 + "Method Name is invalid: " + __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_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_0046: 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_0058: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0568: 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) { if (__instance.behaviour.value == "HeroController") { if (__instance.methodName.value == "TakeQuickDamage") { bool isInvincible = PlayerData.instance.isInvincible; PlayerData.instance.isInvincible = false; 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; HeroController.instance.TakeDamage((GameObject)null, (CollisionSide)4, __instance.parameters[0].intValue, 4096); PlayerData.instance.isInvincible = isInvincible2; ((FsmStateAction)__instance).Finish(); return; } 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.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 i = 0; i < __instance.parameters.Length; i++) { FsmVar val = __instance.parameters[i]; val.UpdateValue(); __instance.parametersArray[i] = val.GetValue(); } try { value = __instance.cachedMethodInfo.Invoke(__instance.component, __instance.parametersArray); } catch (TargetParameterCountException) { ParameterInfo[] parameters = __instance.cachedMethodInfo.GetParameters(); Debug.LogErrorFormat((Object)(object)((FsmStateAction)__instance).Owner, "Count did not match. Required: {0}, Was: {1}, Method: {2}", new object[3] { parameters.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_CameraController_DoPositionToHero : GeneralPatch { public static bool Prefix(CameraController __instance, bool forceDirect) { return true; } public static void Postfix(CameraController __instance, bool forceDirect) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CameraController_LockToArea : GeneralPatch { public static bool Prefix(CameraController __instance, CameraLockArea lockArea) { return true; } public static void Postfix(CameraController __instance, CameraLockArea lockArea) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CameraController_ReleaseLock : GeneralPatch { public static bool Prefix(CameraController __instance, CameraLockArea lockarea) { return true; } public static void Postfix(CameraController __instance, CameraLockArea lockarea) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CameraLockArea_OnInsideStateChanged : GeneralPatch { public static bool Prefix(CameraLockArea __instance, bool isInside) { return true; } public static void Postfix(CameraLockArea __instance, bool isInside) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CameraLockArea_IsInApplicableGameState : GeneralPatch { public static bool Prefix(ref bool __result) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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; } public static void Postfix() { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CharmDisplay_Start : GeneralPatch { public static bool Prefix(CharmDisplay __instance) { return true; } 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; } public static void Postfix(CharmIconList __instance, int id) { } } [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; } public static void Postfix(ConveyorZone __instance, Collider2D collision) { } } [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; } public static void Postfix(ConveyorZone __instance, Collider2D collision) { } } [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; } public static void Postfix(ConveyorZone __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageEffectTicker_DoFlashOnEnemy : GeneralPatch { public static bool Prefix(DamageEffectTicker __instance, GameObject enemy) { return true; } public static void Postfix(DamageEffectTicker __instance, GameObject enemy) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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; Transform parent = transform.parent; if (!Object.op_Implicit((Object)(object)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; } public static void Postfix(DamageHero __instance, Collider2D collision) { } } [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; } public static void Postfix(DamageHero __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageHeroDirectly_OnEnter : GeneralPatch { public static bool Prefix(DamageHeroDirectly __instance) { //IL_0047: 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_0071: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected I4, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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; } public static void Postfix(DamageHeroDirectly __instance) { } } [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_002f: 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 (KnightInSilksong.IsKnight && (Object)(object)t == (Object)(object)HeroController.instance.transform) { Transform transform = ((Component)HeroController.instance).transform; transform.position = new Vector3(x, y, transform.position.z); } return true; } public static void Postfix(Transform t, float x, float y) { } } [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_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) if (KnightInSilksong.IsKnight && (Object)(object)t == (Object)(object)HeroController.instance.transform) { Transform transform = ((Component)HeroController.instance).transform; transform.position = new Vector3(position.x, position.y, transform.position.z); } return true; } public static void Postfix(Transform t, Vector2 position) { } } [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; } public static void Postfix(GameObject go, FsmEvent ev, bool isRecursive = false) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameCameras_HUDOut : GeneralPatch { public static bool Prefix(GameCameras __instance) { return true; } 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 bool Prefix(GameCameras __instance) { return true; } 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 bool Prefix(GameManager __instance) { return true; } public static void Postfix(GameManager __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { ((Component)HeroController.instance).transform.position = HeroController.instance.transform.position; } } } [HarmonyPatch(typeof(GameManager), "SetIsInventoryOpen", new Type[] { typeof(bool) })] public class Patch_GameManager_SetIsInventoryOpen : GeneralPatch { public static bool Prefix(GameManager __instance, bool value) { return true; } 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(); } return true; } public static void Postfix(GameManager __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameSettings_LoadAudioSettings : GeneralPatch { public static bool Prefix(GameSettings __instance) { return true; } 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; } } public static void Postfix(GameObject __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; } public static void Postfix(GetHeroCState __instance) { } } [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 Postfix(GetNailDamage __instance) { } 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(); } } [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) { 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) { __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) { __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) { __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_0039: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null) { __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 @bool = PlayerData.instance.GetBool(__instance.boolName.Value); ((FsmStateAction)__instance).fsm.Event(@bool ? __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.Value = flag; ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(PlayerDataBoolAllTrue __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_PlayerDataBoolTrueAndFalse_OnEnter : GeneralPatch { public static bool Prefix(PlayerDataBoolTrueAndFalse __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null) { if (PlayerData.instance.GetBool(__instance.trueBool.Value) && !PlayerData.instance.GetBool(__instance.falseBool.Value)) { ((FsmStateAction)__instance).Fsm.Event(__instance.isTrue); } else { ((FsmStateAction)__instance).Fsm.Event(__instance.isFalse); } ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(PlayerDataBoolTrueAndFalse __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GrassCut_ShouldCut : GeneralPatch { public static bool Prefix(Collider2D collision, ref bool __result) { if (KnightInSilksong.IsKnight) { if (!(((Component)collision).tag == "Nail Attack") && (!(((Component)collision).tag == "HeroBox") || !HeroController.instance.cState.superDashing)) { __result = ((Component)collision).tag == "Sharp Shadow"; } else { __result = true; } if (!__result) { return true; } return false; } return true; } public static void Postfix(Collider2D collision) { } } [HarmonyPatch(typeof(HealthManager), "Hit", new Type[] { typeof(HitInstance) })] public class Patch_HealthManager_Hit : GeneralPatch { public static bool Prefix(HealthManager __instance, HitInstance hitInstance) { return true; } public static void Postfix(HealthManager __instance, HitInstance hitInstance, ref HitResponse __result) { } } [HarmonyPatch(typeof(HealthManager), "Invincible", new Type[] { typeof(HitInstance) })] public class Patch_HealthManager_Invincible : GeneralPatch { public static bool Prefix(HealthManager __instance, ref HitInstance hitInstance) { return true; } public static void Postfix(HealthManager __instance, ref HitInstance hitInstance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 if ((hitInstance.SpecialType & KnightInSilksong.KnightDamage) > 0) { __instance.evasionByHitRemaining = 0.15f; } } } public class Patch_HealthManager_TakeDamage { public static bool Prefix(HealthManager __instance, ref HitInstance hitInstance) { return true; } public static void Postfix(HealthManager __instance, ref HitInstance hitInstance) { } } [HarmonyPatch(typeof(HealthManager), "NonFatalHit", new Type[] { typeof(bool) })] public class Patch_HealthManager_NonFatalHit : GeneralPatch { public static bool Prefix(HealthManager __instance, bool ignoreEvasion) { return true; } public static void Postfix(HealthManager __instance, bool ignoreEvasion) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 if ((__instance.lastHitInstance.SpecialType & KnightInSilksong.KnightDamage) > 0 && !ignoreEvasion && !__instance.hasAlternateHitAnimation) { __instance.evasionByHitRemaining = 0.2f; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HealthManager_IsBlockingByDirection : GeneralPatch { public static bool Prefix(HealthManager __instance, int cardinalDirection, AttackTypes attackType, ref SpecialTypes specialType) { return true; } public static void Postfix(HealthManager __instance, int cardinalDirection, AttackTypes attackType, SpecialTypes specialType, ref bool __result) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HealthManager_IsInvincible : GeneralPatch { public static bool Prefix(HealthManager __instance, bool value) { return true; } public static void Postfix(HealthManager __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HealthManager_InvincibleFromDirection : GeneralPatch { public static bool Prefix(HealthManager __instance, int value) { return true; } public static void Postfix(HealthManager __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroAnimationController_StartControl : GeneralPatch { public static bool Prefix(HeroAnimationController __instance) { return true; } public static void Postfix(HeroAnimationController __instance) { if (KnightInSilksong.IsKnight) { ((Component)HeroController.instance).GetComponent<HeroAnimationController>().StartControl(); } } } [HarmonyPatch(typeof(HeroAnimationController), "StartControlToIdle", new Type[] { typeof(bool) })] public class Patch_HeroAnimationController_StartControlToIdle : GeneralPatch { public static bool Prefix(HeroAnimationController __instance, bool forcePlay) { return true; } public static void Postfix(HeroAnimationController __instance, bool forcePlay) { if (KnightInSilksong.IsKnight) { ((Component)HeroController.instance).GetComponent<HeroAnimationController>().StartControl(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroAnimationController_StopControl : GeneralPatch { public static bool Prefix(HeroAnimationController __instance) { return true; } public static void Postfix(HeroAnimationController __instance) { if (KnightInSilksong.IsKnight) { ((Component)HeroController.instance).GetComponent<HeroAnimationController>().StopControl(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_RelinquishControl : GeneralPatch { public static HeroController hero; public static bool Prefix() { return true; } public static void Postfix() { if (KnightInSilksong.IsKnight) { HeroController.instance.RelinquishControl(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_AffectedByGravity : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance, bool gravityApplies) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if (KnightInSilksong.IsKnight && (int)HeroController.instance.transitionState != 2 && !HeroController.instance.cState.swimming && FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Surface Water").ActiveStateName == "Inactive") { HeroController.instance.AffectedByGravity(gravityApplies); ("AffectedByGravity Patch " + gravityApplies).LogInfo(); } } } [HarmonyPatch(typeof(HeroController), "RegainControl", new Type[] { typeof(bool) })] public class Patch_HeroController_RegainControl : GeneralPatch { public static bool Prefix(HeroController __instance, bool allowInput) { return true; } public static void Postfix(HeroController __instance, bool allowInput) { if (KnightInSilksong.IsKnight) { HeroController.instance.RegainControl(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_StopAnimationControl : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.StopAnimationControl(); } } } [HarmonyPatch(typeof(HeroController), "StartAnimationControl", new Type[] { })] public class Patch_HeroController_StartAnimationControl : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.StartAnimationControl(); } } } [HarmonyPatch(typeof(MonoBehaviour), "StartCoroutine", new Type[] { typeof(IEnumerator) })] public class Patch_MonoBehaviour_StartCoroutine : GeneralPatch { public static bool Prefix(MonoBehaviour __instance, IEnumerator routine) { if ((Object)(object)__instance == (Object)(object)HeroController.instance && KnightInSilksong.IsKnight && !((Component)HeroController.instance).gameObject.activeSelf) { routine.LogInfo(); ((MonoBehaviour)HeroController.instance).StartCoroutine(routine); return false; } return true; } public static void Postfix(MonoBehaviour __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_LeavingScene : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_LeaveScene : GeneralPatch { public static bool Prefix(HeroController __instance, GatePosition? gate) { //IL_0019: 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_0021: 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 if (KnightInSilksong.IsKnight) { "Leave Scene Patch".LogInfo(); if (gate == (GatePosition?)0 || (int)gate.GetValueOrDefault() == 3) { gate.LogInfo(); } HeroController.instance.LeaveScene(gate); return false; } return true; } public static void Postfix(HeroController __instance, ref GatePosition? gate) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_EnterScene : GeneralPatch { public static bool Prefix(HeroController __instance, TransitionPoint enterGate, float delayBeforeEnter) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { if (HeroController.instance.cState.superDashing) { HeroController.instance.SetSuperDashExit(); } if (HeroController.instance.cState.spellQuake) { HeroController.instance.SetQuakeExit(); } ((MonoBehaviour)GameManager.instance).StartCoroutine(HeroController.instance.EnterScene(enterGate, delayBeforeEnter)); enterGate.GetGatePosition().LogInfo(); "EnterScene Patch".LogInfo(); PlayMakerFSM.BroadcastEvent("LEVEL LOADED"); Time.time.LogInfo(); } return true; } public static void Postfix(HeroController __instance, TransitionPoint enterGate, float delayBeforeEnter) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_EnterSceneDreamGate : GeneralPatch { public static bool Prefix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.EnterSceneDreamGate(); ((Renderer)((Component)HeroController.instance).gameObject.GetComponent<MeshRenderer>()).enabled = false; PlayMakerFSM.BroadcastEvent("LEVEL LOADED"); } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_SceneInit : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.SceneInit(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_Respawn : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { ((MonoBehaviour)GameManager.instance).StartCoroutine(HeroController.instance.Respawn()); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_HazardRespawn : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { ((MonoBehaviour)GameManager.instance).StartCoroutine(HeroController.instance.HazardRespawn()); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_MaxHealth : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.MaxHealth(); EventRegister.SendEvent("UPDATE BLUE HEALTH", (GameObject)null); } } } [HarmonyPatch(typeof(HeroController), "AddSilk", new Type[] { typeof(int), typeof(bool), typeof(SilkAddSource), typeof(bool) })] public class Patch_HeroController_AddSilk : GeneralPatch { public static bool Prefix(HeroController __instance, int amount, bool heroEffect, SilkAddSource source, bool forceCanBindEffect) { return true; } public static void Postfix(HeroController __instance, int amount, bool heroEffect, SilkAddSource source, bool forceCanBindEffect) { if (KnightInSilksong.IsKnight) { HeroController.instance.SoulGain(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_IgnoreInput : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.IgnoreInput(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_IgnoreInputWithoutReset : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.IgnoreInputWithoutReset(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_AcceptInput : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.AcceptInput(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_Pause : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.Pause(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_UnPause : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.UnPause(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_RecoilRight : GeneralPatch { public static bool Prefix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.RecoilRight(); return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_RecoilLeft : GeneralPatch { public static bool Prefix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.RecoilLeft(); return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_RecoilDown : GeneralPatch { public static bool Prefix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.RecoilDown(); return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_DownspikeBounce : GeneralPatch { public static bool Prefix(HeroController __instance, bool harpoonRecoil, HeroSlashBounceConfig bounceConfig = null) { if (KnightInSilksong.IsKnight) { Traverse.Create((object)HeroController.instance).Method("CancelBounce", Array.Empty<object>()).GetValue(); HeroController.instance.Bounce(); "ShroomBounce".LogInfo(); return false; } return true; } public static void Postfix(HeroController __instance, bool harpoonRecoil, HeroSlashBounceConfig bounceConfig = null) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_FinishedEnteringScene : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { "Hornet FinishedEnteringScene Patch".LogInfo(); Time.time.LogInfo(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_Awake : GeneralPatch { public static bool Prefix(HeroController __instance) { KnightInSilksong.Instance.InstKnight(); ((Component)HeroController.instance).gameObject.SetActive(false); "Create Knight".LogInfo(); return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_OnDestroy : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { Object.DestroyImmediate((Object)(object)((Component)HeroController.instance).gameObject); "Destroy Knight".LogInfo(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_IsSwimming : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { "IsSwimming Patch".LogInfo(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_NotSwimming : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (!KnightInSilksong.IsKnight) { } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_StartAnimationControlToIdle : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.StartAnimationControl(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_StartAnimationControlToIdleForcePlay : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.StartAnimationControl(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_CanTakeDamage : GeneralPatch { public static bool Prefix(HeroController __instance, ref bool __result) { if (KnightInSilksong.IsKnight) { bool flag = false; flag |= Traverse.Create((object)HeroController.instance).Method("CanTakeDamage", Array.Empty<object>()).GetValue<bool>(); __result = flag; return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_NailParry : GeneralPatch { public static bool Prefix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.NailParry(); return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_NailParryRecover : GeneralPatch { public static bool Prefix(HeroController __instance) { if (KnightInSilksong.IsKnight) { HeroController.instance.NailParryRecover(); return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(typeof(SetPosition), "DoSetPosition")] internal class Patch_SetPosition_DoSetPosition : GeneralPatch { private static void Postfix(SetPosition __instance) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Invalid comparison between Unknown and I4 //IL_010b: 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) if (KnightInSilksong.IsKnight && (Object)(object)((ComponentAction<Transform>)(object)__instance).cachedTransform == (Object)(object)HeroController.instance.transform) { Vector3 val = ((!((NamedVariable)__instance.vector).IsNone) ? __instance.vector.Value : (((int)__instance.space == 0) ? ((ComponentAction<Transform>)(object)__instance).cachedTransform.position : ((ComponentAction<Transform>)(object)__instance).cachedTransform.localPosition)); if (!((NamedVariable)__instance.x).IsNone) { val.x = __instance.x.Value; } if (!((NamedVariable)__instance.y).IsNone) { val.y = __instance.y.Value; } if (!((NamedVariable)__instance.z).IsNone) { val.z = __instance.z.Value; } if ((int)__instance.space == 0) { ((Component)HeroController.instance).transform.position = val; } else { ((Component)HeroController.instance).transform.localPosition = val; } } } } [HarmonyPatch(typeof(SetPosition2D), "DoSetPosition")] internal class Patch_SetPosition2D_DoSetPosition : GeneralPatch { private static void Postfix(SetPosition2D __instance) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (!KnightInSilksong.IsKnight) { return; } GameObject val = null; try { val = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.GameObject); } catch (NullReferenceException) { string text = ""; text = text + ((FsmStateAction)__instance).fsm.name + " "; text = text + ((FsmStateAction)__instance).fsmState.name + " "; text = text + ((Object)((FsmStateAction)__instance).fsm.GameObject).name + " "; if (__instance != null) { if (__instance.GameObject != null) { text = text + ((object)__instance.GameObject)?.ToString() + " "; } } else { text += "null"; } text.LogInfo(); } if ((Object)(object)val == (Object)(object)((Component)HeroController.instance).gameObject) { ((Component)HeroController.instance).transform.position = HeroController.instance.transform.position; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroWaterController_EnterWaterRegion : GeneralPatch { public static bool Prefix(HeroWaterController __instance, SurfaceWaterRegion surfaceWater) { return true; } public static void Postfix(HeroWaterController __instance, SurfaceWaterRegion surfaceWater) { if (!KnightInSilksong.IsKnight) { } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HitInstance_GetActualDirection : GeneralPatch { public static bool Prefix(ref HitInstance __instance, Transform target, TargetType targetType) { return true; } public static void Postfix(ref HitInstance __instance, Transform target, TargetType targetType) { } } [HarmonyPatch(typeof(HitTaker), "Hit", new Type[] { typeof(GameObject), typeof(HitInstance), typeof(int) })] public class Patch_HitTaker_Hit : GeneralPatch { public static bool Prefix(GameObject targetGameObject, HitInstance damageInstance, int recursionDepth = 3) { return true; } public static void Postfix(GameObject targetGameObject, ref HitInstance damageInstance, int recursionDepth = 3) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_InstaDeath_OnEnter : GeneralPatch { public static bool Prefix(InstaDeath __instance) { if (KnightInSilksong.IsKnight) { ModifyOnEnter(__instance); return false; } return true; } public static void Postfix(InstaDeath __instance) { } public static void ModifyOnEnter(InstaDeath __instance) { GameObject safe = FSMUtility.GetSafe(__instance.target, (FsmStateAction)(object)__instance); if ((Object)(object)safe != (Object)null) { HealthManager component = safe.GetComponent<HealthManager>(); if ((Object)(object)component != (Object)null) { if (!component.isDead) { float value = (((NamedVariable)__instance.direction).IsNone ? DirectionUtils.GetAngle(component.GetAttackDirection()) : __instance.direction.Value); component.Die((float?)value, (AttackTypes)1, (NailElements)0, (GameObject)null, false, 1f, true, false); } } else if ((Object)(object)safe.GetComponent<EnemyDeathEffects>() != (Object)null) { safe.GetComponent<EnemyDeathEffects>().ReceiveDeathEvent((float?)DirectionUtils.GetAngle(1), (AttackTypes)1, 0f, false); } } ((FsmStateAction)__instance).Finish(); } } [HarmonyPatch(typeof(iTweenFsmAction), "OnEnteriTween", new Type[] { typeof(FsmOwnerDefault) })] public class Patch_iTweenFsmAction_OnEnteriTween { public static bool Prefix(iTweenFsmAction __instance) { return true; } public static void Postfix(iTweenFsmAction __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null) { __instance.realTime = FsmBool.op_Implicit(true); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Wait_OnEnter { public static bool Prefix(Wait __instance) { return true; } public static void Postfix(Wait __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable<FsmBool>("FromKnight") != null && !(__instance.time.Value <= 0f) && ((FsmStateAction)__instance).fsm.GameObject.layer == LayerMask.NameToLayer("UI")) { __instance.realTime = true; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_KnightHatchling_OnEnable : GeneralPatch { public static bool Prefix(KnightHatchling __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (KnightInSilksong.IsKnight && (Object)(object)__instance.openEffect == (Object)null) { __instance.openEffect = new GameObject("openEffect"); __instance.openEffect.transform.SetParent(((Component)__instance).transform); } return true; } public static void Postfix(KnightHatchling __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_LocateSpawnPoint : GeneralPatch { public static bool Prefix(HeroController __instance, ref Transform __result) { if (KnightInSilksong.IsKnight) { __result = HeroController.instance.LocateSpawnPoint(); return false; } return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_CharmUpdate : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { PlayMakerFSM.BroadcastEvent("CHARM EQUIP CHECK"); PlayMakerFSM.BroadcastEvent("CHARM INDICATOR CHECK"); EventRegister.SendEvent("UPDATE BLUE HEALTH", (GameObject)null); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_Attack : GeneralPatch { public static bool Prefix(HeroController __instance, AttackDirection attackDir) { if (KnightInSilksong.IsKnight) { HeroController.instance.IncrementAttackCounter(); } return true; } public static void Postfix(HeroController __instance, AttackDirection attackDir) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_FinishedEnteringScene : GeneralPatch { public static bool Prefix() { return true; } public static void Postfix() { "Knight FinishedEnteringScene Patch".LogInfo(); Time.time.LogInfo(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_TakeDamage : GeneralPatch { public static bool Prefix(HeroController __instance, GameObject go, CollisionSide damageSide, int damageAmount, ref int hazardType) { if (KnightInSilksong.IsKnight) { if (hazardType == 4) { hazardType = 2; } else if (hazardType == 4096) { hazardType = 4; } else if (hazardType != 1 && hazardType != 8) { hazardType = 2; } } return true; } public static void Postfix(HeroController __instance, GameObject go, CollisionSide damageSide, int damageAmount, int hazardType) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_Die
Knight.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using GlobalEnums; using HutongGames.PlayMaker; using InControl; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Knight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+64444ccf756cfccbb45ca7f2199248fc167ee372")] [assembly: AssemblyProduct("Knight")] [assembly: AssemblyTitle("Knight")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace 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_001a: 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_003c: 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_0009: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0085: 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) 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Invalid comparison between Unknown and I4 //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Invalid comparison between Unknown and I4 //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Invalid comparison between Unknown and I4 //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Invalid comparison between Unknown and I4 //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Invalid comparison between Unknown and I4 //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Invalid comparison between Unknown and I4 //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Invalid comparison between Unknown and I4 //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Invalid comparison between Unknown and I4 //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Invalid comparison between Unknown and I4 //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Invalid comparison between Unknown and I4 //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Invalid comparison between Unknown and I4 //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0309: 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_0016: Unknown result type (might be due to invalid IL or missing references) if (controlEnabled) { controlEnabled = false; stateBeforeControl = actorState; } } public void StartControl() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) actorState = heroCtrl.hero_state; controlEnabled = true; PlayIdle(); } public void StartControlWithoutSettingState() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001b: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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 t = elapsedTime / duration; src.volume = Mathf.Lerp(0f, 1f, t); 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_0049: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected I4, but got Unknown //IL_0104: 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_0124: Unknown result type (might be due to invalid IL or missing references) if (FSMUtility.ContainsFSM(((Component)otherCollider).gameObject, "damages_hero")) { PlayMakerFSM val = FSMUtility.LocateFSM(((Component)otherCollider).gameObject, "damages_hero"); int @int = FSMUtility.GetInt(val, "damageDealt"); int int2 = FSMUtility.GetInt(val, "hazardType"); if (((Component)otherCollider).transform.position.x > ((Component)this).transform.position.x) { heroCtrl.TakeDamage(((Component)otherCollider).gameObject, (CollisionSide)2, @int, int2); } else { heroCtrl.TakeDamage(((Component)otherCollider).gameObject, (CollisionSide)1, @int, int2); } 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_000e: 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 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Invalid comparison between Unknown and I4 //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Invalid comparison between Unknown and I4 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Invalid comparison between Unknown and I4 //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Invalid comparison between Unknown and I4 //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Invalid comparison between Unknown and I4 //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Invalid comparison between Unknown and I4 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0073: 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_009c: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Invalid comparison between Unknown and I4 //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Invalid comparison between Unknown and I4 //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Invalid comparison between Unknown and I4 //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Invalid comparison between Unknown and I4 //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0912: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Unknown result type (might be due to invalid IL or missing references) //IL_095b: Unknown result type (might be due to invalid IL or missing references) //IL_0960: Unknown result type (might be due to invalid IL or missing references) //IL_0971: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0bad: Unknown result type (might be due to invalid IL or missing references) //IL_0bbe: Unknown result type (might be due to invalid IL or missing references) //IL_0bc3: Unknown result type (might be due to invalid IL or missing references) //IL_0bd4: Unknown result type (might be due to invalid IL or missing references) //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_0a07: Unknown result type (might be due to invalid IL or missing references) //IL_0a0c: Unknown result type (might be due to invalid IL or missing references) //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0bf9: Unknown result type (might be due to invalid IL or missing references) //IL_0c09: Unknown result type (might be due to invalid IL or missing references) //IL_0c0e: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_0a52: Unknown result type (might be due to invalid IL or missing references) //IL_0a57: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0ac0: Unknown result type (might be due to invalid IL or missing references) //IL_0aca: Unknown result type (might be due to invalid IL or missing references) //IL_0acf: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0c50: Unknown result type (might be due to invalid IL or missing references) //IL_0c55: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Invalid comparison between Unknown and I4 //IL_0b60: Unknown result type (might be due to invalid IL or missing references) //IL_0b6a: Unknown result type (might be due to invalid IL or missing references) //IL_0b6f: Unknown result type (might be due to invalid IL or missing references) //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: 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_0caf: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Invalid comparison between Unknown and I4 //IL_0dd4: Unknown result type (might be due to invalid IL or missing references) //IL_0d44: Unknown result type (might be due to invalid IL or missing references) //IL_0d4a: Invalid comparison between Unknown and I4 //IL_0cf4: Unknown result type (might be due to invalid IL or missing references) //IL_0d0b: Unknown result type (might be due to invalid IL or missing references) //IL_0d15: Unknown result type (might be due to invalid IL or missing references) //IL_0cd7: Unknown result type (might be due to invalid IL or missing references) //IL_0cdc: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e0a: Unknown result type (might be due to invalid IL or missing references) //IL_0d83: Unknown result type (might be due to invalid IL or missing references) //IL_0d9a: Unknown result type (might be due to invalid IL or missing references) //IL_0da4: Unknown result type (might be due to invalid IL or missing references) //IL_0d66: Unknown result type (might be due to invalid IL or missing references) //IL_0d6b: Unknown result type (might be due to invalid IL or missing references) //IL_0ea0: Unknown result type (might be due to invalid IL or missing references) //IL_0ea5: Unknown result type (might be due to invalid IL or missing references) //IL_0eb7: Unknown result type (might be due to invalid IL or missing references) //IL_0ebc: Unknown result type (might be due to invalid IL or missing references) //IL_0ec1: 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_0064: 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_005f: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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) 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected I4, but got Unknown //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0563: 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_05ad: 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_078a: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_07e7: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_09c8: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Invalid comparison between Unknown and I4 //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_08c0: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_09d6: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Invalid comparison between Unknown and I4 //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) 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_0075: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) cState.facingRight = true; Vector3 localScale = transform.localScale; localScale.x = -1f; transform.localScale = localScale; } public void FaceLeft() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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.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_0007: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) 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_0033: 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) doubleJumped = false; airDashed = false; cState.bouncing = false; cState.shroomBouncing = true; rb2d.velocity = new Vector2(rb2d.velocity.x, SHROOM_BOUNCE_VELOCITY); } public void RecoilLeft() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) 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_0078: Unknown result type (might be due to invalid IL or missing references)