using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DebugMod; using DebugMod.SaveStates; using DebugMod.UI; using DebugMod.UI.Canvas; using GlobalEnums; using GlobalSettings; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using InControl; using KIS; using KIS.Compatibility; using KIS.Utils; using Knight; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using PolyAndCode.UI; using PrepatcherPlugin; using Silksong.ModMenu; using Silksong.ModMenu.Elements; using Silksong.ModMenu.Internal; using Silksong.ModMenu.Models; using Silksong.ModMenu.Plugin; using Silksong.ModMenu.Screens; using TMProOld; using TeamCherry.Localization; using ToJ; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("DebugMod")] [assembly: IgnoresAccessChecksTo("Knight")] [assembly: IgnoresAccessChecksTo("Silksong.ModMenu")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("KIS")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.6.7.0")] [assembly: AssemblyInformationalVersion("0.6.7+47fc3ec7399a3c8aa2c3b10f258cb5c745bafce8")] [assembly: AssemblyProduct("KIS")] [assembly: AssemblyTitle("KnightInSilkSong")] [assembly: NeutralResourcesLanguage("EN")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.6.7.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class SendDreamImpact : FsmStateAction { public FsmOwnerDefault target = new FsmOwnerDefault { ownerOption = (OwnerDefaultOption)1 }; private NeedolinTextOwner needolinTextOwner; public DreamHelper dreamHelper = ((Component)HeroController.instance).GetComponent(); public override void Reset() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ((FsmStateAction)this).Reset(); target = new FsmOwnerDefault(); } public override void OnEnter() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((FsmStateAction)this).OnEnter(); target.ownerOption = (OwnerDefaultOption)1; target.gameObject = base.fsm.GetVariable("Collider"); GameObject safe = FSMUtility.GetSafe(target, (FsmStateAction)(object)this); ("ONENTER " + (object)safe).LogInfo(); if ((Object)(object)safe != (Object)null) { HealthManager component = safe.GetComponent(); if ((Object)(object)component != (Object)null) { safe.LogInfo(); if (!dreamHelper.Exist(component)) { DoDreamImpact(safe); dreamHelper.Add(component); } } } ((FsmStateAction)this).Finish(); } public void DoDreamImpact(GameObject safe) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown int num = (PlayerData.instance.equippedCharm_30 ? 66 : 33); HeroController.instance.AddMPCharge(num); Recoil component = safe.GetComponent(); if ((Object)(object)component != (Object)null) { bool flag = HeroController.instance.transform.localScale.x <= 0f; component.RecoilByDirection((!flag) ? 2 : 0, 2f); } SpriteFlash component2 = safe.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.flashDreamImpact(); } needolinTextOwner = safe.GetComponent(); if ((Object)(object)needolinTextOwner != (Object)null) { needolinTextOwner.OnAddText.AddListener(new UnityAction(RemoveText)); needolinTextOwner.AddNeedolinText(); } } private void RemoveText() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown needolinTextOwner.RemoveNeedolinText(); needolinTextOwner.OnAddText.RemoveListener(new UnityAction(RemoveText)); } public IEnumerator DelayText(NeedolinTextOwner needolinTextOwner) { if (!((Object)(object)needolinTextOwner == (Object)null)) { needolinTextOwner.AddNeedolinText(); yield return (object)new WaitForSeconds(0.2f); NeedolinMsgBox._instance.ClearAllText(); } } } public static class GameObjectUtils { public static T GetAddComponent(this GameObject go) where T : Component { T val = go.GetComponent(); if ((Object)(object)val == (Object)null) { val = go.AddComponent(); } return val; } public static bool RemoveComponent(this GameObject go) where T : Component { T component = go.GetComponent(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); return true; } return false; } public static T copyComponent(this GameObject to, GameObject from) where T : Component { if ((Object)(object)from == (Object)null) { return default(T); } T component = from.GetComponent(); T addComponent = to.GetAddComponent(); if ((Object)(object)component == (Object)null) { return default(T); } FieldInfo[] fields = typeof(T).GetFields(BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod | BindingFlags.CreateInstance | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.PutDispProperty | BindingFlags.PutRefDispProperty | BindingFlags.ExactBinding | BindingFlags.SuppressChangeType | BindingFlags.OptionalParamBinding | BindingFlags.IgnoreReturn); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(addComponent, fieldInfo.GetValue(component)); } return addComponent; } public static void SetScale(this GameObject gameObject, float scaleX, float scaleY) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = gameObject.transform.localScale; localScale.x = scaleX; localScale.y = scaleY; gameObject.transform.localScale = localScale; } public static GameObject FindGameObjectInChildren(this GameObject gameObject, string name, bool useBaseName = false) { if ((Object)(object)gameObject == (Object)null) { return null; } Transform[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (val.GetName(useBaseName) == name) { return ((Component)val).gameObject; } } return null; } public static List FindGameObjectsInChildren(this GameObject gameObject, string name, bool useBaseName = false) { if ((Object)(object)gameObject == (Object)null) { return null; } List list = new List(); Transform[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if (val.GetName(useBaseName) == name) { list.Add(((Component)val).gameObject); } } return list; } public static void Log(this GameObject gameObject) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gameObject == (Object)null) { return; } KnightInSilksong.logger.LogInfo((object)((Object)gameObject).GetName()); KnightInSilksong.logger.LogInfo((object)gameObject.GetPath()); KnightInSilksong.logger.LogInfo((object)("Layer : " + gameObject.layer)); KnightInSilksong.logger.LogInfo((object)("Position : " + ((object)gameObject.transform.position/*cast due to .constrained prefix*/).ToString())); KnightInSilksong.logger.LogInfo((object)("Rotation : " + ((object)gameObject.transform.rotation/*cast due to .constrained prefix*/).ToString())); KnightInSilksong.logger.LogInfo((object)("Scale : " + ((object)gameObject.transform.localScale/*cast due to .constrained prefix*/).ToString())); Component[] components = gameObject.GetComponents(); foreach (Component val in components) { KnightInSilksong.logger.LogInfo((object)("Component : " + ((object)val).GetType())); if (val is PlayMakerFSM) { KnightInSilksong.logger.LogInfo((object)("---- Fsm name :" + ((PlayMakerFSM)((val is PlayMakerFSM) ? val : null)).FsmName)); } } } public static void LogWithChildren(this GameObject gameObject) { if (!((Object)(object)gameObject == (Object)null)) { gameObject.Log(); Transform[] componentsInChildren = gameObject.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.Log(); } } } public static void PrintAllActiveGameObjectsInScene() { GameObject[] array = Object.FindObjectsByType((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 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 GetAllGameObjects(this Scene scene) { List list = new List(); GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { list.Add(val); val.FindAllChildren(list); } return list; } public static GameObject GetGameObjectByName(this Scene scene, string name, bool useBaseName = false) { GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { if (val.GetName(useBaseName) == name) { return val; } GameObject val2 = val.FindGameObjectInChildren(name, useBaseName); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } public static GameObject[] GetRootGameObjects() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene)).GetRootGameObjects(); } public static GameObject GetGameObjectInScene(string name, bool useBaseName = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return SceneManager.GetActiveScene().GetGameObjectByName(name, useBaseName); } public static List GetAllGameObjectsInScene() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return SceneManager.GetActiveScene().GetAllGameObjects(); } public static string GetName(this Transform transform, bool useBaseName = false) { return ((Component)transform).gameObject.GetName(useBaseName); } public static string GetName(this GameObject go, bool useBaseName = false) { string text = ((Object)go).name; if (useBaseName) { text = text.ToLower(); text.Replace("(clone)", ""); text = text.Trim(); text.Replace("cln", ""); text = text.Trim(); text = Regex.Replace(text, "\\([0-9+]+\\)", ""); text = text.Trim(); text = Regex.Replace(text, "[0-9+]+$", ""); text = text.Trim(); text.Replace("(clone)", ""); text = text.Trim(); } return text; } public static string GetPath(this GameObject go, bool useBaseName = false) { string text = go.GetName(useBaseName); GameObject val = go; while ((Object)(object)val.transform.parent != (Object)null && (Object)(object)((Component)val.transform.parent).gameObject != (Object)null) { val = ((Component)val.transform.parent).gameObject; text = val.GetName(useBaseName) + "/" + text; } return text; } } public enum Tool { Silk_Spear, Thread_Sphere, Parry, Silk_Charge, Silk_Bomb, Silk_Boss_Needle, Straight_Pin, Tri_Pin, Sting_Shard, Tack, Harpoon, Curve_Claws, Curve_Claws_Upgraded, Shakra_Ring, Pimpilo, Conch_Drill, WebShot_Forge, WebShot_Architect, WebShot_Weaver, Screw_Attack, Cogwork_Saw, Cogwork_Flier, Rosary_Cannon, Lightning_Rod, Flintstone, Silk_Snare, Flea_Brew, Lifeblood_Syringe, Extractor, Mosscreep_Tool_1, Mosscreep_Tool_2, Lava_Charm, Bell_Bind, Poison_Pouch, Fractured_Mask, Multibind, White_Ring, Brolly_Spike, Quickbind, Spool_Extender, Reserve_Bind, Dazzle_Bind, Dazzle_Bind_Upgraded, Revenge_Crystal, Thief_Claw, Zap_Imbuement, Quick_Sling, Maggot_Charm, Longneedle, Wisp_Lantern, Flea_Charm, Pinstress_Tool, Compass, Bone_Necklace, Rosary_Magnet, Weighted_Anklet, Barbed_Wire, Dead_Mans_Purse, Shell_Satchel, Magnetite_Dice, Scuttlebrace, Wallcling, Musician_Charm, Sprintmaster, Thief_Charm } public enum Charm { WaywardCompass = 2, GatheringSwarm = 1, StalwartShell = 4, SoulCatcher = 20, ShamanStone = 19, SoulEater = 21, Dashmaster = 31, Sprintmaster = 37, Grubsong = 3, GrubberflysElegy = 35, UnbreakableHeart = 23, UnbreakableGreed = 24, UnbreakableStrength = 25, SpellTwister = 33, SteadyBody = 14, HeavyBlow = 15, QuickSlash = 32, Longnail = 18, MarkOfPride = 13, FuryOfTheFallen = 6, ThornsOfAgony = 12, BaldurShell = 5, Flukenest = 11, DefendersCrest = 10, GlowingWomb = 22, QuickFocus = 7, DeepFocus = 34, LifebloodHeart = 8, LifebloodCore = 9, JonisBlessing = 27, Hiveblood = 29, SporeShroom = 17, SharpShadow = 16, ShapeOfUnn = 28, NailmastersGlory = 26, Weaversong = 39, DreamWielder = 30, Dreamshield = 38, Grimmchild = 40, VoidHeart = 36 } public enum Spell { Scream, Fireball, Quake } public enum NailArt { GREAT_SLASH, DASH_SLASH, CYCLONE } public static class KISHelper { public static Action OnReturnToMenu = null; public static Action OnQuitApp = null; internal const HeroDeathCocoonTypes knight_death_cocoon = (HeroDeathCocoonTypes)1073741824; private static Dictionary resourceTextures = new Dictionary(); public static string GetSaveDataDirectory(int slot) { return Path.Combine(Paths.ConfigPath, "shownyoung-KIS", "Slot" + slot); } public static Texture2D ResourceTexture(string name) { if (!resourceTextures.ContainsKey(name)) { resourceTextures.Add(name, LoadTexture(Assembly.GetExecutingAssembly().GetManifestResourceStream("KIS.Resources.Sprites." + name + ".png"))); } return resourceTextures[name]; } private static Texture2D LoadTexture(Stream stream) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); stream.Close(); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { return val; } return null; } private static Texture2D LoadTexture(string path) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read); byte[] array = new byte[fileStream.Length]; fileStream.Read(array, 0, array.Length); fileStream.Close(); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { return val; } return null; } public static GameObject GetCurrentHero() { return FsmVariables.GlobalVariables.FindFsmGameObject("Hero").Value; } public static Component GetComponent(GameObject gameObject, string type) { return gameObject.GetComponent(type); } public static Component GetAnyComponent(this GameObject gameObject) where T1 : Component where T2 : Component { T1 component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { return (Component)(object)component; } T2 component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { return (Component)(object)component2; } return null; } public static Component GetAnotherComponent(this Component monoBehaviour) { bool flag = false; string? fullName = ((object)monoBehaviour).GetType().FullName; if (fullName.StartsWith("Knight")) { flag = true; } string text = fullName.Split(".").Last(); if (!flag) { return ((Component)HeroController.instance).GetComponent(text); } return ((Component)HeroController.instance).GetComponent(text); } public static void LogInfo(this object msg) { if (KnightInSilksong.allowLog.Value) { KnightInSilksong.logger.LogInfo(msg); } } public static void LogWarning(this object msg) { if (KnightInSilksong.allowLog.Value) { KnightInSilksong.logger.LogWarning(msg); } } public static void LogError(this object msg) { if (KnightInSilksong.allowLog.Value) { KnightInSilksong.logger.LogError(msg); } } public static void LogDebug(this object msg) { if (KnightInSilksong.allowLog.Value) { KnightInSilksong.logger.LogDebug(msg); } } public static void LogFatal(this object msg) { if (KnightInSilksong.allowLog.Value) { KnightInSilksong.logger.LogFatal(msg); } } public static string GetToolName(this Tool tool) { return Enum.GetName(typeof(Tool), tool).Replace("_", " "); } public static string GetCharmName(this Charm charm) { int num = (int)charm; return "gotCharm_" + num; } public static void CheckForDamageHero(this HeroBox heroBox, GameObject gameObject) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected I4, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) DamageHero component = gameObject.GetComponent(); if (!((Object)(object)component != (Object)null) || heroBox.heroCtrl.cState.shadowDashing) { return; } heroBox.damageDealt = component.damageDealt; heroBox.hazardType = (int)component.hazardType; heroBox.damagingObject = gameObject; if (component.OverrideCollisionSide) { heroBox.collisionSide = component.CollisionSide; } else { float num = gameObject.transform.position.x; float num2 = ((Component)heroBox).transform.position.x; if (component.InvertCollisionSide) { float num3 = num2; float num4 = num; num = num3; num2 = num4; } heroBox.collisionSide = (CollisionSide)((!(num > num2)) ? 1 : 2); } if (!HeroBox.IsHitTypeBuffered(heroBox.hazardType)) { heroBox.ApplyBufferedHit(); } else { heroBox.isHitBuffered = true; } } public static Type[] GetTypesSafely(this Assembly asm) { try { return asm.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type x) => (object)x != null).ToArray(); } } public static bool IsAssignableFromSafely(this Type self, Type other) { try { return self.IsAssignableFrom(other); } catch { return false; } } public static string InGameKey(this LangKey langKey) { return MoreLanguge.GetInGameKey(langKey); } public static LocalisedString Localize(this LangKey key) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new LocalisedString("Mods.io.github.shownyoung.knightinsilksong", MoreLanguge.GetInGameKey(key)); } public static LocalisedString Localize(this Tool tool) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) return (LocalisedString)(tool switch { Tool.Curve_Claws_Upgraded => new LocalisedString("Tools", "CURVE_CLAWS_UPG_NAME"), Tool.WebShot_Architect => LangKey.MM_SILKSHOT_ARCHITECT.Localize(), Tool.WebShot_Forge => LangKey.MM_SILKSHOT_FORGE.Localize(), Tool.WebShot_Weaver => LangKey.MM_SILKSHOT_WEAVER.Localize(), Tool.Rosary_Cannon => new LocalisedString("Tools", "ROSARYCANNON_NAME"), Tool.Silk_Snare => new LocalisedString("Tools", "SNARE_NAME"), Tool.Lifeblood_Syringe => new LocalisedString("Tools", "SYRINGE_LIFEBLOOD_NAME"), Tool.Brolly_Spike => new LocalisedString("Tools", "BROLLYSPIKE_NAME"), Tool.Dazzle_Bind_Upgraded => new LocalisedString("Tools", "DAZZLE_BIND_UPG_NAME"), Tool.Pinstress_Tool => new LocalisedString("Tools", "PINSTRESS_NAME"), Tool.Screw_Attack => new LocalisedString("Tools", "SCREWATTACK_NAME"), _ => new LocalisedString("Tools", tool.ToString().ToUpper() + "_NAME"), }); } public static LocalisedString Localize(this Charm charm) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (charm == Charm.VoidHeart) { return new LocalisedString("Mods.io.github.shownyoung.knightinsilksong", "CHARM_NAME_36_C"); } int num = (int)charm; return new LocalisedString("Mods.io.github.shownyoung.knightinsilksong", "CHARM_NAME_" + num); } public static string InGameKey(this Charm charm) { if (charm == Charm.VoidHeart) { return "CHARM_NAME_36_C"; } int num = (int)charm; return "CHARM_NAME_" + num; } public static string PdGotField(this Charm charm) { return $"gotCharm_{(int)charm}"; } public static bool IsFragileCharm(this Charm charm) { if (charm >= Charm.UnbreakableHeart) { return charm <= Charm.UnbreakableStrength; } return false; } public static string PdBrokenField(this Charm charm) { if (!charm.IsFragileCharm()) { throw new ArgumentOutOfRangeException("charm", charm, "Not a fragile charm!"); } return $"brokenCharm_{(int)charm}"; } public static string PdUnbreakableField(this Charm charm) { return charm switch { Charm.UnbreakableHeart => "fragileHealth_unbreakable", Charm.UnbreakableGreed => "fragileGreed_unbreakable", Charm.UnbreakableStrength => "fragileStrength_unbreakable", _ => throw new ArgumentOutOfRangeException("charm", charm, "Not a fragile charm!"), }; } public static string PdGotField(this NailArt nailArt) { return nailArt switch { NailArt.GREAT_SLASH => "hasDashSlash", NailArt.DASH_SLASH => "hasUpwardSlash", NailArt.CYCLONE => "hasCyclone", _ => throw new ArgumentOutOfRangeException("nailArt", nailArt, "Not a nail art!"), }; } } public abstract class IModule { public virtual void Init() { } public virtual void Unload() { } } internal static class ModuleManager { private static Dictionary modules = new Dictionary(); private static bool initialized = false; public static T GetInstance() where T : IModule { if (modules.ContainsKey(typeof(T))) { return (T)modules[typeof(T)]; } return null; } public static void Init() { if (!initialized) { foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypesSafely() where typeof(IModule).IsAssignableFromSafely(t) && !t.IsInterface && !t.IsAbstract select t) { try { modules.Add(item, (IModule)Activator.CreateInstance(item)); } catch { KnightInSilksong.logger.LogError((object)("Fail to Create " + item.FullName)); } } initialized = true; } foreach (KeyValuePair module in modules) { module.Value.Init(); } } public static void Unload() { foreach (KeyValuePair module in modules) { module.Value.Unload(); } } } internal class PreProcess : IModule { public static PreProcess Instance; internal bool shader_initialized; private Dictionary material_shader_map; private Dictionary shaders = new Dictionary(); public Sprite charm_icon; public HashSet share_mixer_group = new HashSet(); 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>(text); } charm_icon = KnightInSilksong.Instance.hk.LoadAsset("GG_bound_charm_prompt"); SceneManager.activeSceneChanged += CheckShaders; SSizeKnight(); SSizeHud(); SSizeCharm(); SSizetk2dCollectionData(); SetAuidoVolume(); } private void SSizetk2dCollectionData() { foreach (KeyValuePair loaded_go in KnightInSilksong.loaded_gos) { tk2dSpriteCollectionData[] componentsInChildren = loaded_go.Value.GetComponentsInChildren(true); foreach (tk2dSpriteCollectionData obj in componentsInChildren) { obj.spriteCollectionName += "(Hollownest)"; ((Object)obj).name = obj.spriteCollectionName; } } } private void SSizeCharm() { if ((Object)(object)KnightInSilksong.Instance.charm == (Object)null) { return; } GameObject charm = KnightInSilksong.Instance.charm; Renderer[] componentsInChildren = charm.GetComponentsInChildren(true); foreach (Renderer obj in componentsInChildren) { obj.sortingGroupID = 1048575; obj.sortingLayerID = 59515797; } BuildEquippedCharms componentInChildren = charm.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { foreach (GameObject gameObject in componentInChildren.gameObjectList) { componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (Renderer obj2 in componentsInChildren) { obj2.sortingGroupID = 1048575; obj2.sortingLayerID = 59515797; } } } componentsInChildren = KnightInSilksong.loaded_gos["Charm Equip Msg"].GetComponentsInChildren(true); foreach (Renderer obj3 in componentsInChildren) { obj3.sortingGroupID = 1048575; obj3.sortingLayerID = 59515797; } } private void SSizeHud() { if (!((Object)(object)KnightInSilksong.Instance.hud_canvas == (Object)null)) { GameObject hud_canvas = KnightInSilksong.Instance.hud_canvas; ((Behaviour)FSMUtility.LocateMyFSM(hud_canvas, "Globalise")).enabled = true; hud_canvas.FindGameObjectInChildren("Geo Counter").SetActive(false); } } private void SSizeKnight() { if (!((Object)(object)KnightInSilksong.Instance.knight == (Object)null)) { GameObject knight = KnightInSilksong.Instance.knight; SetErrorCollider2D(); SetErrorFsm(); knight.GetComponent().Library.GetClipByName("Prostrate Rise").frames[1].triggerEvent = true; knight.GetComponent().Library.GetClipByName("Prostrate Rise").frames[18].triggerEvent = true; knight.GetComponent().constraints = (RigidbodyConstraints2D)4; knight.AddComponent(); knight.AddComponent(); KnightInSilksong.loaded_gos["Grimmchild"].tag = "Grimmchild"; KnightInSilksong.loaded_gos["Weaverling"].tag = "Weaverling"; KnightInSilksong.loaded_gos["Knight Hatchling"].tag = "Knight Hatchling"; KnightInSilksong.loaded_gos["Orbit Shield"].tag = "Orbit Shield"; } } private void CheckShaders(Scene arg0, Scene arg1) { SetShaders(); } private void SetShaders() { Shader[] array = Resources.FindObjectsOfTypeAll(); foreach (Shader val in array) { if ((Object)(object)val != (Object)null && val.isSupported && !shaders.ContainsKey(((Object)val).name)) { KnightInSilksong.logger.LogInfo((object)(((Object)val).name + " " + val.isSupported)); shaders.Add(((Object)val).name, val); } } } public void StopGetShader() { if (!shader_initialized) { shader_initialized = true; KnightInSilksong.logger.LogInfo((object)"Shader Find OK"); SceneManager.activeSceneChanged -= CheckShaders; SetErrorShaders(); } } public Shader GetShader(string name) { if (!shaders.ContainsKey(name)) { return null; } return shaders[name]; } private void SetErrorShaders() { _ = KnightInSilksong.Instance.hk; HashSet materials = new HashSet(); HashSet met_fonts = new HashSet(); foreach (KeyValuePair loaded_go in KnightInSilksong.loaded_gos) { GameObject value = loaded_go.Value; SpriteRenderer[] componentsInChildren = value.GetComponentsInChildren(true); foreach (SpriteRenderer val in componentsInChildren) { materials.Add(((Renderer)val).sharedMaterial); } ParticleSystemRenderer[] componentsInChildren2 = value.GetComponentsInChildren(true); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { materials.Add(((Renderer)val2).sharedMaterial); } tk2dSpriteCollectionData[] componentsInChildren3 = value.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Material[] materials2 = componentsInChildren3[i].materials; foreach (Material item in materials2) { materials.Add(item); } } ChangeFontByLanguage[] componentsInChildren4 = value.GetComponentsInChildren(true); foreach (ChangeFontByLanguage obj in componentsInChildren4) { ProcessFont(obj.fontJA); ProcessFont(obj.fontKO); ProcessFont(obj.fontRU); ProcessFont(obj.fontZH); ProcessFont(obj.defaultFont); } TextMeshPro[] componentsInChildren5 = value.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren5.Length; i++) { ProcessFont(((TMP_Text)componentsInChildren5[i]).font); } componentsInChildren5 = value.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren5.Length; i++) { Material[] materials2 = ((TMP_Text)componentsInChildren5[i]).fontSharedMaterials; foreach (Material item2 in materials2) { materials.Add(item2); } } } foreach (Material item3 in materials) { if ((Object)(object)item3 == (Object)null) { "Null Material".LogInfo(); continue; } if (!material_shader_map.ContainsKey(((Object)item3).name)) { KnightInSilksong.logger.LogError((object)("Cant Find The Material " + ((Object)item3).name + " In Map")); continue; } Shader shader = GetShader(material_shader_map[((Object)item3).name]); if ((Object)(object)shader == (Object)null) { switch (material_shader_map[((Object)item3).name]) { case "tk2d/BlendVertexColor": shader = GetShader("tk2d/BlendVertexColor (addressable)"); break; case "UI/BlendModes/Lighten": shader = GetShader("UI/BlendModes/Screen"); break; case "UI/BlendModes/Multiply": shader = GetShader("UI/BlendModes/Screen"); break; case "UI/BlendModes/VividLight": shader = GetShader("UI/BlendModes/Screen"); break; } if ((Object)(object)shader == (Object)null) { KnightInSilksong.logger.LogError((object)("Cant Find The Shader " + material_shader_map[((Object)item3).name] + " For " + ((Object)item3).name)); } } item3.shader = shader; } void ProcessFont(TMP_FontAsset font) { if ((Object)(object)font == (Object)null || met_fonts.Contains(font)) { return; } materials.Add(((TMP_Asset)font).material); met_fonts.Add(font); foreach (TMP_FontAsset fallbackFontAsset in font.fallbackFontAssets) { ProcessFont(fallbackFontAsset); } } } private void SetErrorCollider2D() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair loaded_go in KnightInSilksong.loaded_gos) { Collider2D[] componentsInChildren = loaded_go.Value.GetComponentsInChildren(true); foreach (Collider2D obj in componentsInChildren) { obj.callbackLayers = LayerMask.op_Implicit(-1); obj.contactCaptureLayers = LayerMask.op_Implicit(-1); obj.forceReceiveLayers = LayerMask.op_Implicit(-1); obj.forceSendLayers = LayerMask.op_Implicit(-1); } } } private void SetAuidoVolume() { foreach (KeyValuePair loaded_go in KnightInSilksong.loaded_gos) { AudioSource[] componentsInChildren = loaded_go.Value.GetComponentsInChildren(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 loaded_go in KnightInSilksong.loaded_gos) { PlayMakerFSM[] componentsInChildren = loaded_go.Value.GetComponentsInChildren(true); foreach (PlayMakerFSM val in componentsInChildren) { val.eventHandlerComponentsAdded = false; if (val.UsesTemplate) { val.fsmTemplate.fsm.GetAddVariable("FromKnight", (object)true); val.fsmTemplate.fsm.preprocessed = false; } else { val.GetAddVariable("FromKnight", (object)true); val.fsm.preprocessed = false; } } } } public static void SetDeathInfo() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) HeroCorpseMarkerProxy instance = HeroCorpseMarkerProxy.Instance; HeroController instance2 = HeroController.instance; if (Object.op_Implicit((Object)(object)instance)) { PlayerDataAccess.HeroCorpseScene = instance.TargetSceneName; PlayerDataAccess.HeroCorpseMarkerGuid = instance.TargetGuid; PlayerDataAccess.HeroDeathScenePos = instance.TargetScenePos; } else { Vector3 position = instance2.transform.position; PlayerDataAccess.HeroCorpseScene = instance2.gm.GetSceneNameString(); HeroCorpseMarker closest = HeroCorpseMarker.GetClosest(Vector2.op_Implicit(position)); if (Object.op_Implicit((Object)(object)closest)) { PlayerDataAccess.HeroCorpseMarkerGuid = closest.Guid.ToByteArray(); PlayerDataAccess.HeroDeathScenePos = closest.Position; } else { PlayerDataAccess.HeroCorpseMarkerGuid = null; PlayerDataAccess.HeroDeathScenePos = Vector2.op_Implicit(position); } } tk2dTileMap tilemap = instance2.gm.tilemap; PlayerDataAccess.HeroDeathSceneSize = new Vector2((float)tilemap.width, (float)tilemap.height); instance2.gm.gameMap.PositionCompassAndCorpse(); PlayerDataAccess.IsSilkSpoolBroken = true; PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)0; int num = PlayerData.instance.geoPool; bool isEquipped = ((ToolBase)Gameplay.DeadPurseTool).IsEquipped; if (isEquipped) { int num2 = Mathf.RoundToInt((float)num * Gameplay.DeadPurseHoldPercent); num -= num2; PlayerDataAccess.geo = num2; } else { PlayerDataAccess.geo = 0; } PlayerDataAccess.HeroCorpseMoneyPool = Mathf.RoundToInt((float)num); if (instance2.playerData.IsAnyCursed) { PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)(PlayerDataAccess.HeroCorpseType | 2); } if (isEquipped && PlayerDataAccess.HeroCorpseMoneyPool >= 10) { PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)(PlayerDataAccess.HeroCorpseType | 1); } PlayerDataAccess.HeroCorpseType = (HeroDeathCocoonTypes)(PlayerDataAccess.HeroCorpseType | 0x40000000); PlayerData instance3 = PlayerData.instance; instance3.shadeScene = PlayerDataAccess.HeroCorpseScene; instance3.shadePositionX = PlayerDataAccess.HeroDeathScenePos.x; instance3.shadePositionY = PlayerDataAccess.HeroDeathScenePos.y; instance3.geoPool = PlayerDataAccess.HeroCorpseMoneyPool; } } [RequireComponent(typeof(SpriteRenderer))] internal class CheckKnight : MonoBehaviour { private SpriteRenderer render; private void Awake() { render = ((Component)this).GetComponent(); } 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 action; public void DoActionNow() { action?.Invoke(this); } } public class DreamHelper : MonoBehaviour { public class DreamInfo { public HealthManager hm; public float cd; } public List dream_cds = new List(); public const float general_cd = 0.2f; public bool Exist(HealthManager hm) { if ((Object)(object)hm == (Object)null) { return true; } foreach (DreamInfo dream_cd in dream_cds) { if ((Object)(object)dream_cd.hm == (Object)(object)hm) { return true; } } return false; } public void Add(HealthManager hm) { if (!((Object)(object)hm == (Object)null)) { dream_cds.Add(new DreamInfo { hm = hm, cd = 0.2f }); } } public void Update() { for (int num = dream_cds.Count - 1; num >= 0; num--) { if ((Object)(object)dream_cds[num].hm == (Object)null) { dream_cds.RemoveAt(num); } else { dream_cds[num].cd -= Time.deltaTime; if (dream_cds[num].cd < 0f) { dream_cds.RemoveAt(num); } } } } } internal class KeepHornet : MonoBehaviour { private Vector3 offset; private Vector2 boxSize; private Vector2 boxOffset; private Rigidbody2D hornet_rb; private Vector2 scale; internal static bool test; internal GameObject Hornet => ((Component)HeroController.instance).gameObject; private void Awake() { hornet_rb = Hornet.GetComponent(); } private void Start() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = Hornet.transform.position; } private void OnEnable() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = Hornet.transform.position; BoxCollider2D component = Hornet.GetComponent(); offset = Vector2.op_Implicit(((Collider2D)component).offset); boxSize = component.size; scale = new Vector2(Math.Abs(Extensions.GetScaleX(Hornet.transform)), Math.Abs(Extensions.GetScaleY(Hornet.transform))); component.size = ((Component)this).GetComponent().size; ((Collider2D)component).offset = ((Collider2D)((Component)this).GetComponent()).offset; Extensions.SetScale2D(Hornet.transform, Vector2.op_Implicit(((Component)this).transform.localScale)); ((Behaviour)Hornet.GetComponent()).enabled = false; foreach (string item in new List(5) { "Slash", "AltSlash", "DownSlash", "UpSlash", "WallSlash" }) { ((Component)this).gameObject.FindGameObjectInChildren("Attacks").FindGameObjectInChildren(item).FindGameObjectInChildren("Clash Tink") .tag = "Nail Attack"; } } private void Update() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) Hornet.transform.position = ((Component)this).transform.position; LookingStateSync(); } private void LookingStateSync() { HeroControllerStates cState = HeroController.instance.cState; HeroControllerStates cState2 = HeroController.instance.cState; cState2.lookingUp = cState.lookingUp; cState2.lookingUpAnim = cState.lookingUpAnim; cState2.lookingDown = cState.lookingDown; cState2.lookingDownAnim = cState.lookingDownAnim; } private void FixedUpdate() { if (Mathf.Abs(hornet_rb.linearVelocityY) > 1f) { hornet_rb.linearVelocityY = 0f; } if (Mathf.Abs(hornet_rb.linearVelocityX) > 1f) { hornet_rb.linearVelocityX = 0f; } } private void OnDisable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) BoxCollider2D component = Hornet.GetComponent(); ((Collider2D)component).offset = Vector2.op_Implicit(offset); component.size = boxSize; ((Behaviour)Hornet.GetComponent()).enabled = true; Extensions.SetScale2D(Hornet.transform, new Vector2((float)((Extensions.GetScaleX(Hornet.transform) > 0f) ? 1 : (-1)) * scale.x, scale.y)); } } internal class TrueCharmDisable : MonoBehaviour { private void OnDisable() { if (((Component)this).gameObject.activeSelf) { Patch_InventoryItemSelectableDirectional_Awake.ToggleCharm(); } } } public class GeneralPatch { } public class StartPatch { } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_BounceBallon_Bounce : GeneralPatch { public static bool Prefix() { if (KnightInSilksong.IsKnight) { HeroController.instance.ShroomBounce(); return false; } return true; } } [HarmonyPatch(typeof(BouncePod), "DoBounceOff")] public class Patch_BouncePod_DoBounceOff : GeneralPatch { private static bool Prefix() { if (KnightInSilksong.IsKnight) { HeroController.instance.ShroomBounce(); return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_BuildEquippedCharms_BuildCharmList : GeneralPatch { public static bool Prefix(BuildEquippedCharms __instance) { if (KnightInSilksong.IsKnight) { __instance.equippedCharms = PlayerData.instance.equippedCharms; } return true; } public static void Postfix(BuildEquippedCharms __instance) { if (KnightInSilksong.IsKnight && PlayerData.instance.charmSlotsFilled >= PlayerData.instance.charmSlots) { try { __instance.instanceList.Remove(__instance.nextDot); } catch { } } } } [HarmonyPatch(typeof(InventoryItemSelectableDirectional), "Awake")] public class Patch_InventoryItemSelectableDirectional_Awake : GeneralPatch { public static GameObject charmButton; private static DoAction button_action; public static void Postfix(InventoryItemSelectableDirectional __instance) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) if (!(((Object)((Component)__instance).gameObject).name == "Change Crest Button")) { return; } InventoryItemSelectableButtonEvent val = (InventoryItemSelectableButtonEvent)(object)((__instance is InventoryItemSelectableButtonEvent) ? __instance : null); if (val != null) { charmButton = Object.Instantiate(((Component)__instance).gameObject, ((Component)__instance).gameObject.transform.parent); Extensions.SetPosition2D(charmButton.transform, -7.8865f, -5.53f); ((InventoryItemSelectableDirectional)val).Selectables[3] = (InventoryItemSelectable)(object)charmButton.GetComponent(); charmButton.GetComponent().Selectables[2] = (InventoryItemSelectable)(object)__instance; Object.Destroy((Object)(object)charmButton.FindGameObjectInChildren("Change Crest Action")); GameObject gameObject = charmButton.FindGameObjectInChildren("Parent"); GameObject val2 = gameObject.FindGameObjectInChildren("Button Icon Locked"); GameObject obj = gameObject.FindGameObjectInChildren("Button Icon Regular"); Object.Destroy((Object)(object)val2); ((Object)obj).name = "Charm Icon"; Extensions.SetScale2D(obj.transform, new Vector2(0.5f, 0.5f)); obj.GetComponent().sprite = ModuleManager.GetInstance().charm_icon; InventoryItemSelectableDirectional component = charmButton.GetComponent(); InventoryItemSelectableButtonEvent val3 = (InventoryItemSelectableButtonEvent)(object)((component is InventoryItemSelectableButtonEvent) ? component : null); if (val3 != null) { button_action = charmButton.AddComponent(); DoAction doAction = button_action; doAction.action = (Action)Delegate.Combine(doAction.action, new Action(ToggleCharm)); val3.ButtonActivated = (Action)Delegate.Combine(val3.ButtonActivated, new Action(button_action.DoActionNow)); } charmButton.SetActive(KnightInSilksong.IsKnight); KnightInSilksong instance = KnightInSilksong.Instance; instance.OnToggleKnight = (Action)Delegate.Combine(instance.OnToggleKnight, (Action)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(); 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("Collection Pos").value == 1) { fsm.SendEvent("FINISHED"); } }, 1); val.InsertCustomAction("Right", delegate(PlayMakerFSM fsm) { if (fsm.GetVariable("Collection Pos").value == 40) { fsm.SendEvent("FINISHED"); } }, 1); KnightInSilksong.Instance.charm_instance.AddComponent(); ((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()).enabled = false; } } [HarmonyPatch(typeof(CallMethodProper), "PreCache")] internal class PatchCallMethodProper : GeneralPatch { public static bool Prefix(CallMethodProper __instance) { return true; } public static void Postfix(CallMethodProper __instance) { } private static void Log(object msg) { KnightInSilksong.logger.LogInfo(msg); } private static void Orig_PreCache(CallMethodProper __instance) { GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.gameObject); if ((Object)(object)ownerDefaultTarget == (Object)null) { Log("ownerDefaultTarget is null "); return; } ref MonoBehaviour component = ref __instance.component; Component component2 = ownerDefaultTarget.GetComponent(__instance.behaviour.Value); component = (MonoBehaviour)(object)((component2 is MonoBehaviour) ? component2 : null); if ((Object)(object)__instance.component == (Object)null) { Log("component is null "); return; } __instance.cachedType = ((object)__instance.component).GetType(); try { __instance.cachedMethodInfo = __instance.cachedType.GetMethod(__instance.methodName.Value); } catch (AmbiguousMatchException) { Type[] types = __instance.parameters.Select((FsmVar fsmVar) => fsmVar.RealType).ToArray(); __instance.cachedMethodInfo = __instance.cachedType.GetMethod(__instance.methodName.Value, types); } if (__instance.cachedMethodInfo == null) { __instance.errorString = __instance.errorString + " CallMethodProper Method Name is invalid: " + __instance.behaviour.Value + "::" + __instance.methodName.Value + "\n"; } else { __instance.cachedParameterInfo = __instance.cachedMethodInfo.GetParameters(); } } } [HarmonyPatch(typeof(CallMethodProper), "DoMethodCall")] internal class PatchDoMethodCall : GeneralPatch { public static bool Prefix(CallMethodProper __instance) { try { Modified_DoMethodCall(__instance); } catch (Exception msg) { Log(((Object)((FsmStateAction)__instance).fsm.GameObject).name + " " + ((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " " + __instance.behaviour.value + __instance.methodName.value); Log(msg); } return false; } public static void Postfix(CallMethodProper __instance) { } private static void Log(object msg) { KnightInSilksong.logger.LogInfo(msg); } public static void WarpToDreamGate(GameManager gm) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown gm.entryGateName = "dreamGate"; gm.targetScene = PlayerData.instance.GetString("dreamGateScene"); gm.entryDelay = 0f; gm.cameraCtrl.FreezeInPlace(false); gm.BeginSceneTransition(new SceneLoadInfo { AlwaysUnloadUnusedAssets = true, EntryGateName = "dreamGate", PreventCameraFadeOut = true, SceneName = PlayerData.instance.GetString("dreamGateScene"), Visualization = (SceneLoadVisualizations)2 }); } private static void Modified_DoMethodCall(CallMethodProper __instance) { //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Invalid comparison between Unknown and I4 if (string.IsNullOrEmpty(__instance.behaviour.Value) || string.IsNullOrEmpty(__instance.methodName.Value)) { ((FsmStateAction)__instance).Finish(); return; } if (__instance.behaviour.value == "CharmIconList" && __instance.methodName.value == "GetSprite") { if ((Object)(object)CharmIconList.Instance != (Object)null) { __instance.parameters[0].UpdateValue(); __instance.storeResult.SetValue((object)CharmIconList.Instance.GetSprite(__instance.parameters[0].intValue)); } ((FsmStateAction)__instance).Finish(); return; } if (KnightInSilksong.IsKnight) { FsmVar[] parameters = __instance.parameters; for (int i = 0; i < parameters.Length; i++) { parameters[i].UpdateValue(); } if (__instance.behaviour.value == "HeroController") { if (__instance.methodName.value == "TakeQuickDamage") { bool isInvincible = PlayerData.instance.isInvincible; PlayerData.instance.isInvincible = false; __instance.parameters[0].UpdateValue(); HeroController.instance.TakeDamage((GameObject)null, (CollisionSide)4, __instance.parameters[0].intValue, 4096); PlayerData.instance.isInvincible = isInvincible; ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "TakeQuickDamageSimple") { bool isInvincible2 = PlayerData.instance.isInvincible; PlayerData.instance.isInvincible = false; __instance.parameters[0].UpdateValue(); HeroController.instance.TakeDamage((GameObject)null, (CollisionSide)4, __instance.parameters[0].intValue, 4096); PlayerData.instance.isInvincible = isInvincible2; ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "CancelDamageRecoilSimple") { __instance.methodName.value = "CancelDamageRecoil"; } else { if (__instance.methodName.value == "WillDoBellBindHit") { __instance.storeResult.SetValue((object)false); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "ActivateVoidAcid") { ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "CanTakeDamage") { bool flag = false; flag |= Traverse.Create((object)HeroController.instance).Method("CanTakeDamage", Array.Empty()).GetValue(); __instance.storeResult.SetValue((object)flag); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "GetEntryGateName") { string entryGateName = GameManager.instance.GetEntryGateName(); __instance.storeResult.SetValue((object)entryGateName); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "AddSilk") { __instance.parameters[0].UpdateValue(); __instance.parameters[1].UpdateValue(); HeroController.instance.AddSilk(__instance.parameters[0].intValue, __instance.parameters[1].boolValue); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "EnterUpdraft") { if (PlayerDataAccess.hasBrolly) { PlayerData.instance.SetBool("infiniteAirJump", true); HeroController.instance.airDashed = false; HeroController.instance.doubleJumped = false; } } else if (__instance.methodName.value == "ExitUpdraft") { if (PlayerDataAccess.hasBrolly) { PlayerData.instance.SetBool("infiniteAirJump", WithDebugMod.infinite_jump); } } else if (__instance.methodName.value == "StartAnimationControlToIdle") { HeroController.instance.StartAnimationControlToIdle(); } else { if (__instance.methodName.value == "AddToMaxSilkRegen") { __instance.parameters[0].UpdateValue(); HeroController.instance.AddToMaxSilkRegen(__instance.parameters[0].intValue); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "CocoonBroken") { HeroController.instance.CocoonBroken(); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "AddGeo") { HeroController.instance.AddGeo(__instance.parameters[0].intValue); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "AddGeoQuietly") { HeroController.instance.AddGeoQuietly(__instance.parameters[0].intValue); ((FsmStateAction)__instance).Finish(); return; } if (__instance.methodName.value == "AddGeoToCounter") { HeroController.instance.AddGeoToCounter(__instance.parameters[0].intValue); ((FsmStateAction)__instance).Finish(); return; } } } } if (__instance.behaviour.value == "GameManager" && __instance.methodName.value == "WarpToDreamGate") { WarpToDreamGate(GameManager.instance); ((FsmStateAction)__instance).Finish(); return; } } GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.gameObject); if ((Object)(object)ownerDefaultTarget == (Object)null) { return; } ref MonoBehaviour component = ref __instance.component; Component component2 = ownerDefaultTarget.GetComponent(__instance.behaviour.Value); component = (MonoBehaviour)(object)((component2 is MonoBehaviour) ? component2 : null); if ((Object)(object)__instance.component == (Object)null) { ((FsmStateAction)__instance).LogWarning("CallMethodProper: " + ((Object)ownerDefaultTarget).name + " missing behaviour: " + __instance.behaviour.Value); return; } if (__instance.cachedMethodInfo == null || !__instance.cachedMethodInfo.Name.Equals(__instance.methodName.Value)) { __instance.errorString = string.Empty; if (!__instance.DoCache()) { Debug.LogError((object)__instance.errorString, (Object)(object)((FsmStateAction)__instance).Owner); ((FsmStateAction)__instance).Finish(); return; } } object value = null; if (__instance.cachedParameterInfo.Length == 0) { try { value = __instance.cachedMethodInfo.Invoke(__instance.component, null); } catch (TargetException) { value = __instance.cachedMethodInfo.Invoke(((Component)(object)__instance.component).GetAnotherComponent(), null); } catch (Exception ex2) { Debug.LogError((object)("CallMethodProper error on " + ((FsmStateAction)__instance).Fsm.OwnerName + " -> " + ex2), (Object)(object)((FsmStateAction)__instance).Owner); } } else { for (int j = 0; j < __instance.parameters.Length; j++) { FsmVar val = __instance.parameters[j]; val.UpdateValue(); __instance.parametersArray[j] = val.GetValue(); } try { value = __instance.cachedMethodInfo.Invoke(__instance.component, __instance.parametersArray); } catch (TargetParameterCountException) { ParameterInfo[] parameters2 = __instance.cachedMethodInfo.GetParameters(); Debug.LogErrorFormat((Object)(object)((FsmStateAction)__instance).Owner, "Count did not match. Required: {0}, Was: {1}, Method: {2}", new object[3] { parameters2.Length, __instance.parametersArray.Length, __instance.cachedMethodInfo.Name }); } catch (TargetException) { value = __instance.cachedMethodInfo.Invoke(((Component)(object)__instance.component).GetAnotherComponent(), __instance.parametersArray); } catch (Exception ex5) { Debug.LogError((object)("CallMethodProper error on " + ((FsmStateAction)__instance).Fsm.OwnerName + " -> " + ex5), (Object)(object)((FsmStateAction)__instance).Owner); } } if ((int)__instance.storeResult.Type != -1) { __instance.storeResult.SetValue(value); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CameraLockArea_IsInApplicableGameState : GeneralPatch { public static bool Prefix(ref bool __result) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 if (KnightInSilksong.IsKnight && (Object)(object)GameManager.UnsafeInstance != (Object)null && (int)GameManager.UnsafeInstance.GameState == 6) { __result = true; return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CharmDisplay_Start : GeneralPatch { public static void Postfix(CharmDisplay __instance) { if (!KnightInSilksong.IsKnight) { return; } Sprite val = null; PlayerData instance = PlayerData.instance; switch (__instance.id) { case 23: if (instance.brokenCharm_23) { val = __instance.brokenGlassHP; } break; case 24: if (instance.brokenCharm_24) { val = __instance.brokenGlassGeo; } break; case 25: if (instance.brokenCharm_25) { val = __instance.brokenGlassAttack; } break; case 36: val = ((instance.royalCharmState <= 3) ? __instance.whiteCharm : __instance.blackCharm); break; } if ((Object)(object)val != (Object)null) { if (Object.op_Implicit((Object)(object)__instance.spriteRenderer)) { __instance.spriteRenderer.sprite = val; } if (Object.op_Implicit((Object)(object)__instance.flashSpriteRenderer)) { __instance.flashSpriteRenderer.sprite = val; } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CharmIconList_GetSprite : GeneralPatch { public static bool Prefix(CharmIconList __instance, int id, ref Sprite __result) { if (KnightInSilksong.IsKnight) { PlayerData instance = PlayerData.instance; switch (id) { case 23: if (instance.fragileHealth_unbreakable) { __result = __instance.unbreakableHeart; return false; } break; case 24: if (instance.fragileGreed_unbreakable) { __result = __instance.unbreakableGreed; return false; } break; case 25: if (instance.fragileStrength_unbreakable) { __result = __instance.unbreakableStrength; return false; } break; case 40: switch (instance.grimmChildLevel) { case 1: __result = __instance.grimmchildLevel1; return false; case 2: __result = __instance.grimmchildLevel2; return false; case 3: __result = __instance.grimmchildLevel3; return false; case 4: __result = __instance.grimmchildLevel4; return false; case 5: __result = __instance.nymmCharm; return false; } break; } } return true; } } [HarmonyPatch(typeof(CheckHeroPerformanceRegion), "SendEvents")] public class Patch_CheckHeroPerformanceRegion_SendEvents : GeneralPatch { public static bool Prefix(AffectedState affectedState) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if (!KnightInSilksong.IsKnight) { return true; } if ((int)affectedState == 2) { HeroPerformanceRegion.IsPerforming = false; } return true; } } [HarmonyPatch(typeof(CheckHeroPerformanceRegionBase), "DoAction")] public class Patch_CheckHeroPerformanceRegionBase_DoAction : GeneralPatch { public static void Postfix(CheckHeroPerformanceRegionBase __instance) { if (KnightInSilksong.IsKnight && FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Dream Nail").ActiveStateName == "Slash") { HeroPerformanceRegion.IsPerforming = true; __instance.delay = 0.001f; } } } [HarmonyPatch(typeof(CheckHeroPerformanceRegionV2), "SendEvents")] public class Patch_CheckHeroPerformanceRegionV2_SendEvents : GeneralPatch { public static bool Prefix(AffectedState affectedState) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if (!KnightInSilksong.IsKnight) { return true; } if ((int)affectedState == 2) { HeroPerformanceRegion.IsPerforming = false; } return true; } } [HarmonyPatch] public class PatchCogMultiHitter : GeneralPatch { private static DefaultDict cog_hc_dict = new DefaultDict(() => (HeroController)null); public static HeroController damagingKnight; [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool CogMultiHitter_OnTriggerEnter2D_Prefix(CogMultiHitter __instance, Collider2D other) { if (KnightInSilksong.IsKnight) { OnTriggerEnter2DForKnight(__instance, other); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool CogMultiHitter_CancelDelay_Prefix(CogMultiHitter __instance) { if (KnightInSilksong.IsKnight && Object.op_Implicit((Object)(object)cog_hc_dict[__instance])) { cog_hc_dict[__instance].OnHazardRespawn -= __instance.OnHeroHazardRespawn; } return true; } public static void OnTriggerEnter2DForKnight(CogMultiHitter __instance, Collider2D other) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (Time.timeAsDouble < __instance.canDamageTime || ((Component)other).gameObject.layer != 20) { return; } HeroController componentInParent = ((Component)other).GetComponentInParent(); if (!componentInParent.isHeroInPosition || componentInParent.playerData.isInvincible) { return; } __instance.CancelDelay(); cog_hc_dict[__instance] = componentInParent; componentInParent.OnHazardRespawn += __instance.OnHeroHazardRespawn; Vector3 position = ((Component)componentInParent).transform.position; float angleToTarget; if (__instance.useSelfForAngle) { angleToTarget = __instance.GetAngleToTarget(Vector2.op_Implicit(position), Vector2.op_Implicit(((Component)__instance).transform.position)); } else { GameObject[] array = GameObject.FindGameObjectsWithTag("Cog Grind Marker"); Transform val = null; float num = float.PositiveInfinity; GameObject[] array2 = array; foreach (GameObject val2 in array2) { if (!((Object)(object)val2 == (Object)(object)((Component)__instance).gameObject)) { Transform transform = val2.transform; Vector3 val3 = position - transform.position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; val = transform; } } } angleToTarget = __instance.GetAngleToTarget(Vector2.op_Implicit(position), Vector2.op_Implicit(Object.op_Implicit((Object)(object)val) ? val.position : ((Component)__instance).transform.position)); } EventRegister.SendEvent(EventRegisterEvents.CogDamage, ((Component)__instance).gameObject); ObjectPoolExtensions.Spawn(__instance.hitEffectPrefab, position); EventRegister.SendEvent(EventRegisterEvents.HeroDamaged, (GameObject)null); StaticVariableList.SetValue("Wound Sender Override", (object)((Component)__instance).gameObject, 0); FSMUtility.SendEventToGameObject(((Component)componentInParent).gameObject, "WOUND START", false); componentInParent.CancelAttack(); componentInParent.CancelBounce(); __instance.multiHitRumble.DoShake((Object)(object)__instance, false); if (Object.op_Implicit((Object)(object)__instance.jitter)) { __instance.jitter.StartJitter(); } if (Object.op_Implicit((Object)(object)__instance.cogAnimator)) { __instance.cogAnimator.FreezePosition = true; } Extensions.SetPosition2D(__instance.heroGrindEffect, Vector2.op_Implicit(position)); Extensions.SetRotation2D(__instance.heroGrindEffect, angleToTarget); ((Component)__instance.heroGrindEffect).gameObject.SetActive(true); ((AudioEvent)(ref __instance.heroDamageAudio)).SpawnAndPlayOneShot(position, (Action)null); __instance.delayRoutine = ((MonoBehaviour)__instance).StartCoroutine(DelayEndForKnight(__instance, componentInParent)); } public static IEnumerator DelayEndForKnight(CogMultiHitter __instance, HeroController hc) { yield return (object)new WaitForSeconds(0.35f); __instance.multiHitRumble.CancelShake(); if (Object.op_Implicit((Object)(object)__instance.jitter)) { __instance.jitter.StopJitter(); } DamageKnightDirectly(__instance, hc); yield return (object)new WaitForSeconds(0.2f); ((Component)__instance.heroGrindEffect).gameObject.SetActive(false); } public static void DamageKnightDirectly(CogMultiHitter __instance, HeroController hc) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) hc.playerData.isInvincible = false; hc.cState.focusing = false; hc.TakeDamage(((Component)__instance).gameObject, (CollisionSide)((!(((Component)__instance).transform.position.x > ((Component)hc).transform.position.x)) ? 1 : 2), 1, 2); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ConveyorZone_OnTriggerEnter2D : GeneralPatch { public static bool Prefix(ConveyorZone __instance, Collider2D collision) { if (KnightInSilksong.IsKnight) { if (!__instance.activated) { return true; } __instance.hasEntered = true; __instance.conveyorMovement = ((Component)collision).GetComponent(); if (Object.op_Implicit((Object)(object)__instance.conveyorMovement)) { __instance.conveyorMovement.StartConveyorMove(__instance.speed, 0f); } HeroController component = ((Component)collision).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { if (__instance.vertical) { ((Component)component).GetComponent().StartConveyorMove(0f, __instance.speed); component.cState.onConveyorV = true; } else { component.SetConveyorSpeed(__instance.speed); component.cState.inConveyorZone = true; } } return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ConveyorZone_OnTriggerExit2D : GeneralPatch { public static bool Prefix(ConveyorZone __instance, Collider2D collision) { if (KnightInSilksong.IsKnight) { if (__instance.activated) { __instance.hasEntered = false; ConveyorMovement component = ((Component)collision).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.StopConveyorMove(); } HeroController component2 = ((Component)collision).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { ((Component)component2).GetComponent().StopConveyorMove(); component2.cState.inConveyorZone = false; component2.cState.onConveyorV = false; } } return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ConveyorZone_OnDisable : GeneralPatch { public static bool Prefix(ConveyorZone __instance) { if (KnightInSilksong.IsKnight && __instance.hasEntered) { if (Object.op_Implicit((Object)(object)__instance.conveyorMovement)) { __instance.conveyorMovement.StopConveyorMove(); } HeroController instance = HeroController.instance; if (Object.op_Implicit((Object)(object)instance)) { ((Component)instance).GetComponent().StopConveyorMove(); instance.cState.inConveyorZone = false; instance.cState.onConveyorV = false; } __instance.hasEntered = false; __instance.conveyorMovement = null; __instance.hc = null; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_CustomSceneManager_Start : GeneralPatch { public static bool Prefix(CustomSceneManager __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if ((PlayerDataAccess.HeroCorpseType & 0x40000000) != 0) { __instance.heroCorpsePrefab = KnightInSilksong.loaded_gos["Hollow Shade"]; } return true; } public static void Postfix(CustomSceneManager __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageEffectTicker_DoFlashOnEnemy : GeneralPatch { public static void Postfix(DamageEffectTicker __instance, GameObject enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!KnightInSilksong.IsKnight || (int)__instance.enemySpriteFlash != 0) { return; } string name = ((Object)__instance).name; SpriteFlash component = enemy.GetComponent(); if ((Object)(object)component != (Object)null) { if (name.Contains("Spore")) { component.flashSporeQuick(); } else if (name.Contains("Dung")) { component.flashDungQuick(); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageHero_TryClashTinkCollider : GeneralPatch { public static bool Prefix(DamageHero __instance, Collider2D collision) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { string tag = ((Component)collision).gameObject.tag; Transform transform = ((Component)collision).transform; Vector3 position = transform.position; if (!Object.op_Implicit((Object)(object)transform.parent)) { return true; } if (tag == "Nail Attack") { if (!__instance.canClashTink || __instance.nailClashRoutine != null || __instance.preventClashTink || ((Component)collision).gameObject.layer != 16) { ("Cant Clash " + ((Object)((Component)collision).gameObject).name + " " + ((Object)__instance).name).LogInfo(); (!__instance.canClashTink + " " + (__instance.nailClashRoutine != null) + " " + __instance.preventClashTink).LogInfo(); return false; } ("Clash yes" + ((Object)((Component)collision).gameObject).name + " " + ((Object)__instance).name).LogInfo(); HeroController instance = HeroController.instance; if (tag == "Nail Attack" && !__instance.noClashFreeze && instance.parryInvulnTimer < Mathf.Epsilon) { ("try freeze " + ((Object)((Component)collision).gameObject).name).LogInfo(); GameManager.instance.FreezeMoment((FreezeMomentTypes)3, (Action)null); } float num = 0f; PlayMakerFSM val = FSMUtility.LocateMyFSM(((Component)((Component)collision).gameObject.transform.parent).gameObject, "damages_enemy"); if ((Object)(object)val != (Object)null) { num = val.GetVariable("direction").Value; } __instance.nailClashRoutine = ((MonoBehaviour)__instance).StartCoroutine(__instance.NailClash(num, tag, position)); return false; } } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageHero_OnDamaged : GeneralPatch { public static bool Prefix(DamageHero __instance) { if (KnightInSilksong.IsKnight) { return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageHeroDirectly_OnEnter : GeneralPatch { public static bool Prefix(DamageHeroDirectly __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected I4, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected I4, but got Unknown if (KnightInSilksong.IsKnight) { GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.damager); if ((Object)(object)ownerDefaultTarget == (Object)null) { ((FsmStateAction)__instance).Finish(); return false; } PlayerData.instance.isInvincible = false; HazardType val = (HazardType)1; if (__instance.spikeHazard) { val = (HazardType)2; } else if (__instance.sinkHazard) { val = (HazardType)9; } if (ownerDefaultTarget.transform.position.x > ((Component)HeroController.instance).gameObject.transform.position.x) { HeroController.instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, (int)val); } else { HeroController.instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, (int)val); } ((FsmStateAction)__instance).Finish(); return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_DamageHeroDirectlyV2_OnEnter : GeneralPatch { public static bool Prefix(DamageHeroDirectlyV2 __instance) { if (KnightInSilksong.IsKnight) { ModifiedOnEnter(__instance); return false; } return true; } public static void ModifiedOnEnter(DamageHeroDirectlyV2 __instance) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) GameObject ownerDefaultTarget = ((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.damager); if ((Object)(object)ownerDefaultTarget == (Object)null) { return; } HeroController instance = HeroController.instance; PlayerDataAccess.isInvincible = false; _ = (HazardType)(object)__instance.hazardType.Value; if (((NamedVariable)__instance.overrideDirection).IsNone) { DamageDirection val = (DamageDirection)(object)__instance.damageDirection.Value; if ((int)val != 0) { if ((int)val == 1) { if (__instance.invertDirection.Value) { if (instance.transform.localScale.x > 0f) { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } else { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } } else if (instance.transform.localScale.x < 0f) { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } else { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } } } else if (__instance.invertDirection.Value) { if (ownerDefaultTarget.transform.position.x < ((Component)instance).gameObject.transform.position.x) { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } else { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } } else if (ownerDefaultTarget.transform.position.x > ((Component)instance).gameObject.transform.position.x) { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)2, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } else { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)1, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } } else { instance.TakeDamage(ownerDefaultTarget.gameObject, (CollisionSide)(object)__instance.overrideDirection.Value, __instance.damageAmount.Value, ((NamedVariable)__instance.hazardType).ToInt()); } ((FsmStateAction)__instance).Finish(); } } [HarmonyPatch(typeof(Extensions), "SetPosition2D", new Type[] { typeof(Transform), typeof(float), typeof(float) })] public class Patch_Extensions_SetPosition2D : GeneralPatch { public static bool Prefix(Transform t, float x, float y) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && (Object)(object)t == (Object)(object)HeroController.instance.transform) { Transform transform = HeroController.instance.transform; transform.position = new Vector3(x, y, transform.position.z); } return true; } } [HarmonyPatch(typeof(Extensions), "SetPosition2D", new Type[] { typeof(Transform), typeof(Vector2) })] public class Patch_Extensions_SetPosition2D2 : GeneralPatch { public static bool Prefix(Transform t, ref Vector2 position) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && (Object)(object)t == (Object)(object)HeroController.instance.transform) { Transform transform = HeroController.instance.transform; transform.position = new Vector3(position.x, position.y, transform.position.z); } return true; } } [HarmonyPatch(typeof(FSMUtility), "SendEventToGameObject", new Type[] { typeof(GameObject), typeof(FsmEvent), typeof(bool) })] public class Patch_FSMUtility_SendEventToGameObject : GeneralPatch { public static bool Prefix(GameObject go, FsmEvent ev, bool isRecursive = false) { if (KnightInSilksong.IsKnight && (Object)(object)HeroController.instance != (Object)null && (Object)(object)go == (Object)(object)((Component)HeroController.instance).gameObject) { FSMUtility.SendEventToGameObject(((Component)HeroController.instance).gameObject, ev, isRecursive); return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameCameras_HUDOut : GeneralPatch { public static void Postfix(GameCameras __instance) { if (KnightInSilksong.IsKnight) { FSMUtility.SendEventToGameObject(KnightInSilksong.Instance.hud_instance, "OUT", false); "Hud OUT".LogInfo(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameCameras_HUDIn : GeneralPatch { public static void Postfix(GameCameras __instance) { if (KnightInSilksong.IsKnight) { FSMUtility.SendEventToGameObject(KnightInSilksong.Instance.hud_instance, "IN", false); "Hud IN".LogInfo(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameManager_PositionHeroAtSceneEntrance : GeneralPatch { public static void Postfix(GameManager __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { HeroController.instance.transform.position = HeroController.instance.transform.position; } } } [HarmonyPatch(typeof(GameManager), "SetIsInventoryOpen", new Type[] { typeof(bool) })] public class Patch_GameManager_SetIsInventoryOpen : GeneralPatch { public static void Postfix(GameManager __instance, bool value) { if (KnightInSilksong.IsKnight) { if (value) { __instance.SetTimeScale(1f); HeroController.instance.RelinquishControl(); } else { HeroController.instance.RegainControl(); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameManager_ReturnToMainMenu : GeneralPatch { public static bool Prefix(GameManager __instance) { if (KnightInSilksong.IsKnight) { KnightInSilksong.Instance.ToggleKnight(); KnightInSilksong.return_to_main_menu = true; "return to Main Menu".LogInfo(); } KISHelper.OnReturnToMenu?.Invoke(); return true; } } [HarmonyPatch(typeof(GameManager), "StartNewGame", new Type[] { typeof(bool), typeof(bool) })] public class Patch_GameManager_StartNewGame : GeneralPatch { public static bool Prefix(GameManager __instance, bool permadeathMode, bool bossRushMode) { int profileID = __instance.profileID; if (profileID == 0) { return true; } KnightInSilksong.Instance.current_data = SlotData.CreateSave(profileID, KnightInSilksong.default_sync.Value); KnightInSilksong.Instance.current_data.LoadSave(); return true; } public static void Postfix(GameManager __instance, bool permadeathMode, bool bossRushMode) { } } [HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[] { typeof(SaveGameData), typeof(int) })] public class Patch_GameManager_SetLoadedGameData : GeneralPatch { public static bool Prefix(GameManager __instance, SaveGameData saveGameData, int saveSlot) { if (saveSlot == 0) { return true; } KnightInSilksong.Instance.current_data = new SlotData(saveSlot); KnightInSilksong.Instance.current_data.LoadSave(); return true; } public static void Postfix(GameManager __instance, SaveGameData saveGameData, int saveSlot) { } } [HarmonyPatch(typeof(GameManager), "SaveGame", new Type[] { typeof(int), typeof(Action), typeof(bool), typeof(AutoSaveName) })] public class Patch_GameManager_SaveGame : GeneralPatch { public static bool Prefix(GameManager __instance, int saveSlot, ref Action ogCallback, bool withAutoSave, AutoSaveName autoSaveName) { if (saveSlot == 0) { return true; } Action ogCallbackCopy = ogCallback; ogCallback = delegate(bool didSave) { ogCallbackCopy?.Invoke(didSave); if (didSave) { KnightInSilksong.Instance.current_data.SaveSave(); } }; return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameManager_ClearSaveFile : GeneralPatch { public static bool Prefix(GameManager __instance, int saveSlot, Action callback) { return true; } public static void Postfix(GameManager __instance, int saveSlot, Action callback) { SlotData.DeleteSave(saveSlot); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GameSettings_LoadAudioSettings : GeneralPatch { public static void Postfix(GameSettings __instance) { AudioMixer master = KnightInSilksong.Master; float masterVolume = __instance.masterVolume; float soundVolume = __instance.soundVolume; float num = Helper.LinearToDecibel(masterVolume / 10f); master.SetFloat("MasterVolume", num); num = Helper.LinearToDecibel(soundVolume / 10f); master.SetFloat("SFXVolume", num); "LoadAudioSettings OK".LogInfo(); } } [HarmonyPatch(typeof(GameObject), "GetComponentByName")] internal class PatchGetComponent : GeneralPatch { public static bool Prefix(GameObject __instance, ref Component __result, ref string type) { switch (type) { case "HeroController": __result = __instance.GetAnyComponent(); return false; case "HeroAudioController": __result = __instance.GetAnyComponent(); return false; case "HeroAnimationController": __result = __instance.GetAnyComponent(); return false; case "HeroBox": __result = __instance.GetAnyComponent(); return false; case "NailSlash": __result = __instance.GetAnyComponent(); return false; default: return true; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetHero_OnEnter : GeneralPatch { public static HashSet<(string, string)> blacklist = new HashSet<(string, string)> { ("RestBench", "Bench Control") }; public static bool Prefix(GetHero __instance) { return true; } public static void Postfix(GetHero __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetHeroCState_DoAction : GeneralPatch { public static bool Prefix(GetHeroCState __instance) { if (KnightInSilksong.IsKnight && !((NamedVariable)__instance.VariableName).IsNone && !((NamedVariable)__instance.StoreValue).IsNone && __instance.VariableName.Value == "parrying") { bool flag = false; HeroController instance = HeroController.instance; flag = instance.playerData.equippedCharm_5 && instance.playerData.blockerHits > 0 && instance.cState.focusing; __instance.StoreValue.Value = flag; return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetNailDamage_OnEnter : GeneralPatch { public static bool Prefix(GetNailDamage __instance) { if (KnightInSilksong.IsKnight) { KnightOnEnter(__instance); return false; } return true; } public static void KnightOnEnter(GetNailDamage __instance) { if (!((NamedVariable)__instance.storeValue).IsNone) { if (BossSequenceController.BoundNail) { __instance.storeValue.Value = Mathf.Min(PlayerData.instance.nailDamage, BossSequenceController.BoundNailDamage); } else { __instance.storeValue.Value = PlayerData.instance.nailDamage; } } ((FsmStateAction)__instance).Finish(); } } public static class KnightGetHornetPD { private static HashSet knight_get_hornet_pd_list = new HashSet { "geo" }; public static bool IsFromHornet(string name) { return knight_get_hornet_pd_list.Contains(name); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetPlayerDataBool_OnEnter : GeneralPatch { public static bool Prefix(GetPlayerDataBool __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.boolName.Value)) { if (__instance.boolName.value == "EncounteredLostLace") { (((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " GetPlayerDataBool").LogInfo(); } __instance.storeValue.Value = PlayerData.instance.GetBool(__instance.boolName.Value); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(GetPlayerDataBool __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetPlayerDataFloat_OnEnter : GeneralPatch { public static bool Prefix(GetPlayerDataFloat __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.floatName.Value)) { __instance.storeValue.Value = PlayerData.instance.GetFloat(__instance.floatName.Value); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(GetPlayerDataFloat __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetPlayerDataInt_OnEnter : GeneralPatch { public static bool Prefix(GetPlayerDataInt __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.intName.Value)) { __instance.storeValue.Value = PlayerData.instance.GetInt(__instance.intName.Value); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(GetPlayerDataInt __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetPlayerDataString_OnEnter : GeneralPatch { public static bool Prefix(GetPlayerDataString __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null && KnightGetHornetPD.IsFromHornet(__instance.stringName.Value)) { __instance.storeValue.Value = PlayerData.instance.GetString(__instance.stringName.Value); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(GetPlayerDataString __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_GetPlayerDataVector3_OnEnter : GeneralPatch { public static bool Prefix(GetPlayerDataVector3 __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null && !KnightGetHornetPD.IsFromHornet(__instance.vector3Name.Value)) { __instance.storeValue.Value = PlayerData.instance.GetVector3(__instance.vector3Name.Value); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(GetPlayerDataVector3 __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_PlayerDataBoolTest_OnEnter : GeneralPatch { private static List in_knight_bool = new List { "isInvincible" }; public static bool Prefix(PlayerDataBoolTest __instance) { if (KnightInSilksong.IsKnight && (((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null || Extensions.IsAny(__instance.boolName.Value, in_knight_bool.ToArray()))) { bool flag = PlayerData.instance.GetBool(__instance.boolName.Value); ((FsmStateAction)__instance).fsm.Event(flag ? __instance.isTrue : __instance.isFalse); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(PlayerDataBoolTest __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_PlayerDataBoolAllTrue_DoAllTrue : GeneralPatch { public static bool Prefix(PlayerDataBoolAllTrue __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("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("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_0001: 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) if ((hitInstance.SpecialType & KnightInSilksong.KnightDamage) != 0) { __instance.evasionByHitRemaining = 0.15f; } } } [HarmonyPatch(typeof(HealthManager), "TakeDamage", new Type[] { typeof(HitInstance) })] public class Patch_HealthManager_TakeDamage : GeneralPatch { public static bool Prefix(HealthManager __instance, ref HitInstance hitInstance) { //IL_0001: 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) if ((hitInstance.SpecialType & KnightInSilksong.KnightDamage) != 0) { __instance.WillAwardJournalKill = true; "WillAwardJournalKill".LogDebug(); } 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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) 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_HealthManager_ApplyDamageScaling : GeneralPatch { public static bool Prefix(HealthManager __instance, ref HitInstance hitInstance, ref HitInstance __result) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { if (!KnightInSilksong.apply_damage_scaling.Value) { return true; } if ((hitInstance.SpecialType & KnightInSilksong.KnightDamage) != 0) { int num = PlayerData.instance.nailDamage / 4 - 1; float multFromLevel = __instance.damageScaling.GetMultFromLevel(num); hitInstance.DamageDealt = Mathf.RoundToInt((float)hitInstance.DamageDealt * multFromLevel); __result = hitInstance; return false; } } return true; } public static void Postfix(HealthManager __instance, HitInstance hitInstance) { } } [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().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().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().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_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)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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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 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_0058: 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()).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(typeof(HeroController), "Recoil", new Type[] { typeof(bool), typeof(bool) })] public class Patch_HeroController_Recoil : GeneralPatch { public static bool Prefix(HeroController __instance, bool isRight, bool isLong) { ("Recoil Right:" + isRight + " Long:" + isLong).LogInfo(); if (KnightInSilksong.IsKnight) { if (isRight && isLong) { HeroController.instance.RecoilRightLong(); } else if (isRight && !isLong) { HeroController.instance.RecoilRight(); } if (!isRight && isLong) { HeroController.instance.RecoilLeftLong(); } else if (!isRight && !isLong) { HeroController.instance.RecoilLeft(); } return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_RecoilLeftLong : GeneralPatch { public static bool Prefix(HeroController __instance) { ("RecoilLeftLong " + __instance.CanRecoil()).LogInfo(); 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()).GetValue(); ((Component)HeroController.instance).GetComponent(); HeroController.instance.Bounce(); 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_Start : 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) { _ = 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()).GetValue(); __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(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_SetHeroParent : GeneralPatch { public static bool Prefix(HeroController __instance, Transform newParent) { return true; } public static void Postfix(HeroController __instance, Transform newParent) { if (KnightInSilksong.IsKnight) { HeroController.instance.SetHeroParent(newParent); } } } [HarmonyPatch(typeof(HeroController), "CocoonBroken", new Type[] { typeof(bool), typeof(bool) })] public class Patch_HeroController_CocoonBroken : GeneralPatch { public static void Postfix(HeroController __instance, bool doAirPause, bool forceCanBind) { PlayerData instance = PlayerData.instance; if (instance != null) { instance.EndSoulLimiter(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_DamageSelf : GeneralPatch { public static bool Prefix(HeroController __instance) { if (!KnightInSilksong.IsKnight) { return true; } HeroController.instance.TakeDamage(((Component)HeroController.instance).gameObject, (CollisionSide)1, 1, 0); return true; } public static void Postfix(HeroController __instance) { } } [HarmonyPatch] public class Patch_HeroPlatformStick : GeneralPatch { [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool OnCollisionEnter2D_Prefix(HeroPlatformStick __instance, Collision2D collision) { if (KnightInSilksong.IsKnight) { OnCollisionEnter2DForKnight(__instance, collision); return false; } return true; } private static void OnCollisionEnter2DForKnight(HeroPlatformStick __instance, Collision2D collision) { //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) if (Object.op_Implicit((Object)(object)__instance.insideTracker)) { return; } GameObject gameObject = collision.gameObject; if (gameObject.layer != 9) { return; } HeroController component = gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component) && !(Collision2DUtils.GetSafeContact(collision).Normal.y >= 0f)) { if (HeroPlatformStick._waitRoutine != null) { ((MonoBehaviour)__instance).StopCoroutine(HeroPlatformStick._waitRoutine); HeroPlatformStick._waitRoutine = null; } if (component.cState.onGround) { __instance.wasInside = true; __instance.Refresh(); } else { HeroPlatformStick._waitRoutine = ((MonoBehaviour)__instance).StartCoroutine(WaitForGrounded(__instance, component)); } } } public static IEnumerator WaitForGrounded(HeroPlatformStick __instance, HeroController heroController) { while (!heroController.cState.onGround) { yield return null; } __instance.wasInside = true; __instance.Refresh(); } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool OnCollisionExit2D_Prefix(HeroPlatformStick __instance, Collision2D collision) { if (KnightInSilksong.IsKnight) { OnCollisionExit2DForKnight(__instance, collision); return false; } return true; } private static void OnCollisionExit2DForKnight(HeroPlatformStick __instance, Collision2D collision) { if (Object.op_Implicit((Object)(object)__instance.insideTracker)) { return; } GameObject gameObject = collision.gameObject; if (gameObject.layer == 9 && Object.op_Implicit((Object)(object)gameObject.GetComponent())) { if (HeroPlatformStick._waitRoutine != null) { ((MonoBehaviour)__instance).StopCoroutine(HeroPlatformStick._waitRoutine); HeroPlatformStick._waitRoutine = null; } __instance.wasInside = false; __instance.Refresh(); } } [HarmonyPostfix] [HarmonyPatch(typeof(HeroPlatformStick), "DoParent")] private static void OnDoParent(HeroPlatformStick __instance, HeroController heroController) { HeroController.instance.rb2d.interpolation = (RigidbodyInterpolation2D)0; } [HarmonyPostfix] [HarmonyPatch(typeof(HeroPlatformStick), "DoDeparent")] private static void OnDoDeParent(HeroPlatformStick __instance, HeroController heroController) { HeroController.instance.rb2d.interpolation = (RigidbodyInterpolation2D)1; } } [HarmonyPatch(typeof(SetPosition), "DoSetPosition")] internal class Patch_SetPosition_DoSetPosition : GeneralPatch { private static void Postfix(SetPosition __instance) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && (Object)(object)((ComponentAction)(object)__instance).cachedTransform == (Object)(object)HeroController.instance.transform) { Vector3 val = ((!((NamedVariable)__instance.vector).IsNone) ? __instance.vector.Value : (((int)__instance.space == 0) ? ((ComponentAction)(object)__instance).cachedTransform.position : ((ComponentAction)(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) { HeroController.instance.transform.position = val; } else { HeroController.instance.transform.localPosition = val; } } } } [HarmonyPatch(typeof(SetPosition2D), "DoSetPosition")] internal class Patch_SetPosition2D_DoSetPosition : GeneralPatch { private static void Postfix(SetPosition2D __instance) { //IL_00d9: 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) { 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) { } } [HarmonyPatch(typeof(HeroWaterController), "ExitWaterRegion", new Type[] { typeof(bool) })] public class Patch_HeroWaterController_ExitWaterRegion : GeneralPatch { public static bool Prefix(HeroWaterController __instance, bool vibrate) { return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroWaterController_TumbleOut : GeneralPatch { public static bool Prefix(HeroWaterController __instance, bool vibrate) { if (KnightInSilksong.IsKnight) { return false; } return true; } } [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(); 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() != (Object)null) { safe.GetComponent().ReceiveDeathEvent((float?)DirectionUtils.GetAngle(1), (AttackTypes)1, 0f, false); } } ((FsmStateAction)__instance).Finish(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_InventoryItemToolManager_IsAvailable : GeneralPatch { public static bool Prefix(InventoryItemToolManager __instance, ref bool __result) { if (KnightInSilksong.IsKnight) { if (CollectableItemManager.IsInHiddenMode()) { __result = false; } else { __result = true; } return false; } return true; } public static void Postfix(InventoryItemToolManager __instance) { } } [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("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("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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!KnightInSilksong.IsKnight) { return; } PlayerData instance = PlayerData.instance; if (instance.GetBool("equippedCharm_10")) { __instance.details = __instance.dungDetails; } if (instance.GetBool("equippedCharm_6") && instance.GetInt("health") == 1 && (!instance.GetBool("equippedCharm_27") || instance.GetInt("healthBlue") <= 0)) { if (Object.op_Implicit((Object)(object)__instance.spriteFlash)) { __instance.spriteFlash.FlashingFury(); } __instance.details.damage += 5; } if (Object.op_Implicit((Object)(object)__instance.dungPt)) { if (__instance.details.dung && !__instance.dreamSpawn) { __instance.dungPt.Play(); } else { __instance.dungPt.Stop(); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroBox_CheckForDamage : GeneralPatch { public static DamagePropertyFlags flags; public static void Postfix(HeroBox __instance, Collider2D otherCollider) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { DamageHero component = ((Component)otherCollider).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && !HeroController.instance.cState.shadowDashing) { flags = component.damagePropertyFlags; } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroBox_ApplyBufferedHit : GeneralPatch { public static bool Prefix(HeroBox __instance) { //IL_0021: 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) if (KnightInSilksong.IsKnight) { Traverse val = Traverse.Create((object)__instance).Field("damageDealt"); if (val.GetValue() > 0 && (Patch_Knight_HeroBox_CheckForDamage.flags & 4) != 0) { val.SetValue((object)2); } } return true; } } [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; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_HeroController_CharmUpdate : GeneralPatch { 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; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_FinishedEnteringScene : GeneralPatch { public static void Postfix() { EventRegister.SendEvent("ENTERING SCENE", (GameObject)null); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_TakeDamage : GeneralPatch { public static HazardType last_hazard_type; public static bool Prefix(HeroController __instance, GameObject go, CollisionSide damageSide, int damageAmount, ref int hazardType) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { last_hazard_type = (HazardType)hazardType; if (hazardType == 4) { hazardType = 2; } else if (hazardType == 4096) { hazardType = 4; } else if (hazardType != 1 && hazardType != 8) { hazardType = 2; } } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_Die : GeneralPatch { public static bool Prefix(HeroController __instance) { "Try Dead".LogInfo(); HeroController.instance.cState.dead = true; ((MonoBehaviour)GameManager.instance).StartCoroutine(HeroController.instance.Die(false, false)); "Try Dead".LogInfo(); return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_CanTakeDamage : GeneralPatch { public static bool Prefix(HeroController __instance, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)__instance.damageMode == 1 || __instance.cState.shadowDashing || __instance.parryInvulnTimer > 0f) { __result = false; return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_HazardRespawn : GeneralPatch { public static bool Prefix(HeroController __instance) { ((Component)__instance).GetComponent().bodyType = (RigidbodyType2D)0; return true; } } [HarmonyPatch] public class Give_One_WallJump : GeneralPatch { public static bool used_walljump; [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void Knight_HeroController_DoWallJump_PostFix(HeroController __instance) { if (KnightInSilksong.IsKnight) { used_walljump = true; } } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void Postfix(HeroController __instance) { if (KnightInSilksong.IsKnight) { used_walljump = false; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_CanInfiniteAirJump : GeneralPatch { public static void Postfix(HeroController __instance, ref bool __result) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (__result) { tk2dSpriteAnimator component = ((Component)HeroController.instance).GetComponent(); component.Stop(); component.state.LogInfo(); } } } [HarmonyPatch] public class Patch_Knight_HeroController_DieFromHazard : GeneralPatch { [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool Prefix(HeroController __instance, ref HazardType hazardType, float angle) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)Patch_Knight_HeroController_TakeDamage.last_hazard_type == 4) { hazardType = (HazardType)4; } return true; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void Postfix(HeroController __instance, HazardType hazardType, float angle) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if ((int)hazardType == 4) { GameObject obj = ObjectPoolExtensions.Spawn(HeroController.instance.lavaDeathPrefab); obj.transform.position = HeroController.instance.transform.position; obj.transform.localScale = HeroController.instance.transform.localScale; DeliveryQuestItem.BreakAll(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_FaceLeft : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) Vector3 localScale = __instance.transform.localScale; localScale.x *= KnightInSilksong.knight_scaleX.Value; localScale.y = KnightInSilksong.knight_scaleY.Value; Extensions.SetScale2D(__instance.transform, Vector2.op_Implicit(localScale)); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_FaceRight : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) Vector3 localScale = __instance.transform.localScale; localScale.x *= KnightInSilksong.knight_scaleX.Value; localScale.y = KnightInSilksong.knight_scaleY.Value; Extensions.SetScale2D(__instance.transform, Vector2.op_Implicit(localScale)); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_Update10 : GeneralPatch { public static bool Prefix(HeroController __instance) { return true; } public static void Postfix(HeroController __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) Vector3 localScale = __instance.transform.localScale; localScale.x *= KnightInSilksong.knight_scaleX.Value; localScale.y = KnightInSilksong.knight_scaleY.Value; Extensions.SetScale2D(__instance.transform, Vector2.op_Implicit(localScale)); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_HeroController_DoDoubleJump : GeneralPatch { public static void Postfix(HeroController __instance) { if (PlayerData.instance.infiniteAirJump) { __instance.doubleJumped = false; } } } [HarmonyPatch(typeof(NailSlash), "OnTriggerEnter2D")] public class Patch_NailSlash_OnTriggerEnter2D : GeneralPatch { public static bool Prefix(NailSlash __instance, Collider2D otherCollider) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) //IL_00d2: 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) if (!PlayerDataAccess.hasHarpoonDash) { return true; } if (((Component)otherCollider).gameObject.tag == "Harpoon Ring") { GameObject gameObject = ((Component)otherCollider).gameObject; Object.Destroy((Object)(object)gameObject.GetComponent()); ("Hit ring " + ((Object)gameObject).name).LogInfo(); PlayMakerFSM val = null; PlayMakerFSM[] components = gameObject.GetComponents(); foreach (PlayMakerFSM val2 in components) { if (val2.FsmName == "ride") { val = val2; } if (val2.FsmName == "Rail Control") { val = val2; } } if ((Object)(object)val != (Object)null) { val.SendEvent("SELF RING GRAB"); val.SendEvent("CONNECT"); Rigidbody2D component = ((Component)HeroController.instance).GetComponent(); component.position = new Vector2(component.position.x, component.position.y + 0.3f); } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.ToLower() == "under_18" && ((Object)gameObject).name == "Harpoon Ring Citadel") { PlayMakerFSM val3 = null; components = GameObject.Find("Harpoon Ring Pull Switch").GetComponents(); foreach (PlayMakerFSM val4 in components) { if (val4.FsmName == "Pull Control") { val3 = val4; } } val3.SendEvent("CONNECT"); } Transform parent = gameObject.transform.parent; if ((Object)(object)parent != (Object)null) { Transform parent2 = ((Component)parent).transform.parent; if ((Object)(object)parent2 != (Object)null) { GameObject gameObject2 = ((Component)parent2).gameObject; if ((Object)(object)gameObject2.GetComponent() != (Object)null) { openHarpoonGate(gameObject2); } } } } else if ((Object)(object)((Component)otherCollider).gameObject.GetComponentInChildren() != (Object)null && __instance.slashAngle == 270f) { HeroController.instance.ShroomBounce(); return false; } return true; } private static void openHarpoonGate(GameObject gate) { gate.GetComponent().HeroOnRing(); } } [HarmonyPatch(typeof(PlayerData), "SetHazardRespawn", new Type[] { typeof(HazardRespawnMarker) })] public class Patch_PlayerData_SetHazardRespawn2 : GeneralPatch { public static bool Prefix(PlayerData __instance, HazardRespawnMarker location) { //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) __instance.hazardRespawnLocation = ((Component)location).transform.position; return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_PlayerData_TakeHealth : GeneralPatch { public static bool Prefix(PlayerData __instance, int amount) { return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Knight_PlayerData_GetBool : GeneralPatch { public static void Postfix(PlayerData __instance, string boolName, ref bool __result) { if (boolName == "hasWalljump") { __result |= !Give_One_WallJump.used_walljump; } } } [HarmonyPatch(typeof(Language), "Get", new Type[] { typeof(string), typeof(string) })] public class Patch_Language_Get : StartPatch { private static void CheckText(ref string key, ref string sheetTitle) { if (sheetTitle == "UI" && (key.StartsWith("CHARM_NAME_") || key.StartsWith("CHARM_DESC_") || key.StartsWith("CHARM_TXT_"))) { sheetTitle = "Mods.io.github.shownyoung.knightinsilksong"; } } public static bool Prefix(ref string key, ref string sheetTitle, ref string __result) { CheckText(ref key, ref sheetTitle); return true; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool Language_Has_Prefix(ref string key, ref string sheetTitle) { CheckText(ref key, ref sheetTitle); return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ListenForJump_OnEnter : GeneralPatch { public static bool Prefix(ListenForJump __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null) { __instance.activeBool = FsmBool.op_Implicit(true); } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ListenForJump_CheckInput : GeneralPatch { public static bool Prefix(ListenForJump __instance) { if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null) { CheckInput(__instance); return false; } return true; } private static void CheckInput(ListenForJump __instance) { if (GameManager.instance.isPaused || (!((NamedVariable)__instance.activeBool).IsNone && !__instance.activeBool.Value)) { return; } if (((OneAxisInputControl)__instance.inputHandler.inputActions.Jump).WasPressed) { "WAS PRESSED1".LogInfo(); ((FsmStateAction)__instance).Fsm.Event(__instance.wasPressed); "WAS PRESSED2".LogInfo(); if (!((NamedVariable)__instance.queueBool).IsNone) { __instance.queueBool.Value = true; } } if (((OneAxisInputControl)__instance.inputHandler.inputActions.Jump).WasReleased) { ((FsmStateAction)__instance).Fsm.Event(__instance.wasReleased); } if (((OneAxisInputControl)__instance.inputHandler.inputActions.Jump).IsPressed) { ((FsmStateAction)__instance).Fsm.Event(__instance.isPressed); } if (!((OneAxisInputControl)__instance.inputHandler.inputActions.Jump).IsPressed) { ((FsmStateAction)__instance).Fsm.Event(__instance.isNotPressed); if (!((NamedVariable)__instance.queueBool).IsNone) { __instance.queueBool.Value = false; } } } } public class Patch_Mask_Update { public static IDictionary valuePairs; public static List check_list; public static bool Prefix(Mask __instance) { OrigUpdate(__instance); return false; } private unsafe static void ModifiedUpdate(Mask __instance) { //IL_0093: 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_0136: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Invalid comparison between Unknown and I4 //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Invalid comparison between Unknown and I4 //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Invalid comparison between Unknown and I4 //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Invalid comparison between Unknown and I4 //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: 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_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_086f: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0951: 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_09d6: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06db: Unknown result type (might be due to invalid IL or missing references) //IL_06e0: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Expected I4, but got Unknown //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: 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_071d: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_07f7: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_0813: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_0837: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0847: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance._maskedSpriteWorldCoordsShader == (Object)null) { __instance._maskedSpriteWorldCoordsShader = Shader.Find("Alpha Masked/Sprites Alpha Masked - World Coords"); } if ((Object)(object)__instance._maskedUnlitWorldCoordsShader == (Object)null) { __instance._maskedUnlitWorldCoordsShader = Shader.Find("Alpha Masked/Unlit Alpha Masked - World Coords"); } if ((Object)(object)__instance._maskedSpriteWorldCoordsShader == (Object)null || (Object)(object)__instance._maskedUnlitWorldCoordsShader == (Object)null) { if (!__instance.shaderErrorLogged) { Debug.LogError((object)"Shaders necessary for masking don't seem to be present in the project."); } } else { if (!((Component)__instance).transform.hasChanged) { return; } "Begin Change".LogInfo(); ((Component)__instance).transform.hasChanged = false; if ((int)__instance.maskMappingWorldAxis == 0 && (Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.x, 0f)) > 0.01f || Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.y, (float)(__instance.invertAxis ? (-90) : 90))) > 0.01f)) { ((Component)__instance).transform.eulerAngles = new Vector3(0f, (float)(__instance.invertAxis ? 270 : 90), ((Component)__instance).transform.eulerAngles.z); } else if ((int)__instance.maskMappingWorldAxis == 1 && (Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.x, (float)(__instance.invertAxis ? (-90) : 90))) > 0.01f || Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.z, 0f)) > 0.01f)) { ((Component)__instance).transform.eulerAngles = new Vector3((float)(__instance.invertAxis ? (-90) : 90), ((Component)__instance).transform.eulerAngles.y, 0f); } else if ((int)__instance.maskMappingWorldAxis == 2 && (Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.x, 0f)) > 0.01f || Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.y, (float)(__instance.invertAxis ? (-180) : 0))) > 0.01f)) { ((Component)__instance).transform.eulerAngles = new Vector3(0f, (float)(__instance.invertAxis ? (-180) : 0), ((Component)__instance).transform.eulerAngles.z); } if (!((Object)(object)((Component)__instance).transform.parent != (Object)null)) { return; } "Parent Changed".LogInfo(); Renderer[] componentsInChildren = ((Component)((Component)__instance).transform.parent).gameObject.GetComponentsInChildren(); Graphic[] componentsInChildren2 = ((Component)((Component)__instance).transform.parent).gameObject.GetComponentsInChildren(); List list = (check_list = new List()); Dictionary dictionary = (Dictionary)(valuePairs = new Dictionary()); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!((Object)(object)((Component)val).gameObject != (Object)(object)((Component)__instance).gameObject)) { continue; } Material[] sharedMaterials = val.sharedMaterials; foreach (Material item in sharedMaterials) { if (!list.Contains(item)) { list.Add(item); } } } Graphic[] array2 = componentsInChildren2; foreach (Graphic val2 in array2) { if ((Object)(object)((Component)val2).gameObject != (Object)(object)((Component)__instance).gameObject && !list.Contains(val2.material)) { list.Add(val2.material); Canvas canvas = val2.canvas; if ((int)canvas.renderMode == 0 || ((int)canvas.renderMode == 1 && (Object)(object)canvas.worldCamera == (Object)null)) { dictionary.Add(list[list.Count - 1], val2); } } } Vector2 val3 = default(Vector2); foreach (Material item2 in list) { if (((object)item2.shader).ToString() == ((object)__instance._maskedSpriteWorldCoordsShader).ToString() && ((Object)item2.shader).GetInstanceID() != ((Object)__instance._maskedSpriteWorldCoordsShader).GetInstanceID()) { __instance._maskedSpriteWorldCoordsShader = null; } if (((object)item2.shader).ToString() == ((object)__instance._maskedUnlitWorldCoordsShader).ToString() && ((Object)item2.shader).GetInstanceID() != ((Object)__instance._maskedUnlitWorldCoordsShader).GetInstanceID()) { __instance._maskedUnlitWorldCoordsShader = null; } if (!((Object)(object)item2.shader == (Object)(object)__instance._maskedSpriteWorldCoordsShader) && !((Object)(object)item2.shader == (Object)(object)__instance._maskedUnlitWorldCoordsShader)) { continue; } item2.DisableKeyword("_SCREEN_SPACE_UI"); ((Vector2)(ref val3))..ctor(1f / ((Component)__instance).transform.lossyScale.x, 1f / ((Component)__instance).transform.lossyScale.y); Vector2 val4 = Vector2.zero; float num = 0f; int num2 = 1; if ((int)__instance.maskMappingWorldAxis == 0) { num2 = (__instance.invertAxis ? 1 : (-1)); ((Vector2)(ref val4))..ctor(0f - ((Component)__instance).transform.position.z, 0f - ((Component)__instance).transform.position.y); num = (float)num2 * ((Component)__instance).transform.eulerAngles.z; } else if ((int)__instance.maskMappingWorldAxis == 1) { ((Vector2)(ref val4))..ctor(0f - ((Component)__instance).transform.position.x, 0f - ((Component)__instance).transform.position.z); num = 0f - ((Component)__instance).transform.eulerAngles.y; } else if ((int)__instance.maskMappingWorldAxis == 2) { num2 = ((!__instance.invertAxis) ? 1 : (-1)); ((Vector2)(ref val4))..ctor(0f - ((Component)__instance).transform.position.x, 0f - ((Component)__instance).transform.position.y); num = (float)num2 * ((Component)__instance).transform.eulerAngles.z; } RectTransform component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { Rect rect = component.rect; val4 += Vector2.op_Implicit(((Component)__instance).transform.right * (component.pivot.x - 0.5f) * ((Rect)(ref rect)).width * ((Component)__instance).transform.lossyScale.x + ((Component)__instance).transform.up * (component.pivot.y - 0.5f) * ((Rect)(ref rect)).height * ((Component)__instance).transform.lossyScale.y); val3.x /= ((Rect)(ref rect)).width; val3.y /= ((Rect)(ref rect)).height; } if (dictionary.ContainsKey(item2)) { val4 = Vector2.op_Implicit(((Component)dictionary[item2]).transform.InverseTransformVector(Vector2.op_Implicit(val4))); MappingAxis maskMappingWorldAxis = __instance.maskMappingWorldAxis; switch ((int)maskMappingWorldAxis) { case 0: val4.x *= ((Component)dictionary[item2]).transform.lossyScale.z; val4.y *= ((Component)dictionary[item2]).transform.lossyScale.y; break; case 1: val4.x *= ((Component)dictionary[item2]).transform.lossyScale.x; val4.y *= ((Component)dictionary[item2]).transform.lossyScale.z; break; case 2: val4.x *= ((Component)dictionary[item2]).transform.lossyScale.x; val4.y *= ((Component)dictionary[item2]).transform.lossyScale.y; break; } Canvas canvas2 = dictionary[item2].canvas; val4 /= canvas2.scaleFactor; val4 = Vector2.op_Implicit(__instance.RotateVector(Vector2.op_Implicit(val4), ((Component)dictionary[item2]).transform.eulerAngles)); val4 += ((Component)canvas2).GetComponent().sizeDelta * 0.5f; val3 *= canvas2.scaleFactor; item2.EnableKeyword("_SCREEN_SPACE_UI"); } Vector2 mainTextureScale = ((Component)__instance).gameObject.GetComponent().sharedMaterial.mainTextureScale; val3.x *= mainTextureScale.x; val3.y *= mainTextureScale.y; val3.x *= num2; Vector2 val5 = val4; float num3 = Mathf.Sin((0f - num) * (MathF.PI / 180f)); float num4 = Mathf.Cos((0f - num) * (MathF.PI / 180f)); val4.x = (num4 * val5.x - num3 * val5.y) * val3.x + 0.5f * mainTextureScale.x; val4.y = (num3 * val5.x + num4 * val5.y) * val3.y + 0.5f * mainTextureScale.y; val4 += ((Component)__instance).gameObject.GetComponent().sharedMaterial.mainTextureOffset; ("Vector: " + ((object)(*(Vector2*)(&val4))/*cast due to .constrained prefix*/).ToString()).LogInfo(); ("Value: " + ((object)(*(Vector2*)(&val3))/*cast due to .constrained prefix*/).ToString()).LogInfo(); ("Num: " + num).LogInfo(); ("Num in Radians: " + num * (MathF.PI / 180f)).LogInfo(); item2.SetTextureOffset("_AlphaTex", val4); item2.SetTextureScale("_AlphaTex", val3); item2.SetFloat("_MaskRotation", num * (MathF.PI / 180f)); } } } private static void OrigUpdate(Mask __instance) { //IL_0089: 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_012c: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Invalid comparison between Unknown and I4 //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Invalid comparison between Unknown and I4 //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Invalid comparison between Unknown and I4 //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Invalid comparison between Unknown and I4 //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_086c: Unknown result type (might be due to invalid IL or missing references) //IL_0883: Unknown result type (might be due to invalid IL or missing references) //IL_0885: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_0931: 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_0948: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Expected I4, but got Unknown //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07da: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_07f8: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_082c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance._maskedSpriteWorldCoordsShader == (Object)null) { __instance._maskedSpriteWorldCoordsShader = Shader.Find("Alpha Masked/Sprites Alpha Masked - World Coords"); } if ((Object)(object)__instance._maskedUnlitWorldCoordsShader == (Object)null) { __instance._maskedUnlitWorldCoordsShader = Shader.Find("Alpha Masked/Unlit Alpha Masked - World Coords"); } if ((Object)(object)__instance._maskedSpriteWorldCoordsShader == (Object)null || (Object)(object)__instance._maskedUnlitWorldCoordsShader == (Object)null) { if (!__instance.shaderErrorLogged) { Debug.LogError((object)"Shaders necessary for masking don't seem to be present in the project."); } } else { if (!((Component)__instance).transform.hasChanged) { return; } ((Component)__instance).transform.hasChanged = false; if ((int)__instance.maskMappingWorldAxis == 0 && (Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.x, 0f)) > 0.01f || Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.y, (float)(__instance.invertAxis ? (-90) : 90))) > 0.01f)) { ((Component)__instance).transform.eulerAngles = new Vector3(0f, (float)(__instance.invertAxis ? 270 : 90), ((Component)__instance).transform.eulerAngles.z); } else if ((int)__instance.maskMappingWorldAxis == 1 && (Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.x, (float)(__instance.invertAxis ? (-90) : 90))) > 0.01f || Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.z, 0f)) > 0.01f)) { ((Component)__instance).transform.eulerAngles = new Vector3((float)(__instance.invertAxis ? (-90) : 90), ((Component)__instance).transform.eulerAngles.y, 0f); } else if ((int)__instance.maskMappingWorldAxis == 2 && (Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.x, 0f)) > 0.01f || Mathf.Abs(Mathf.DeltaAngle(((Component)__instance).transform.eulerAngles.y, (float)(__instance.invertAxis ? (-180) : 0))) > 0.01f)) { ((Component)__instance).transform.eulerAngles = new Vector3(0f, (float)(__instance.invertAxis ? (-180) : 0), ((Component)__instance).transform.eulerAngles.z); } if (!((Object)(object)((Component)__instance).transform.parent != (Object)null)) { return; } Renderer[] componentsInChildren = ((Component)((Component)__instance).transform.parent).gameObject.GetComponentsInChildren(); Graphic[] componentsInChildren2 = ((Component)((Component)__instance).transform.parent).gameObject.GetComponentsInChildren(); List list = new List(); Dictionary dictionary = new Dictionary(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!((Object)(object)((Component)val).gameObject != (Object)(object)((Component)__instance).gameObject)) { continue; } Material[] sharedMaterials = val.sharedMaterials; foreach (Material item in sharedMaterials) { if (!list.Contains(item)) { list.Add(item); } } } Graphic[] array2 = componentsInChildren2; foreach (Graphic val2 in array2) { if ((Object)(object)((Component)val2).gameObject != (Object)(object)((Component)__instance).gameObject && !list.Contains(val2.material)) { list.Add(val2.material); Canvas canvas = val2.canvas; if ((int)canvas.renderMode == 0 || ((int)canvas.renderMode == 1 && (Object)(object)canvas.worldCamera == (Object)null)) { dictionary.Add(list[list.Count - 1], val2); } } } Vector2 val3 = default(Vector2); foreach (Material item2 in list) { if (((object)item2.shader).ToString() == ((object)__instance._maskedSpriteWorldCoordsShader).ToString() && ((Object)item2.shader).GetInstanceID() != ((Object)__instance._maskedSpriteWorldCoordsShader).GetInstanceID()) { __instance._maskedSpriteWorldCoordsShader = null; } if (((object)item2.shader).ToString() == ((object)__instance._maskedUnlitWorldCoordsShader).ToString() && ((Object)item2.shader).GetInstanceID() != ((Object)__instance._maskedUnlitWorldCoordsShader).GetInstanceID()) { __instance._maskedUnlitWorldCoordsShader = null; } if (!((Object)(object)item2.shader == (Object)(object)__instance._maskedSpriteWorldCoordsShader) && !((Object)(object)item2.shader == (Object)(object)__instance._maskedUnlitWorldCoordsShader)) { continue; } item2.DisableKeyword("_SCREEN_SPACE_UI"); ((Vector2)(ref val3))..ctor(1f / ((Component)__instance).transform.lossyScale.x, 1f / ((Component)__instance).transform.lossyScale.y); Vector2 val4 = Vector2.zero; float num = 0f; int num2 = 1; if ((int)__instance.maskMappingWorldAxis == 0) { num2 = (__instance.invertAxis ? 1 : (-1)); ((Vector2)(ref val4))..ctor(0f - ((Component)__instance).transform.position.z, 0f - ((Component)__instance).transform.position.y); num = (float)num2 * ((Component)__instance).transform.eulerAngles.z; } else if ((int)__instance.maskMappingWorldAxis == 1) { ((Vector2)(ref val4))..ctor(0f - ((Component)__instance).transform.position.x, 0f - ((Component)__instance).transform.position.z); num = 0f - ((Component)__instance).transform.eulerAngles.y; } else if ((int)__instance.maskMappingWorldAxis == 2) { num2 = ((!__instance.invertAxis) ? 1 : (-1)); ((Vector2)(ref val4))..ctor(0f - ((Component)__instance).transform.position.x, 0f - ((Component)__instance).transform.position.y); num = (float)num2 * ((Component)__instance).transform.eulerAngles.z; } RectTransform component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { Rect rect = component.rect; val4 += Vector2.op_Implicit(((Component)__instance).transform.right * (component.pivot.x - 0.5f) * ((Rect)(ref rect)).width * ((Component)__instance).transform.lossyScale.x + ((Component)__instance).transform.up * (component.pivot.y - 0.5f) * ((Rect)(ref rect)).height * ((Component)__instance).transform.lossyScale.y); val3.x /= ((Rect)(ref rect)).width; val3.y /= ((Rect)(ref rect)).height; } if (dictionary.ContainsKey(item2)) { val4 = Vector2.op_Implicit(((Component)dictionary[item2]).transform.InverseTransformVector(Vector2.op_Implicit(val4))); MappingAxis maskMappingWorldAxis = __instance.maskMappingWorldAxis; switch ((int)maskMappingWorldAxis) { case 0: val4.x *= ((Component)dictionary[item2]).transform.lossyScale.z; val4.y *= ((Component)dictionary[item2]).transform.lossyScale.y; break; case 1: val4.x *= ((Component)dictionary[item2]).transform.lossyScale.x; val4.y *= ((Component)dictionary[item2]).transform.lossyScale.z; break; case 2: val4.x *= ((Component)dictionary[item2]).transform.lossyScale.x; val4.y *= ((Component)dictionary[item2]).transform.lossyScale.y; break; } Canvas canvas2 = dictionary[item2].canvas; val4 /= canvas2.scaleFactor; val4 = Vector2.op_Implicit(__instance.RotateVector(Vector2.op_Implicit(val4), ((Component)dictionary[item2]).transform.eulerAngles)); val4 += ((Component)canvas2).GetComponent().sizeDelta * 0.5f; val3 *= canvas2.scaleFactor; item2.EnableKeyword("_SCREEN_SPACE_UI"); } Vector2 mainTextureScale = ((Component)__instance).gameObject.GetComponent().sharedMaterial.mainTextureScale; val3.x *= mainTextureScale.x; val3.y *= mainTextureScale.y; val3.x *= num2; Vector2 val5 = val4; float num3 = Mathf.Sin((0f - num) * (MathF.PI / 180f)); float num4 = Mathf.Cos((0f - num) * (MathF.PI / 180f)); val4.x = (num4 * val5.x - num3 * val5.y) * val3.x + 0.5f * mainTextureScale.x; val4.y = (num3 * val5.x + num4 * val5.y) * val3.y + 0.5f * mainTextureScale.y; val4 += ((Component)__instance).gameObject.GetComponent().sharedMaterial.mainTextureOffset; item2.SetTextureOffset("_AlphaTex", val4); item2.SetTextureScale("_AlphaTex", val3); item2.SetFloat("_MaskRotation", num * (MathF.PI / 180f)); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_MenuAudioSlider_SetSoundLevel : GeneralPatch { public static void Postfix(MenuAudioSlider __instance, float soundLevel) { ("Sound Volume " + __instance.gs.soundVolume).LogInfo(); AudioMixer master = KnightInSilksong.Master; if (!((Object)(object)master == (Object)null)) { float num = Helper.LinearToDecibel(__instance.GetVolumeLevel(soundLevel)); master.SetFloat("SFXVolume", num); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_MenuAudioSlider_SetMasterLevel : GeneralPatch { public static void Postfix(MenuAudioSlider __instance, float masterLevel) { ("Master Volume " + __instance.gs.soundVolume).LogInfo(); AudioMixer master = KnightInSilksong.Master; if (!((Object)(object)master == (Object)null)) { float num = Helper.LinearToDecibel(__instance.GetVolumeLevel(masterLevel)); master.SetFloat("MasterVolume", num); } } } [HarmonyPatch(typeof(ObjectPool), "CreatePool", new Type[] { typeof(GameObject), typeof(int), typeof(bool), typeof(Vector3), typeof(Quaternion), typeof(bool) })] public class Patch_ObjectPool_CreatePool : GeneralPatch { public static bool Prefix(GameObject prefab, int initialPoolSize, ref bool setPosition, Vector3 position, Quaternion rotation, bool runInitialisation = false) { if (KnightInSilksong.IsKnight) { (((Object)prefab).name + " " + setPosition + " ").LogInfo(); if (((Object)prefab).name.Contains("Fireball")) { PlayMakerFSM component = prefab.GetComponent(); if ((Object)(object)component != (Object)null && component.GetVariable("FromKnight") != null) { setPosition = false; } } if (((Object)prefab).name == "Audio Player Actor" || ((Object)prefab).name == "Audio Player Actor 2D") { setPosition = false; } } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ParticleDamageHero_Start : GeneralPatch { public static bool Prefix(ParticleDamageHero __instance) { return true; } public static void Postfix(ParticleDamageHero __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { TriggerModule trigger = __instance.system.trigger; HeroBox component = ((Component)HeroController.instance).gameObject.FindGameObjectInChildren("HeroBox").GetComponent(); ((TriggerModule)(ref trigger)).AddCollider((Component)(object)((Component)component).GetComponent()); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ParticleDamageHero_OnParticleTrigger : GeneralPatch { public static bool Prefix(ParticleDamageHero __instance) { if (KnightInSilksong.IsKnight) { OnParticleTriggerForKnight(__instance); return false; } return true; } public static void OnParticleTriggerForKnight(ParticleDamageHero __instance) { if (ParticlePhysicsExtensions.GetSafeTriggerParticlesSize(__instance.system, (ParticleSystemTriggerEventType)2) > 0) { HeroBox component = ((Component)HeroController.instance).gameObject.FindGameObjectInChildren("HeroBox").GetComponent(); if (!HeroBox.inactive) { component.CheckForDamageHero(((Component)__instance).gameObject); } } } public static void Postfix(ParticleDamageHero __instance) { } } internal static class BlackList { public static readonly HashSet HDFields; public static readonly HashSet KDFields; public static readonly HashSet BlackListedFields; public static readonly HashSet should_handle_fields; public static bool IsBlackListed(string var_name) { return BlackListedFields.Contains(var_name); } public static bool ShouldHandle(string var_name) { return should_handle_fields.Contains(var_name); } static BlackList() { HashSet hashSet = new HashSet(); foreach (string item in from x in typeof(PlayerData).GetFields() select x.Name) { hashSet.Add(item); } HDFields = hashSet; hashSet = new HashSet(); foreach (string item2 in from x in typeof(PlayerData).GetFields() select x.Name) { hashSet.Add(item2); } KDFields = hashSet; hashSet = new HashSet(); foreach (string item3 in HDFields.Except(KDFields)) { hashSet.Add(item3); } BlackListedFields = hashSet; hashSet = new HashSet(); foreach (string item4 in KDFields.Except(HDFields)) { hashSet.Add(item4); } should_handle_fields = hashSet; } } internal static class HandlePlayerData { private static PlayerData kd => PlayerData.instance; public static void Init() { PlayerDataVariableEvents.OnGetBool += HandleGetBool; PlayerDataVariableEvents.OnGetInt += HandleGetInt; PlayerDataVariableEvents.OnGetFloat += HandleGetFloat; PlayerDataVariableEvents.OnGetString += HandleGetString; PlayerDataVariableEvents.OnGetVector3 += HandleGetVector3; } private static Vector3 HandleGetVector3(PlayerData pd, string fieldName, Vector3 current) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (BlackList.ShouldHandle(fieldName)) { return kd.GetVector3(fieldName); } return current; } private static string HandleGetString(PlayerData pd, string fieldName, string current) { if (BlackList.ShouldHandle(fieldName)) { return kd.GetString(fieldName); } return current; } private static float HandleGetFloat(PlayerData pd, string fieldName, float current) { if (BlackList.ShouldHandle(fieldName)) { return kd.GetFloat(fieldName); } return current; } private static int HandleGetInt(PlayerData pd, string fieldName, int current) { if (BlackList.ShouldHandle(fieldName)) { return kd.GetInt(fieldName); } return current; } private static bool HandleGetBool(PlayerData pd, string fieldName, bool current) { if (BlackList.ShouldHandle(fieldName)) { return kd.GetBool(fieldName); } return current; } } [HarmonyPatch(typeof(PlayerData), "SetBool")] internal class Patch_PlayerData_SetBool : GeneralPatch { private static void Postfix(string boolName, bool value) { if (!KnightInSilksong.IsKnight) { return; } try { if (!SyncManager.Instance.IsWatching(boolName) && !BlackList.IsBlackListed(boolName)) { PlayerData.instance.SetBool(boolName, value); } if (boolName == "atBench") { if (value) { PlayMakerFSM.BroadcastEvent("BENCHREST"); } else { PlayMakerFSM.BroadcastEvent("BENCHREST END"); } } SyncManager.Instance.H2KSyncData(boolName); } catch (ArgumentException) { ("ArgumentException " + boolName + " " + value).LogError(); } } } [HarmonyPatch(typeof(PlayerData), "SetInt")] internal class Patch_PlayerData_SetInt : GeneralPatch { private static void Postfix(string intName, int value) { if (KnightInSilksong.IsKnight) { PlayerData.instance.SetInt(intName, value); SyncManager.Instance.H2KSyncData(intName); } } } [HarmonyPatch(typeof(PlayerData), "SetFloat")] internal class Patch_PlayerData_SetFloat : GeneralPatch { private static void Postfix(string floatName, float value) { if (KnightInSilksong.IsKnight) { if (!SyncManager.Instance.IsWatching(floatName) && !BlackList.IsBlackListed(floatName)) { PlayerData.instance.SetFloat(floatName, value); } SyncManager.Instance.H2KSyncData(floatName); } } } [HarmonyPatch(typeof(PlayerData), "SetString")] internal class Patch_PlayerData_SetString : GeneralPatch { private static void Postfix(string stringName, string value) { if (KnightInSilksong.IsKnight) { PlayerData.instance.SetString(stringName, value); SyncManager.Instance.H2KSyncData(stringName); } } } [HarmonyPatch(typeof(PlayerData), "SetVector3")] internal class Patch_PlayerData_SetVector3 : GeneralPatch { private static void Postfix(string vectorName, Vector3 value) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { PlayerData.instance.SetVector3(vectorName, value); SyncManager.Instance.H2KSyncData(vectorName); } } } [HarmonyPatch(typeof(PlayerData), "SetBenchRespawn", new Type[] { typeof(RespawnMarker), typeof(string), typeof(int) })] public class Patch_PlayerData_SetBenchRespawn : GeneralPatch { public static void Postfix(PlayerData __instance, RespawnMarker spawnMarker, string sceneName, int spawnType) { if (KnightInSilksong.IsKnight) { PlayerData.instance.respawnMarkerName = ((Object)spawnMarker).name; PlayerData.instance.respawnScene = sceneName; PlayerData.instance.respawnType = spawnType; } } } [HarmonyPatch(typeof(PlayerData), "SetBenchRespawn", new Type[] { typeof(string), typeof(string), typeof(bool) })] public class Patch_PlayerData_SetBenchRespawn2 : GeneralPatch { public static void Postfix(PlayerData __instance, string spawnMarker, string sceneName, bool facingRight) { if (KnightInSilksong.IsKnight) { PlayerData.instance.respawnMarkerName = spawnMarker; PlayerData.instance.respawnScene = sceneName; } } } [HarmonyPatch(typeof(PlayerData), "SetBenchRespawn", new Type[] { typeof(string), typeof(string), typeof(int), typeof(bool) })] public class Patch_PlayerData_SetBenchRespawn3 : GeneralPatch { public static void Postfix(PlayerData __instance, string spawnMarker, string sceneName, int spawnType, bool facingRight) { if (KnightInSilksong.IsKnight) { PlayerData.instance.respawnMarkerName = spawnMarker; PlayerData.instance.respawnScene = sceneName; PlayerData.instance.respawnType = spawnType; } } } [HarmonyPatch(typeof(PlayerData), "SetHazardRespawn", new Type[] { typeof(HazardRespawnMarker) })] public class Patch_PlayerData_SetHazardRespawn : GeneralPatch { public static void Postfix(PlayerData __instance, HazardRespawnMarker location) { if (KnightInSilksong.IsKnight) { PlayerData.instance.SetHazardRespawn(location); } } } [HarmonyPatch(typeof(PlayerData), "SetHazardRespawn", new Type[] { typeof(Vector3), typeof(bool) })] public class Patch_PlayerData_SetHazardRespawn_2 : GeneralPatch { public static void Postfix(PlayerData __instance, Vector3 position, bool facingRight) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { PlayerData.instance.SetHazardRespawn(position, facingRight); } } } [HarmonyPatch(typeof(PlayerData), "EquipCharm", new Type[] { typeof(int) })] public class Patch_PlayerData_EquipCharm : GeneralPatch { public static void Postfix(PlayerData __instance, int charmNum) { if (KnightInSilksong.IsKnight) { PlayerData.instance.EquipCharm(charmNum); } } } [HarmonyPatch(typeof(PlayerData), "UnequipCharm", new Type[] { typeof(int) })] public class Patch_PlayerData_UnequipCharm : GeneralPatch { public static void Postfix(PlayerData __instance, int charmNum) { if (KnightInSilksong.IsKnight) { PlayerData.instance.UnequipCharm(charmNum); } } } [HarmonyPatch(typeof(PlayMakerFSM), "Start")] public class Patch_PlayMakerFSM_Start : GeneralPatch { public static bool Prefix(PlayMakerFSM __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight) { string text = __instance.FsmName.ToLower(); string text2 = ((Object)((Component)__instance).gameObject).name.ToLower(); Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.ToLower() == "belltown_shrine" && text2 == "spinner boss" && text == "control") { widow_skip_focus(__instance); } if (text2 == "silk heart" && text == "control") { FixGetSilkHeart(__instance); } if (text2.StartsWith("silk spool ui") && text == "silk spool ui") { FixGetSilkSpool(__instance); } } if (((Object)((Component)__instance).gameObject).name.StartsWith("Hollow Shade Death") && __instance.FsmName == "Shade Control") { PreventGetGeoFromShade(__instance); } return true; } private static void PreventGetGeoFromShade(PlayMakerFSM fsm) { ((FsmStateAction)fsm.GetAction("Death Start", 3)).enabled = false; ((FsmStateAction)fsm.GetAction("Give Geo", 3)).enabled = false; fsm.InsertCustomAction("Destroy", (Action)delegate { HeroController.instance.CocoonBroken(); }, 0); } private static void FixGetSilkHeart(PlayMakerFSM fsm) { fsm.AddCustomAction("Regen Last Silk", delegate(PlayMakerFSM val) { val.SendEvent("REGENERATED SILK CHUNK"); }); } private static void FixGetSilkSpool(PlayMakerFSM fsm) { //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) if ((Object)(object)fsm.fsm.GetFsmGameObject("Hero").Value == (Object)null) { Scene activeScene = SceneManager.GetActiveScene(); ("Get Error SilkSpool at " + ((Scene)(ref activeScene)).name).LogWarning(); } else { fsm.fsm.GetFsmGameObject("Hero").value = KISHelper.GetCurrentHero(); } } private static void bell_beast_skip_silkheart(PlayMakerFSM fsm) { fsm.ChangeTransition("Idle", "BATTLE END", "End Pause"); } private static void widow_skip_focus(PlayMakerFSM fsm) { fsm.ChangeTransition("Hornet Dash", "FINISHED", "Final Bind Burst"); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Renderer_enabled : GeneralPatch { public static bool Prefix(Renderer __instance, bool value) { if ((Object)(object)HeroController.instance != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)((Component)HeroController.instance).gameObject && KnightInSilksong.IsKnight) { return !value; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_RespondToCurrencyCounterEvents_OnEnter : GeneralPatch { public static bool Prefix(RespondToCurrencyCounterEvents __instance) { ((MonoBehaviour)((FsmStateAction)__instance).fsm.FsmComponent).StartCoroutine(DelayFinished(__instance)); return true; } public static void Postfix(RespondToCurrencyCounterEvents __instance) { } private static IEnumerator DelayFinished(RespondToCurrencyCounterEvents __instance) { yield return (object)new WaitForSeconds(0.5f); if (((FsmStateAction)__instance).State.active) { ((FsmStateAction)__instance).Event(__instance.Response); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_SendEventByName_OnEnter { public static bool Prefix(SendEventByName __instance) { if (KnightInSilksong.IsKnight && __instance.sendEvent.value == "UPDATE BLUE HEALTH" && ((FsmStateAction)__instance).fsm.GetVariable("FromKnight") != null) { (((Object)((FsmStateAction)__instance).fsm.GameObject).name + " " + ((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " SendEventByName UPDATE BLUE HEALTH").LogInfo(); ((FsmStateAction)__instance).Finish(); return false; } return true; } public static void Postfix(SendEventByName __instance) { if (KnightInSilksong.IsKnight) { if (__instance.sendEvent.value == "REMOVE BLUE HEALTH") { (((Object)((FsmStateAction)__instance).fsm.GameObject).name + " " + ((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " SendEventByName REMOVE BLUE HEALTH").LogInfo(); } if (__instance.sendEvent.value == "UPDATE BLUE HEALTH") { (((Object)((FsmStateAction)__instance).fsm.GameObject).name + " " + ((FsmStateAction)__instance).fsm.name + " " + ((FsmStateAction)__instance).State.name + " SendEventByName UPDATE BLUE HEALTH").LogInfo(); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_SendMessage_DoSendMessage : GeneralPatch { private static List herocontroller_methods = new List { "RegainControl", "RelinquishControl", "StartAnimationControl", "StartAnimationControlToIdle", "StartAnimationControlToIdleForcePlay" }; private static List hero_animation_controller_methods = new List { "StartControlToIdle", "StartControl", "StopControl" }; public static bool Prefix(SendMessage __instance) { if (KnightInSilksong.IsKnight) { bool flag = false; if (Extensions.IsAny(__instance.functionCall.FunctionName, herocontroller_methods.ToArray())) { Traverse.Create((object)HeroController.instance).Method(__instance.functionCall.FunctionName, Array.Empty()).GetValue(); flag = true; } if (Extensions.IsAny(__instance.functionCall.FunctionName, hero_animation_controller_methods.ToArray())) { Traverse.Create((object)((Component)HeroController.instance).GetComponent()).Method(__instance.functionCall.FunctionName, Array.Empty()).GetValue(); flag = true; } if (flag) { ((FsmStateAction)__instance).Finish(); return false; } } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_SetGravity2dScale_DoSetGravityScale : GeneralPatch { public static bool Prefix(SetGravity2dScale __instance) { if (KnightInSilksong.IsKnight && (Object)(object)((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.gameObject) == (Object)(object)((Component)HeroController.instance).gameObject && __instance.gravityScale.Value <= Mathf.Epsilon) { HeroController.instance.AffectedByGravity(false); return false; } return true; } public static void Postfix(SetGravity2dScale __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_SetIsKinematic2d_DoSetIsKinematic { public static void Postfix(SetIsKinematic2d __instance) { if (KnightInSilksong.IsKnight && (Object)(object)((FsmStateAction)__instance).Fsm.GetOwnerDefaultTarget(__instance.gameObject) == (Object)(object)((Component)HeroController.instance).gameObject) { ((Component)HeroController.instance).GetComponent().isKinematic = __instance.isKinematic.Value; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_SpellFluke_OnEnable : GeneralPatch { public static void Postfix(SpellFluke __instance) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && PlayerData.instance.GetBool("equippedCharm_19")) { float num = Random.Range(0.9f, 1.2f); ((Component)__instance).transform.localScale = new Vector3(num, num, 0f); __instance.damage = 5; } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_SurfaceWaterRegion_OnTriggerEnter2D : GeneralPatch { public static bool Prefix(SurfaceWaterRegion __instance, Collider2D collision) { if (KnightInSilksong.IsKnight && (Object)(object)((Component)collision).gameObject == (Object)(object)((Component)HeroController.instance).gameObject) { FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Surface Water").SendEvent("SURFACE ENTER"); "SurfaceWaterRegion OnTriggerEnter2D Prefix".LogInfo(); return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_TakeDamage_OnEnter : GeneralPatch { public static bool Prefix(TakeDamage __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0129: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && ((FsmStateAction)__instance).fsm.GetFsmBool("FromKnight") != null) { HitTaker.Hit(__instance.Target.Value, new HitInstance { Source = ((FsmStateAction)__instance).Owner, AttackType = (AttackTypes)__instance.AttackType.Value, CircleDirection = __instance.CircleDirection.Value, DamageDealt = __instance.DamageDealt.Value, StunDamage = 1f, Direction = __instance.Direction.Value, IgnoreInvulnerable = __instance.IgnoreInvulnerable.Value, MagnitudeMultiplier = __instance.MagnitudeMultiplier.Value, MoveAngle = __instance.MoveAngle.Value, MoveDirection = __instance.MoveDirection.Value, Multiplier = (((NamedVariable)__instance.Multiplier).IsNone ? 1f : __instance.Multiplier.Value), SpecialType = (SpecialTypes)(__instance.SpecialType.Value | KnightInSilksong.KnightDamage), IsFirstHit = true, IsHeroDamage = true }, 3); ((FsmStateAction)__instance).Finish(); return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_TinkEffect_Hit : GeneralPatch { public static bool Prefix(TinkEffect __instance, ref HitInstance damageInstance, ref HitResponse __result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (KnightInSilksong.IsKnight && (damageInstance.SpecialType & KnightInSilksong.KnightDamage) != 0) { GameObject source = damageInstance.Source; if (source.layer != 17) { __result = HitResponse.op_Implicit((Response)0); } bool isNailAttack = source.CompareTag("Nail Attack"); __result = HitResponse.op_Implicit((Response)(TryDoTinkReactionNoDamagerWithoutDamageEnemies(ref damageInstance, __instance, damageInstance.Source, doCamShake: true, doSound: true, isNailAttack, out var _) ? 1 : 0)); return false; } return true; } private static float GetActualHitDirectionWithoutDE(TinkEffect __instance, ref HitInstance hitInstance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!hitInstance.CircleDirection) { return hitInstance.Direction; } Vector2 val = Vector2.op_Implicit(((Component)__instance).transform.position) - Vector2.op_Implicit(hitInstance.Source.transform.position); return Mathf.Atan2(val.y, val.x) * 57.29578f; } public static bool TryDoTinkReactionNoDamagerWithoutDamageEnemies(ref HitInstance damageInstance, TinkEffect __instance, GameObject obj, bool doCamShake, bool doSound, bool isNailAttack, out Vector2 tinkPosition) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_0745: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_07ec: Unknown result type (might be due to invalid IL or missing references) //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a6: Unknown result type (might be due to invalid IL or missing references) bool flag = true; bool flag2 = Time.timeAsDouble >= TinkEffect._nextTinkTime; NailAttackBase component = obj.GetComponent(); bool flag3 = isNailAttack && Object.op_Implicit((Object)(object)component) && !component.CanHitSpikes; HeroController instance = HeroController.instance; Vector3 position = obj.transform.position; tinkPosition = Vector2.op_Implicit(position); Vector3 val = (isNailAttack ? instance.transform.position : position); if (__instance.useOwnYPosition) { position.y = (val.y = ((Component)__instance).transform.position.y); } bool flag4 = true; float actualHitDirectionWithoutDE; if (isNailAttack) { if (Object.op_Implicit((Object)(object)__instance.heroDamager) && (int)__instance.heroDamager.hazardType == 2 && flag3) { instance.TakeDamage(((Component)__instance.heroDamager).gameObject, (CollisionSide)0, __instance.heroDamager.damageDealt, (HazardType)2, __instance.heroDamager.damagePropertyFlags); return false; } actualHitDirectionWithoutDE = GetActualHitDirectionWithoutDE(__instance, ref damageInstance); } else { actualHitDirectionWithoutDE = GetActualHitDirectionWithoutDE(__instance, ref damageInstance); ITinkResponder component2 = obj.GetComponent(); bool flag5 = component2 != null; if (flag5) { if ((__instance.ignoreResponders & component2.ResponderType) != 0) { return false; } component2.Tinked(); } if (__instance.onlyReactToNail) { if (!flag5) { return false; } flag = false; } } int cardinalDirection = DirectionUtils.GetCardinalDirection(actualHitDirectionWithoutDE); switch (cardinalDirection) { case 3: if (!Extensions.IsBitSet(__instance.directionMask, 3)) { return false; } __instance.TryPreventDamage((DamageEnemies)null, 3); break; case 1: if (!Extensions.IsBitSet(__instance.directionMask, 2)) { return false; } __instance.TryPreventDamage((DamageEnemies)null, 2); break; case 2: if (!Extensions.IsBitSet(__instance.directionMask, 0)) { return false; } if (isNailAttack && __instance.checkSlashPosition && obj.transform.position.x < ((Component)__instance).transform.position.x) { return false; } __instance.TryPreventDamage((DamageEnemies)null, 0); break; case 0: if (!Extensions.IsBitSet(__instance.directionMask, 1)) { return false; } if (isNailAttack && __instance.checkSlashPosition && obj.transform.position.x > ((Component)__instance).transform.position.x) { return false; } __instance.TryPreventDamage((DamageEnemies)null, 1); break; } _ = flag2 && __instance.RecoilHero && flag4; bool flag6 = Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent()); if (flag4) { int layer = ((Component)__instance).gameObject.layer; if ((layer == 11 || layer == 17 || layer == 19) && !flag6) { switch (cardinalDirection) { } } } if (isNailAttack) { if (flag2) { TinkEffect._nextTinkTime = Time.timeAsDouble + 0.009999999776482582; } if (!Object.op_Implicit((Object)(object)__instance.gameCam)) { __instance.gameCam = GameCameras.instance; } if (doCamShake && flag2 && Object.op_Implicit((Object)(object)__instance.gameCam)) { if (__instance.overrideCamShake) { __instance.camShakeOverride.DoShake((Object)(object)__instance, true); } else { __instance.gameCam.cameraShakeFSM.SendEvent("EnemyKillShake"); } } } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, 0f, 0f); bool flag7 = (Object)(object)__instance.collider != (Object)null; if (__instance.useNailPosition && !flag4) { flag7 = false; } Vector2 val3 = Vector2.zero; float num = 0f; float num2 = 0f; if (flag7) { Bounds bounds = __instance.collider.bounds; val3 = Vector2.op_Implicit(((Component)__instance).transform.TransformPoint(Vector2.op_Implicit(__instance.collider.offset))); num = ((Bounds)(ref bounds)).size.x * 0.5f; num2 = ((Bounds)(ref bounds)).size.y * 0.5f; } Vector3 val4 = default(Vector3); switch (cardinalDirection) { case 0: if (isNailAttack && flag2 && __instance.RecoilHero) { instance.RecoilLeft(); } if (flag) { if (__instance.sendDirectionalFSMEvents && Object.op_Implicit((Object)(object)__instance.fsm)) { __instance.fsm.SendEvent("TINK RIGHT"); } ((HitResponseBase)__instance).SendHitInDirection(obj, (HitDirection)1); } if (flag7) { float num4 = Mathf.Max(0f, num2 - 1.5f); position.y = Mathf.Clamp(position.y, val3.y - num4, val3.y + num4); ((Vector3)(ref val4))..ctor(val3.x - num, position.y, 0.002f); } else { val4 = ((!isNailAttack) ? new Vector3(val.x, val.y, 0.002f) : new Vector3(val.x + 2f, val.y, 0.002f)); } break; case 1: if (isNailAttack && flag2 && __instance.RecoilHero) { instance.RecoilDown(); } if (flag) { if (__instance.sendDirectionalFSMEvents && Object.op_Implicit((Object)(object)__instance.fsm)) { __instance.fsm.SendEvent("TINK UP"); } ((HitResponseBase)__instance).SendHitInDirection(obj, (HitDirection)2); } val4 = (flag7 ? new Vector3(position.x, Mathf.Max(val3.y - num2, position.y), 0.002f) : ((!isNailAttack) ? new Vector3(val.x, val.y, 0.002f) : new Vector3(val.x, val.y + 2f, 0.002f))); ((Vector3)(ref val2))..ctor(0f, 0f, 90f); break; case 2: if (isNailAttack && flag2 && __instance.RecoilHero) { instance.RecoilRight(); } if (flag) { if (__instance.sendDirectionalFSMEvents && Object.op_Implicit((Object)(object)__instance.fsm)) { __instance.fsm.SendEvent("TINK LEFT"); } ((HitResponseBase)__instance).SendHitInDirection(obj, (HitDirection)0); } if (!flag7) { val4 = ((!isNailAttack) ? new Vector3(val.x, val.y, 0.002f) : new Vector3(val.x - 2f, val.y, 0.002f)); } else { float num5 = Mathf.Max(0f, num2 - 1.5f); position.y = Mathf.Clamp(position.y, val3.y - num5, val3.y + num5); ((Vector3)(ref val4))..ctor(val3.x + num, position.y, 0.002f); } ((Vector3)(ref val2))..ctor(0f, 0f, 180f); break; default: if (flag) { if (__instance.sendDirectionalFSMEvents && Object.op_Implicit((Object)(object)__instance.fsm)) { __instance.fsm.SendEvent("TINK DOWN"); if (isNailAttack) { __instance.fsm.SendEvent(instance.cState.facingRight ? "TINK DOWN R" : "TINK DOWN L"); } } ((HitResponseBase)__instance).SendHitInDirection(obj, (HitDirection)3); } if (!flag7) { val4 = ((!isNailAttack) ? new Vector3(val.x, val.y, 0.002f) : new Vector3(val.x, val.y - 2f, 0.002f)); } else { float num3 = position.x; if (num3 < val3.x - num) { num3 = val3.x - num; } if (num3 > val3.x + num) { num3 = val3.x + num; } ((Vector3)(ref val4))..ctor(num3, Mathf.Min(val3.y + num2, position.y), 0.002f); } ((Vector3)(ref val2))..ctor(0f, 0f, 270f); break; } GameObject val5 = (flag3 ? Effects.TinkEffectDullPrefab : __instance.blockEffect); if (flag2) { Quaternion val6 = Quaternion.Euler(val2); if (Object.op_Implicit((Object)(object)val5)) { AudioSource component3 = ObjectPoolExtensions.Spawn(val5, val4, val6).GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.pitch = Random.Range(0.85f, 1.15f); component3.volume = (doSound ? 1f : 0f); } } } tinkPosition = Vector2.op_Implicit(val4); if (!flag) { return true; } if (__instance.sendFSMEvent && Object.op_Implicit((Object)(object)__instance.fsm)) { __instance.fsm.SendEvent(__instance.FSMEvent); } __instance.OnTinked.Invoke(); if (flag4 && PlayerData.instance.equippedCharm_15) { __instance.OnTinkedHeavy.Invoke(); } switch (cardinalDirection) { case 3: __instance.OnTinkedDown.Invoke(); break; case 1: __instance.OnTinkedUp.Invoke(); break; case 2: __instance.OnTinkedLeft.Invoke(); break; case 0: __instance.OnTinkedRight.Invoke(); break; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Tk2dPlayAnimation_DoPlayAnimation : GeneralPatch { private static List KnightAnims = new List { "Sit" }; public static Dictionary hornet_to_knight_anime = new Dictionary { { "Sit", "Sit" }, { "Taunt Back Up", "Challenge Start" }, { "Taunt Straight Back Q", "Challenge Start" }, { "Taunt Back", "Challenge Start" }, { "Taunt Straight Back", "Challenge Start" }, { "Sit Fall Asleep", "Sit Fall Asleep" }, { "Sit Idle", "Sit" }, { "Get Off", "Get Off" }, { "Challenge Strong", "Roar Lock" }, { "ChallengeStrongToIdle", "Idle" }, { "HardLand Greymoor", "HardLand" } }; public static void Postfix(Tk2dPlayAnimation __instance) { if ((Object)(object)__instance._sprite != (Object)null && KnightInSilksong.IsKnight && (((Object)(object)HeroController.instance != (Object)null && (Object)(object)((Component)__instance._sprite).gameObject == (Object)(object)((Component)HeroController.instance).gameObject) || (Object)(object)((Component)__instance._sprite).gameObject == (Object)(object)((Component)HeroController.instance).gameObject) && hornet_to_knight_anime.ContainsKey(__instance.clipName.Value)) { ((Component)HeroController.instance).GetComponent().Play(hornet_to_knight_anime[__instance.clipName.Value]); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_tk2dPlayAnimAfterPreviousComplete_OnEnter : GeneralPatch { public static bool Prefix(tk2dPlayAnimAfterPreviousComplete __instance) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 if (KnightInSilksong.IsKnight) { if ((Object)(object)__instance.animator == (Object)null || (Object)(object)((Component)__instance.animator).gameObject == (Object)null) { return true; } if ((Object)(object)((Component)__instance.animator).gameObject != (Object)(object)((Component)HeroController.instance).gameObject) { return true; } if (__instance.animator.Playing) { tk2dSpriteAnimationClip currentClip = __instance.animator.CurrentClip; if (currentClip != null && (int)currentClip.wrapMode == 2) { goto IL_008c; } } __instance.OnAnimationCompleted(__instance.animator, (tk2dSpriteAnimationClip)null); ((FsmStateAction)__instance).Finish(); return false; } goto IL_008c; IL_008c: return true; } public static void Postfix(tk2dPlayAnimAfterPreviousComplete __instance) { } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Tk2dPlayAnimationWait_OnEnter : GeneralPatch { public static void Postfix(Tk2dPlayAnimationWait __instance) { if (KnightInSilksong.IsKnight && (Object)(object)((Component)__instance.sprite).gameObject == (Object)(object)((Component)HeroController.instance).gameObject && __instance.sprite.GetClipByName(__instance.ClipName.Value) == null) { ((FsmStateAction)__instance).Fsm.Event(__instance.AnimationCompleteEvent); ((FsmStateAction)__instance).Finish(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_tk2dSpriteAnimator_GetClipByName : GeneralPatch { public static Dictionary hornet_to_knight_anime_with_event = new Dictionary { { "HardLand Greymoor", "HardLand" } }; public static bool Prefix(tk2dSpriteAnimator __instance, ref string name) { if (KnightInSilksong.IsKnight && (Object)(object)((Component)__instance).gameObject == (Object)(object)((Component)HeroController.instance).gameObject && hornet_to_knight_anime_with_event.ContainsKey(name)) { name = hornet_to_knight_anime_with_event[name]; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_Tk2dWatchAnimationEvents_OnUpdate : GeneralPatch { public static bool Prefix(Tk2dWatchAnimationEvents __instance) { if (KnightInSilksong.IsKnight && (Object)(object)__instance._sprite == (Object)(object)((Component)HeroController.instance).gameObject.GetComponent() && !__instance._sprite.Playing && __instance.animationTriggerEvent != null) { ((FsmStateAction)__instance).Fsm.Event(__instance.animationTriggerEvent); } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ToolCrestsData_SetData : GeneralPatch { public static void Postfix(SerializableNamedList __instance, string itemName, Data data) { SyncManager.Instance.H2KSyncData("ToolEquips"); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_ToolItemsData_SetData : GeneralPatch { public static bool Prefix(SerializableNamedList __instance, string itemName, Data data) { return true; } public static void Postfix(SerializableNamedList __instance, string itemName, Data data) { SyncManager.Instance.H2KSyncData(itemName); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Patch_TransitionPoint_PrepareEntry : GeneralPatch { public static void Postfix(TransitionPoint __instance) { "PrepareEntry Patch".LogInfo(); Time.time.LogInfo(); } } public class SceneObjectManager { public static string sceneFolder; public static async Task loadObjectFromScene(string sceneName, string objectToRetrieve) { Scene activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Current scene " + ((Scene)(ref activeScene)).name); Console.WriteLine("Loading " + sceneName + " scene"); AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(sceneFolder, (sceneName + ".bundle").ToLower())); Awaiter val = AsyncOperationAwaitableExtensions.GetAwaiter(SceneManager.LoadSceneAsync(sceneName, (LoadSceneMode)1)); Awaiter val2 = default(Awaiter); if (!((Awaiter)(ref val)).IsCompleted) { await val; val = val2; val2 = default(Awaiter); } ((Awaiter)(ref val)).GetResult(); Scene sceneByName = SceneManager.GetSceneByName(sceneName); Console.WriteLine("Scene " + ((Scene)(ref sceneByName)).name + " successfully loaded"); GameObject val3 = findObjectInScene(sceneByName, "_SceneManager"); if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); } GameObject val4 = findObjectInScene(sceneByName, objectToRetrieve); GameObject go_copy = Object.Instantiate(val4); Object.DontDestroyOnLoad((Object)(object)go_copy); Console.WriteLine("Unloading '" + ((Scene)(ref sceneByName)).name + "' scene"); val = AsyncOperationAwaitableExtensions.GetAwaiter(SceneManager.UnloadSceneAsync(((Scene)(ref sceneByName)).name)); if (!((Awaiter)(ref val)).IsCompleted) { await val; val = val2; val2 = default(Awaiter); } ((Awaiter)(ref val)).GetResult(); Console.WriteLine("Unloading bundle '" + ((Object)bundle).name + "'"); val = AsyncOperationAwaitableExtensions.GetAwaiter((AsyncOperation)(object)bundle.UnloadAsync(false)); if (!((Awaiter)(ref val)).IsCompleted) { await val; val = val2; } ((Awaiter)(ref val)).GetResult(); go_copy.SetActive(false); return go_copy; } public static GameObject findObjectInScene(Scene scene, string objectToRetrieve) { int objectIndex = 0; string[] objectHierarchy = objectToRetrieve.Split("/"); Console.WriteLine("Searching scene " + ((Scene)(ref scene)).name + " for object '" + objectToRetrieve + "'"); Console.WriteLine($"Scene {((Scene)(ref scene)).name} has {((Scene)(ref scene)).GetRootGameObjects().Length} objects"); GameObject val = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject obj) => ((Object)obj).name == objectHierarchy[objectIndex]); objectIndex++; for (; objectIndex < objectHierarchy.Length; objectIndex++) { Console.WriteLine("Current child object searched for: '" + objectHierarchy[objectIndex] + "'"); val = ((Component)((Component)val.transform).GetComponentsInChildren(true).First((Transform tf) => ((Object)tf).name == objectHierarchy[objectIndex])).gameObject; } Console.WriteLine($"Found object {val}"); return val; } public static GameObject findObjectInCurrentScene(string objectToRetrieve) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return findObjectInScene(SceneManager.GetActiveScene(), objectToRetrieve); } public static GameObject findChildObject(GameObject obj, string childObj) { int objectIndex = 0; string[] objectHierarchy = childObj.Split("/"); GameObject val = obj; for (; objectIndex < objectHierarchy.Length; objectIndex++) { Console.WriteLine("Current child object searched for: '" + objectHierarchy[objectIndex] + "'"); val = ((Component)((Component)val.transform).GetComponentsInChildren(true).First((Transform tf) => ((Object)tf).name == objectHierarchy[objectIndex])).gameObject; } Console.WriteLine($"Found object {val}"); return val; } static SceneObjectManager() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 string streamingAssetsPath = Application.streamingAssetsPath; RuntimePlatform platform = Application.platform; string path = (((int)platform == 1) ? "StandaloneOSX" : (((int)platform == 2) ? "StandaloneWindows64" : (((int)platform != 13) ? "" : "StandaloneLinux64"))); sceneFolder = Path.Combine(streamingAssetsPath, "aa", path, "scenes_scenes_scenes"); } } public class SlotData { private const string general = "General"; private const string gameplay = "GamePlay"; private int? slot; private ConfigFile slot_file; public ConfigEntry sync; internal List baseInfos; public PlayerData playerData; private string slot_setting_path => Path.Combine(KISHelper.GetSaveDataDirectory(slot.Value), "SlotSetting.cfg"); private string playerdata_path => Path.Combine(KISHelper.GetSaveDataDirectory(slot.Value), "PlayerData.json"); private string sync_config_path => Path.Combine(KISHelper.GetSaveDataDirectory(slot.Value), "SyncConfig.json"); public SlotData(int slot) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown this.slot = slot; slot_file = new ConfigFile(slot_setting_path, true); sync = slot_file.Bind("General", "Sync", false, "make knight sync with hornet in this save"); } private void Setting2Default() { foreach (KeyValuePair item in slot_file) { item.Value.BoxedValue = item.Value.DefaultValue; } } public static void DeleteSave(int slot) { SlotData slotData = new SlotData(slot); slotData.Setting2Default(); slotData.playerData = null; if (File.Exists(slotData.playerdata_path)) { File.Delete(slotData.playerdata_path); } } public static SlotData CreateSave(int slot, bool sync_value) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown SlotData slotData = new SlotData(slot); slotData.sync.Value = sync_value; if (File.Exists(slotData.playerdata_path)) { File.Delete(slotData.playerdata_path); } slotData.LoadSyncConfig(); slotData.playerData = new PlayerData(); if (!slotData.sync.Value) { slotData.playerData.AddGGPlayerDataOverrides(); slotData.playerData.royalCharmState = 4; } return slotData; } public void LoadSave() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown bool flag = false; if (File.Exists(playerdata_path) && playerData == null) { try { playerData = new PlayerData(); if (!sync.Value) { playerData.AddGGPlayerDataOverrides(); playerData.royalCharmState = 4; } JsonUtility.FromJsonOverwrite(File.ReadAllText(playerdata_path), (object)playerData); flag = true; } catch (Exception ex) { ("Loading PlayerData Error: " + ex).LogWarning(); flag = false; } } if (!flag) { playerData = new PlayerData(); if (!sync.Value) { playerData.AddGGPlayerDataOverrides(); playerData.royalCharmState = 4; } } PlayerData.instance = playerData; LoadSyncConfig(); SyncManager.Instance.Initialize(baseInfos, sync.Value); } public void SaveSave() { if (playerData != null) { File.WriteAllText(playerdata_path, JsonUtility.ToJson((object)playerData, true)); } } public void SaveSyncConfig() { if (baseInfos != null) { File.WriteAllText(sync_config_path, JsonConvert.SerializeObject((object)baseInfos, (Formatting)1)); } } public void LoadSyncConfig() { if (File.Exists(sync_config_path)) { try { baseInfos = JsonConvert.DeserializeObject>(File.ReadAllText(sync_config_path)); return; } catch (Exception msg) { msg.LogWarning(); } } baseInfos = SyncManager.DefaultConfig(); foreach (SyncManager.SyncBaseInfo baseInfo in baseInfos) { if (baseInfo.hdValue is long num) { baseInfo.hdValue = (int)num; } if (baseInfo.kdValue is long num2) { baseInfo.kdValue = (int)num2; } } } } public class Test { private void TestMethod() { } } public class DefaultDict : IEnumerable>, IEnumerable { private readonly Dictionary _dict = new Dictionary(); private readonly Func _factory; public TValue this[TKey key] { get { if (!_dict.TryGetValue(key, out var value)) { value = _factory(); _dict[key] = value; } return value; } set { _dict[key] = value; } } public IEnumerable Keys => _dict.Keys; public DefaultDict(Func factory) { _factory = factory; } public bool TryGetValue(TKey key, out TValue value) { return _dict.TryGetValue(key, out value); } public IEnumerator> GetEnumerator() { foreach (TKey key in Keys) { yield return new KeyValuePair(key, this[key]); } } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } public static class DictUtils { } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace KIS { public class CustomFsmAction : FsmStateAction { public Action method; public CustomFsmAction(Action method) { this.method = method; } public CustomFsmAction() { } public override void Reset() { method = null; ((FsmStateAction)this).Reset(); } public override void OnEnter() { method?.Invoke(); ((FsmStateAction)this).Finish(); } } public class CustomFsmActionUpdate : FsmStateAction { public Action method; public CustomFsmActionUpdate(Action method) { this.method = method; } public CustomFsmActionUpdate() { } public override void Reset() { method = null; ((FsmStateAction)this).Reset(); } public override void OnEnter() { method?.Invoke(); } public override void OnUpdate() { method?.Invoke(); } } public class CustomFsmActionFixedUpdate : FsmStateAction { public Action method; public CustomFsmActionFixedUpdate(Action method) { this.method = method; } public CustomFsmActionFixedUpdate() { } public override void Reset() { method = null; ((FsmStateAction)this).Reset(); } public override void OnEnter() { method?.Invoke(); } public override void OnFixedUpdate() { method?.Invoke(); } } [ModMenuIgnore] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("io.github.shownyoung.knightinsilksong", "KnightInSilkSong", "0.6.7")] public class KnightInSilksong : BaseUnityPlugin { internal static KnightInSilksong Instance = null; internal static ManualLogSource logger = null; internal static bool return_to_main_menu = false; public AssetBundle hk; public GameObject knight; public GameObject hud_canvas; public static Dictionary loaded_gos = new Dictionary(); public static List loaded_mats = new List(); public GameObject hud_instance; public GameObject charm; public GameObject charm_instance; public GameObject fury_effect; public GameObject fury_effect_instance; public static ConfigEntry allowLog; public static ConfigEntry toggleButton; public static ConfigEntry apply_damage_scaling; public static ConfigEntry default_sync; public static ConfigEntry knight_scaleX; public static ConfigEntry knight_scaleY; internal static bool KeybindEnabled = true; private bool iskight; public const int HazardType_NORESPOND = 4096; public Harmony self_hormony; public Action OnToggleKnight; private static AudioMixer master = null; public static bool shouldToggleKnight = false; [CompilerGenerated] private SlotData k__BackingField; public const string Id = "io.github.shownyoung.knightinsilksong"; private HeroController KnightController => HeroController.instance; internal static bool IsKnight => Instance.iskight; public static int KnightDamage => 1073741824; public static AudioMixer Master { get { if ((Object)(object)master == (Object)null) { master = PreProcess.Instance.share_mixer_group.First((AudioMixer am) => ((Object)am).name == "Master"); } return master; } } public SlotData current_data { [CompilerGenerated] get { return k__BackingField; } set { if (k__BackingField != value) { if (k__BackingField != null) { k__BackingField.SaveSyncConfig(); } k__BackingField = value; } } } public static string Name => "KnightInSilkSong"; public static string Version => "0.6.7"; private void Awake() { //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown logger = ((BaseUnityPlugin)this).Logger; allowLog = ((BaseUnityPlugin)this).Config.Bind("General", "AllowLog", false, (ConfigDescription)null); toggleButton = ((BaseUnityPlugin)this).Config.Bind("General", "ToggleButton", (KeyCode)286, (ConfigDescription)null); apply_damage_scaling = ((BaseUnityPlugin)this).Config.Bind("Play", "ApplyDamageScaling", true, "Enable this to make knight's damage influenced by damage scaling"); default_sync = ((BaseUnityPlugin)this).Config.Bind("Play", "DefaultSync", false, "Start game under knight sync mode"); knight_scaleX = ((BaseUnityPlugin)this).Config.Bind("Play", "KnightScaleX", 1f, "The X scale of the knight. Switch to apply"); knight_scaleY = ((BaseUnityPlugin)this).Config.Bind("Play", "KnightScaleY", 1f, "The Y scale of the knight. Switch to apply"); Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.shownyoung.knightinsilksong) has loaded!")); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Game version: " + Application.version)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Unity version: " + Application.unityVersion)); hk = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("KIS.Resources.knight")); GameObject[] array = hk.LoadAllAssets(); foreach (GameObject val in array) { loaded_gos.Add(((Object)val).name, val); } knight = loaded_gos["Knight_0"]; hud_canvas = loaded_gos["Hud Canvas"]; charm = loaded_gos["Charms"]; fury_effect = loaded_gos["fury_effects_v2"]; Object.DontDestroyOnLoad((Object)(object)knight); ModuleManager.Init(); self_hormony = new Harmony("io.github.shownyoung.knightinsilksong"); Type[] typesSafely = Assembly.GetExecutingAssembly().GetTypesSafely(); foreach (Type type in typesSafely) { if (type.IsSubclassOf(typeof(GeneralPatch)) && !type.IsAbstract) { self_hormony.PatchAll(type); } } HandlePlayerData.Init(); } internal void Start() { CompatibilityManager.CheckAndInit(); Type[] typesSafely = Assembly.GetExecutingAssembly().GetTypesSafely(); foreach (Type type in typesSafely) { if (type.IsSubclassOf(typeof(StartPatch)) && !type.IsAbstract) { self_hormony.PatchAll(type); } } } internal void ToggleKnight() { //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) if (!GameManager.instance.IsGameplayScene()) { return; } bool num = iskight; iskight = !iskight; if (num) { if ((Object)(object)KnightController != (Object)null) { ((Component)KnightController).gameObject.SetActive(false); hud_instance.SetActive(false); ((Renderer)((Component)HeroController.instance).GetComponent()).enabled = true; ((Behaviour)HeroController.instance).enabled = true; PlayMakerFSM[] components = ((Component)HeroController.instance).GetComponents(); for (int i = 0; i < components.Length; i++) { ((Behaviour)components[i]).enabled = true; } ((Component)HeroController.instance).gameObject.FindGameObjectInChildren("HeroBox").SetActive(true); EnableOriHud(); } DialogueBox._instance.hudFSM = FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Slide Out"); } else { ((Renderer)((Component)HeroController.instance).GetComponent()).enabled = false; ((Behaviour)HeroController.instance).enabled = false; PlayMakerFSM[] components = ((Component)HeroController.instance).GetComponents(); for (int i = 0; i < components.Length; i++) { ((Behaviour)components[i]).enabled = false; } ((Component)HeroController.instance).gameObject.FindGameObjectInChildren("HeroBox").SetActive(false); SyncManager.Instance.H2KSyncData(); if ((Object)(object)KnightController == (Object)null) { InstKnight(); fury_effect_instance = Object.Instantiate(fury_effect); Object.DontDestroyOnLoad((Object)(object)fury_effect_instance); } else { ((Component)KnightController).gameObject.SetActive(true); if (return_to_main_menu) { Traverse.Create((object)KnightController).Method("SetupGameRefs", Array.Empty()).GetValue(); "Try SetupGameRefs".LogDebug(); return_to_main_menu = false; } } if ((Object)(object)hud_instance == (Object)null) { InstHud((Object)(object)charm_instance == (Object)null); } else { hud_instance.SetActive(true); } DisableOriHud(); DialogueBox._instance.hudFSM = FSMUtility.LocateMyFSM(hud_instance, "Slide Out"); } Extensions.SetScale2D(((Component)KnightController).gameObject.transform, new Vector2((float)((KnightController.transform.localScale.x > 0f) ? 1 : (-1)) * knight_scaleX.Value, knight_scaleY.Value)); ProgressionManager.setup(); OnToggleKnight?.Invoke(iskight); void InstCharm() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) charm_instance = Object.Instantiate(charm); charm_instance.transform.SetParent(((Component)HudCanvas.instance).transform.parent.parent.parent.Find("Inventory").Find("Tools"), false); charm_instance.transform.position = new Vector3(-4.05f, 7.55f, 2.3f); } void InstHud(bool with_charm = true) { hud_instance = Object.Instantiate(hud_canvas); hud_instance.transform.SetParent(((Component)HudCanvas.instance).gameObject.transform.parent, true); GameCameras.instance.soulOrbFSM = FSMUtility.LocateMyFSM(hud_instance.FindGameObjectInChildren("Soul Orb"), "Soul Orb Control"); GameCameras.instance.soulVesselFSM = FSMUtility.LocateMyFSM(hud_instance.FindGameObjectInChildren("Soul Orb").FindGameObjectInChildren("Vessels"), "Update Vessels"); GameManager.instance.soulOrb_fsm = GameCameras.instance.soulOrbFSM; GameManager.instance.soulVessel_fsm = GameCameras.instance.soulVesselFSM; GameObject val = hud_instance.FindGameObjectInChildren("Orb Full"); val.FindGameObjectInChildren("Pulse Sprite").GetComponent().sprite = val.GetComponent().sprite; if (with_charm) { InstCharm(); } } } internal void InstKnight() { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown ModuleManager.GetInstance().StopGetShader(); knight.GetComponent().hardLandingEffectPrefab = HeroController.instance.hardLandingEffectPrefab; knight.GetComponent().softLandingEffectPrefab = HeroController.instance.softLandingEffectPrefab; Object.Instantiate(knight); FSMUtility.LocateMyFSM(((Component)KnightController).gameObject.FindGameObjectInChildren("Charm Effects"), "Fury").AddCustomAction("Get Ref", delegate(PlayMakerFSM fsm3) { fsm3.GetVariable("Fury Vignette").Value = fury_effect_instance; }); ((Component)KnightController).gameObject.Find("Vignette").SetActive(false); ((Component)KnightController).gameObject.Find("white_light_donut").SetActive(false); ((Component)KnightController).gameObject.Find("HeroLight").SetActive(false); ((Component)KnightController).gameObject.Find("Attacks").Find("Sharp Shadow").tag = "Sharp Shadow"; PlayMakerFSM fsm = FSMUtility.LocateMyFSM(KnightController.heroDeathPrefab, "Hero Death Anim"); fsm.GetAction("Set Shade", 1).functionCall.FunctionName = "PositionCompassAndCorpse"; fsm.InsertCustomAction("Check MP", (Action)delegate { PreProcess.SetDeathInfo(); }, 0); fsm.AddCustomAction("Map Zone", delegate(PlayMakerFSM val2) { if (GameManager.instance.IsMemoryScene()) { val2.SendEvent("DREAM"); } }); GameObject val = new GameObject("Centre"); val.transform.SetParent(KnightController.transform, false); val.transform.localPosition = new Vector3(0f, 0f, 0f); PlayMakerFSM obj = ((Component)KnightController).gameObject.AddComponent(); obj.Fsm = new Fsm(FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Roar and Wound States").Fsm, (FsmVariables)null); obj.AddTransition("Damage Check 4", "CANCEL", "Idle"); ((Component)KnightController).gameObject.FindGameObjectInChildren("Dream Effects").FindGameObjectInChildren("Hitbox"); PlayMakerFSM fsm2 = FSMUtility.LocateMyFSM(((Component)KnightController).gameObject, "ProxyFSM"); FsmState state = fsm2.AddState("Parried"); state.AddTransition("FINISHED", "Blocker Hit"); state.AddCustomAction((Action)delegate { ((MonoBehaviour)KnightController).StartCoroutine(KnightController.StartRecoil((CollisionSide)0, false, 0)); }); fsm2.AddTransition("Idle", "PARRIED", "Parried"); PlayerData.instance.SetBool("infiniteAirJump", WithDebugMod.infinite_jump); PlayerData.instance.SetInt("MPCharge", 0); PlayerData.instance.SetInt("MPReserve", 0); FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Harpoon Dash").AddCustomAction("Init", delegate(PlayMakerFSM fsm3) { FsmGameObject variable = fsm3.GetVariable("Needle"); if (variable.Value == null) { GameObject val2 = (variable.Value = ((Component)HeroController.instance).gameObject.FindGameObjectInChildren("Harpoon Needle")); } variable = fsm3.GetVariable("Thread"); if (variable.Value == null) { GameObject val2 = (variable.Value = ((Component)HeroController.instance).gameObject.FindGameObjectInChildren("Harpoon Needle").FindGameObjectInChildren("Thread")); } }); } internal void DisableOriHud() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(-0.024f, -1.095f, 0f); GameObject value = FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Slide Out").FsmVariables.FindFsmGameObject("Counters Parent").Value; FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Slide Out").RemoveTransition("Out", "IN"); FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Slide Out").SendEvent("OUT INSTANT"); Extensions.SetScale2D(((Component)HudCanvas.instance).gameObject.transform, Vector2.one); ((Behaviour)FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Globalise")).enabled = false; if ((Object)(object)value != (Object)null) { value.transform.SetParent(hud_instance.transform); value.transform.position = position; PositionRelativeTo component = value.GetComponent(); if (component != null) { component.previousPos = value.transform.position; } } } internal void EnableOriHud() { ((Behaviour)FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Globalise")).enabled = true; FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Slide Out").AddTransition("Out", "IN", "In Wait"); FSMUtility.LocateMyFSM(((Component)HudCanvas.instance).gameObject, "Slide Out").SendEvent("IN"); } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if ((KeybindEnabled && Input.GetKeyDown(toggleButton.Value)) || shouldToggleKnight) { ToggleKnight(); shouldToggleKnight = false; } if ((Object)(object)HeroController.instance != (Object)null) { ProgressionManager.setProgression(); } CompatibilityManager.UpdateAll(); } private void OnApplicationQuit() { KISHelper.OnQuitApp?.Invoke(); current_data = null; } } public enum LangKey { DEBUG_SCREAM_NAME, DEBUG_FIREBALL_NAME, DEBUG_QUAKE_NAME, KING_SOUL, GRIMM_CHILD, CHARM_HEART, CHARM_GREED, CHARM_STRENGTH, DEBUG_ALL_CHARMS, DEBUG_REMOVE_ALL_CHARMS, OVERCHARM, DEBUG_INCREASE_CHARMSLOTS, DEBUG_DECREASE_CHARMSLOTS, DEBUG_ALL_SKILL, DEBUG_DASH_NAME, DEBUG_DOUBLE_JUMP_NAME, DEBUG_WALL_JUMP_NAME, DEBUG_SUPER_DASH_NAME, DEBUG_ACID_SWIM_NAME, DEBUG_DREAM_NAIL_NAME, DEBUG_DREAM_GATE_NAME, DEBUG_GREAT_SLASH_NAME, DEBUG_DASH_SLASH_NAME, DEBUG_CYCLONE_NAME, DEBUG_PROMPT, DEBUG_FIX_CHARMSLOTS, MM_MAX_HEALTH_BASE, MM_NAIL_UPGRADES, MM_KNIGHT_NAIL_UPGRADES, MM_BOSSRUSH_MODE, MM_UNLOCK_SLOTS, MM_SILKSHOT_ARCHITECT, MM_SILKSHOT_FORGE, MM_SILKSHOT_WEAVER, DASH_NAME, SHADOWDASH_NAME, SALUBRA_NAME, CHARMSLOT_NAME, MAP_NAME, SYNC_MODE_SET, SYNC_MODE_EQUAL, SYNC_MODE_CONTRIBUTE, MM_ROYAL_CHARM_STATE, MM_GRIMM_CHARM_STATE, WHITE_FRAGMENT, VOID_HEART, CAREFREE_MELODY, SOUL_ORB, MM_ADD, MM_DELETE, MM_RELOAD, MM_DEFAULT, MM_EDIT, MM_CLEAR, MM_VALIDATE, MM_SAVE, MM_OK, MM_FAIL, MM_MODDED, MM_STATE, MM_SAVE_OPTIONS, MM_ALLOW_LOG, MM_TOGGLE_BUTTON, MM_APPLY_DAMAGE_SCALING, MM_DEFAULT_SYNC, MM_KNIGHT_SCALE_X, MM_KNIGHT_SCALE_Y, MM_SYNC, SWITCH_CHARACTER, DEBUG_KNIGHT, DEBUG_CONTROL, DEBUG_SKILL, DEBUG_CHARM, DEBUG_CHARACTER, DEBUG_NAIL_BASE, DEBUG_DASHING, DEBUG_SUPERDASHING, DEBUG_CAN_SUPERDASH, DEBUG_SOUL } public class MoreLanguge : IModule { private static Dictionary game_key_dict = new Dictionary { { LangKey.KING_SOUL, "CHARM_NAME_36_B" }, { LangKey.GRIMM_CHILD, "CHARM_NAME_40" }, { LangKey.CHARM_HEART, "CHARM_NAME_23_G" }, { LangKey.CHARM_GREED, "CHARM_NAME_24_G" }, { LangKey.CHARM_STRENGTH, "CHARM_NAME_25_G" }, { LangKey.OVERCHARM, "CHARM_TXT_OVERCHARMED" }, { LangKey.DEBUG_DOUBLE_JUMP_NAME, "INV_NAME_DOUBLEJUMP" }, { LangKey.DEBUG_WALL_JUMP_NAME, "INV_NAME_WALLJUMP" }, { LangKey.DEBUG_SUPER_DASH_NAME, "INV_NAME_SUPERDASH" }, { LangKey.DEBUG_ACID_SWIM_NAME, "INV_NAME_ACIDARMOUR" }, { LangKey.DEBUG_DREAM_NAIL_NAME, "INV_NAME_DREAMNAIL_A" }, { LangKey.DEBUG_DREAM_GATE_NAME, "INV_NAME_DREAMGATE" }, { LangKey.DEBUG_DASH_SLASH_NAME, "INV_NAME_ART_UPPER" }, { LangKey.DEBUG_GREAT_SLASH_NAME, "INV_NAME_ART_DASH" }, { LangKey.DEBUG_CYCLONE_NAME, "INV_NAME_ART_CYCLONE" }, { LangKey.DASH_NAME, "INV_NAME_DASH" }, { LangKey.SHADOWDASH_NAME, "INV_NAME_SHADOWDASH" }, { LangKey.SALUBRA_NAME, "NAME_BLESSING" }, { LangKey.CHARMSLOT_NAME, "INV_NAME_NOTCH" }, { LangKey.MAP_NAME, "PANE_MAP" }, { LangKey.WHITE_FRAGMENT, "CHARM_NAME_36_A" }, { LangKey.VOID_HEART, "CHARM_NAME_36_C" }, { LangKey.CAREFREE_MELODY, "CHARM_NAME_40_N" }, { LangKey.SOUL_ORB, "INV_NAME_SOULORBS_ALL" } }; public static LocalisedString Yes => new LocalisedString("MainMenu", "NAV_YES"); public static LocalisedString No => new LocalisedString("MainMenu", "NAV_NO"); public static LocalisedString On => new LocalisedString("MainMenu", "MOH_ON"); public static LocalisedString Off => new LocalisedString("MainMenu", "MOH_OFF"); public static LocalisedString None => new LocalisedString("MainMenu", "KEYBOARD_NONE"); public static string GetInGameKey(LangKey langKey) { if (!game_key_dict.TryGetValue(langKey, out var value)) { return langKey.ToString(); } return value; } public override void Init() { base.Init(); } } public class ProgressionManager { private static GameObject smallPlatform; private static int oldKnightHealth = 0; private static int oldKnightMPCharge = 0; private static int knightSoulRemainder = 0; private static bool managedFsmChange = false; private static SyncManager syncManager = new SyncManager(); private static Dictionary> platform_positions = new Dictionary> { { "under_17", new List(1) { new Vector2(45f, 15f) } }, { "bone_east_20", new List(1) { new Vector2(113f, 19f) } }, { "under_18", new List(3) { new Vector2(117f, 14f), new Vector2(40f, 33.5f), new Vector2(79f, 34f) } }, { "hang_13", new List(1) { new Vector2(53f, 17.5f) } }, { "peak_01", new List(1) { new Vector2(30.56f, 66.5f) } } }; public static void setup() { if (!((Object)(object)smallPlatform != (Object)null)) { setupPlatform(); SceneManager.activeSceneChanged -= onActiveSceneChanged; SceneManager.activeSceneChanged += onActiveSceneChanged; } } private static async void setupPlatform() { smallPlatform = await SceneObjectManager.loadObjectFromScene("Tut_01b", "bone_plat_03 (2)"); smallPlatform.SetActive(false); ((Object)smallPlatform).name = "smallPlatform"; Object.DontDestroyOnLoad((Object)(object)smallPlatform); } private static void placePlatform(float x, float y) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(x, y); GameObject obj = Object.Instantiate(smallPlatform); obj.transform.position = Vector2.op_Implicit(val); obj.SetActive(true); } private static void placeBounceBloom(float x, float y, string name) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(x, y); GameObject obj = Object.Instantiate(GameObject.Find(name)); obj.GetComponent().position = Vector2.op_Implicit(val); obj.SetActive(true); } private static void onActiveSceneChanged(Scene from, Scene to) { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) string text = ((Scene)(ref to)).name.ToLower(); managedFsmChange = false; switch (text) { case "tut_01": patchIntroCutscenes(); disableWeaknessCutscene(); break; case "tut_03": disableWeaknessCutscene(); break; case "bonetown": PlayerDataAccess.churchKeeperIntro = true; disableWeaknessCutscene(); break; case "library_10": movePsalmCylinderDown(); break; case "hang_01": moveHang01RingDown(); break; case "shellwood_03": placeBounceBloom(10f, 21.5f, "Shellwood Bounce Bloom"); break; case "shellwood_13": if (!PlayerDataAccess.hasWalljump) { AddNonSlider("Chunk 0 2"); } break; case "song_tower_01": MoveDoorPosition(); break; } if (!platform_positions.TryGetValue(text, out var value)) { return; } foreach (Vector2 item in value) { placePlatform(item.x, item.y); } } private static void MoveDoorPosition() { Extensions.SetPositionY(GameObject.Find("Boss Scene").FindGameObjectInChildren("Silk Heart Memory Return").FindGameObjectInChildren("door_cinematicEnd") .transform, 100f); } private static void AddNonSlider(string goname) { GameObject.Find(goname).GetAddComponent(); } public static void setProgression() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //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) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.ToLower() == "song_tower_01") { if (!managedFsmChange) { managedFsmChange = bypassSilkHeartLace(); } return; } activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name.ToLower() == "cradle_03") { if (!managedFsmChange) { managedFsmChange = fixEndSequence(); } } else { managedFsmChange = false; } } private static bool bypassSilkHeartLace() { if ((Object)(object)GameObject.Find("Silk Heart") == (Object)null) { return false; } ((UnlockablePropBase)GameObject.Find("song_tower_right_gate").GetComponent()).Open(); return true; } private static bool fixEndSequence() { GameObject val = GameObject.Find("Death Sequence"); if ((Object)(object)val == (Object)null) { return false; } if (val.GetFsm("Control").ActiveStateName == "Final Bind") { if (KnightInSilksong.IsKnight) { KnightInSilksong.shouldToggleKnight = true; } return true; } return false; } private static void patchIntroCutscenes() { //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) if (!PlayerDataAccess.bindCutscenePlayed) { PlayerDataAccess.bindCutscenePlayed = true; HeroController.instance.transform.position = Vector2.op_Implicit(new Vector2(50f, 30f)); KnightInSilksong.shouldToggleKnight = true; } } private static void disableWeaknessCutscene() { GameObject.Find("Weakness Scene").active = false; } private static void movePsalmCylinderDown() { //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_0035: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Collectable Item Pickup - Melody"); if (!((Object)(object)val == (Object)null)) { val.transform.localPosition = Vector2.op_Implicit(new Vector2(val.transform.position.x, 3.6264f)); } } private static void moveHang01RingDown() { //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_0035: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Harpoon Ring Citadel (1)"); if (!((Object)(object)val == (Object)null)) { val.transform.localPosition = Vector2.op_Implicit(new Vector2(val.transform.position.x, 18.3f)); } } } internal class SyncManager { public enum SyncMode { EQUAL, SET, CONTRIBUTE } public class SyncBaseInfo { public string hdPath; public object hdValue; public string kdPath; public object kdValue; [JsonProperty(/*Could not decode attribute arguments.*/)] public string operation = SyncMode.EQUAL.ToString(); [CompilerGenerated] private SyncMode k__BackingField; [JsonIgnore] public SyncMode SyncMode { get { if (Enum.TryParse(typeof(SyncMode), operation, out object result)) { k__BackingField = (SyncMode)result; } return k__BackingField; } set { k__BackingField = value; operation = k__BackingField.ToString(); } } public SyncBaseInfo(string hdPath, object hdValue, string kdPath, object kdValue, SyncMode operation) { this.hdPath = hdPath; this.hdValue = hdValue; this.kdPath = kdPath; this.kdValue = kdValue; this.operation = operation.ToString(); if (this.hdValue is long num) { this.hdValue = (int)num; } if (this.kdValue is long num2) { this.kdValue = (int)num2; } } } public abstract class SyncEntry { public Action dirty_action; public SyncMode mode = (Enum.TryParse(info.operation, out var result) ? result : SyncMode.EQUAL); protected static PlayerData kd => PlayerData.instance; public abstract string KDPath { get; } public abstract string SubscribeHDPath { get; } protected SyncEntry(SyncBaseInfo info) { } public abstract SyncBaseInfo ToBaseInfo(); protected virtual object GetKDValue() { if (((object)kd).GetType().GetField(KDPath) != null) { return ((object)kd).GetType().GetField(KDPath).GetValue(kd); } throw new Exception("Knight.PlayerData don't have field " + KDPath); } protected virtual void _SetKDValue(object value) { if (((object)kd).GetType().GetField(KDPath) != null) { ((object)kd).GetType().GetField(KDPath).SetValue(kd, Convert.ChangeType(value, ((object)kd).GetType().GetField(KDPath).FieldType)); return; } throw new Exception("Knight.PlayerData don't have field " + KDPath); } public abstract bool ShouldApply(); public abstract bool ApplyValue(); public void H2KSyncData() { try { if (ShouldApply() && ApplyValue()) { dirty_action?.Invoke(GetKDValue()); } } catch (Exception ex) { ("H2KSyncData error " + ex).LogError(); } } } public class DefaultKDValue : SyncEntry { private string kdPath; private object kdValue; public override string KDPath => kdPath; public override string SubscribeHDPath => null; public DefaultKDValue(SyncBaseInfo info) : base(info) { kdPath = info.kdPath; kdValue = info.kdValue; } public override bool ApplyValue() { if (!object.Equals(GetKDValue(), kdValue)) { _SetKDValue(kdValue); return true; } return false; } public override bool ShouldApply() { return true; } public override SyncBaseInfo ToBaseInfo() { return new SyncBaseInfo(null, null, kdPath, kdValue, SyncMode.SET); } } public class HD2KDSync : SyncEntry { protected string hdPath; protected object hdValue; protected string kdPath; protected object kdValue; protected bool always_equal; protected SyncMode sync_mode; protected static PlayerData hd => PlayerData.instance; public override string KDPath => kdPath; public override string SubscribeHDPath => hdPath; public HD2KDSync(SyncBaseInfo info) : base(info) { hdPath = info.hdPath; hdValue = info.hdValue; kdPath = info.kdPath; kdValue = info.kdValue; sync_mode = info.SyncMode; always_equal = info.SyncMode == SyncMode.EQUAL; } protected virtual object GetHDValue() { if (((object)hd).GetType().GetField(hdPath) != null) { return ((object)hd).GetType().GetField(hdPath).GetValue(hd); } if (((object)hd).GetType().GetProperty(hdPath) != null) { return ((object)hd).GetType().GetProperty(hdPath).GetValue(hd); } throw new Exception("PlayerData has no field or Property " + hdPath); } public override bool ApplyValue() { object obj = null; Type fieldType = ((object)SyncEntry.kd).GetType().GetField(KDPath).FieldType; switch (sync_mode) { case SyncMode.CONTRIBUTE: if (fieldType == typeof(bool)) { obj = true; } else if (fieldType == typeof(int)) { obj = (int)GetKDValue() + 1; } else { $"CONTRIBUTE to type {fieldType} for {KDPath}".LogWarning(); } break; case SyncMode.EQUAL: obj = GetHDValue(); break; case SyncMode.SET: obj = kdValue; break; } if (!object.Equals(obj, GetKDValue())) { _SetKDValue(obj); return true; } return false; } public override bool ShouldApply() { if (!always_equal) { return object.Equals(hdValue, GetHDValue()); } return true; } public override SyncBaseInfo ToBaseInfo() { return new SyncBaseInfo(hdPath, hdValue, kdPath, kdValue, (!always_equal) ? SyncMode.SET : SyncMode.EQUAL); } } public class FromUnlockedSlots : HD2KDSync { private object unlockedSlots; public const string CheckKey = "ToolEquips"; public override string SubscribeHDPath => "ToolEquips"; public FromUnlockedSlots(SyncBaseInfo info) : base(info) { unlockedSlots = info.hdValue; } protected override object GetHDValue() { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (Data validData in ((SerializableNamedList)(object)HD2KDSync.hd.ToolEquips).GetValidDatas((Func)null)) { if (validData.IsUnlocked && validData.Slots != null) { num += validData.Slots.Count((SlotData slot) => slot.IsUnlocked); } } return num; } } public class FromTool : HD2KDSync { public const string prefix = "Tool_"; private string tool_name; public override string SubscribeHDPath => tool_name; public FromTool(SyncBaseInfo info) : base(info) { tool_name = hdPath.Replace("Tool_", ""); } protected override object GetHDValue() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!((SerializableNamedList)(object)HD2KDSync.hd.Tools).GetValidNames((Func)null).Contains(tool_name)) { return false; } Data data = ((SerializableNamedList)(object)HD2KDSync.hd.Tools).GetData(tool_name); return data.IsUnlocked && !data.IsHidden; } } private static Dictionary> dirty_action_dict = new Dictionary> { { "nailDamage", delegate { PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); } }, { "charmSlots", delegate { kd.charmSlots = Math.Max(Math.Min(kd.charmSlots, 11), 3); } }, { "maxHealthBase", delegate { kd.maxHealthBase = Math.Min(kd.maxHealthBase, 9); } }, { "nailSmithUpgrades", delegate(object val) { int num = Math.Min((int)val, 4); kd.SetInt("nailSmithUpgrades", num); kd.SetInt("nailDamage", 5 + 4 * num); PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); } }, { "hasDash", delegate(object val) { kd.SetBool("canDash", (bool)val); } }, { "hasShadowDash", delegate(object val) { kd.SetBool("canShadowDash", (bool)val); } }, { "hasDashSlash", delegate { UpdateNailArtState(); } }, { "hasUpwardSlash", delegate { UpdateNailArtState(); } }, { "hasCyclone", delegate { UpdateNailArtState(); } }, { "grimmChildLevel", delegate(object val) { int num = (int)val; if (num > 5) { num = 5; } int num2 = ((num == 5) ? 3 : 2); kd.SetInt("grimmChildLevel", num); kd.SetInt("charmCost_40", num2); kd.SetBool("destroyedNightmareLantern", num == 5); } }, { "royalCharmState", delegate(object val) { int num = (int)val; if (num > 4) { num = 4; } int num2 = ((num != 4) ? 5 : 0); kd.SetInt("royalCharmState", num); kd.SetInt("charmCost_36", num2); } }, { "fireballLevel", delegate(object val) { kd.SetInt("fireballLevel", Math.Min((int)val, 2)); } }, { "quakeLevel", delegate(object val) { kd.SetInt("quakeLevel", Math.Min((int)val, 2)); } }, { "screamLevel", delegate(object val) { kd.SetInt("screamLevel", Math.Min((int)val, 2)); } }, { "permadeathMode", delegate(object val) { kd.SetInt("permadeathMode", Math.Min((int)val, 1)); } }, { "MPReserveMax", delegate(object val) { kd.SetInt("MPReserveMax", Math.Min((int)val, 99)); } } }; private static SyncManager _instance; private List sync_entries = new List(); private List base_infos = new List(); private Dictionary> hdpath_to_sync_entry = new Dictionary>(); private bool enable = true; private bool initialized; public static SyncManager Instance => _instance ?? (_instance = new SyncManager()); private static PlayerData hd => PlayerData.instance; private static PlayerData kd => PlayerData.instance; private static void UpdateNailArtState() { kd.SetBool("hasNailArt", kd.GetBool("hasDashSlash") || kd.GetBool("hasUpwardSlash") || kd.GetBool("hasCyclone")); kd.SetBool("hasAllNailArts", kd.GetBool("hasDashSlash") && kd.GetBool("hasUpwardSlash") && kd.GetBool("hasCyclone")); } private static void AddNecessarySyncAction(SyncEntry entry) { SyncEntry syncEntry = entry; syncEntry.dirty_action = (Action)Delegate.Combine(syncEntry.dirty_action, (Action)delegate(object val) { (entry.KDPath + " is dirty, set value to " + val).LogInfo(); }); if (dirty_action_dict.ContainsKey(entry.KDPath)) { SyncEntry syncEntry2 = entry; syncEntry2.dirty_action = (Action)Delegate.Combine(syncEntry2.dirty_action, dirty_action_dict[entry.KDPath]); } } public static SyncEntry FromBaseInfo(SyncBaseInfo info) { SyncEntry syncEntry = (Utility.IsNullOrWhiteSpace(info.hdPath) ? ((SyncEntry)new DefaultKDValue(info)) : ((SyncEntry)((info.hdPath == "ToolEquips") ? new FromUnlockedSlots(info) : ((!info.hdPath.StartsWith("Tool_")) ? new HD2KDSync(info) : new FromTool(info))))); AddNecessarySyncAction(syncEntry); return syncEntry; } public SyncManager() { KISHelper.OnReturnToMenu = (Action)Delegate.Remove(KISHelper.OnReturnToMenu, new Action(Return2Menu)); KISHelper.OnReturnToMenu = (Action)Delegate.Combine(KISHelper.OnReturnToMenu, new Action(Return2Menu)); } private void ResetConfig() { ApplyInfo(DefaultConfig()); } private static SyncBaseInfo SameNameSync(string path) { return new SyncBaseInfo(path, null, path, null, SyncMode.EQUAL); } private static SyncBaseInfo SameValueSync(string hdPath, string kdPath) { return new SyncBaseInfo(hdPath, null, kdPath, null, SyncMode.EQUAL); } private static SyncBaseInfo DefaultValue(string kdPath, object kdValue) { return new SyncBaseInfo(null, null, kdPath, kdValue, SyncMode.SET); } private static SyncBaseInfo Tool2Charm(Tool tool, Charm charm, bool always_equal = true) { return new SyncBaseInfo("Tool_" + tool.GetToolName(), true, charm.GetCharmName(), true, (!always_equal) ? SyncMode.CONTRIBUTE : SyncMode.EQUAL); } public static List DefaultConfig() { return new List(76) { SameNameSync("hasDash"), SameNameSync("hasWalljump"), SameNameSync("hasDoubleJump"), SameValueSync("hasDash", "hasSuperDash"), SameValueSync("hasHarpoonDash", "hasShadowDash"), DefaultValue("fireballLevel", 0), new SyncBaseInfo("hasNeedleThrow", true, "fireballLevel", 1, SyncMode.CONTRIBUTE), new SyncBaseInfo("hasSilkCharge", true, "fireballLevel", 2, SyncMode.CONTRIBUTE), DefaultValue("quakeLevel", 0), new SyncBaseInfo("hasParry", true, "quakeLevel", 1, SyncMode.CONTRIBUTE), new SyncBaseInfo("hasSilkBossNeedle", true, "quakeLevel", 2, SyncMode.CONTRIBUTE), DefaultValue("screamLevel", 0), new SyncBaseInfo("hasThreadSphere", true, "screamLevel", 1, SyncMode.CONTRIBUTE), new SyncBaseInfo("hasSilkBomb", true, "screamLevel", 2, SyncMode.CONTRIBUTE), DefaultValue("MPReserveMax", 0), SameNameSync("maxHealthBase"), SameValueSync("nailUpgrades", "nailSmithUpgrades"), SameValueSync("hasNeedolin", "hasDreamNail"), SameValueSync("UnlockedFastTravelTeleport", "hasDreamGate"), SameValueSync("permadeathMode", "permadeathMode"), SameNameSync("bossRushMode"), SameValueSync("HasBoundCrestUpgrader", "salubraBlessing"), SameValueSync("hasChargeSlash", "hasCyclone"), SameValueSync("hasChargeSlash", "hasDashSlash"), SameValueSync("hasChargeSlash", "hasUpwardSlash"), DefaultValue("hasMap", true), new SyncBaseInfo("ToolEquips", null, "charmSlots", null, SyncMode.EQUAL), Tool2Charm(Tool.Compass, Charm.WaywardCompass), Tool2Charm(Tool.Sting_Shard, Charm.Weaversong), Tool2Charm(Tool.Pimpilo, Charm.DefendersCrest), Tool2Charm(Tool.Lightning_Rod, Charm.MarkOfPride), Tool2Charm(Tool.Flintstone, Charm.UnbreakableStrength), Tool2Charm(Tool.Flea_Brew, Charm.QuickSlash), Tool2Charm(Tool.Lifeblood_Syringe, Charm.JonisBlessing), DefaultValue(Charm.Grubsong.GetCharmName(), false), Tool2Charm(Tool.Mosscreep_Tool_1, Charm.Grubsong, always_equal: false), Tool2Charm(Tool.Mosscreep_Tool_2, Charm.Grubsong, always_equal: false), Tool2Charm(Tool.Bell_Bind, Charm.BaldurShell), Tool2Charm(Tool.Poison_Pouch, Charm.Flukenest), Tool2Charm(Tool.Lava_Charm, Charm.StalwartShell), Tool2Charm(Tool.Fractured_Mask, Charm.LifebloodHeart), Tool2Charm(Tool.Multibind, Charm.DeepFocus), Tool2Charm(Tool.White_Ring, Charm.SoulEater), Tool2Charm(Tool.Brolly_Spike, Charm.SharpShadow), Tool2Charm(Tool.Quickbind, Charm.QuickFocus), Tool2Charm(Tool.Spool_Extender, Charm.SpellTwister), Tool2Charm(Tool.Reserve_Bind, Charm.Hiveblood), DefaultValue(Charm.SporeShroom.GetCharmName(), false), Tool2Charm(Tool.Dazzle_Bind, Charm.SporeShroom, always_equal: false), Tool2Charm(Tool.Dazzle_Bind_Upgraded, Charm.SporeShroom, always_equal: false), Tool2Charm(Tool.Revenge_Crystal, Charm.ThornsOfAgony), Tool2Charm(Tool.Zap_Imbuement, Charm.ShamanStone), Tool2Charm(Tool.Quick_Sling, Charm.SoulCatcher), Tool2Charm(Tool.Maggot_Charm, Charm.LifebloodCore), Tool2Charm(Tool.Longneedle, Charm.Longnail), Tool2Charm(Tool.Wisp_Lantern, Charm.GlowingWomb), Tool2Charm(Tool.Flea_Charm, Charm.GrubberflysElegy), Tool2Charm(Tool.Pinstress_Tool, Charm.NailmastersGlory), Tool2Charm(Tool.Bone_Necklace, Charm.HeavyBlow), Tool2Charm(Tool.Rosary_Magnet, Charm.GatheringSwarm), Tool2Charm(Tool.Weighted_Anklet, Charm.SteadyBody), Tool2Charm(Tool.Barbed_Wire, Charm.FuryOfTheFallen), DefaultValue(Charm.UnbreakableHeart.GetCharmName(), false), Tool2Charm(Tool.Dead_Mans_Purse, Charm.UnbreakableHeart, always_equal: false), Tool2Charm(Tool.Shell_Satchel, Charm.UnbreakableHeart, always_equal: false), DefaultValue(Charm.Grimmchild.GetCharmName(), false), DefaultValue("grimmChildLevel", 4), Tool2Charm(Tool.Cogwork_Flier, Charm.Grimmchild, always_equal: false), Tool2Charm(Tool.Magnetite_Dice, Charm.Grimmchild, always_equal: false), new SyncBaseInfo("Tool_" + Tool.Magnetite_Dice.GetToolName(), true, "grimmChildLevel", 5, SyncMode.SET), Tool2Charm(Tool.Scuttlebrace, Charm.Dashmaster), Tool2Charm(Tool.Sprintmaster, Charm.Sprintmaster), Tool2Charm(Tool.Musician_Charm, Charm.DreamWielder), Tool2Charm(Tool.Thief_Charm, Charm.UnbreakableGreed), Tool2Charm(Tool.Wallcling, Charm.ShapeOfUnn), Tool2Charm(Tool.Cogwork_Saw, Charm.Dreamshield) }; } private void ApplyInfo(List infos) { if (infos == null) { infos = DefaultConfig(); } sync_entries.Clear(); hdpath_to_sync_entry.Clear(); base_infos = infos; foreach (SyncBaseInfo base_info in base_infos) { SyncEntry syncEntry = FromBaseInfo(base_info); sync_entries.Add(syncEntry); if (!Utility.IsNullOrWhiteSpace(syncEntry.SubscribeHDPath)) { if (!hdpath_to_sync_entry.ContainsKey(syncEntry.SubscribeHDPath)) { hdpath_to_sync_entry.Add(syncEntry.SubscribeHDPath, new List()); } hdpath_to_sync_entry[syncEntry.SubscribeHDPath].Add(syncEntry); } } } public void Initialize(List infos, bool enable) { this.enable = enable; ApplyInfo(infos); initialized = true; } public void Return2Menu() { initialized = false; } public void H2KSyncData() { if (!enable || !initialized) { return; } "H2KSyncData".LogInfo(); foreach (SyncEntry sync_entry in sync_entries) { sync_entry.H2KSyncData(); } } public void H2KSyncData(string hdPath) { if (!enable || !initialized || !hdpath_to_sync_entry.ContainsKey(hdPath)) { return; } ("H2KSyncData2 " + hdPath).LogInfo(); foreach (SyncEntry item in hdpath_to_sync_entry[hdPath]) { item.H2KSyncData(); } } public void SaveConfig(string path) { if (!initialized) { return; } List list = new List(); foreach (SyncEntry sync_entry in sync_entries) { list.Add(sync_entry.ToBaseInfo()); } File.WriteAllText(path, JsonConvert.SerializeObject((object)list, (Formatting)1)); } public bool IsWatching(string var_name) { if (enable) { return hdpath_to_sync_entry.ContainsKey(var_name); } return false; } } } namespace KIS.Utils { public static class FsmUtil { public static PlayMakerFSM GetFsm(this GameObject go, string name) { PlayMakerFSM[] components = go.GetComponents(); foreach (PlayMakerFSM val in components) { if (val.FsmName == name) { return val; } } return null; } public static FsmState AddState(this PlayMakerFSM fsm, FsmState state) { FsmState[] states = fsm.Fsm.States; FsmState[] array = (FsmState[])(object)new FsmState[states.Length + 1]; int i; for (i = 0; i < states.Length; i++) { array[i] = states[i]; } array[i] = state; fsm.Fsm.States = array; return array[i]; } public static void GiveStatesPosition(this PlayMakerFSM fsm, float startX = 500f, float Y = 1100f) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) FsmState[] states = fsm.Fsm.States; float num = startX; for (int i = 0; i < states.Length; i++) { Rect position = states[i].Position; if (((Rect)(ref position)).height == 0f) { FsmState val = states[i]; val.GiveStatePosition(num, Y, 10 * val.Name.Length + 10, 15 * (val.Transitions.Length + 1)); float num2 = num; position = val.Position; num = num2 + (((Rect)(ref position)).width + 50f); } } } public static void GiveStatePosition(this FsmState state, float x, float y, float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) state.Position = new Rect(x, y, w, h); } public static FsmState AddState(this PlayMakerFSM fsm, string stateName) { //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_0018: Expected O, but got Unknown return fsm.AddState(new FsmState(fsm.Fsm) { Name = stateName }); } [Obsolete("Satchel.FsmUtil.GetState is deprecated, please use Satchel.FsmUtil.TryGetState or Satchel.FsmUtil.GetValidState instead.")] public static FsmState GetState(this PlayMakerFSM fsm, string stateName) { return fsm.Fsm.GetState(stateName); } public static bool TryGetState(this PlayMakerFSM fsm, string stateName, out FsmState state) { state = fsm.Fsm.GetState(stateName); return state != null; } public static FsmState GetValidState(this PlayMakerFSM fsm, string stateName) { if (fsm.TryGetState(stateName, out var state)) { return state; } throw new ArgumentException("FSM \"" + fsm.FsmName + "\" does not have state \"" + stateName + "\""); } public static FsmState CopyState(this PlayMakerFSM fsm, string origStateName, string newStateName) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown FsmState val = new FsmState(fsm.Fsm.GetState(origStateName)) { Name = newStateName }; val.FixTransitionsFromState(); fsm.AddState(val); return val; } public static void FixTransitionsFromState(this FsmState state) { FsmTransition[] transitions = state.Transitions; foreach (FsmTransition val in transitions) { val.ToFsmState = state.Fsm.GetState(val.ToState); } } public static void FixTransitionToState(this FsmState state) { FsmState[] states = state.Fsm.States; for (int i = 0; i < states.Length; i++) { FsmTransition[] transitions = states[i].Transitions; foreach (FsmTransition val in transitions) { if (val.ToState == state.Name) { val.ToFsmState = state; } } } } public static void AddTransition(this FsmState state, string onEventName, string toStateName) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_003d: Expected O, but got Unknown FsmTransition[] transitions = state.Transitions; FsmTransition[] array = (FsmTransition[])(object)new FsmTransition[transitions.Length + 1]; FsmTransition val = new FsmTransition { ToState = toStateName, ToFsmState = state.Fsm.GetState(toStateName), FsmEvent = FsmEvent.GetFsmEvent(onEventName) }; int i; for (i = 0; i < transitions.Length; i++) { array[i] = transitions[i]; } array[i] = val; state.Transitions = array; } public static void AddTransition(this PlayMakerFSM fsm, string fromStateName, string onEventName, string toStateName) { fsm.Fsm.GetState(fromStateName).AddTransition(onEventName, toStateName); } public static void RemoveTransition(this FsmState state, string onEventName) { state.Transitions = state.Transitions.Where((FsmTransition t) => t.EventName != onEventName).ToArray(); } public static void RemoveTransition(this PlayMakerFSM fsm, string fromStateName, string onEventName) { fsm.GetValidState(fromStateName).RemoveTransition(onEventName); } public static FsmTransition? GetTransition(this FsmState state, string onEventName) { return ((IEnumerable)state.Transitions).FirstOrDefault((Func)((FsmTransition t) => t.EventName == onEventName)); } public static FsmTransition GetTransition(this PlayMakerFSM fsm, string fromStateName, string onEventName) { return fsm.Fsm.GetState(fromStateName).GetTransition(onEventName); } public static void ChangeTransition(this FsmState state, string onEventName, string toStateName) { FsmTransition? transition = state.GetTransition(onEventName); transition.ToState = toStateName; transition.ToFsmState = state.Fsm.GetState(toStateName); } public static void ChangeTransition(this PlayMakerFSM fsm, string fromStateName, string onEventName, string toStateName) { fsm.GetValidState(fromStateName).ChangeTransition(onEventName, toStateName); } public static void AddGlobalTransition(this PlayMakerFSM fsm, string onGlobalEventName, string toStateName) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0042: Expected O, but got Unknown FsmTransition[] globalTransitions = fsm.Fsm.GlobalTransitions; FsmTransition[] array = (FsmTransition[])(object)new FsmTransition[globalTransitions.Length + 1]; FsmTransition val = new FsmTransition { ToState = toStateName, ToFsmState = fsm.Fsm.GetState(toStateName), FsmEvent = FsmEvent.GetFsmEvent(onGlobalEventName) }; int i; for (i = 0; i < globalTransitions.Length; i++) { array[i] = globalTransitions[i]; } array[i] = val; fsm.Fsm.GlobalTransitions = array; } public static FsmStateAction GetAction(this FsmState state, int index) { return state.Actions[index]; } public static FsmStateAction GetAction(this PlayMakerFSM fsm, string stateName, int index) { return fsm.GetValidState(stateName).GetAction(index); } public static T GetAction(this FsmState state, int index) where T : FsmStateAction { FsmStateAction action = state.GetAction(index); return (T)(object)((action is T) ? action : null); } public static T GetAction(this PlayMakerFSM fsm, string stateName, int index) where T : FsmStateAction { return fsm.GetValidState(stateName).GetAction(index); } public static T[] GetActions(this FsmState state) where T : FsmStateAction { FsmStateAction[] actions = state.Actions; List list = new List(); FsmStateAction[] array = actions; foreach (FsmStateAction val in array) { if (((object)val).GetType() == typeof(T)) { list.Add((T)(object)val); } } return list.ToArray(); } public static T[] GetActions(this PlayMakerFSM fsm, string stateName) where T : FsmStateAction { return fsm.GetValidState(stateName).GetActions(); } public static T GetFirstActionOfType(this FsmState state) where T : FsmStateAction { return state.GetActions().FirstOrDefault(); } public static T GetFirstActionOfType(this PlayMakerFSM fsm, string state) where T : FsmStateAction { return fsm.GetActions(state).FirstOrDefault(); } public static void InsertAction(this FsmState state, FsmStateAction action, int index) { FsmStateAction[] actions = state.Actions; FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[actions.Length + 1]; int num = 0; int num2 = 0; while (num < array.Length) { if (num == index) { array[num] = action; num++; } if (num2 < actions.Length) { array[num] = actions[num2]; } num++; num2++; } state.Actions = array; action.Init(state); } public static void InsertAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action, int index) { fsm.GetValidState(stateName).InsertAction(action, index); } public static void AddAction(this FsmState state, FsmStateAction action) { state.InsertAction(action, state.Actions.Length); } public static void AddAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action) { fsm.GetValidState(stateName).AddAction(action); } public static void AddFirstAction(this FsmState state, FsmStateAction action) { state.InsertAction(action, 0); } public static void AddFirstAction(this PlayMakerFSM fsm, string stateName, FsmStateAction action) { fsm.GetValidState(stateName).AddFirstAction(action); } public static void RemoveAction(this FsmState state, int index) { FsmStateAction[] actions = state.Actions; FsmStateAction[] array = (FsmStateAction[])(object)new FsmStateAction[actions.Length - 1]; int i = 0; int num = 0; for (; i < actions.Length; i++) { if (i != index) { array[num] = actions[i]; num++; } } state.Actions = array; } public static void RemoveAction(this PlayMakerFSM fsm, string stateName, int index) { fsm.GetValidState(stateName).RemoveAction(index); } public static void DisableAction(this FsmState state, int index) { state.GetAction(index).Enabled = false; } public static void DisableAction(this PlayMakerFSM fsm, string state, int index) { fsm.GetValidState(state).DisableAction(index); } public static void AddCustomAction(this FsmState state, Action method) { state.AddAction((FsmStateAction)(object)new CustomFsmAction { method = method }); } public static void AddCustomAction(this PlayMakerFSM fsm, string stateName, Action method) { fsm.GetValidState(stateName).AddAction((FsmStateAction)(object)new CustomFsmAction { method = method }); } public static void AddCustomAction(this FsmState state, Action method) { state.AddAction((FsmStateAction)(object)new CustomFsmAction { method = delegate { method(state); } }); } public static void AddCustomAction(this PlayMakerFSM fsm, string stateName, Action method) { fsm.GetValidState(stateName).AddAction((FsmStateAction)(object)new CustomFsmAction { method = delegate { method(fsm); } }); } public static void InsertCustomAction(this FsmState state, Action method, int index) { state.InsertAction((FsmStateAction)(object)new CustomFsmAction { method = method }, index); } public static void InsertCustomAction(this PlayMakerFSM fsm, string stateName, Action method, int index) { fsm.GetValidState(stateName).InsertAction((FsmStateAction)(object)new CustomFsmAction { method = method }, index); } public static void InsertCustomAction(this FsmState state, Action method, int index) { state.InsertAction((FsmStateAction)(object)new CustomFsmAction { method = delegate { method(state); } }, index); } public static void InsertCustomAction(this PlayMakerFSM fsm, string stateName, Action method, int index) { fsm.GetValidState(stateName).InsertAction((FsmStateAction)(object)new CustomFsmAction { method = delegate { method(fsm); } }, index); } public static void RemoveState(this PlayMakerFSM fsm, string stateName) { FsmState[] states = fsm.Fsm.States; fsm.Fsm.States = states.Where((FsmState state) => state.Name != stateName).ToArray(); } } public static class FsmVariables { public static NamedVariable[] GetVariables(this PlayMakerFSM fsm) where T : NamedVariable, new() { FsmVariables fsmVariables = fsm.FsmVariables; Type typeFromHandle = typeof(T); if (typeFromHandle == typeof(FsmFloat)) { return (NamedVariable[])(object)fsmVariables.FloatVariables; } if (typeFromHandle == typeof(FsmInt)) { return (NamedVariable[])(object)fsmVariables.IntVariables; } if (typeFromHandle == typeof(FsmBool)) { return (NamedVariable[])(object)fsmVariables.BoolVariables; } if (typeFromHandle == typeof(FsmString)) { return (NamedVariable[])(object)fsmVariables.StringVariables; } if (typeFromHandle == typeof(FsmVector2)) { return (NamedVariable[])(object)fsmVariables.Vector2Variables; } if (typeFromHandle == typeof(FsmVector3)) { return (NamedVariable[])(object)fsmVariables.Vector3Variables; } if (typeFromHandle == typeof(FsmColor)) { return (NamedVariable[])(object)fsmVariables.ColorVariables; } if (typeFromHandle == typeof(FsmRect)) { return (NamedVariable[])(object)fsmVariables.RectVariables; } if (typeFromHandle == typeof(FsmQuaternion)) { return (NamedVariable[])(object)fsmVariables.QuaternionVariables; } if (typeFromHandle == typeof(FsmGameObject)) { return (NamedVariable[])(object)fsmVariables.GameObjectVariables; } return null; } public static NamedVariable[] GetVariables(this Fsm fsm) where T : NamedVariable, new() { FsmVariables variables = fsm.Variables; Type typeFromHandle = typeof(T); if (typeFromHandle == typeof(FsmFloat)) { return (NamedVariable[])(object)variables.FloatVariables; } if (typeFromHandle == typeof(FsmInt)) { return (NamedVariable[])(object)variables.IntVariables; } if (typeFromHandle == typeof(FsmBool)) { return (NamedVariable[])(object)variables.BoolVariables; } if (typeFromHandle == typeof(FsmString)) { return (NamedVariable[])(object)variables.StringVariables; } if (typeFromHandle == typeof(FsmVector2)) { return (NamedVariable[])(object)variables.Vector2Variables; } if (typeFromHandle == typeof(FsmVector3)) { return (NamedVariable[])(object)variables.Vector3Variables; } if (typeFromHandle == typeof(FsmColor)) { return (NamedVariable[])(object)variables.ColorVariables; } if (typeFromHandle == typeof(FsmRect)) { return (NamedVariable[])(object)variables.RectVariables; } if (typeFromHandle == typeof(FsmQuaternion)) { return (NamedVariable[])(object)variables.QuaternionVariables; } if (typeFromHandle == typeof(FsmGameObject)) { return (NamedVariable[])(object)variables.GameObjectVariables; } return null; } public static void SetVariables(this PlayMakerFSM fsm, NamedVariable[] namedVariables) where T : NamedVariable, new() { FsmVariables fsmVariables = fsm.FsmVariables; Type? typeFromHandle = typeof(T); if (typeFromHandle == typeof(FsmFloat)) { fsmVariables.FloatVariables = (FsmFloat[])(object)namedVariables; } if (typeFromHandle == typeof(FsmInt)) { fsmVariables.IntVariables = (FsmInt[])(object)namedVariables; } if (typeFromHandle == typeof(FsmBool)) { fsmVariables.BoolVariables = (FsmBool[])(object)namedVariables; } if (typeFromHandle == typeof(FsmString)) { fsmVariables.StringVariables = (FsmString[])(object)namedVariables; } if (typeFromHandle == typeof(FsmVector2)) { fsmVariables.Vector2Variables = (FsmVector2[])(object)namedVariables; } if (typeFromHandle == typeof(FsmVector3)) { fsmVariables.Vector3Variables = (FsmVector3[])(object)namedVariables; } if (typeFromHandle == typeof(FsmColor)) { fsmVariables.ColorVariables = (FsmColor[])(object)namedVariables; } if (typeFromHandle == typeof(FsmRect)) { fsmVariables.RectVariables = (FsmRect[])(object)namedVariables; } if (typeFromHandle == typeof(FsmQuaternion)) { fsmVariables.QuaternionVariables = (FsmQuaternion[])(object)namedVariables; } if (typeFromHandle == typeof(FsmGameObject)) { fsmVariables.GameObjectVariables = (FsmGameObject[])(object)namedVariables; } } public static void SetVariables(this Fsm fsm, NamedVariable[] namedVariables) where T : NamedVariable, new() { FsmVariables variables = fsm.Variables; Type? typeFromHandle = typeof(T); if (typeFromHandle == typeof(FsmFloat)) { variables.FloatVariables = (FsmFloat[])(object)namedVariables; } if (typeFromHandle == typeof(FsmInt)) { variables.IntVariables = (FsmInt[])(object)namedVariables; } if (typeFromHandle == typeof(FsmBool)) { variables.BoolVariables = (FsmBool[])(object)namedVariables; } if (typeFromHandle == typeof(FsmString)) { variables.StringVariables = (FsmString[])(object)namedVariables; } if (typeFromHandle == typeof(FsmVector2)) { variables.Vector2Variables = (FsmVector2[])(object)namedVariables; } if (typeFromHandle == typeof(FsmVector3)) { variables.Vector3Variables = (FsmVector3[])(object)namedVariables; } if (typeFromHandle == typeof(FsmColor)) { variables.ColorVariables = (FsmColor[])(object)namedVariables; } if (typeFromHandle == typeof(FsmRect)) { variables.RectVariables = (FsmRect[])(object)namedVariables; } if (typeFromHandle == typeof(FsmQuaternion)) { variables.QuaternionVariables = (FsmQuaternion[])(object)namedVariables; } if (typeFromHandle == typeof(FsmGameObject)) { variables.GameObjectVariables = (FsmGameObject[])(object)namedVariables; } } public static void AddVariable(this PlayMakerFSM fsm, string name) where T : NamedVariable, new() { fsm.GetAddVariable(name); } public static T GetAddVariable(this PlayMakerFSM fsm, string name, object value = null) where T : NamedVariable, new() { T[] array = (T[])(object)fsm.GetVariables(); if (array == null) { return default(T); } T variable = fsm.GetVariable(name); if (variable != null) { return variable; } List list = new List(array); T val = new T(); ((NamedVariable)val).SetName(name); if (value != null) { ((NamedVariable)val).RawValue = value; } list.Add(val); NamedVariable[] namedVariables = (NamedVariable[])(object)list.ToArray(); fsm.SetVariables(namedVariables); return val; } public static T GetAddVariable(this Fsm fsm, string name, object value = null) where T : NamedVariable, new() { T[] array = (T[])(object)fsm.GetVariables(); if (array == null) { return default(T); } T variable = fsm.GetVariable(name); if (variable != null) { return variable; } List list = new List(array); T val = new T(); ((NamedVariable)val).SetName(name); if (value != null) { ((NamedVariable)val).RawValue = value; } list.Add(val); NamedVariable[] namedVariables = (NamedVariable[])(object)list.ToArray(); fsm.SetVariables(namedVariables); return val; } public static T GetVariable(this PlayMakerFSM fsm, string name) where T : NamedVariable, new() { T[] array = (T[])(object)fsm.GetVariables(); if (array == null) { return default(T); } return Array.Find(array, (T x) => ((NamedVariable)x).Name == name); } public static T GetVariable(this Fsm fsm, string name) where T : NamedVariable, new() { T[] array = (T[])(object)fsm.GetVariables(); if (array == null) { return default(T); } return Array.Find(array, (T x) => ((NamedVariable)x).Name == name); } } } namespace KIS.Compatibility { [AttributeUsage(AttributeTargets.Class)] public class RequiresModAttribute : Attribute { public string Id { get; } public RequiresModAttribute(string mod_id) { Id = mod_id; } } public interface ICompatibility { string ModId { get; } string ModName { get; } void Init(); void Update(); } public static class CompatibilityManager { private static Dictionary compatibilities = new Dictionary(); public static void CheckAndInit() { "Checking for compatible mods...".LogDebug(); Type[] typesSafely = Assembly.GetExecutingAssembly().GetTypesSafely(); foreach (Type type in typesSafely) { RequiresModAttribute customAttribute = type.GetCustomAttribute(); if (customAttribute == null) { continue; } if (Chainloader.PluginInfos.ContainsKey(customAttribute.Id)) { if (!compatibilities.ContainsKey(customAttribute.Id)) { compatibilities.Add(customAttribute.Id, Activator.CreateInstance(type) as ICompatibility); } compatibilities[customAttribute.Id]?.Init(); } else { Debug.Log((object)("Mod with ID " + customAttribute.Id + " not found. Skipping compatibility for " + type.Name + ".")); } } } public static void UpdateAll() { foreach (KeyValuePair compatibility in compatibilities) { compatibility.Value.Update(); } } } [RequiresMod("io.github.hk-speedrunning.debugmod")] public class WithDebugMod : ICompatibility { private static PlayMakerFSM _refKnightSlash; public static bool infinite_jump; public string ModName => "Debug Mod"; public string ModId => "io.github.hk-speedrunning.debugmod"; private static PlayerData pd => PlayerData.instance; private static HeroController hc => HeroController.instance; internal static PlayMakerFSM RefKnightSlash { get { if (!((Object)(object)_refKnightSlash != (Object)null)) { HeroController obj = hc; return _refKnightSlash = ((obj != null) ? ((Component)obj.transform.Find("Attacks/Slash")).GetComponent() : null); } return _refKnightSlash; } } public void Init() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) DebugMod.Log("Debug Mod detected KIS, initializing compatibility."); KnightInSilksong.Instance.self_hormony.PatchAll(typeof(WithDebugMod)); DebugMod.AddTranslationSheet("Mods.io.github.shownyoung.knightinsilksong"); SaveState.OnSave += OnSave; SaveState.AfterLoad += AfterLoad; DebugMod.AddTextToInfoPanel(LangKey.DEBUG_CHARACTER.InGameKey(), (Func)(() => (!KnightInSilksong.IsKnight) ? "Hornet" : "Knight"), (InfoPanelColumn)1); RegisterBindableFunctions(); KnightInSilksong.KeybindEnabled = false; string toggleKnightBindName = LangKey.SWITCH_CHARACTER.InGameKey(); if ((int)KnightInSilksong.toggleButton.Value != 0) { DebugMod.UpdateBind(toggleKnightBindName, (KeyCode?)KnightInSilksong.toggleButton.Value); } KnightInSilksong.toggleButton.SettingChanged += delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if ((int)KnightInSilksong.toggleButton.Value == 0 && DebugMod.settings.binds.ContainsKey(toggleKnightBindName)) { DebugMod.UpdateBind(toggleKnightBindName, (KeyCode?)null); } else if (KnightInSilksong.toggleButton.Value != DebugMod.settings.binds.GetValueOrDefault(toggleKnightBindName)) { DebugMod.UpdateBind(toggleKnightBindName, (KeyCode?)KnightInSilksong.toggleButton.Value); } }; DebugMod.bindUpdated += delegate(string keybindName, KeyCode? keycode) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!(keybindName != toggleKnightBindName) && keycode != (KeyCode?)KnightInSilksong.toggleButton.Value) { KnightInSilksong.toggleButton.Value = keycode.GetValueOrDefault(); } }; } public void Update() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!KnightInSilksong.IsKnight) { return; } if (DebugMod.noclip) { HeroController obj = hc; if (obj != null && (int)obj.transitionState == 0 && SaveState.loadingSavestate == null) { HeroController obj2 = hc; if (obj2 != null) { obj2.transform.position = DebugMod.noclipPos; } } else { DebugMod.noclipPos = hc.transform.position; } } if (DebugMod.infiniteSilk && pd.MPCharge < pd.maxMP) { PlayerData obj3 = pd; if (obj3 != null) { obj3.MPCharge = pd.maxMP; } HeroController obj4 = hc; if (obj4 != null) { obj4.SoulGain(); } } if (DebugMod.playerInvincible) { PlayerData obj5 = pd; if (obj5 != null) { obj5.isInvincible = true; } } HeroBox.inactive = DebugMod.heroColliderDisabled; infinite_jump = PlayerData.instance?.infiniteAirJump ?? false; } private static void OnSave(SaveState state) { if (KnightInSilksong.IsKnight) { state.data.customData["KIS.KnightPd"] = JsonUtility.ToJson((object)pd); } } private static void AfterLoad(SaveState state) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) string value; bool flag = state.data.customData.TryGetValue("KIS.KnightPd", out value); if (KnightInSilksong.IsKnight != flag) { KnightInSilksong.Instance.ToggleKnight(); } if (flag) { JsonUtility.FromJsonOverwrite(value, (object)pd); hc.transform.position = state.data.savePos; GameObject gameObject = KnightInSilksong.Instance.hud_instance.gameObject; FSMUtility.SendEventToGameObject(gameObject, "HERO LEAVE", true); FSMUtility.SendEventToGameObject(gameObject, "HERO DAMAGED", true); ((Component)gameObject.transform.Find("Soul Orb/Orb Full")).gameObject.SetActive(false); GameObject gameObject2 = ((Component)gameObject.transform.Find("Soul Orb")).gameObject; FSMUtility.SendEventToGameObject(gameObject2, "MP RESERVE DOWN", true); FSMUtility.SendEventToGameObject(gameObject2, (pd.GetInt("MPCharge") >= pd.GetInt("maxMP")) ? "MP GAIN" : "MP LOSE", true); hc.CancelDamageRecoil(); InvulnerablePulse component = ((Component)hc).GetComponent(); if (component != null) { component.StopInvulnerablePulse(); } hc.transitionState = (HeroTransitionState)0; hc.cState.invulnerable = false; HeroController obj = hc; if (obj != null) { ((MonoBehaviour)obj).StartCoroutine(WaitThenClearHud()); } } static IEnumerator WaitThenClearHud() { yield return null; yield return null; KnightInSilksong.Instance.DisableOriHud(); } } [HarmonyPatch(typeof(SaveStateManager), "LoadFileStates")] [HarmonyPostfix] private static void UpgradeLegacyStates() { foreach (KeyValuePair fileState in SaveStateManager.fileStates) { fileState.Deconstruct(out var key, out var value); int num = key; SaveState[] array = value; for (int i = 0; i < array.Length; i++) { SaveState val = array[i]; if (val == null) { continue; } string filePath = SaveStateManager.GetFilePath(num, i); filePath = Path.Combine(Path.GetDirectoryName(filePath), "knightPD_" + Path.GetFileName(filePath)); try { if (File.Exists(filePath)) { KnightInSilksong.logger.LogInfo((object)$"Found knightPD file for state p{num}[{i}], upgrading..."); val.data.customData["KIS.KnightPd"] = File.ReadAllText(filePath); SaveStateManager.SaveToFile(val.data, num, i); File.Delete(filePath); } } catch (Exception msg) { msg.LogDebug(); } } } } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool Debug_Knight_PlayerData_TakeHealth_Prefix(PlayerData __instance, ref int amount) { if (!KnightInSilksong.IsKnight) { return true; } ModHooks.PlayerData_TakeHealth(ref amount); return true; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_GiveMask_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } PlayerData obj = pd; if (obj != null && obj.maxHealthBase < 9) { pd.MaxHealth(); pd.AddToMaxHealth(1); PlayMakerFSM.BroadcastEvent("MAX HP UP"); } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_GiveSpool_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } PlayerData obj = pd; if (obj != null && obj.MPReserveMax < 99) { HeroController obj2 = hc; if (obj2 != null) { obj2.AddToMaxMPReserve(33); } PlayMakerFSM.BroadcastEvent("NEW SOUL ORB"); } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_TakeAwayMask_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } PlayerData obj = pd; if (obj != null && obj.maxHealthBase > 1) { PlayerData obj2 = pd; obj2.maxHealth--; PlayerData obj3 = pd; obj3.maxHealthBase--; if (!KnightInSilksong.Instance.hud_instance.gameObject.activeInHierarchy) { KnightInSilksong.Instance.hud_instance.gameObject.SetActive(true); } else { KnightInSilksong.Instance.hud_instance.gameObject.SetActive(false); KnightInSilksong.Instance.hud_instance.gameObject.SetActive(true); } } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_TakeAwaySpool_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } PlayerData obj = pd; if (obj != null && obj.MPReserveMax > 0) { PlayerData obj2 = pd; if (obj2 != null) { obj2.MPReserveMax -= 33; } if (!KnightInSilksong.Instance.hud_instance.gameObject.activeInHierarchy) { KnightInSilksong.Instance.hud_instance.gameObject.SetActive(true); } else { KnightInSilksong.Instance.hud_instance.gameObject.SetActive(false); KnightInSilksong.Instance.hud_instance.gameObject.SetActive(true); } } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_AddHealth_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } if (pd?.health < pd.maxHealth) { HeroController obj = hc; if (obj != null) { obj.AddHealth(1); } } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_TakeHealth_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } PlayerData obj = pd; if (obj != null && obj.health > 1) { HeroController obj2 = hc; if (obj2 != null) { obj2.TakeHealth(1); } } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_AddSilk_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } HeroController obj = hc; if (obj != null) { obj.AddMPCharge(33); } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_TakeSilk_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } HeroController obj = hc; if (obj != null) { obj.TakeMP(33); } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_Lifeblood_Prefix() { return true; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_KillSelf_Prefix() { if (!KnightInSilksong.IsKnight) { return false; } HeroController obj = hc; if (obj != null) { ((MonoBehaviour)obj).StartCoroutine(hc.Die()); } return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_GiveAllSkills_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } GiveAllSkills(); return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_IncreaseNeedleDamage_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } int num = 4; PlayerData obj = pd; if (obj != null && obj.nailDamage == 0) { num = 5; } PlayerData obj2 = pd; if (obj2 != null) { obj2.nailDamage += num; } PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_DecreaseNeedleDamage_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } int val = pd.nailDamage - 4; pd.nailDamage = Math.Max(0, val); PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); return false; } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool BindableFunctions_ToggleHUD_Prefix() { if (!KnightInSilksong.IsKnight) { return true; } if (KnightInSilksong.Instance.hud_instance.gameObject.activeInHierarchy) { KnightInSilksong.Instance.hud_instance.gameObject.SetActive(false); } else { KnightInSilksong.Instance.hud_instance.gameObject.SetActive(true); } return false; } [HarmonyPostfix] [HarmonyPatch(typeof(InfoPanel), "AppendInfo", new Type[] { typeof(string), typeof(Func) })] public static void InfoPanel_AppendInfo_Postfix(InfoPanel __instance, string label, ref Func info) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) int num = __instance.counter - 1; CanvasText labelText = (CanvasText)((CanvasPanel)__instance).byName[$"Label{num}"]; CanvasText infoText = (CanvasText)((CanvasPanel)__instance).byName[$"Info{num}"]; if (label == null) { return; } switch (label.Length) { case 18: switch (label[10]) { case 'P': if (label == "INFOPANEL_POSITION") { KnightInfo(() => ((Object)(object)hc == (Object)null) ? string.Empty : $"{hc.transform.position.x:.000000#}, {hc.transform.position.y:.000000#}"); } break; case 'V': if (label == "INFOPANEL_VELOCITY") { KnightT(() => hc.current_velocity); } break; case 'H': if (label == "INFOPANEL_HARDLAND") { KnightBool(() => hc.cState.willHardLand); } break; case 'S': if (label == "INFOPANEL_SWIMMING") { KnightBool(() => hc.cState.swimming); } break; } break; case 19: switch (label[10]) { case 'H': if (label == "INFOPANEL_HEROSTATE") { KnightT(() => hc.hero_state); } break; case 'A': if (label == "INFOPANEL_ATTACKING") { KnightBool(() => hc.cState.attacking); } break; case 'S': if (label == "INFOPANEL_SPRINTING") { KnightLabel(labelText.Text, LocalisedString.op_Implicit(LangKey.DEBUG_DASHING.Localize())); KnightBool(() => hc.cState.dashing || hc.cState.shadowDashing); } break; case 'R': if (label == "INFOPANEL_RECOILING") { KnightBool(() => hc.cState.recoiling); } break; } break; case 21: switch (label[10]) { case 'D': if (label == "INFOPANEL_DAMAGESTATE") { KnightT(() => hc.damageMode); } break; case 'C': if (label == "INFOPANEL_CANQUICKMAP") { KnightBool(() => hc.CanQuickMap()); } break; case 'A': if (label == "INFOPANEL_ACCEPTINPUT") { KnightBool(() => hc.acceptingInput); } break; case 'B': break; } break; case 20: switch (label[10]) { case 'N': if (label == "INFOPANEL_NEEDLEBASE") { KnightLabel(labelText.Text, LocalisedString.op_Implicit(LangKey.DEBUG_NAIL_BASE.Localize())); KnightInfo(() => RefKnightSlash.FsmVariables.GetFsmInt("damageDealt").Value + " (Flat " + PlayerData.instance.nailDamage + ", x" + RefKnightSlash.FsmVariables.GetFsmFloat("Multiplier").Value + ")"); } break; case 'I': if (label == "INFOPANEL_INVINCIBLE") { KnightBool(() => pd.isInvincible); } break; } break; case 17: switch (label[13]) { case 'P': if (label == "INFOPANEL_JUMPING") { KnightBool(() => hc.cState.jumping || hc.cState.doubleJumping); } break; case 'L': if (label == "INFOPANEL_FALLING") { KnightBool(() => hc.cState.falling); } break; case 'R': if (label == "INFOPANEL_SOARING") { KnightLabel(labelText.Text, LocalisedString.op_Implicit(LangKey.DEBUG_SUPERDASHING.Localize())); KnightBool(() => hc.cState.superDashing); } break; case 'C': if (label == "INFOPANEL_CANCAST") { KnightBool(() => hc.CanCast()); } break; case 'S': if (label == "INFOPANEL_CANSOAR") { KnightLabel(labelText.Text, LocalisedString.op_Implicit(LangKey.DEBUG_CAN_SUPERDASH.Localize())); KnightBool(() => hc.CanSuperDash()); } break; case 'E': if (label == "INFOPANEL_ATBENCH") { KnightBool(() => pd.atBench); } break; } break; case 22: switch (label[10]) { case 'C': if (label == "INFOPANEL_CANINVENTORY") { KnightBool(() => hc.CanOpenInventory()); } break; case 'I': if (label == "INFOPANEL_INVULNERABLE") { KnightBool(() => hc.cState.invulnerable); } break; } break; case 16: if (label == "INFOPANEL_HEALTH") { KnightInfo(() => $"{pd.health} / {pd.maxHealth}"); } break; case 14: if (label == "INFOPANEL_SILK") { KnightLabel(labelText.Text, LocalisedString.op_Implicit(LangKey.DEBUG_SOUL.Localize())); KnightT(() => pd.MPCharge + pd.MPReserve); } break; case 29: if (label == "INFOPANEL_CONTROLRELINQUISHED") { KnightBool(() => hc.controlReqlinquished); } break; case 15: case 23: case 24: case 25: case 26: case 27: case 28: break; } void KnightBool(Func knight_info) { KnightInfo(() => InfoPanel.GetStringForBool(knight_info())); } void KnightInfo(Func knight_info) { ((CanvasNode)infoText).OnUpdate += delegate { if (KnightInSilksong.IsKnight) { infoText.Text = knight_info(); } }; } void KnightLabel(string ori_name, string knight_name) { ((CanvasNode)labelText).OnUpdate += delegate { labelText.Text = (KnightInSilksong.IsKnight ? knight_name : ori_name); }; } void KnightT(Func knight_info) { KnightInfo(() => knight_info().ToString()); } } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void MainPanel_Postfix(MainPanel __instance) { __instance.AddTab(LangKey.DEBUG_KNIGHT.InGameKey()); __instance.AppendSectionHeader(LangKey.DEBUG_CONTROL.InGameKey()); __instance.AppendRow(new int[1] { 1 }); __instance.AppendToggleControl(LangKey.SWITCH_CHARACTER.InGameKey(), (Func)(() => KnightInSilksong.IsKnight), (Action)KnightInSilksong.Instance.ToggleKnight); __instance.AppendSectionHeader(LangKey.DEBUG_SKILL.InGameKey()); __instance.AppendRow(new int[1] { 1 }); __instance.AppendBasicControl(LangKey.DEBUG_ALL_SKILL.InGameKey(), (Action)GiveAllSkills); AppendLeveledTile(LangKey.DEBUG_DASH_NAME.InGameKey(), GetDashLevel, CycleDash, new List(2) { KISHelper.ResourceTexture("inv_dash_cloak"), KISHelper.ResourceTexture("inv_shade_cloak") }, includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_WALL_JUMP_NAME.InGameKey(), () => pd.hasWalljump, ToggleWallJump, "inv_mantis_claw", includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_DOUBLE_JUMP_NAME.InGameKey(), () => pd.GetBool("hasDoubleJump"), ToggleDoubleJump, "inv_emperor_wings", includeLabel: false, 7); AppendLeveledTile(LangKey.DEBUG_DREAM_NAIL_NAME.InGameKey(), GetDreamNailLevel, CycleDreamNail, new List(2) { KISHelper.ResourceTexture("inv_dream_nail"), KISHelper.ResourceTexture("inv_dream_nail_upgraded") }, includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_DREAM_GATE_NAME.InGameKey(), () => pd.GetBool("hasDreamGate"), ToggleDreamGate, "inv_dream_gate", includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_SUPER_DASH_NAME.InGameKey(), () => pd.GetBool("hasSuperDash"), ToggleSuperDash, "inv_crystal_heart", includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_ACID_SWIM_NAME.InGameKey(), () => pd.GetBool("hasAcidArmour"), ToggleAcidSwim, "inv_acid_armour", includeLabel: false, 7); AppendLeveledTile(LangKey.DEBUG_SCREAM_NAME.InGameKey(), () => pd.GetInt("screamLevel"), delegate { IncreaseSpellLevel(Spell.Scream); }, new List(2) { KISHelper.ResourceTexture("inv_scream_01"), KISHelper.ResourceTexture("inv_scream_02") }, includeLabel: false, 7); AppendLeveledTile(LangKey.DEBUG_FIREBALL_NAME.InGameKey(), () => pd.GetInt("fireballLevel"), delegate { IncreaseSpellLevel(Spell.Fireball); }, new List(2) { KISHelper.ResourceTexture("inv_fireball_01"), KISHelper.ResourceTexture("inv_fireball_02") }, includeLabel: false, 7); AppendLeveledTile(LangKey.DEBUG_QUAKE_NAME.InGameKey(), () => pd.GetInt("quakeLevel"), delegate { IncreaseSpellLevel(Spell.Quake); }, new List(2) { KISHelper.ResourceTexture("inv_quake_01"), KISHelper.ResourceTexture("inv_quake_02") }, includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_GREAT_SLASH_NAME.InGameKey(), () => pd.GetBool("hasDashSlash"), delegate { ToggleNailArt(NailArt.GREAT_SLASH); }, "inv_upgraded_slash", includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_DASH_SLASH_NAME.InGameKey(), () => pd.GetBool("hasUpwardSlash"), delegate { ToggleNailArt(NailArt.DASH_SLASH); }, "inv_dash_slash", includeLabel: false, 7); AppendCustomImageTitleByName(LangKey.DEBUG_CYCLONE_NAME.InGameKey(), () => pd.GetBool("hasCyclone"), delegate { ToggleNailArt(NailArt.CYCLONE); }, "inv_cyclone", includeLabel: false, 7); __instance.AppendSectionHeader(LangKey.DEBUG_CHARM.InGameKey()); __instance.AppendRow(new int[2] { 1, 1 }); __instance.AppendBasicControl(LangKey.DEBUG_ALL_CHARMS.InGameKey(), (Action)GiveAllCharms); __instance.AppendBasicControl(LangKey.DEBUG_REMOVE_ALL_CHARMS.InGameKey(), (Action)RemoveAllCharms); __instance.AppendRow(new int[1] { 1 }); __instance.AppendNumericControl(LangKey.CHARMSLOT_NAME.InGameKey(), (Func)(() => pd.charmSlots), 3f, (Action)delegate(float val) { pd.SetInt("charmSlots", (int)val); }, (Action)IncreaseCharmSlots, (Action)DecreaseCharmSlots, (Action)delegate { pd.SetInt("charmSlots", 3); }); __instance.AppendRow(new int[1] { 1 }); __instance.AppendBasicControl(LangKey.DEBUG_FIX_CHARMSLOTS.InGameKey(), (Action)FixCharmSlots); CharmIconList component = KnightInSilksong.Instance.charm.FindGameObjectInChildren("Charm Icons").GetComponent(); for (int num = 1; num <= 40; num++) { if (num % 6 == 1) { __instance.AppendTileRow(6); } Charm charm = (Charm)num; if (charm.IsFragileCharm()) { string text = charm.ToString().Replace("Unbreakable", "").ToLower(); AppendLeveledTile(charm.InGameKey(), () => GetFragileState(charm), delegate { CycleCharm(charm); }, new List(3) { KISHelper.ResourceTexture("charm_glass_" + text), KISHelper.ResourceTexture("charm_broken_" + text), KISHelper.ResourceTexture("charm_full_" + text) }, includeLabel: false, 6); continue; } switch (charm) { case Charm.Grimmchild: AppendLeveledTile(LangKey.GRIMM_CHILD.InGameKey(), () => pd.gotCharm_40 ? pd.grimmChildLevel : 0, delegate { CycleCharm(charm); }, new List(5) { KISHelper.ResourceTexture("charm_grimmkin_01"), KISHelper.ResourceTexture("charm_grimmkin_02"), KISHelper.ResourceTexture("charm_grimmkin_03"), KISHelper.ResourceTexture("charm_grimmkin_04"), KISHelper.ResourceTexture("charm_grimmkin_05") }, includeLabel: false, 6); break; case Charm.VoidHeart: AppendLeveledTile(LangKey.KING_SOUL.InGameKey(), () => pd.gotCharm_36 ? pd.royalCharmState : 0, delegate { CycleCharm(Charm.VoidHeart); }, new List(4) { KISHelper.ResourceTexture("charm_white_left"), KISHelper.ResourceTexture("charm_white_right"), KISHelper.ResourceTexture("charm_white_full"), KISHelper.ResourceTexture("charm_black") }, includeLabel: false, 6); break; default: AppendCustomImageTitleWithSprite(charm.InGameKey(), delegate { PlayerData obj = pd; int num2 = (int)charm; return obj.GetBool("gotCharm_" + num2); }, delegate { CycleCharm(charm); }, component.GetSprite(num), includeLabel: false, 6); break; } } __instance.AppendSectionHeader(LangKey.DEBUG_PROMPT.InGameKey()).FontSize = MainPanel.KeybindHeaderFontSize; void AppendCustomImageTitle(string name, Func getter, Action effect, Texture2D icon, bool includeLabel = true, int defaultRowWidth = 5) { CanvasPanel customImageTitle = null; customImageTitle = __instance.AppendLabeledTile(name, (Func)delegate { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)icon != (Object)null) { CanvasImage obj = customImageTitle.Get("Icon"); if (obj != null) { obj.SetImage(icon, default(Rect)); } } return getter(); }, effect, "IconX", includeLabel, defaultRowWidth); } void AppendCustomImageTitleByName(string name, Func getter, Action effect, string icon_name, bool includeLabel = true, int defaultRowWidth = 5) { AppendCustomImageTitle(name, getter, effect, KISHelper.ResourceTexture(icon_name), includeLabel, defaultRowWidth); } void AppendCustomImageTitleWithSprite(string name, Func getter, Action effect, Sprite icon, bool includeLabel = true, int defaultRowWidth = 5) { CanvasPanel customImageTitle = null; customImageTitle = __instance.AppendLabeledTile(name, (Func)delegate { if ((Object)(object)icon != (Object)null) { CanvasImage obj = customImageTitle.Get("Icon"); if (obj != null) { obj.SetImage(icon); } } return getter(); }, effect, "IconX", includeLabel, defaultRowWidth); } void AppendLeveledTile(string name, Func getter, Action effect, List icons, bool includeLabel = true, int defaultRowWidth = 5) { CanvasPanel leveledTile = null; leveledTile = __instance.AppendLabeledTile(name, (Func)delegate { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) int num2 = getter(); int num3 = Math.Max(0, num2 - 1); Texture2D val = ((num3 < icons.Count) ? icons[num3] : null); if ((Object)(object)val != (Object)null) { CanvasImage obj = leveledTile.Get("Icon"); if (obj != null) { obj.SetImage(val, default(Rect)); } } return num2 > 0; }, effect, "IconX", includeLabel, defaultRowWidth); } } private static void RegisterBindableFunctions() { DebugMod.AddActionToKeyBindList((Action)GiveAllSkills, LangKey.DEBUG_ALL_SKILL.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); DebugMod.AddActionToKeyBindList((Action)GiveAllCharms, LangKey.DEBUG_ALL_CHARMS.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); DebugMod.AddActionToKeyBindList((Action)RemoveAllCharms, LangKey.DEBUG_REMOVE_ALL_CHARMS.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); DebugMod.AddActionToKeyBindList((Action)IncreaseCharmSlots, LangKey.DEBUG_INCREASE_CHARMSLOTS.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); DebugMod.AddActionToKeyBindList((Action)DecreaseCharmSlots, LangKey.DEBUG_DECREASE_CHARMSLOTS.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); DebugMod.AddActionToKeyBindList((Action)FixCharmSlots, LangKey.DEBUG_FIX_CHARMSLOTS.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); DebugMod.AddActionToKeyBindList((Action)KnightInSilksong.Instance.ToggleKnight, LangKey.SWITCH_CHARACTER.InGameKey(), LangKey.DEBUG_KNIGHT.InGameKey()); } private static void UpdateCharmsEffects() { PlayMakerFSM.BroadcastEvent("CHARM INDICATOR CHECK"); PlayMakerFSM.BroadcastEvent("CHARM EQUIP CHECK"); Object.Destroy((Object)(object)GameObject.FindWithTag("Grimmchild")); if (pd.equippedCharm_40) { ((MonoBehaviour)GameManager.instance).StartCoroutine(SpawnGrimmChild()); } static IEnumerator SpawnGrimmChild() { for (int i = 0; i < 2; i++) { yield return null; } HeroController obj = hc; if (obj != null) { FSMUtility.LocateMyFSM(((Component)obj.transform.Find("Charm Effects")).gameObject, "Spawn Grimmchild").SendEvent("CHARM EQUIP CHECK"); } } } public static void ToggleNailArt(NailArt nailArt) { string text = nailArt.PdGotField(); pd.SetBool(text, !pd.GetBool(text)); pd.SetBool("hasNailArt", pd.GetBool("hasDashSlash") || pd.GetBool("hasUpwardSlash") || pd.GetBool("hasCyclone")); pd.SetBool("hasAllNailArts", pd.GetBool("hasDashSlash") && pd.GetBool("hasUpwardSlash") && pd.GetBool("hasCyclone")); } public static void ToggleAcidSwim() { bool flag = pd.GetBool("hasAcidArmour"); pd.SetBool("hasAcidArmour", !flag); if (!flag) { PlayMakerFSM.BroadcastEvent("GET ACID ARMOUR"); } } public static void ToggleSuperDash() { bool flag = pd.GetBool("hasSuperDash"); pd.SetBool("hasSuperDash", !flag); pd.SetBool("canSuperDash", !flag); } public static void ToggleDreamGate() { if (!pd.GetBool("hasDreamGate")) { if (!pd.GetBool("hasDreamNail")) { pd.SetBool("hasDreamNail", true); } pd.SetBool("hasDreamGate", true); HeroController obj = hc; if (obj != null) { FSMUtility.LocateMyFSM(((Component)obj).gameObject, "Dream Nail").FsmVariables.FindFsmBool("Dream Warp Allowed").Value = true; } } else { pd.SetBool("hasDreamGate", false); HeroController obj2 = hc; if (obj2 != null) { FSMUtility.LocateMyFSM(((Component)obj2).gameObject, "Dream Nail").FsmVariables.FindFsmBool("Dream Warp Allowed").Value = false; } } } public static int GetDreamNailLevel() { if (pd.GetBool("hasDreamNail") && pd.GetBool("dreamNailUpgraded")) { return 2; } if (pd.GetBool("hasDreamNail")) { return 1; } return 0; } public static void CycleDreamNail() { int num = (GetDreamNailLevel() + 1) % 3; pd.SetBool("hasDreamNail", num > 0); pd.SetBool("dreamNailUpgraded", num == 2); } public static void ToggleDoubleJump() { pd.SetBool("hasDoubleJump", !pd.GetBool("hasDoubleJump")); } public static void ToggleWallJump() { bool hasWalljump = pd.hasWalljump; pd.SetBool("hasWalljump", !hasWalljump); pd.SetBool("canWallJump", !hasWalljump); } public static int GetDashLevel() { if (pd.GetBool("hasDash")) { if (!pd.GetBool("hasShadowDash")) { return 1; } return 2; } return 0; } public static void CycleDash() { int num = (GetDashLevel() + 1) % 3; pd.SetBool("hasDash", num > 0); pd.SetBool("canDash", num > 0); pd.SetBool("hasShadowDash", num == 2); pd.SetBool("canShadowDash", num == 2); if (num == 2) { EventRegister.SendEvent("GOT SHADOW DASH", (GameObject)null); } } public static void GiveAllSkills() { PlayerData obj = pd; if (obj != null) { obj.screamLevel = 2; } PlayerData obj2 = pd; if (obj2 != null) { obj2.fireballLevel = 2; } PlayerData obj3 = pd; if (obj3 != null) { obj3.quakeLevel = 2; } PlayerData obj4 = pd; if (obj4 != null) { obj4.hasDash = true; } PlayerData obj5 = pd; if (obj5 != null) { obj5.canDash = true; } PlayerData obj6 = pd; if (obj6 != null) { obj6.hasShadowDash = true; } PlayerData obj7 = pd; if (obj7 != null) { obj7.canShadowDash = true; } PlayerData obj8 = pd; if (obj8 != null) { obj8.hasWalljump = true; } PlayerData obj9 = pd; if (obj9 != null) { obj9.canWallJump = true; } PlayerData obj10 = pd; if (obj10 != null) { obj10.hasDoubleJump = true; } PlayerData obj11 = pd; if (obj11 != null) { obj11.hasSuperDash = true; } PlayerData obj12 = pd; if (obj12 != null) { obj12.canSuperDash = true; } PlayerData obj13 = pd; if (obj13 != null) { obj13.hasAcidArmour = true; } PlayerData obj14 = pd; if (obj14 != null) { obj14.hasDreamNail = true; } PlayerData obj15 = pd; if (obj15 != null) { obj15.dreamNailUpgraded = true; } PlayerData obj16 = pd; if (obj16 != null) { obj16.hasDreamGate = true; } PlayerData obj17 = pd; if (obj17 != null) { obj17.hasNailArt = true; } PlayerData obj18 = pd; if (obj18 != null) { obj18.hasCyclone = true; } PlayerData obj19 = pd; if (obj19 != null) { obj19.hasDashSlash = true; } PlayerData obj20 = pd; if (obj20 != null) { obj20.hasUpwardSlash = true; } PlayerData obj21 = pd; if (obj21 != null) { obj21.hasAllNailArts = true; } } public static void IncreaseCharmSlots() { pd.IncrementInt("charmSlots"); } public static void DecreaseCharmSlots() { pd.DecrementInt("charmSlots"); } public static void GiveAllCharms() { for (int i = 1; i <= 40; i++) { pd.SetBool("gotCharm_" + i, true); } pd.SetInt("charmSlots", 10); pd.SetBool("hasCharm", true); pd.SetInt("charmsOwned", 40); pd.SetInt("royalCharmState", 4); pd.SetBool("gotShadeCharm", true); pd.SetInt("charmCost_36", 0); pd.SetBool("fragileGreed_unbreakable", true); pd.SetBool("fragileStrength_unbreakable", true); pd.SetBool("fragileHealth_unbreakable", true); pd.SetInt("grimmChildLevel", 5); pd.SetInt("charmCost_40", 3); pd.SetInt("charmSlots", 11); UpdateCharmsEffects(); } public static void RemoveAllCharms() { for (int i = 1; i <= 40; i++) { pd.SetBool("gotCharm_" + i, false); pd.SetBool("equippedCharm_" + i, false); } pd.SetInt("charmSlots", 3); pd.SetBool("hasCharm", false); pd.SetInt("charmsOwned", 0); pd.SetInt("royalCharmState", 0); pd.SetBool("gotShadeCharm", false); pd.SetBool("fragileGreed_unbreakable", true); pd.SetBool("fragileStrength_unbreakable", true); pd.SetBool("fragileHealth_unbreakable", true); pd.SetInt("grimmChildLevel", 0); pd.SetInt("charmCost_40", 2); pd.SetInt("charmSlots", 3); pd.equippedCharms.Clear(); pd.SetInt("charmSlotsFilled", 0); UpdateCharmsEffects(); } public static void FixCharmSlots() { pd.CalculateNotchesUsed(); } public static void CycleCharm(int charmId) { CycleCharm((Charm)charmId); } public static void CycleCharm(Charm charm) { bool flag = pd.GetBool($"gotCharm_{(int)charm}"); switch (charm) { case Charm.Grimmchild: { int num3 = (pd.grimmChildLevel + 1) % 6; pd.SetBool("gotCharm_40", num3 > 0); if (num3 == 0) { RemoveCharm((int)charm); } pd.SetInt("charmCost_40", (num3 == 5) ? 3 : 2); pd.SetInt("grimmChildLevel", num3); pd.SetBool("destroyedNightmareLantern", num3 == 5); break; } case Charm.VoidHeart: { int num = (pd.royalCharmState + 1) % 5; pd.gotCharm_36 = num > 0; if (num == 0) { RemoveCharm((int)charm); } pd.royalCharmState = num; PlayerData val = pd; val.charmCost_36 = num switch { 3 => 5, 4 => 0, _ => pd.charmCost_36, }; break; } case Charm.UnbreakableHeart: case Charm.UnbreakableGreed: case Charm.UnbreakableStrength: { int num2 = (GetFragileState(charm) + 1) % 4; pd.SetBool(charm.PdGotField(), num2 != 0); if (num2 == 0) { RemoveCharm((int)charm); } pd.SetBool(charm.PdUnbreakableField(), num2 == 3); pd.SetBool(charm.PdBrokenField(), num2 == 2); break; } default: pd.SetBool($"gotCharm_{(int)charm}", !flag); if (flag) { RemoveCharm((int)charm); } break; } UpdateCharmsEffects(); } public static void RemoveCharm(int id) { pd.SetBool($"equippedCharm_{id}", false); pd.equippedCharms.Remove(id); pd.CalculateNotchesUsed(); } public static int GetFragileState(Charm charm) { if (!pd.GetBool(charm.PdGotField())) { return 0; } if (pd.GetBool(charm.PdUnbreakableField())) { return 3; } if (!pd.GetBool(charm.PdBrokenField())) { return 1; } return 2; } public static void IncreaseSpellLevel(Spell spell) { string text = spell switch { Spell.Fireball => "fireballLevel", Spell.Quake => "quakeLevel", Spell.Scream => "screamLevel", _ => throw new ArgumentOutOfRangeException("spell", spell, "Not a valid spell"), }; pd.SetInt(text, (pd.GetInt(text) + 1) % 3); } } internal class ModMenuIgnoreAttribute : Attribute { } public class ScrollContent : AbstractGroup { public readonly List<(IMenuEntity, Func, Func)> entities_with_height = new List<(IMenuEntity, Func, Func)>(); public readonly List entities = new List(); private static GameObject scoll_content_prefab; public bool HideInactiveElements = true; public GameObject content; public GameObject scroll_rect; public ScrollRect scroll_rect_component; public GameObject view_port; public GameObject gameobject_parent; public GameObject true_content; public float VerticalSpacing = SpacingConstants.VSPACE_MEDIUM; public float height; public float width; public Action BeforeUpdate; public static GameObject GetPrefab() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scoll_content_prefab == (Object)null) { GameObject gameObject = ((Component)((Component)UIManager.instance.UICanvas).transform.Find("AchievementsMenuScreen/Content")).gameObject; gameObject.SetActive(false); GameObject val = Object.Instantiate(gameObject); gameObject.SetActive(true); GameObject val2 = val.Find("ScrollRect"); GameObject gameObject2 = ((Component)val.transform.Find("ScrollRect/AchievementListUI")).gameObject; GameObject val3 = val.Find("Scrollbar"); val3.GetComponent().onValueChanged = new ScrollEvent(); val2.RemoveComponent(); val2.RemoveComponent(); gameObject2.RemoveComponent(); gameObject2.RemoveComponent(); GameObjectUtil.DestroyAllChildren(gameObject2); ((Object)gameObject2).name = "ViewPort"; gameObject2.GetComponent().sizeDelta = Vector2.zero; gameObject2.GetComponent().anchorMin = new Vector2(0f, 0f); gameObject2.GetComponent().anchorMax = new Vector2(1f, 1f); gameObject2.GetComponent().anchoredPosition = Vector2.zero; gameObject2.GetComponent().sizeDelta = val2.GetComponent().sizeDelta; gameObject2.AddComponent(); GameObject val4 = new GameObject("Content"); val4.AddComponent(); val4.transform.SetParent(gameObject2.transform); RectTransform component = val4.GetComponent(); component.anchoredPosition = Vector2.zero; component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); ScrollRect obj = val2.AddComponent(); obj.scrollSensitivity = 40f; obj.movementType = (MovementType)2; obj.vertical = true; obj.horizontal = false; obj.verticalScrollbar = val3.GetComponent(); ? val5 = obj; Transform transform = gameObject2.transform; ((ScrollRect)val5).viewport = (RectTransform)(object)((transform is RectTransform) ? transform : null); ? val6 = obj; Transform transform2 = val4.transform; ((ScrollRect)val6).content = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); val.SetActive(false); ((Object)val).name = "ScollContent"; Object.DontDestroyOnLoad((Object)(object)val); scoll_content_prefab = val; } return Object.Instantiate(scoll_content_prefab); } public override IEnumerable AllEntities() { return entities; } public override IEnumerable GetNavigables(NavigationDirection direction) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected I4, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) switch ((int)direction) { case 1: case 2: return NonHiddenEntities().OfType(); case 0: return NonHiddenEntities().OfType().Take(1); case 3: return NonHiddenEntities().OfType().Reverse().Take(1); default: throw EnumUtil.UnsupportedEnum(direction); } } public override bool GetSelectable(NavigationDirection direction, [MaybeNullWhen(false)] out Selectable selectable) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected I4, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) NavigationDirection val = direction; switch ((int)val) { case 1: case 2: { Selectable val2 = default(Selectable); selectable = (from n in CollectionsUtil.MedianOutwards(NonHiddenEntities()).OfType() select n.GetSelectable(direction, ref val2) ? val2 : null).FirstOrDefault(); return (Object)(object)selectable != (Object)null; } case 0: { Selectable val2 = default(Selectable); selectable = (from n in NonHiddenEntities().OfType() select n.GetSelectable(direction, ref val2) ? val2 : null).LastOrDefault(); return (Object)(object)selectable != (Object)null; } case 3: { Selectable val2 = default(Selectable); selectable = (from n in NonHiddenEntities().OfType() select n.GetSelectable(direction, ref val2) ? val2 : null).FirstOrDefault(); return (Object)(object)selectable != (Object)null; } default: throw EnumUtil.UnsupportedEnum(direction); } } public IEnumerable NonHiddenEntities() { if (!HideInactiveElements) { return entities; } return entities.Where((IMenuEntity e) => IMenuEntityExtensions[e]); } public override void UpdateLayout(Vector2 localAnchorPos) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) BeforeUpdate?.Invoke(); ((AbstractGroup)this).ClearNeighbors(); RectTransformUtil.SetAnchoredPosition(content.GetComponent(), localAnchorPos); true_content.GetComponent().sizeDelta = new Vector2(0f, entities_with_height.Sum(((IMenuEntity, Func, Func) e) => e.Item2(e.Item1))); Vector2 val = true_content.GetComponent().sizeDelta / 2f; foreach (var item in entities_with_height) { if (item.Item3 != null) { val.y -= item.Item3(item.Item1); item.Item1.UpdateLayout(val); val.y -= item.Item2(item.Item1) - item.Item3(item.Item1); } else { val.y -= item.Item2(item.Item1) / 2f; item.Item1.UpdateLayout(val); val.y -= item.Item2(item.Item1) / 2f; } } float y = true_content.GetComponent().sizeDelta.y; Rect rect = view_port.GetComponent().rect; if (y <= ((Rect)(ref rect)).height) { ((Component)scroll_rect_component.verticalScrollbar).gameObject.SetActive(false); scroll_rect_component.vertical = false; } else { ((Component)scroll_rect_component.verticalScrollbar).gameObject.SetActive(true); scroll_rect_component.vertical = true; scroll_rect_component.verticalScrollbar = scroll_rect_component.verticalScrollbar; } } private static void SetRectTransformHeight(RectTransform rect, float height) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) rect.sizeDelta = new Vector2(rect.sizeDelta.x, height); } private static void SetRectTransformWidth(RectTransform rect, float width) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) rect.sizeDelta = new Vector2(width, rect.sizeDelta.y); } public ScrollContent(float height = 906f, float width = 2000f, Color? color = null) { //IL_00df: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) this.height = height; content = GetPrefab(); scroll_rect = ((Component)content.transform.Find("ScrollRect")).gameObject; scroll_rect_component = scroll_rect.GetComponent(); view_port = scroll_rect.Find("ViewPort").gameObject; true_content = ((Component)view_port.transform.Find("Content")).gameObject; ((Graphic)true_content.AddComponent()).color = (Color)(((??)color) ?? new Color(0f, 0f, 0f, 0f)); base.visibility.OnVisibilityChanged += content.SetActive; content.SetActive(true); Extensions.SetScale2D(content.transform, Vector2.one); view_port.GetComponent().anchorMin = Vector2.zero; view_port.GetComponent().anchorMax = Vector2.one; true_content.GetComponent().anchorMin = new Vector2(0f, 1f); true_content.GetComponent().anchorMax = new Vector2(1f, 1f); true_content.GetComponent().pivot = new Vector2(0.5f, 1f); true_content.GetComponent().anchoredPosition = Vector2.zero; SetRectTransformHeight(content.GetComponent(), height); SetRectTransformWidth(content.GetComponent(), width); Transform obj = content.transform.Find("Scrollbar"); SetRectTransformHeight((RectTransform)(object)((obj is RectTransform) ? obj : null), height); Transform obj2 = content.transform.Find("Scrollbar/Background"); SetRectTransformHeight((RectTransform)(object)((obj2 is RectTransform) ? obj2 : null), height); } public override void ClearGameObjectParent() { if (!((Object)(object)base.gameObjectParent == (Object)null)) { content.transform.SetParent((Transform)null); content.SetActive(false); } } public override void SetGameObjectParent(GameObject parent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) ((AbstractGroup)this).ClearGameObjectParent(); gameobject_parent = parent; content.transform.SetParent(gameobject_parent.transform); Extensions.SetScale2D(content.transform, Vector2.one); } public void AddChild(IMenuEntity entity) { IMenuEntityExtensions.SetParents(entity, (IMenuEntity)(object)this, true_content); } public void Add(IMenuEntity entity, Func height_func = null, Func top_padding = null) { entities.Add(entity); entities_with_height.Add((entity, height_func ?? ((Func)((IMenuEntity _) => SpacingConstants.VSPACE_MEDIUM)), top_padding)); AddChild(entity); } public void Insert(int index, IMenuEntity entity, Func height_func = null, Func top_padding = null) { entities.Insert(index, entity); entities_with_height.Insert(index, (entity, height_func ?? ((Func)((IMenuEntity _) => SpacingConstants.VSPACE_MEDIUM)), top_padding)); AddChild(entity); } public override bool Contains(IMenuEntity entity) { return entities.Contains(entity); } public bool Remove(IMenuEntity entity) { int num = entities.IndexOf(entity); if (num == -1) { return false; } entities.RemoveAt(num); entities_with_height.RemoveAt(num); IMenuEntityExtensions.ClearParents(entity); return true; } public override void Clear() { foreach (IMenuEntity entity in entities) { entity.ClearGameObjectParent(); } entities.Clear(); entities_with_height.Clear(); } } public class EntryLine { public class HornetVariableInfo { public LocalisedString name; public Type type; public Func saver; public Func loader; public List display_values; public List store_values; public string id; public object Display2Store(object o, int? index) { if (saver == null && store_values == null) { throw new Exception("You must set either saver or store_values"); } int? num = index; if (!num.HasValue) { index = display_values?.IndexOf(o); } if (saver != null) { return saver(o, index); } return store_values[index.Value]; } public object Store2Display(object o, int? index) { //IL_00a0: 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) if (loader == null && display_values == null) { throw new Exception("You must set either loader or display_values"); } int? num = index; if (!num.HasValue) { index = store_values?.IndexOf(o); } if (loader != null) { return loader(o, index); } if (!index.HasValue) { $"{name}:index error".LogWarning(); return null; } try { return display_values[index.Value]; } catch { $"{name} {index.Value}".LogWarning(); return null; } } } public class KnightVariableInfo { public LocalisedString name; public Type type; public Func saver; public Func loader; public List display_values; public List store_values; public string id; public object Display2Store(object o, int? index) { if (saver == null && store_values == null) { throw new Exception("You must set either saver or store_values"); } int? num = index; if (!num.HasValue) { index = display_values?.IndexOf(o); } if (saver != null) { return saver(o, index); } return store_values[index.Value]; } public object Store2Display(object o, int? index) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (loader == null && display_values == null) { throw new Exception("You must set either loader or display_values"); } int? num = index; if (!num.HasValue) { index = store_values?.FindIndex((object e) => e.Equals(o)); } if (loader != null) { return loader(o, index); } if (!index.HasValue) { (((object)Unsafe.As(ref name)/*cast due to .constrained prefix*/).ToString() + ":index error").LogWarning(); return null; } try { return display_values[index.Value]; } catch { $"{name} {index.Value} {o} ".LogWarning(); $"{o.GetType()} {store_values[0].GetType()}".LogWarning(); foreach (object store_value in store_values) { $"{store_value} \n".LogWarning(); } return null; } } } internal enum LineButtonMode { HORNET_VARIABLE, MODE, KNIGHT_VARIABLE, HORNET_VALUE, KNIGHT_VALUE } public static List AcceptableHornetVariables = new List { GeneralHornetInfo("hasDash", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_SPRINT"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasWalljump", (LocalisedString?)new LocalisedString("UI", "INV_NAME_WALLJUMP"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasDoubleJump", (LocalisedString?)new LocalisedString("UI", "INV_NAME_DRESS_DJ"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasHarpoonDash", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_HARPOON"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasNeedleThrow", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_THROW"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasSilkCharge", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_SILKDASH"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasParry", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_PARRY"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasSilkBossNeedle", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_SILKBOSS_NEEDLE"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasThreadSphere", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_SPHERE"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasSilkBomb", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_SILKBOMB"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("maxHealthBase", LangKey.MM_MAX_HEALTH_BASE.Localize(), new List(6) { 5, 6, 7, 8, 9, 10 }, new List(6) { 5, 6, 7, 8, 9, 10 }), GeneralHornetInfo("nailUpgrades", LangKey.MM_NAIL_UPGRADES.Localize(), new List(5) { 0, 1, 2, 3, 4 }, new List(6) { 5, 6, 7, 8, 9, 10 }), GeneralHornetInfo("hasNeedolin", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_NEEDOLIN"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("UnlockedFastTravelTeleport", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_BELLBEAST_MELODY"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("permadeathMode", (LocalisedString?)new LocalisedString("MainMenu", "MODE_STEEL"), new List(2) { MoreLanguge.On, MoreLanguge.Off }, new List(2) { (object)(PermadeathModes)1, (object)(PermadeathModes)0 }, (Func)null, (Func)null), GeneralHornetInfo("bossRushMode", LangKey.MM_BOSSRUSH_MODE.Localize()), GeneralHornetInfo("HasBoundCrestUpgrader", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_EVAHEAL"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("hasChargeSlash", (LocalisedString?)new LocalisedString("UI", "INV_NAME_SKILL_CHARGESLASH"), (List)null, (List)null, (Func)null, (Func)null), GeneralHornetInfo("ToolEquips", LangKey.MM_UNLOCK_SLOTS.Localize()) }.Concat(from Tool tool in Enum.GetValues(typeof(Tool)) where tool > Tool.Silk_Boss_Needle select ToolHornetInfo(tool)).ToList(); public static List AcceptableKnightVariables; private List current_lines; internal FreeGroup parentgroup; internal GridGroup line; private ScrollContent scroll; private TextButton up; private TextButton down; private Action update_action; internal int index_int; private TextButton index; private TextButton hornet; private HornetVariableInfo current_hornet_info; private TextButton hornet_value; private object current_hornet_value; private TextButton mode; private SyncManager.SyncMode? current_mode; private TextButton knight; private KnightVariableInfo current_knight_info; private TextButton knight_value; private object current_knight_value; private TextButton add; private TextButton delete; private int font_size = 30; private bool spawned; internal bool freeze; private bool error; private static List available_lines; [CompilerGenerated] private static GridGroup k__BackingField; internal static TextButton current_selected_button; internal static EntryLine current_editing_entry; private static PlayerData hd => PlayerData.instance; private static PlayerData kd => PlayerData.instance; private static GridGroup OptionsBlock { get { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (k__BackingField == null) { k__BackingField = new GridGroup(5); k__BackingField.HorizontalSpacing = SpacingConstants.HSPACE_MEDIUM / 2f; int num = Math.Max(AcceptableHornetVariables.Count, AcceptableKnightVariables.Count) + 1; for (int i = 0; i < num; i++) { TextButton val = new TextButton(LocalizedText.op_Implicit("option")); k__BackingField.Add((IMenuEntity)(object)val); } ((AbstractGroup)k__BackingField).Visibility.VisibleSelf = false; } return k__BackingField; } } public static HornetVariableInfo GeneralHornetInfo(string id, LocalisedString? name = null, List display_values = null, List store_values = null, Func saver = null, Func loader = null) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Type typeFromHandle = typeof(T); if (display_values == null) { display_values = ((typeFromHandle == typeof(bool)) ? new List(2) { MoreLanguge.Yes, MoreLanguge.No } : null); } if (store_values == null) { store_values = ((typeFromHandle == typeof(bool)) ? new List(2) { true, false } : null); } return new HornetVariableInfo { name = (LocalisedString)(((??)name) ?? new LocalisedString("", id)), type = typeFromHandle, saver = saver, loader = loader, display_values = display_values, store_values = store_values, id = id }; } public static HornetVariableInfo ToolHornetInfo(Tool tool, LocalisedString? name = null) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) return new HornetVariableInfo { name = (LocalisedString)(((??)name) ?? tool.Localize()), type = typeof(bool), saver = null, loader = null, display_values = new List(2) { MoreLanguge.Yes, MoreLanguge.No }, store_values = new List(2) { true, false }, id = "Tool_" + tool.GetToolName() }; } public static KnightVariableInfo GeneralKnightInfo(string id, LocalisedString? name = null, List display_values = null, List store_values = null, Func saver = null, Func loader = null) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Type typeFromHandle = typeof(T); if (display_values == null) { display_values = ((typeFromHandle == typeof(bool)) ? new List(2) { MoreLanguge.Yes, MoreLanguge.No } : null); } if (store_values == null) { store_values = ((typeFromHandle == typeof(bool)) ? new List(2) { true, false } : null); } return new KnightVariableInfo { name = (LocalisedString)(((??)name) ?? new LocalisedString("", id)), type = typeFromHandle, saver = saver, loader = loader, display_values = display_values, store_values = store_values, id = id }; } public static KnightVariableInfo CharmKnightInfo(Charm charm, LocalisedString? name = null) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) return new KnightVariableInfo { name = (LocalisedString)(((??)name) ?? charm.Localize()), type = typeof(bool), display_values = new List(2) { MoreLanguge.Yes, MoreLanguge.No }, store_values = new List(2) { true, false }, saver = null, loader = null, id = charm.GetCharmName() }; } public static void SetStableTextSize(Text text, int size) { if (!((Object)(object)text == (Object)null)) { ChangeTextFontScaleOnHandHeld component = ((Component)text).GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } text.fontSize = size; } } private static void SelectLineButton(TextButton button, EntryLine line, LineButtonMode mode) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) if (current_selected_button == button) { UnSelectLine(); } else { SelectLine(line); current_selected_button = button; if (!((AbstractGroup)line.parentgroup).Contains((IMenuEntity)(object)OptionsBlock)) { line.parentgroup.Add((IMenuEntity)(object)OptionsBlock, new Vector2(0f, 0f - SpacingConstants.VSPACE_SMALL)); } ((AbstractGroup)OptionsBlock).Visibility.VisibleSelf = true; int num = ((AbstractGroup)OptionsBlock).AllEntities().Count(); int size = 30; switch (mode) { case LineButtonMode.HORNET_VARIABLE: { for (int num4 = 0; num4 < num; num4++) { IMenuEntity obj5 = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(num4); TextButton val4 = (TextButton)(object)((obj5 is TextButton) ? obj5 : null); if (val4 == null) { continue; } if (num4 < AcceptableHornetVariables.Count) { HornetVariableInfo now_info2 = AcceptableHornetVariables[num4]; int now_index3 = num4; val4.ButtonText.text = ((object)Unsafe.As(ref AcceptableHornetVariables[num4].name)/*cast due to .constrained prefix*/).ToString(); SetStableTextSize(val4.ButtonText, size); ((MenuElement)val4).Visibility.VisibleSelf = true; val4.OnSubmit = delegate { SelectOptionsButton(mode, now_info2, now_index3); }; if (current_editing_entry.current_hornet_info == AcceptableHornetVariables[num4]) { ((MenuElement)val4).State = (ElementState)1; ((SelectableElement)val4).Interactable = false; } else { ((MenuElement)val4).State = (ElementState)2; ((SelectableElement)val4).Interactable = true; } } else if (num4 == AcceptableHornetVariables.Count) { val4.ButtonText.text = LocalisedString.op_Implicit(MoreLanguge.None); SetStableTextSize(val4.ButtonText, size); ((MenuElement)val4).Visibility.VisibleSelf = true; val4.OnSubmit = delegate { SelectOptionsButton(mode, null, AcceptableHornetVariables.Count); }; if (current_editing_entry.current_hornet_info == null) { ((MenuElement)val4).State = (ElementState)1; ((SelectableElement)val4).Interactable = false; } else { ((MenuElement)val4).State = (ElementState)2; ((SelectableElement)val4).Interactable = true; } } else { ((MenuElement)val4).Visibility.VisibleSelf = false; } } break; } case LineButtonMode.KNIGHT_VARIABLE: { for (int num3 = 0; num3 < num; num3++) { IMenuEntity obj4 = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(num3); TextButton val3 = (TextButton)(object)((obj4 is TextButton) ? obj4 : null); if (val3 == null) { continue; } if (num3 < AcceptableKnightVariables.Count) { KnightVariableInfo now_info = AcceptableKnightVariables[num3]; int now_index2 = num3; val3.ButtonText.text = ((object)Unsafe.As(ref AcceptableKnightVariables[num3].name)/*cast due to .constrained prefix*/).ToString(); ((MenuElement)val3).Visibility.VisibleSelf = true; SetStableTextSize(val3.ButtonText, size); val3.OnSubmit = delegate { SelectOptionsButton(mode, now_info, now_index2); }; if (current_editing_entry.current_knight_info == AcceptableKnightVariables[num3]) { ((MenuElement)val3).State = (ElementState)1; ((SelectableElement)val3).Interactable = false; } else { ((MenuElement)val3).State = (ElementState)2; ((SelectableElement)val3).Interactable = true; } } else if (num3 == AcceptableKnightVariables.Count) { val3.ButtonText.text = LocalisedString.op_Implicit(MoreLanguge.None); SetStableTextSize(val3.ButtonText, size); ((MenuElement)val3).Visibility.VisibleSelf = true; val3.OnSubmit = delegate { SelectOptionsButton(mode, null, AcceptableKnightVariables.Count); }; if (current_editing_entry.current_knight_info == null) { ((MenuElement)val3).State = (ElementState)1; ((SelectableElement)val3).Interactable = false; } else { ((MenuElement)val3).State = (ElementState)2; ((SelectableElement)val3).Interactable = true; } } else { ((MenuElement)val3).Visibility.VisibleSelf = false; } } break; } case LineButtonMode.MODE: { for (int num7 = 0; num7 < num; num7++) { IMenuEntity obj9 = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(num7); TextButton val7 = (TextButton)(object)((obj9 is TextButton) ? obj9 : null); if (val7 == null) { continue; } if (num7 < Enum.GetNames(typeof(SyncManager.SyncMode)).Length) { SyncManager.SyncMode now_mode = (SyncManager.SyncMode)Enum.GetValues(typeof(SyncManager.SyncMode)).GetValue(num7); int now_index5 = num7; val7.ButtonText.text = LocalisedString.op_Implicit(((LangKey)Enum.Parse(typeof(LangKey), "SYNC_MODE_" + now_mode)).Localize()); ((MenuElement)val7).Visibility.VisibleSelf = true; SetStableTextSize(val7.ButtonText, size); val7.OnSubmit = delegate { SelectOptionsButton(mode, now_mode, now_index5); }; if (current_editing_entry.current_mode == now_mode) { ((MenuElement)val7).State = (ElementState)1; ((SelectableElement)val7).Interactable = false; } else { ((MenuElement)val7).State = (ElementState)2; ((SelectableElement)val7).Interactable = true; } } else { ((MenuElement)val7).Visibility.VisibleSelf = false; } } break; } case LineButtonMode.HORNET_VALUE: { if (current_editing_entry.current_hornet_info != null) { List display_values2 = current_editing_entry.current_hornet_info.display_values; List store_values2 = current_editing_entry.current_hornet_info.store_values; for (int num5 = 0; num5 < num; num5++) { IMenuEntity obj6 = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(num5); TextButton val5 = (TextButton)(object)((obj6 is TextButton) ? obj6 : null); if (val5 == null) { continue; } if (num5 < display_values2.Count) { object obj7 = display_values2[num5]; object now_store_option2 = store_values2[num5]; int now_index4 = num5; val5.ButtonText.text = obj7.ToString(); ((MenuElement)val5).Visibility.VisibleSelf = true; SetStableTextSize(val5.ButtonText, size); val5.OnSubmit = delegate { SelectOptionsButton(mode, now_store_option2, now_index4); }; if (current_editing_entry.current_hornet_value != null && object.Equals(now_store_option2, current_editing_entry.current_hornet_value)) { ((MenuElement)val5).State = (ElementState)1; ((SelectableElement)val5).Interactable = false; } else { ((MenuElement)val5).State = (ElementState)2; ((SelectableElement)val5).Interactable = true; } } else { ((MenuElement)val5).Visibility.VisibleSelf = false; } } break; } for (int num6 = 0; num6 < num; num6++) { IMenuEntity obj8 = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(num6); TextButton val6 = (TextButton)(object)((obj8 is TextButton) ? obj8 : null); if (val6 != null) { if (num6 == 0) { val6.ButtonText.text = LocalisedString.op_Implicit(MoreLanguge.None); ((MenuElement)val6).Visibility.VisibleSelf = true; SetStableTextSize(val6.ButtonText, size); val6.OnSubmit = null; ((MenuElement)val6).State = (ElementState)1; ((SelectableElement)val6).Interactable = false; } else { ((MenuElement)val6).Visibility.VisibleSelf = false; } } } "Error: current hornet variable is null".LogWarning(); break; } case LineButtonMode.KNIGHT_VALUE: { if (current_editing_entry.current_knight_info != null) { List display_values = current_editing_entry.current_knight_info.display_values; List store_values = current_editing_entry.current_knight_info.store_values; for (int i = 0; i < num; i++) { IMenuEntity obj = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(i); TextButton val = (TextButton)(object)((obj is TextButton) ? obj : null); if (val == null) { continue; } if (i < display_values.Count) { object obj2 = display_values[i]; object now_store_option = store_values[i]; int now_index = i; val.ButtonText.text = obj2.ToString(); ((MenuElement)val).Visibility.VisibleSelf = true; SetStableTextSize(val.ButtonText, size); val.OnSubmit = delegate { SelectOptionsButton(mode, now_store_option, now_index); }; if (current_editing_entry.current_knight_value != null && object.Equals(now_store_option, current_editing_entry.current_knight_value)) { ((MenuElement)val).State = (ElementState)1; ((SelectableElement)val).Interactable = false; } else { ((MenuElement)val).State = (ElementState)2; ((SelectableElement)val).Interactable = true; } } else { ((MenuElement)val).Visibility.VisibleSelf = false; } } break; } for (int num2 = 0; num2 < num; num2++) { IMenuEntity obj3 = ((AbstractGroup)OptionsBlock).AllEntities().ElementAt(num2); TextButton val2 = (TextButton)(object)((obj3 is TextButton) ? obj3 : null); if (val2 != null) { if (num2 == 0) { val2.ButtonText.text = LocalisedString.op_Implicit(MoreLanguge.None); ((MenuElement)val2).Visibility.VisibleSelf = true; SetStableTextSize(val2.ButtonText, size); val2.OnSubmit = null; ((MenuElement)val2).State = (ElementState)1; ((SelectableElement)val2).Interactable = false; } else { ((MenuElement)val2).Visibility.VisibleSelf = false; } } } "Error: current knight variable is null".LogWarning(); break; } } } line.CheckLock(); } private static void SelectOptionsButton(LineButtonMode mode, object value, int index) { if (OptionsBlock != null && current_selected_button != null) { switch (mode) { case LineButtonMode.HORNET_VARIABLE: current_editing_entry.current_hornet_info = (HornetVariableInfo)value; current_editing_entry.current_hornet_value = null; break; case LineButtonMode.KNIGHT_VARIABLE: current_editing_entry.current_knight_info = (KnightVariableInfo)value; current_editing_entry.current_knight_value = null; break; case LineButtonMode.MODE: current_editing_entry.current_mode = (SyncManager.SyncMode)value; break; case LineButtonMode.HORNET_VALUE: current_editing_entry.current_hornet_value = current_editing_entry.current_hornet_info.Display2Store(value, index); break; case LineButtonMode.KNIGHT_VALUE: current_editing_entry.current_knight_value = current_editing_entry.current_knight_info.Display2Store(value, index); break; } current_editing_entry.error = false; current_editing_entry.CheckLock(); current_editing_entry.update_action?.Invoke(); ((AbstractGroup)OptionsBlock).Visibility.VisibleSelf = false; UnSelectLine(); } } private static void SelectLine(EntryLine line) { if (current_editing_entry != null) { UnSelectLine(); } current_editing_entry = line; ((MenuElement)line.index).State = (ElementState)1; ((SelectableElement)line.index).Interactable = false; line.CheckLock(); } internal static void UnSelectLine() { if (current_editing_entry != null) { if (((AbstractGroup)current_editing_entry.parentgroup).Contains((IMenuEntity)(object)OptionsBlock)) { current_editing_entry.parentgroup.Remove((IMenuEntity)(object)OptionsBlock); ((AbstractGroup)OptionsBlock).Visibility.VisibleSelf = false; } ((MenuElement)current_editing_entry.index).State = (ElementState)0; ((SelectableElement)current_editing_entry.index).Interactable = true; current_selected_button = null; current_editing_entry = null; } } internal void UnFreeze() { freeze = true; ((SelectableElement)index).Interactable = true; ((SelectableElement)hornet).Interactable = true; ((SelectableElement)hornet_value).Interactable = true; ((SelectableElement)mode).Interactable = true; ((SelectableElement)knight).Interactable = true; ((SelectableElement)knight_value).Interactable = true; ((SelectableElement)add).Interactable = true; ((SelectableElement)delete).Interactable = true; CheckLock(); } internal void Freeze() { freeze = false; ((SelectableElement)index).Interactable = false; ((SelectableElement)hornet).Interactable = false; ((SelectableElement)hornet_value).Interactable = false; ((SelectableElement)mode).Interactable = false; ((SelectableElement)knight).Interactable = false; ((SelectableElement)knight_value).Interactable = false; ((SelectableElement)add).Interactable = false; ((SelectableElement)delete).Interactable = false; } public EntryLine() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) line = new GridGroup(8); line.HorizontalSpacing = SpacingConstants.HSPACE_MEDIUM * 4f / 11f; line.VerticalSpacing = SpacingConstants.VSPACE_SMALL; index = new TextButton(LocalizedText.op_Implicit("index")); line.Add((IMenuEntity)(object)index); SetStableTextSize(index.ButtonText, font_size); index.OnSubmit = delegate { SelectLine(this); }; hornet = new TextButton(LocalizedText.op_Implicit("hornet")); SetStableTextSize(hornet.ButtonText, font_size); line.Add((IMenuEntity)(object)hornet); hornet.OnSubmit = delegate { SelectLineButton(hornet, this, LineButtonMode.HORNET_VARIABLE); }; hornet_value = new TextButton(LocalizedText.op_Implicit("value")); SetStableTextSize(hornet_value.ButtonText, font_size); line.Add((IMenuEntity)(object)hornet_value); hornet_value.OnSubmit = delegate { SelectLineButton(hornet_value, this, LineButtonMode.HORNET_VALUE); }; mode = new TextButton(LocalizedText.op_Implicit("mode")); SetStableTextSize(mode.ButtonText, font_size); line.Add((IMenuEntity)(object)mode); mode.OnSubmit = delegate { SelectLineButton(mode, this, LineButtonMode.MODE); }; knight = new TextButton(LocalizedText.op_Implicit("knight")); SetStableTextSize(knight.ButtonText, font_size); line.Add((IMenuEntity)(object)knight); knight.OnSubmit = delegate { SelectLineButton(knight, this, LineButtonMode.KNIGHT_VARIABLE); }; knight_value = new TextButton(LocalizedText.op_Implicit("value")); SetStableTextSize(knight_value.ButtonText, font_size); line.Add((IMenuEntity)(object)knight_value); knight_value.OnSubmit = delegate { SelectLineButton(knight_value, this, LineButtonMode.KNIGHT_VALUE); }; add = new TextButton(LocalizedText.op_Implicit(LangKey.MM_ADD.Localize())); SetStableTextSize(add.ButtonText, font_size); ((MenuElement)add).SetMainColor(Color.green); ((MenuElement)add).ApplyDefaultColors = false; add.OnSubmit = delegate { Spawn(scroll, scroll.entities.IndexOf((IMenuEntity)(object)parentgroup) + 1, current_lines, up, down, update_action); }; delete = new TextButton(LocalizedText.op_Implicit(LangKey.MM_DELETE.Localize())); ((MenuElement)delete).ApplyDefaultColors = false; SetStableTextSize(delete.ButtonText, font_size); ((MenuElement)delete).SetMainColor(Color.red); delete.OnSubmit = delegate { Recycle(); }; line.Add((IMenuEntity)(object)add); line.Add((IMenuEntity)(object)delete); ((AbstractGroup)line).Visibility.VisibleSelf = false; parentgroup = new FreeGroup(); parentgroup.Add((IMenuEntity)(object)line, Vector2.zero); available_lines.Add(this); } internal bool Validate() { //IL_01cf: Unknown result type (might be due to invalid IL or missing references) bool flag = true; List list = new List(5) { hornet, hornet_value, mode, knight, knight_value }; List list2 = new List(); switch (current_mode) { case SyncManager.SyncMode.EQUAL: if (current_hornet_info != null && current_knight_info != null && current_hornet_info.type == current_knight_info.type) { flag = false; break; } list2.Add(hornet); list2.Add(knight); break; case SyncManager.SyncMode.CONTRIBUTE: if (current_hornet_info != null && current_hornet_value != null && current_knight_info != null) { flag = false; break; } if (current_hornet_info == null) { list2.Add(hornet); } if (current_knight_info == null) { list2.Add(knight); } if (current_hornet_value == null) { list2.Add(hornet_value); } break; case SyncManager.SyncMode.SET: if (current_knight_info == null || current_knight_value == null) { flag = true; if (current_knight_info == null) { list2.Add(knight); } if (current_knight_value == null) { list2.Add(knight_value); } } else if ((current_hornet_info == null) ^ (current_hornet_value == null)) { list2.Add(hornet); list2.Add(hornet_value); flag = true; } else { flag = false; } break; default: list2.Add(mode); break; } foreach (TextButton item in list) { if (flag && list2.Contains(item)) { ((MenuElement)item).SetMainColor(Color.red); } else { ((MenuElement)item).MaybeApplyDefaultColors(); } } error = flag; return !flag; } public static EntryLine Spawn(ScrollContent scroll, List lines, TextButton up, TextButton down, Action updateAction) { return Spawn(scroll, ((AbstractGroup)scroll).AllEntities().Count(), lines, up, down, updateAction); } public static EntryLine Spawn(ScrollContent scroll, int index, List lines, TextButton up, TextButton down, Action updateAction) { if (index < 0 || index > ((AbstractGroup)scroll).AllEntities().Count()) { $"Spawn EntryLine at {index} Error".LogWarning(); return null; } if (available_lines.Count == 0) { new EntryLine(); } EntryLine entry_line = available_lines[0]; available_lines.RemoveAt(0); entry_line.spawned = true; ((AbstractGroup)entry_line.line).Visibility.VisibleSelf = true; entry_line.up = up; entry_line.down = down; entry_line.update_action = updateAction; entry_line.scroll = scroll; entry_line.current_lines = lines; scroll.Insert(index, (IMenuEntity)(object)entry_line.parentgroup, (IMenuEntity _) => entry_line.GetHeight(), (IMenuEntity _) => SpacingConstants.VSPACE_SMALL / 2f); lines.Insert(index, entry_line); UpdateFrom(scroll, lines, index); entry_line.current_hornet_info = null; entry_line.current_hornet_value = null; entry_line.current_mode = null; entry_line.current_knight_info = null; entry_line.current_knight_value = null; entry_line.CheckLock(); return entry_line; } public void Recycle() { spawned = false; ((AbstractGroup)line).Visibility.VisibleSelf = false; UnSelectLine(); scroll.Remove((IMenuEntity)(object)parentgroup); current_lines.Remove(this); available_lines.Add(this); UpdateFrom(scroll, current_lines, index_int - 1); } internal void Init(SyncManager.SyncBaseInfo baseInfo) { current_hornet_info = AcceptableHornetVariables.Find((HornetVariableInfo info) => info.id == baseInfo.hdPath); current_knight_info = AcceptableKnightVariables.Find((KnightVariableInfo info) => info.id == baseInfo.kdPath); current_mode = (Enum.TryParse(typeof(SyncManager.SyncMode), baseInfo.operation, out object result) ? new SyncManager.SyncMode?((SyncManager.SyncMode)result) : ((SyncManager.SyncMode?)null)); current_hornet_value = ((current_hornet_info == null) ? null : baseInfo.hdValue); current_knight_value = ((current_knight_info == null) ? null : baseInfo.kdValue); CheckLock(); } internal SyncManager.SyncBaseInfo SaveToBaseInfo() { if (!Validate()) { "Validate ERROR, Please Check".LogWarning(); return null; } string hdPath = ((current_hornet_info == null) ? null : current_hornet_info.id); string kdPath = ((current_knight_info == null) ? null : current_knight_info.id); object hdValue = ((current_hornet_info == null) ? null : current_hornet_value); object kdValue = ((current_knight_info == null) ? null : current_knight_value); return new SyncManager.SyncBaseInfo(hdPath, hdValue, kdPath, kdValue, current_mode.Value); } internal static void UpdateFrom(ScrollContent scroll, List lines, int index) { for (int i = 0; i < ((AbstractGroup)scroll).AllEntities().Count(); i++) { if (i >= index) { lines[i].UpdateIndex(i + 1); } } } internal void UpdateIndex(int index) { this.index.ButtonText.text = index.ToString(); index_int = index; } internal void Update() { } internal float GetHeight() { if (current_editing_entry != this || !((AbstractGroup)OptionsBlock).Visibility.VisibleSelf) { return SpacingConstants.VSPACE_SMALL; } return SpacingConstants.VSPACE_SMALL + (float)Mathf.CeilToInt((float)((AbstractGroup)OptionsBlock).AllEntities().Count((IMenuEntity m) => m.Visibility.VisibleSelf) / (float)OptionsBlock.Columns) * OptionsBlock.VerticalSpacing; } internal void LockButton(LineButtonMode mode) { switch (mode) { case LineButtonMode.HORNET_VARIABLE: ((SelectableElement)hornet).Interactable = false; current_hornet_info = null; ((MenuElement)hornet).State = (ElementState)2; break; case LineButtonMode.HORNET_VALUE: ((SelectableElement)hornet_value).Interactable = false; current_hornet_value = null; ((MenuElement)hornet_value).State = (ElementState)2; break; case LineButtonMode.MODE: ((SelectableElement)this.mode).Interactable = false; current_mode = null; ((MenuElement)this.mode).State = (ElementState)2; break; case LineButtonMode.KNIGHT_VARIABLE: ((SelectableElement)knight).Interactable = false; current_knight_info = null; ((MenuElement)knight).State = (ElementState)2; break; case LineButtonMode.KNIGHT_VALUE: ((SelectableElement)knight_value).Interactable = false; current_knight_value = null; ((MenuElement)knight_value).State = (ElementState)2; break; } } internal void UpdateButtonText() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) if (current_hornet_info == null) { hornet.ButtonText.text = "hornet"; ((MenuElement)hornet).State = (ElementState)0; } else { hornet.ButtonText.text = LocalisedString.op_Implicit(current_hornet_info.name); ((MenuElement)hornet).State = (ElementState)1; } if (current_hornet_value == null) { hornet_value.ButtonText.text = "value"; ((MenuElement)hornet_value).State = (ElementState)0; } else { hornet_value.ButtonText.text = current_hornet_info.Store2Display(current_hornet_value, null).ToString(); ((MenuElement)hornet_value).State = (ElementState)1; } if (!current_mode.HasValue) { mode.ButtonText.text = "mode"; ((MenuElement)mode).State = (ElementState)0; } else { mode.ButtonText.text = LocalisedString.op_Implicit(((LangKey)Enum.Parse(typeof(LangKey), "SYNC_MODE_" + current_mode.ToString())).Localize()); ((MenuElement)mode).State = (ElementState)1; } if (current_knight_info == null) { knight.ButtonText.text = "knight"; ((MenuElement)knight).State = (ElementState)0; } else { knight.ButtonText.text = LocalisedString.op_Implicit(current_knight_info.name); ((MenuElement)knight).State = (ElementState)1; } if (current_knight_value == null) { knight_value.ButtonText.text = "value"; ((MenuElement)knight_value).State = (ElementState)0; } else { knight_value.ButtonText.text = current_knight_info.Store2Display(current_knight_value, null).ToString(); ((MenuElement)knight_value).State = (ElementState)1; } if (!error) { ((MenuElement)hornet).MaybeApplyDefaultColors(); ((MenuElement)hornet_value).MaybeApplyDefaultColors(); ((MenuElement)mode).MaybeApplyDefaultColors(); ((MenuElement)knight).MaybeApplyDefaultColors(); ((MenuElement)knight_value).MaybeApplyDefaultColors(); } } internal void UnLockButton(LineButtonMode mode) { switch (mode) { case LineButtonMode.HORNET_VARIABLE: ((SelectableElement)hornet).Interactable = true; ((MenuElement)hornet).State = (ElementState)0; break; case LineButtonMode.HORNET_VALUE: ((SelectableElement)hornet_value).Interactable = true; ((MenuElement)hornet_value).State = (ElementState)0; break; case LineButtonMode.MODE: ((SelectableElement)this.mode).Interactable = true; ((MenuElement)this.mode).State = (ElementState)0; break; case LineButtonMode.KNIGHT_VARIABLE: ((SelectableElement)knight).Interactable = true; ((MenuElement)knight).State = (ElementState)0; break; case LineButtonMode.KNIGHT_VALUE: ((SelectableElement)knight_value).Interactable = true; ((MenuElement)knight_value).State = (ElementState)0; break; } } internal void CheckLock() { UnLockButton(LineButtonMode.MODE); switch (current_mode) { case SyncManager.SyncMode.CONTRIBUTE: UnLockButton(LineButtonMode.HORNET_VARIABLE); UnLockButton(LineButtonMode.HORNET_VALUE); UnLockButton(LineButtonMode.KNIGHT_VARIABLE); LockButton(LineButtonMode.KNIGHT_VALUE); break; case SyncManager.SyncMode.EQUAL: UnLockButton(LineButtonMode.HORNET_VARIABLE); LockButton(LineButtonMode.HORNET_VALUE); UnLockButton(LineButtonMode.KNIGHT_VARIABLE); LockButton(LineButtonMode.KNIGHT_VALUE); break; default: UnLockButton(LineButtonMode.HORNET_VARIABLE); UnLockButton(LineButtonMode.HORNET_VALUE); UnLockButton(LineButtonMode.KNIGHT_VARIABLE); UnLockButton(LineButtonMode.KNIGHT_VALUE); break; } if (current_hornet_info == null) { LockButton(LineButtonMode.HORNET_VALUE); } if (current_knight_info == null) { LockButton(LineButtonMode.KNIGHT_VALUE); } ((SelectableElement)up).Interactable = false; ((SelectableElement)down).Interactable = false; if (current_editing_entry != null && current_editing_entry == this) { if (current_editing_entry.index_int > 1) { ((SelectableElement)current_editing_entry.up).Interactable = true; } if (current_editing_entry.index_int < current_editing_entry.current_lines.Count) { ((SelectableElement)current_editing_entry.down).Interactable = true; } } UpdateButtonText(); } static EntryLine() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_0aa1: Unknown result type (might be due to invalid IL or missing references) //IL_0abd: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Unknown result type (might be due to invalid IL or missing references) //IL_0b43: Unknown result type (might be due to invalid IL or missing references) //IL_0b55: Unknown result type (might be due to invalid IL or missing references) //IL_0b70: Unknown result type (might be due to invalid IL or missing references) //IL_0b8b: Unknown result type (might be due to invalid IL or missing references) //IL_0ba6: Unknown result type (might be due to invalid IL or missing references) //IL_0bc2: Unknown result type (might be due to invalid IL or missing references) List list = new List(); list.Add(GeneralKnightInfo("hasDash", LangKey.DASH_NAME.Localize())); list.Add(GeneralKnightInfo("hasShadowDash", LangKey.SHADOWDASH_NAME.Localize())); list.Add(GeneralKnightInfo("hasWalljump", LangKey.DEBUG_WALL_JUMP_NAME.Localize())); list.Add(GeneralKnightInfo("hasDoubleJump", LangKey.DEBUG_DOUBLE_JUMP_NAME.Localize())); list.Add(GeneralKnightInfo("hasSuperDash", LangKey.DEBUG_SUPER_DASH_NAME.Localize())); list.Add(GeneralKnightInfo("fireballLevel", LangKey.DEBUG_FIREBALL_NAME.Localize(), new List(3) { 0, 1, 2 }, new List(3) { 0, 1, 2 })); list.Add(GeneralKnightInfo("quakeLevel", LangKey.DEBUG_QUAKE_NAME.Localize(), new List(3) { 0, 1, 2 }, new List(3) { 0, 1, 2 })); list.Add(GeneralKnightInfo("screamLevel", LangKey.DEBUG_SCREAM_NAME.Localize(), new List(3) { 0, 1, 2 }, new List(3) { 0, 1, 2 })); list.Add(GeneralKnightInfo("MPReserveMax", LangKey.SOUL_ORB.Localize(), new List(4) { 0, 1, 2, 3 }, new List(4) { 0, 33, 66, 99 })); list.Add(GeneralKnightInfo("maxHealthBase", LangKey.MM_MAX_HEALTH_BASE.Localize(), new List(5) { 5, 6, 7, 8, 9 }, new List(5) { 5, 6, 7, 8, 9 })); list.Add(GeneralKnightInfo("nailSmithUpgrades", LangKey.MM_KNIGHT_NAIL_UPGRADES.Localize())); list.Add(GeneralKnightInfo("hasDreamNail", LangKey.DEBUG_DREAM_NAIL_NAME.Localize())); list.Add(GeneralKnightInfo("hasDreamGate", LangKey.DEBUG_DREAM_GATE_NAME.Localize())); list.Add(GeneralKnightInfo("permadeathMode", (LocalisedString?)new LocalisedString("MainMenu", "MODE_STEEL"), new List(2) { MoreLanguge.On, MoreLanguge.Off }, new List(2) { 1, 0 }, (Func)null, (Func)null)); list.Add(GeneralKnightInfo("bossRushMode", LangKey.MM_BOSSRUSH_MODE.Localize())); list.Add(GeneralKnightInfo("salubraBlessing", LangKey.SALUBRA_NAME.Localize())); list.Add(GeneralKnightInfo("hasCyclone", LangKey.DEBUG_CYCLONE_NAME.Localize())); list.Add(GeneralKnightInfo("hasDashSlash", LangKey.DEBUG_GREAT_SLASH_NAME.Localize())); list.Add(GeneralKnightInfo("hasUpwardSlash", LangKey.DEBUG_DASH_SLASH_NAME.Localize())); list.Add(GeneralKnightInfo("hasMap", LangKey.MAP_NAME.Localize())); list.Add(GeneralKnightInfo("charmSlots", LangKey.CHARMSLOT_NAME.Localize(), new List(9) { 3, 4, 5, 6, 7, 8, 9, 10, 11 }, new List(9) { 3, 4, 5, 6, 7, 8, 9, 10, 11 })); list.AddRange(from Charm charm in Enum.GetValues(typeof(Charm)) select CharmKnightInfo(charm)); list.Add(GeneralKnightInfo("royalCharmState", LangKey.MM_ROYAL_CHARM_STATE.Localize(), new List(4) { LocalisedString.op_Implicit(LangKey.WHITE_FRAGMENT.Localize()) + "-1", LocalisedString.op_Implicit(LangKey.WHITE_FRAGMENT.Localize()) + "-2", LangKey.KING_SOUL.Localize(), LangKey.VOID_HEART.Localize() }, new List(4) { 1, 2, 3, 4 })); list.Add(GeneralKnightInfo("grimmChildLevel", LangKey.MM_GRIMM_CHARM_STATE.Localize(), new List(5) { LocalisedString.op_Implicit(LangKey.GRIMM_CHILD.Localize()) + "-1", LocalisedString.op_Implicit(LangKey.GRIMM_CHILD.Localize()) + "-2", LocalisedString.op_Implicit(LangKey.GRIMM_CHILD.Localize()) + "-3", LocalisedString.op_Implicit(LangKey.GRIMM_CHILD.Localize()) + "-4", LangKey.CAREFREE_MELODY.Localize() }, new List(5) { 1, 2, 3, 4, 5 })); AcceptableKnightVariables = list; available_lines = new List(); current_selected_button = null; current_editing_entry = null; } } internal enum SlotConfigState { OK, FAIL, MODDED } [RequiresMod("org.silksong-modding.modmenu")] public class WithModMenu : ICompatibility { public string ModId => "org.silksong-modding.modmenu"; public string ModName => "ModMenu"; private static MenuElement GenerateLocalizedBoolElement(ConfigEntryBase entry, LocalisedString? name = null, LocalisedString? desc = null, LocalisedString? false_string = null, LocalisedString? true_string = null) { //IL_0028: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (!(entry is ConfigEntry val)) { return null; } List<(bool, string)> list = new List<(bool, string)>(2) { (false, LocalisedString.op_Implicit((LocalisedString)(((??)false_string) ?? MoreLanguge.Off))), (true, LocalisedString.op_Implicit((LocalisedString)(((??)true_string) ?? MoreLanguge.On))) }; LocalisedString? val2 = name; LocalizedText obj = LocalizedText.op_Implicit(val2.HasValue ? LocalisedString.op_Implicit(val2.GetValueOrDefault()) : ConfigEntryFactoryExtensions.LabelName((ConfigEntryBase)(object)val)); ListChoiceModel obj2 = ChoiceModels.ForNamedValues((IEnumerable>)list); val2 = desc; ChoiceElement obj3 = new ChoiceElement(obj, (IChoiceModel)(object)obj2, LocalizedText.op_Implicit(val2.HasValue ? LocalisedString.op_Implicit(val2.GetValueOrDefault()) : ConfigEntryFactoryExtensions.DescriptionLine((ConfigEntryBase)(object)val))); ConfigEntryFactoryExtensions.SynchronizeWith((SelectableValueElement)(object)obj3, val); return (MenuElement)(object)obj3; } private static MenuElement GenerateLocalizedFloatElement(ConfigEntryBase entry, bool use_slider, LocalisedString? name = null, float? min = null, float? max = null, int? tick = null) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!(entry is ConfigEntry val)) { return null; } if (use_slider && min.HasValue && max.HasValue) { LinearFloatSliderModel val2 = SliderModels.ForFloats(min.Value, max.Value, tick ?? 10); LocalisedString? val3 = name; SliderElement obj = new SliderElement(LocalizedText.op_Implicit(val3.HasValue ? LocalisedString.op_Implicit(val3.GetValueOrDefault()) : ConfigEntryFactoryExtensions.LabelName(entry)), (SliderModel)(object)val2); ConfigEntryFactoryExtensions.SynchronizeWith((SelectableValueElement)(object)obj, val); return (MenuElement)(object)obj; } ParserTextModel val4 = ((entry.Description.AcceptableValues is AcceptableValueRange val5) ? TextModels.ForFloats(val5.MinValue, val5.MaxValue) : TextModels.ForFloats()); TextInput obj2 = new TextInput(LocalizedText.op_Implicit(ConfigEntryFactoryExtensions.LabelName(entry)), (ITextModel)(object)val4, LocalizedText.op_Implicit(ConfigEntryFactoryExtensions.DescriptionLine(entry))); ConfigEntryFactoryExtensions.SynchronizeWith((SelectableValueElement)(object)obj2, val); return (MenuElement)(object)obj2; } private static MenuElement GenerateLocalizedKeyCodeElement(ConfigEntryBase entry, LocalisedString? name = null) { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_003d: Expected O, but got Unknown if (!(entry is ConfigEntry val)) { return null; } LocalisedString? val2 = name; KeyBindElement val3 = new KeyBindElement(LocalizedText.op_Implicit(val2.HasValue ? LocalisedString.op_Implicit(val2.GetValueOrDefault()) : ConfigEntryFactoryExtensions.LabelName(entry))); ConfigEntryFactoryExtensions.SynchronizeWith((SelectableValueElement)val3, val); return (MenuElement)val3; } private static float CalVerticalHeight(VerticalGroup group) { return (float)group.entities.Count * SpacingConstants.VSPACE_MEDIUM; } private static float CalGridHeight(GridGroup group) { return (float)group.Rows * group.VerticalSpacing; } public void Init() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Registry.AddModMenu("KnightInSilksong", new MenuElementGenerator(GenerateMenu)); KnightInSilksong.Instance.self_hormony.PatchAll(typeof(WithModMenu)); } [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static bool MenuElement_ClearGameObjectParent_Prefix(MenuElement __instance) { __instance.Container.transform.SetParent((Transform)null, false); return false; } public void Update() { } private SelectableElement GenerateMenu() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Expected O, but got Unknown //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Expected O, but got Unknown //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Expected O, but got Unknown //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Expected O, but got Unknown //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Expected O, but got Unknown //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Expected O, but got Unknown //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Expected O, but got Unknown new ConfigEntryFactory(); SimpleMenuScreen main_screen = new SimpleMenuScreen("KnightInSilksong"); main_screen.Add(GenerateLocalizedBoolElement((ConfigEntryBase)(object)KnightInSilksong.allowLog, LangKey.MM_ALLOW_LOG.Localize())); main_screen.Add(GenerateLocalizedKeyCodeElement((ConfigEntryBase)(object)KnightInSilksong.toggleButton, LangKey.MM_TOGGLE_BUTTON.Localize())); main_screen.Add(GenerateLocalizedBoolElement((ConfigEntryBase)(object)KnightInSilksong.apply_damage_scaling, LangKey.MM_APPLY_DAMAGE_SCALING.Localize())); main_screen.Add(GenerateLocalizedBoolElement((ConfigEntryBase)(object)KnightInSilksong.default_sync, LangKey.MM_DEFAULT_SYNC.Localize())); main_screen.Add(GenerateLocalizedFloatElement((ConfigEntryBase)(object)KnightInSilksong.knight_scaleX, use_slider: true, LangKey.MM_KNIGHT_SCALE_X.Localize(), 1f, 3f, 11)); main_screen.Add(GenerateLocalizedFloatElement((ConfigEntryBase)(object)KnightInSilksong.knight_scaleY, use_slider: true, LangKey.MM_KNIGHT_SCALE_Y.Localize(), 1f, 3f, 11)); PaginatedMenuScreen slot_screen = new PaginatedMenuScreen(LocalizedText.op_Implicit("KIS-Save")); for (int i = 1; i <= 4; i++) { SlotData sd = new SlotData(i); float scoll_height = 600f; float width = 2200f; FreeGroup val = new FreeGroup(); ScrollContent scrollContent = new ScrollContent(906f, 2400f, (Color?)new Color(0f, 1f, 0f, 0f)); ScrollContent scollList = new ScrollContent(scoll_height, width, (Color?)new Color(0.1f, 0.1f, 0.1f, 0.5f)); val.Add((IMenuEntity)(object)scrollContent, Vector2.zero - SpacingConstants.TOP_CENTER_ANCHOR); scrollContent.Add((IMenuEntity)(object)GenerateLocalizedBoolElement((ConfigEntryBase)(object)sd.sync, LangKey.MM_SYNC.Localize()), (IMenuEntity _) => SpacingConstants.VSPACE_MEDIUM); GridGroup val2 = new GridGroup(5); val2.HorizontalSpacing = SpacingConstants.HSPACE_MEDIUM * 2f / 5f; TextButton reload = new TextButton(LocalizedText.op_Implicit(LangKey.MM_RELOAD.Localize())); EntryLine.SetStableTextSize(reload.ButtonText, 30); TextButton default_button = new TextButton(LocalizedText.op_Implicit(LangKey.MM_DEFAULT.Localize())); EntryLine.SetStableTextSize(default_button.ButtonText, 30); TextButton edit = new TextButton(LocalizedText.op_Implicit(LangKey.MM_EDIT.Localize())); ((MenuElement)edit).State = (ElementState)2; EntryLine.SetStableTextSize(edit.ButtonText, 68); TextButton add = new TextButton(LocalizedText.op_Implicit(LangKey.MM_ADD.Localize())); EntryLine.SetStableTextSize(add.ButtonText, 30); TextButton clear = new TextButton(LocalizedText.op_Implicit(LangKey.MM_CLEAR.Localize())); EntryLine.SetStableTextSize(clear.ButtonText, 30); val2.Add((IMenuEntity)(object)reload); val2.Add((IMenuEntity)(object)default_button); val2.Add((IMenuEntity)(object)edit); val2.Add((IMenuEntity)(object)add); val2.Add((IMenuEntity)(object)clear); scrollContent.Add((IMenuEntity)(object)val2, (IMenuEntity _) => SpacingConstants.VSPACE_MEDIUM); scrollContent.Add((IMenuEntity)(object)scollList, (IMenuEntity _) => scoll_height); TextButton up = new TextButton(LocalizedText.op_Implicit("↑")); TextButton down = new TextButton(LocalizedText.op_Implicit("↓")); TextButton validate = new TextButton(LocalizedText.op_Implicit(LangKey.MM_VALIDATE.Localize())); TextButton val3 = new TextButton(LocalizedText.op_Implicit(LangKey.MM_SAVE.Localize())); TextLabel state = new TextLabel(LocalizedText.op_Implicit(LangKey.MM_STATE.Localize())); ((SelectableElement)up).Interactable = false; ((SelectableElement)down).Interactable = false; List entry_lines = new List(); sd.LoadSyncConfig(); foreach (SyncManager.SyncBaseInfo baseInfo in sd.baseInfos) { EntryLine entryLine = EntryLine.Spawn(scollList, entry_lines, up, down, delegate { UpdateState(SlotConfigState.MODDED); }); entryLine.Init(baseInfo); entryLine.CheckLock(); } reload.OnSubmit = delegate { EntryLine.UnSelectLine(); for (int num = entry_lines.Count; num > 0; num--) { entry_lines[num - 1].Recycle(); } sd.LoadSyncConfig(); foreach (SyncManager.SyncBaseInfo baseInfo2 in sd.baseInfos) { EntryLine entryLine2 = EntryLine.Spawn(scollList, entry_lines, up, down, delegate { UpdateState(SlotConfigState.MODDED); }); entryLine2.Init(baseInfo2); entryLine2.CheckLock(); } UpdateState(SlotConfigState.MODDED); }; default_button.OnSubmit = delegate { EntryLine.UnSelectLine(); for (int num = entry_lines.Count; num > 0; num--) { entry_lines[num - 1].Recycle(); } sd.baseInfos = SyncManager.DefaultConfig(); foreach (SyncManager.SyncBaseInfo baseInfo3 in sd.baseInfos) { EntryLine entryLine2 = EntryLine.Spawn(scollList, entry_lines, up, down, delegate { UpdateState(SlotConfigState.MODDED); }); entryLine2.Init(baseInfo3); entryLine2.CheckLock(); } UpdateState(SlotConfigState.MODDED); }; add.OnSubmit = delegate { EntryLine.UnSelectLine(); EntryLine.Spawn(scollList, entry_lines, up, down, delegate { UpdateState(SlotConfigState.MODDED); }).CheckLock(); UpdateState(SlotConfigState.MODDED); }; clear.OnSubmit = delegate { EntryLine.UnSelectLine(); for (int num = entry_lines.Count; num > 0; num--) { entry_lines[num - 1].Recycle(); } UpdateState(SlotConfigState.MODDED); }; GridGroup val4 = new GridGroup(5); up.OnSubmit = delegate { int index_int = EntryLine.current_editing_entry.index_int; EntryLine entryline = EntryLine.current_editing_entry; entry_lines.Remove(entryline); scollList.Remove((IMenuEntity)(object)entryline.parentgroup); entry_lines.Insert(index_int - 2, entryline); scollList.Insert(index_int - 2, (IMenuEntity)(object)entryline.parentgroup, (IMenuEntity _) => entryline.GetHeight(), (IMenuEntity _) => SpacingConstants.VSPACE_SMALL / 2f); EntryLine.UpdateFrom(scollList, entry_lines, index_int - 2); entryline.CheckLock(); }; down.OnSubmit = delegate { int index_int = EntryLine.current_editing_entry.index_int; EntryLine entryline = EntryLine.current_editing_entry; entry_lines.Remove(entryline); scollList.Remove((IMenuEntity)(object)entryline.parentgroup); entry_lines.Insert(index_int, entryline); scollList.Insert(index_int, (IMenuEntity)(object)entryline.parentgroup, (IMenuEntity _) => entryline.GetHeight(), (IMenuEntity _) => SpacingConstants.VSPACE_SMALL / 2f); EntryLine.UpdateFrom(scollList, entry_lines, index_int - 1); entryline.CheckLock(); }; validate.OnSubmit = delegate { //IL_0054: 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) bool flag = true; foreach (EntryLine item in entry_lines) { flag &= item.Validate(); } if (flag) { ((MenuElement)validate).SetMainColor(Color.green); } else { ((MenuElement)validate).SetMainColor(Color.red); } }; val3.OnSubmit = delegate { bool flag = true; foreach (EntryLine item2 in entry_lines) { flag &= item2.Validate(); } if (flag) { UpdateState(SlotConfigState.OK); sd.baseInfos = new List(); foreach (EntryLine item3 in entry_lines) { sd.baseInfos.Add(item3.SaveToBaseInfo()); } sd.SaveSyncConfig(); } else { UpdateState(SlotConfigState.FAIL); } }; edit.OnSubmit = delegate { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)((MenuElement)edit).State == 1) { UpdateEdit(on: false); } else { UpdateEdit(on: true); } }; val4.HorizontalSpacing = SpacingConstants.HSPACE_MEDIUM * 2f / 5f; val4.Add((IMenuEntity)(object)up); val4.Add((IMenuEntity)(object)down); val4.Add((IMenuEntity)(object)validate); val4.AddAt(0, 3, (IMenuEntity)(object)val3); val4.AddAt(0, 4, (IMenuEntity)(object)state); scrollContent.Add((IMenuEntity)(object)val4); slot_screen.AddPage((INavigableMenuEntity)(object)val); UpdateEdit(on: false); ((AbstractValueModel)(object)slot_screen.pageNumberModel).OnValueChanged += delegate { EntryLine.UnSelectLine(); ((SelectableElement)up).Interactable = false; ((SelectableElement)down).Interactable = false; }; ((AbstractMenuScreen)slot_screen).OnGoBack -= delegate { UpdateEdit(on: false); }; ((AbstractMenuScreen)slot_screen).OnGoBack += delegate { UpdateEdit(on: false); }; void UpdateEdit(bool on) { if (GameManager.instance.IsGameplayScene() && on) { return; } ((MenuElement)edit).State = (ElementState)(on ? 1 : 2); ((SelectableElement)reload).Interactable = on; ((MenuElement)reload).State = (ElementState)((!on) ? 2 : 0); ((SelectableElement)default_button).Interactable = on; ((MenuElement)default_button).State = (ElementState)((!on) ? 2 : 0); ((SelectableElement)add).Interactable = on; ((MenuElement)add).State = (ElementState)((!on) ? 2 : 0); ((SelectableElement)clear).Interactable = on; ((MenuElement)clear).State = (ElementState)((!on) ? 2 : 0); ((SelectableElement)up).Interactable = on; ((MenuElement)up).State = (ElementState)((!on) ? 2 : 0); ((SelectableElement)down).Interactable = on; ((MenuElement)down).State = (ElementState)((!on) ? 2 : 0); EntryLine.UnSelectLine(); foreach (EntryLine item4 in entry_lines) { if (on) { item4.UnFreeze(); } else { item4.Freeze(); } } } void UpdateState(SlotConfigState update_state) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0020: 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_00a2: Unknown result type (might be due to invalid IL or missing references) switch (update_state) { case SlotConfigState.FAIL: state.Text.text = LocalisedString.op_Implicit(LangKey.MM_FAIL.Localize()); ((MenuElement)state).State = (ElementState)3; ((MenuElement)validate).SetMainColor(Color.red); break; case SlotConfigState.OK: state.Text.text = LocalisedString.op_Implicit(LangKey.MM_OK.Localize()); ((MenuElement)state).State = (ElementState)0; ((MenuElement)validate).SetMainColor(Color.green); ((MenuElement)state).SetMainColor(Color.green); break; case SlotConfigState.MODDED: state.Text.text = LocalisedString.op_Implicit(LangKey.MM_MODDED.Localize()); ((MenuElement)validate).MaybeApplyDefaultColors(); ((MenuElement)state).State = (ElementState)1; break; } } } TextButton val5 = new TextButton(LocalizedText.op_Implicit(LangKey.MM_SAVE_OPTIONS.Localize())) { OnSubmit = delegate { MenuScreenNavigation.Show((AbstractMenuScreen)(object)slot_screen, (HistoryMode)0); } }; main_screen.Add((MenuElement)(object)val5); TextButton val6 = new TextButton(LocalizedText.op_Implicit("KnightInSilksong")); val6.OnSubmit = (Action)Delegate.Combine(val6.OnSubmit, (Action)delegate { MenuScreenNavigation.Show((AbstractMenuScreen)(object)main_screen, (HistoryMode)0); }); return (SelectableElement)val6; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }