Decompiled source of DebugMod v1.8.0
DebugModPlus.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Com.LuisPedroFonseca.ProCamera2D; using Cysharp.Threading.Tasks; using DebugModPlus; using DebugModPlus.Modules; using DebugModPlus.Modules.Hitbox; using DebugModPlus.Savestates; using HarmonyLib; using I2.Loc; using InputExtension; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using MonsterLove.StateMachine; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using NineSolsAPI; using NineSolsAPI.Utils; using QFSW.QC; using RCGFSM.Animation; using RCGFSM.GameObjects; using RCGFSM.StateEvents; using RCGFSM.Transition; using RCGFSM.Variable; using RCGMaker.Core; using TAS; using TMPro; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.Tilemaps; using UnityEngine.UI; using mixpanel; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DebugModPlus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Advanced Debug Mod for Nine Sols")] [assembly: AssemblyFileVersion("1.8.0.0")] [assembly: AssemblyInformationalVersion("1.8.0+80d64b8bc479daff1f9a7db287545a5787276736")] [assembly: AssemblyProduct("DebugModPlus")] [assembly: AssemblyTitle("DebugModPlus")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.8.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TAS { public static class GameInfo { public static string GetInfoText(bool includeRapidlyChanging = false) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0349: 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_0381: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) string text = ""; if (!SingletonBehaviour<ApplicationCore>.IsAvailable()) { return "Loading"; } if (!SingletonBehaviour<GameCore>.IsAvailable()) { text += "MainMenu\n"; return text + ((object)(PlayerInputStateType)(ref SingletonBehaviour<PlayerInputBinder>.Instance.currentStateType)).ToString(); } GameCore instance = SingletonBehaviour<GameCore>.Instance; if ((int)instance.currentCoreState != 1) { string enumName = typeof(GameCoreState).GetEnumName(instance.currentCoreState); text = text + enumName + "\n"; } Player player = instance.player; if (Object.op_Implicit((Object)(object)player)) { text += $"Pos: {Vector2.op_Implicit(((Component)player).transform.position)}\n"; text += $"Speed: {((Actor)player).FinalVelocity}\n"; text += $"HP: {player.health.CurrentHealthValue:0.00} (+{player.health.CurrentInternalInjury:0.00})\n"; string enumName2 = typeof(PlayerStateType).GetEnumName(player.fsm.State); PlayerInputStateType state = player.playerInput.fsm.State; text = text + "State: " + enumName2 + " " + (((int)state == 0) ? "" : ((object)(PlayerInputStateType)(ref state)).ToString()) + "\n"; List<(bool, string)> source = new List<(bool, string)>(8) { (player.isOnWall, "Wall"), (player.isOnLedge, "Ledge"), (player.isOnRope, "Rope"), (player.kicked, "Kicked"), (((Actor)player).onGround, "OnGround"), (Object.op_Implicit((Object)(object)player.interactableFinder.CurrentInteractableArea), "CanInteract"), (player.rollCooldownTimer <= 0f, "CanDash"), (player.airJumpCount > 0, "AirJumping") }; List<(float, string)> source2 = new List<(float, string)>(2) { (player.rollCooldownTimer, "DashCD"), (player.jumpGraceTimer, "Coyote") }; string text2 = GeneralExtensions.Join<(bool, string)>(source.Where(((bool, string) x) => x.Item1), (Func<(bool, string), string>)(((bool, string) x) => x.Item2), " "); string text3 = GeneralExtensions.Join<(float, string)>(source2.Where(((float, string) x) => x.Item1 > 0f), (Func<(float, string), string>)(((float, string) x) => $"{x.Item2}({x.Item1:0.000})"), " "); text = text + text2 + "\n" + text3 + "\n"; if ((int)player.jumpState != 0) { float currentVarJumpTimer = player.currentVarJumpTimer; float num = ReflectionUtils.AccessField<float>((object)player, "GroundJumpRefrenceY"); float num2 = ((Component)player).transform.position.y - num; text += string.Format("JumpState {0} {1}h={2}\n", player.jumpState, (currentVarJumpTimer > 0f) ? (currentVarJumpTimer.ToString("0.00") + " ") : "", num2); } else { text += "\n"; } AnimatorStateInfo currentAnimatorStateInfo = ((Actor)player).animator.GetCurrentAnimatorStateInfo(0); string text4 = ((Actor)player).animator.ResolveHash(currentAnimatorStateInfo.m_Name); text = text + "Animation " + text4; if (includeRapidlyChanging) { text += $" {((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime % 1f * 100f:00.0}%"; } text += "\n"; } GameLevel gameLevel = instance.gameLevel; if (Object.op_Implicit((Object)(object)gameLevel)) { text += $"[{gameLevel.SceneName}] ({gameLevel.BlockCountX}x{gameLevel.BlockCountY})"; if (includeRapidlyChanging) { text += $" dt={Time.deltaTime:0.00000000}\n"; } text += "\n"; } if (Object.op_Implicit((Object)(object)instance.currentCutScene)) { text += $"{instance.currentCutScene}"; } return text; } } } namespace System.Runtime.CompilerServices { internal static class IsExternalInit { } public class RequiredMemberAttribute : Attribute { } public class CompilerFeatureRequiredAttribute : Attribute { public CompilerFeatureRequiredAttribute(string name) { } } } namespace DebugModPlus { [AttributeUsage(AttributeTargets.Method, Inherited = false)] [MeansImplicitUse] public class BindableMethod : Attribute { public string? Name; public KeyCode[]? DefaultKeybind; } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("DebugModPlus", "DebugModPlus", "1.8.0")] public class DebugModPlus : BaseUnityPlugin { public static DebugModPlus Instance; private DebugUI debugUI; private QuantumConsoleModule quantumConsoleModule = new QuantumConsoleModule(); private Harmony harmony; private InfotextModule infotextModule = new InfotextModule(); public HitboxModule HitboxModule; public SavestateModule SavestateModule; public SpeedrunTimerModule SpeedrunTimerModule; private FsmInspectorModule fsmInspectorModule = new FsmInspectorModule(); public GhostModule GhostModule; private ConfigEntry<KeyboardShortcut> configShortcutFsmPickerModifier; private Dictionary<KeyboardShortcut, string> configSavestateShortcutsCreate; private Dictionary<KeyboardShortcut, string> configSavestateShortcutsLoad; internal ConfigEntry<HitboxType> HitboxFilter; private bool initializedSuccessfully; internal static bool JustGainedFocus; private void HandleLog(string logString, string stackTrace, LogType type) { ToastManager.Toast((object)logString); } private void Awake() { //IL_00b6: 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) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); Log.Info("Plugin DebugModPlus started loading..."); try { harmony = Harmony.CreateAndPatchAll(typeof(DebugModPlus).Assembly, (string)null); Type type = GameVersions.Select<Type>("d4c12f4d7e8442e79988244014fb92d2", typeof(PatchesSpeedrunPatch), typeof(PatchesCurrentPatch)); harmony.PatchAll(type); Log.Info($"Patched {harmony.GetPatchedMethods().Count()} methods..."); ConfigEntry<TimerMode> configTimerMode = ((BaseUnityPlugin)this).Config.Bind<TimerMode>("SpeedrunTimer", "Timer Mode", TimerMode.Triggers, (ConfigDescription)null); ConfigEntry<KeyboardShortcut> changeModeShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer Shortcuts", "Cycle Timer Mode", default(KeyboardShortcut), (ConfigDescription)null); ConfigEntry<KeyboardShortcut> resetTimerShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer Shortcuts", "Reset Timer", default(KeyboardShortcut), (ConfigDescription)null); ConfigEntry<KeyboardShortcut> pauseTimerShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer Shortcuts", "Pause Timer", default(KeyboardShortcut), (ConfigDescription)null); ConfigEntry<KeyboardShortcut> setStartpointShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer Shortcuts", "Set Startpoint", default(KeyboardShortcut), (ConfigDescription)null); ConfigEntry<KeyboardShortcut> setEndpointShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer Shortcuts", "Set Endpoint", default(KeyboardShortcut), (ConfigDescription)null); ConfigEntry<KeyboardShortcut> clearCheckpointsShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer Shortcuts", "Clear Checkpoints", default(KeyboardShortcut), (ConfigDescription)null); configShortcutFsmPickerModifier = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Shortcuts", "FSM Picker Modifier", default(KeyboardShortcut), new ConfigDescription("When this key is pressed and you click on a sprite, it will try to open the FSM inspector for that object", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<bool> configRecordGhost = ((BaseUnityPlugin)this).Config.Bind<bool>("SpeedrunTimer", "Record Ghost", false, (ConfigDescription)null); ConfigEntry<Color> ghostColor = ((BaseUnityPlugin)this).Config.Bind<Color>("SpeedrunTimer", "PB Ghost Color", new Color(1f, 0.8f, 0f, 0.5f), (ConfigDescription)null); ConfigEntry<bool> configPauseStopsTimer = ((BaseUnityPlugin)this).Config.Bind<bool>("SpeedrunTimer", "Pause Timer Stops Speedrun Timer", false, (ConfigDescription)null); ConfigEntry<SavestateFilter> currentFilter = ((BaseUnityPlugin)this).Config.Bind<SavestateFilter>("Savestates", "Savestate filter", SavestateFilter.Flags | SavestateFilter.Player, (ConfigDescription)null); HitboxFilter = ((BaseUnityPlugin)this).Config.Bind<HitboxType>("The rest", "Hitbox Filter", HitboxType.Default, (ConfigDescription)null); HitboxFilter.SettingChanged += delegate { HitboxModule.HitboxesVisible = true; }; configSavestateShortcutsCreate = new Dictionary<KeyboardShortcut, string>(); configSavestateShortcutsLoad = new Dictionary<KeyboardShortcut, string>(); SavestateModule = new SavestateModule(currentFilter, ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestates", "Save", new KeyboardShortcut((KeyCode)270, Array.Empty<KeyCode>()), (ConfigDescription)null), ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestates", "Load", new KeyboardShortcut((KeyCode)271, Array.Empty<KeyCode>()), (ConfigDescription)null), ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestates", "Delete", new KeyboardShortcut((KeyCode)269, Array.Empty<KeyCode>()), (ConfigDescription)null), ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestates", "Page next", new KeyboardShortcut((KeyCode)275, Array.Empty<KeyCode>()), (ConfigDescription)null), ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Savestates", "Page prev", new KeyboardShortcut((KeyCode)276, Array.Empty<KeyCode>()), (ConfigDescription)null)); SpeedrunTimerModule = new SpeedrunTimerModule(configTimerMode, configRecordGhost, configPauseStopsTimer); GhostModule = new GhostModule(ghostColor); SavestateModule.SavestateLoaded += delegate { SpeedrunTimerModule.OnSavestateLoaded(); }; SavestateModule.SavestateCreated += delegate { SpeedrunTimerModule.OnSavestateCreated(); }; HitboxModule = new GameObject().AddComponent<HitboxModule>(); KeybindManager.Add((MonoBehaviour)(object)this, (Action)quantumConsoleModule.ToggleConsole, (KeyCode[])(object)new KeyCode[2] { (KeyCode)306, (KeyCode)46 }); KeybindManager.Add((MonoBehaviour)(object)this, (Action)ToggleSettings, (KeyCode[])(object)new KeyCode[2] { (KeyCode)306, (KeyCode)44 }); KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate { SpeedrunTimerModule.CycleTimerMode(); }, (Func<KeyboardShortcut>)(() => changeModeShortcut.Value)); KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate { SpeedrunTimerModule.ResetTimerUser(); }, (Func<KeyboardShortcut>)(() => resetTimerShortcut.Value)); KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate { SpeedrunTimerModule.PauseTimer(); }, (Func<KeyboardShortcut>)(() => pauseTimerShortcut.Value)); KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate { SpeedrunTimerModule.SetStartpoint(); }, (Func<KeyboardShortcut>)(() => setStartpointShortcut.Value)); KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate { SpeedrunTimerModule.SetEndpoint(); }, (Func<KeyboardShortcut>)(() => setEndpointShortcut.Value)); KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate { SpeedrunTimerModule.ClearCheckpoints(); }, (Func<KeyboardShortcut>)(() => clearCheckpointsShortcut.Value)); debugUI = ((Component)this).gameObject.AddComponent<DebugUI>(); debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(FreecamModule)); debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(TimeModule)); debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(InfotextModule)); debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(HitboxModule)); debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(SavestateModule)); debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(CheatModule)); FlagLoggerModule.Awake(); RCGLifeCycle.DontDestroyForever(((Component)this).gameObject); RCGLifeCycle.DontDestroyForever(((Component)HitboxModule).gameObject); Log.Info("Plugin DebugModPlus is loaded!"); initializedSuccessfully = true; } catch (Exception data) { Log.Error(data); } } private void ToggleSettings() { debugUI.settingsOpen = !debugUI.settingsOpen; _ = Player.i; } private void OnApplicationFocus(bool hasFocus) { JustGainedFocus |= hasFocus; } private void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Invalid comparison between Unknown and I4 //IL_00ac: 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_0135: Unknown result type (might be due to invalid IL or missing references) if (!initializedSuccessfully) { return; } FreecamModule.Update(); MapTeleportModule.Update(); infotextModule.Update(); SavestateModule.Update(); bool flag = false; foreach (KeyValuePair<KeyboardShortcut, string> item in configSavestateShortcutsCreate) { if (KeybindManager.CheckShortcutOnly(item.Key)) { SavestateModule.CreateSavestate(item.Value); flag = true; } } if (!flag) { foreach (KeyValuePair<KeyboardShortcut, string> item2 in configSavestateShortcutsLoad) { if (KeybindManager.CheckShortcutOnly(item2.Key)) { SavestateModule.LoadSavestateAt(item2.Value); } } } Player i = Player.i; PlayerInputStateType? val = ((i != null) ? new PlayerInputStateType?(i.playerInput.fsm.State) : null); if (!val.HasValue || (int)val.GetValueOrDefault() != 1) { KeyboardShortcut value = configShortcutFsmPickerModifier.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { Cursor.visible = true; if (Input.GetMouseButtonDown(0)) { TryPickFsm(); } } } JustGainedFocus = false; } private void TryPickFsm() { //IL_0021: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005e: Unknown result type (might be due to invalid IL or missing references) fsmInspectorModule.Objects.Clear(); try { Camera theRealSceneCamera = SingletonBehaviour<CameraManager>.Instance.cameraCore.theRealSceneCamera; Vector3 worldPosition = theRealSceneCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0f - ((Component)theRealSceneCamera).transform.position.z)); worldPosition.z = 0f; GameObject val = (from x in ((IEnumerable<GameObject>)PickVisible(worldPosition)).Select((Func<GameObject, GameObject>)delegate(GameObject sprite) { StateMachineOwner componentInParent = sprite.GetComponentInParent<StateMachineOwner>(); object obj = ((componentInParent != null) ? ((Component)componentInParent).gameObject : null); if (obj == null) { FSMStateMachineRunner componentInParent2 = sprite.GetComponentInParent<FSMStateMachineRunner>(); if (componentInParent2 == null) { return null; } obj = ((Component)componentInParent2).gameObject; } return (GameObject)obj; }) where Object.op_Implicit((Object)(object)x) select x).Distinct().FirstOrDefault(); if (Object.op_Implicit((Object)(object)val)) { fsmInspectorModule.Objects.Add(val); } else { ToastManager.Toast((object)"No state machine found at cursor"); } } catch (Exception ex) { ToastManager.Toast((object)ex); } } private List<GameObject> PickVisible(Vector3 worldPosition) { //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) return (from x in (from t in (from renderer in Object.FindObjectsOfType<SpriteRenderer>() select (((Component)renderer).gameObject, ((Renderer)renderer).bounds)).Concat(from renderer in Object.FindObjectsOfType<ParticleSystemRenderer>() select (((Component)renderer).gameObject, ((Renderer)renderer).bounds)) where ((Bounds)(ref t.bounds)).Contains(worldPosition) select t).Where<(GameObject, Bounds)>(delegate((GameObject gameObject, Bounds bounds) t) { string text = ((Object)t.gameObject.gameObject).name.ToLower(); Transform parent = t.gameObject.gameObject.transform.parent; string text2 = ((parent != null) ? ((Object)parent).name : null) ?? ""; return !text.Contains("light") && !text.Contains("fade") && !text.Contains("glow") && !text.Contains("attack") && !text2.Contains("Vibe") && !text2.Contains("Skin"); }) select x.gameObject).ToList(); } private void LateUpdate() { if (!initializedSuccessfully) { return; } try { GhostModule.LateUpdate(); SpeedrunTimerModule.LateUpdate(); } catch (Exception data) { Log.Error(data); } } private void OnGUI() { if (!initializedSuccessfully) { return; } try { SpeedrunTimerModule.OnGui(); } catch (Exception arg) { Log.Error($"Error in SpeedrunTimerModule: {arg}"); } try { fsmInspectorModule.OnGui(); } catch (Exception arg2) { Log.Error($"Error in fsm inspector module: {arg2}"); } try { SavestateModule.OnGui(); } catch (Exception arg3) { Log.Error($"Error in SavestateModule: {arg3}"); } } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Application.logMessageReceived -= new LogCallback(HandleLog); harmony.UnpatchSelf(); GhostModule.Unload(); SpeedrunTimerModule.Destroy(); infotextModule.Destroy(); if (Object.op_Implicit((Object)(object)((Component)HitboxModule).gameObject)) { Object.Destroy((Object)(object)((Component)HitboxModule).gameObject); } Log.Info("Plugin DebugModPlus unloaded\n\n"); } } [PublicAPI] public class DebugSave { public const int DebugSaveIndex = 100; public static void LoadDebugSave() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) SingletonBehaviour<SaveManager>.Instance.LoadSaveAtSlot(100); SingletonBehaviour<ApplicationUIGroupManager>.Instance.ClearAll(); RuntimeInitHandler.LoadCore(); if (!GameVersions.IsVersion("d4c12f4d7e8442e79988244014fb92d2")) { typeof(GameConfig).GetMethod("InstantiateGameCore").Invoke(ScriptableObjectSingleton<GameConfig>.Instance, Array.Empty<object>()); } } } internal class DebugActionToggle { public bool Value; public required Action<bool> OnChange; } internal class DebugAction { public required Action OnChange; } public class DebugUI : MonoBehaviour { public bool settingsOpen; private GUIStyle? styleButton; private GUIStyle? styleToggle; private Dictionary<string, DebugActionToggle> toggles = new Dictionary<string, DebugActionToggle>(); private Dictionary<string, DebugAction> actions = new Dictionary<string, DebugAction>(); private void Awake() { toggles.Clear(); } public void AddBindableMethods(ConfigFile config, Type ty) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) MethodInfo[] methods = ty.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { BindableMethod customAttribute = methodInfo.GetCustomAttribute<BindableMethod>(); if (customAttribute != null) { string text = customAttribute.Name ?? methodInfo.Name; Action action = (Action)Delegate.CreateDelegate(typeof(Action), methodInfo); string text2 = new string(Array.FindAll(text.ToCharArray(), char.IsLetterOrDigit)); ConfigEntry<KeyboardShortcut> keyboardShortcut = config.Bind<KeyboardShortcut>("Shortcuts", text2, (customAttribute.DefaultKeybind != null) ? new KeyboardShortcut(customAttribute.DefaultKeybind[^1], customAttribute.DefaultKeybind[..^1]) : default(KeyboardShortcut), (ConfigDescription)null); actions.Add(text, new DebugAction { OnChange = action }); KeybindManager.Add((MonoBehaviour)(object)this, action, (Func<KeyboardShortcut>)(() => keyboardShortcut.Value)); } } } public void AddToggle(string actionName, Action<bool> onChange, bool defaultValue = false) { toggles.Add(actionName, new DebugActionToggle { Value = defaultValue, OnChange = onChange }); } private void OnGUI() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) //IL_0041: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if (!settingsOpen) { return; } RCGInput.SetCursorVisible(true); if (styleButton == null) { styleButton = new GUIStyle(GUI.skin.box) { alignment = (TextAnchor)5, padding = new RectOffset(20, 20, 20, 20), fontSize = 20 }; } if (styleToggle == null) { styleToggle = new GUIStyle(GUI.skin.toggle) { fontSize = 20 }; } GUILayout.BeginArea(new Rect(20f, 20f, (float)(Screen.width - 40), (float)(Screen.height - 40))); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); string key; foreach (KeyValuePair<string, DebugActionToggle> toggle in toggles) { toggle.Deconstruct(out key, out var value); string arg = key; DebugActionToggle debugActionToggle = value; if (GUILayout.Button($"{arg}: {debugActionToggle.Value}", styleButton, Array.Empty<GUILayoutOption>())) { debugActionToggle.Value = !debugActionToggle.Value; debugActionToggle.OnChange(debugActionToggle.Value); ToastManager.Toast((object)$"change {arg} to {debugActionToggle.Value}"); } } foreach (KeyValuePair<string, DebugAction> action in actions) { action.Deconstruct(out key, out var value2); object obj = key; DebugAction debugAction = value2; if (obj == null) { obj = ""; } if (GUILayout.Button((string)obj, styleButton, Array.Empty<GUILayoutOption>())) { debugAction.OnChange(); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndArea(); } } [HarmonyPatch] public class FastLoads { public static bool Enabled { get { if (!FreecamModule.FreecamActive) { return SavestateModule.IsLoadingSavestate; } return true; } } [HarmonyPatch(typeof(GameCore), "FadeOutBlack")] [HarmonyPrefix] private static void FadeOutBlack(ref float fadeTime, ref float delayTime) { if (Enabled) { fadeTime = 0f; delayTime = 0f; } } [HarmonyPatch(typeof(UIExtension), "AddUITask")] [HarmonyPrefix] private static void AddUiTask(MonoBehaviour mb, Action action, ref float delay) { if (Enabled) { delay = 0f; } } } internal static class Log { private static ManualLogSource logSource; internal static void Init(ManualLogSource logSource) { Log.logSource = logSource; } internal static void Debug(object data) { logSource.LogDebug(data); } internal static void Error(object data) { logSource.LogError(data); } internal static void Fatal(object data) { logSource.LogFatal(data); } internal static void Info(object data) { logSource.LogInfo(data); } internal static void Message(object data) { logSource.LogMessage(data); } internal static void Warning(object data) { logSource.LogWarning(data); } } public static class PatchesSpeedrunPatch { [HarmonyPatch(typeof(GameCore), "FadeToBlack")] [HarmonyPrefix] private static void FadeToBlack(ref float fadeTime) { if (FastLoads.Enabled) { fadeTime = 0f; } } [HarmonyPatch(typeof(GameCore), "ChangeScene", new Type[] { typeof(ChangeSceneData), typeof(bool), typeof(bool) })] [HarmonyPrefix] private static void ChangeScene(ref ChangeSceneData changeSceneData, ref bool showTip, bool captureLastImage) { DebugModPlus.Instance.SpeedrunTimerModule.OnLevelChange(); if (FastLoads.Enabled) { showTip = false; } } } public static class PatchesCurrentPatch { [HarmonyPatch(typeof(GameCore), "FadeToBlack", new Type[] { typeof(float), typeof(float) })] [HarmonyPatch(typeof(GameCore), "FadeToBlack", new Type[] { typeof(float), typeof(UnityAction), typeof(float) })] [HarmonyPrefix] private static void FadeToBlack(ref float fadeTime) { if (FastLoads.Enabled) { fadeTime = 0f; } } [HarmonyPatch(typeof(GameCore), "ChangeScene", new Type[] { typeof(ChangeSceneData), typeof(bool), typeof(bool), typeof(float) })] [HarmonyPrefix] private static void ChangeScene(ref ChangeSceneData changeSceneData, ref bool showTip, bool captureLastImage, ref float delayTime) { DebugModPlus.Instance.SpeedrunTimerModule.OnLevelChange(); if (FastLoads.Enabled) { delayTime = 0f; showTip = false; } } } public class AnimatorSnapshot { public required int StateHash; public required float NormalizedTime; public required Dictionary<int, float> ParamsFloat; public required Dictionary<int, int> ParamsInt; public required Dictionary<int, bool> ParamsBool; public static AnimatorSnapshot Snapshot(Animator animator) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003a: 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_0053: Expected I4, but got Unknown //IL_00b6: 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_0057: Invalid comparison between Unknown and I4 AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); AnimatorControllerParameter[] parameters = animator.parameters; Dictionary<int, float> dictionary = new Dictionary<int, float>(); Dictionary<int, bool> dictionary2 = new Dictionary<int, bool>(); Dictionary<int, int> dictionary3 = new Dictionary<int, int>(); AnimatorControllerParameter[] array = parameters; foreach (AnimatorControllerParameter val in array) { AnimatorControllerParameterType type = val.type; switch (type - 1) { default: if ((int)type == 9) { continue; } break; case 0: dictionary[val.nameHash] = animator.GetFloat(val.nameHash); continue; case 3: dictionary2[val.nameHash] = animator.GetBool(val.nameHash); continue; case 2: dictionary3[val.nameHash] = animator.GetInteger(val.nameHash); continue; case 1: break; } ToastManager.Toast((object)$"Unsnapshotted param {val.type}"); } return new AnimatorSnapshot { StateHash = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash, NormalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime, ParamsFloat = dictionary, ParamsInt = dictionary3, ParamsBool = dictionary2 }; } public void Restore(Animator animator) { if ((Object)(object)animator == (Object)null) { return; } animator.Play(StateHash, 0, NormalizedTime); foreach (KeyValuePair<int, float> item in ParamsFloat) { animator.SetFloat(item.Key, item.Value); } foreach (KeyValuePair<int, int> item2 in ParamsInt) { animator.SetInteger(item2.Key, item2.Value); } foreach (KeyValuePair<int, bool> item3 in ParamsBool) { animator.SetBool(item3.Key, item3.Value); } } } public class Savestate { public string? Scene; public Vector3? PlayerPosition; public string? LastTeleportId; public List<MonoBehaviourSnapshot>? MonobehaviourSnapshots; public List<MonsterLoveFsmSnapshot>? FsmSnapshots; public List<GeneralFsmSnapshot>? GeneralFsmSnapshots; public List<ReferenceFixups>? ReferenceFixups; public JObject? Flags; private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings { Formatting = (Formatting)1, Converters = new List<JsonConverter>(1) { (JsonConverter)(object)new Vector3Converter() } }; public void SerializeTo(StreamWriter writer) { JsonSerializer.Create(jsonSettings).Serialize((TextWriter)writer, (object)this); } public static Savestate DeserializeFrom(StreamReader reader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown JsonTextReader val = new JsonTextReader((TextReader)reader); return JsonSerializer.Create(jsonSettings).Deserialize<Savestate>((JsonReader)(object)val) ?? throw new Exception("Failed to deserialize savestate"); } public string Serialize() { return JsonConvert.SerializeObject((object)this, (Formatting)1); } public static Savestate Deserialize(string data) { return JsonConvert.DeserializeObject<Savestate>(data) ?? throw new Exception("Failed to deserialize savestate"); } } public class MonoBehaviourSnapshot { public required string Path; public required JToken Data; public static MonoBehaviourSnapshot Of(Component mb) { return new MonoBehaviourSnapshot { Path = ObjectUtils.ObjectComponentPath(mb), Data = SnapshotSerializer.Snapshot(mb) }; } } public class GeneralFsmSnapshot { public required string Path; public required string CurrentState; public static GeneralFsmSnapshot Of(StateMachineOwner owner) { return new GeneralFsmSnapshot { Path = ObjectUtils.ObjectPath(((Component)owner).gameObject), CurrentState = ((Object)((StateMachineContext<GeneralState, GeneralState>)(object)owner.FsmContext).fsm.State).name }; } } public class MonsterLoveFsmSnapshot { public required string Path; public required object CurrentState; public static MonsterLoveFsmSnapshot Of(IStateMachine machine) { return new MonsterLoveFsmSnapshot { Path = ObjectUtils.ObjectPath(((Component)machine.Component).gameObject), CurrentState = machine.CurrentStateMap.stateObj }; } } public record ReferenceFixupField(string Field, string? Reference); public class ReferenceFixups { public required string Path; public required List<ReferenceFixupField> Fields; public static ReferenceFixups Of(MonoBehaviour mb, List<ReferenceFixupField> fixups) { return new ReferenceFixups { Path = ObjectUtils.ObjectComponentPath((Component)(object)mb), Fields = fixups }; } } public static class SnapshotSerializer { private static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)0, Error = delegate(object _, ErrorEventArgs args) { args.ErrorContext.Handled = true; Log.Error($"Serialization error while creating snapshot: {args.CurrentObject?.GetType()}: {args.ErrorContext.Path}: {args.ErrorContext.Error.Message}"); }, ContractResolver = (IContractResolver)(object)new <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__SnapshotStateResolver(), Converters = new List<JsonConverter> { (JsonConverter)(object)new <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__TransformConverter(), (JsonConverter)(object)new Vector2Converter(), (JsonConverter)(object)new Vector3Converter(), (JsonConverter)(object)new <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__Vector4Converter(), (JsonConverter)(object)new <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__QuatConverter(), (JsonConverter)(object)new <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__AnimatorConverter() } }; private static readonly JsonSerializer Serializer = JsonSerializer.Create(Settings); public static JToken Snapshot(object obj) { return JToken.FromObject(obj, JsonSerializer.Create(Settings)); } public static string SnapshotToString(object? obj) { return JsonConvert.SerializeObject(obj, (Formatting)1, Settings); } public static void Populate(object target, string json) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown JsonReader val = (JsonReader)new JsonTextReader((TextReader)new StringReader(json)); try { JsonSerializer.Create(Settings).Populate(val, target); } finally { ((IDisposable)val)?.Dispose(); } } public static void Populate(object target, JToken json) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown JsonSerializer val = JsonSerializer.Create(Settings); JsonReader val2 = (JsonReader)new JTokenReader(json); try { val.Populate(val2, target); } finally { ((IDisposable)val2)?.Dispose(); } } } internal class <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__SnapshotStateResolver : DefaultContractResolver { private readonly Type[] containerTypesToIgnore = new Type[3] { typeof(MonoBehaviour), typeof(Component), typeof(Object) }; private readonly Type[] fieldTypesToIgnore = new Type[41] { typeof(PoolObject), typeof(MonoBehaviour), typeof(GameObject), typeof(UnityEventBase), typeof(Action), typeof(Delegate), typeof(FxPlayer), typeof(StateEvents), typeof(IEffectOwner), typeof(PositionConstraint), typeof(PathArea), typeof(IEffectHitHandler), typeof(ICooldownEffectReceiver), typeof(PathToAreaFinder), typeof(Value), typeof(Sprite), typeof(Tilemap), typeof(LineRenderer), typeof(Color), typeof(VelocityModifierParam), typeof(ParticleSystem), typeof(RopeSegment), typeof(AnimationCurve), typeof(IActiveOverrider), typeof(CullingObserver), typeof(Rect), typeof(DelayTask), typeof(Rigidbody2D), typeof(Transform), typeof(SpriteRenderer), typeof(LayerMask), typeof(Collider2D), typeof(AbilityWrapper), typeof(EffectHitData), typeof(IStateMachine), typeof(RuntimeConditionVote), typeof(ScriptableObject), typeof(StatData), typeof(CharacterStat), typeof(StatModifier), typeof(MapTileData) }; private Type? declaredOnly; protected override List<MemberInfo> GetSerializableMembers(Type objectType) { Type type = declaredOnly; Type obj = (((object)type != null && type.IsAssignableFrom(objectType)) ? type : objectType); BindingFlags bindingFlags = ((declaredOnly != null) ? BindingFlags.DeclaredOnly : BindingFlags.Default); IEnumerable<MemberInfo> first = obj.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | bindingFlags).Cast<MemberInfo>(); IEnumerable<MemberInfo> second = (from x in obj.GetProperties(BindingFlags.Instance | BindingFlags.Public | bindingFlags) where x.CanWrite && x.CanRead select x).Cast<MemberInfo>(); return first.Concat(second).ToList(); } private bool IgnorePropertyType(Type? type) { Type type2 = type; return Array.Exists(fieldTypesToIgnore, (Type x) => x.IsAssignableFrom(type2)); } protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) JsonProperty val = ((DefaultContractResolver)this).CreateProperty(member, memberSerialization); val.Readable = true; val.Writable = true; val.Ignored = false; bool shouldSerialize = true; Type propertyType = val.PropertyType; if (propertyType == null) { return val; } shouldSerialize &= !IgnorePropertyType(propertyType); if (propertyType.IsArray) { shouldSerialize &= !IgnorePropertyType(propertyType.GetElementType()); } if (propertyType.IsGenericType) { if (propertyType.GetGenericTypeDefinition() == typeof(List<>)) { shouldSerialize &= !IgnorePropertyType(propertyType.GetGenericArguments()[0]); val.ObjectCreationHandling = (ObjectCreationHandling)2; } if (propertyType.GetGenericTypeDefinition() == typeof(Dictionary<, >)) { Type[] genericArguments = propertyType.GetGenericArguments(); shouldSerialize &= genericArguments[0].IsPrimitive || genericArguments[0] == typeof(string); shouldSerialize &= !IgnorePropertyType(propertyType.GetGenericArguments()[1]); } if (propertyType.GetGenericTypeDefinition() == typeof(HashSet<>)) { shouldSerialize &= !IgnorePropertyType(propertyType.GetGenericArguments()[0]); } } if (containerTypesToIgnore.Contains<Type>(member.DeclaringType)) { shouldSerialize = false; } val.ShouldSerialize = (object _) => shouldSerialize; return val; } } internal class <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__AnimatorConverter : NullableJsonConverter<Animator> { public override void WriteJson(JsonWriter writer, Animator? value, JsonSerializer serializer) { if ((Object)(object)value == (Object)null) { writer.WriteNull(); return; } AnimatorSnapshot animatorSnapshot = AnimatorSnapshot.Snapshot(value); serializer.Serialize(writer, (object)animatorSnapshot); } public override Animator? ReadJson(JsonReader reader, Type objectType, Animator? existingValue, bool hasExistingValue, JsonSerializer serializer) { if (!hasExistingValue) { Log.Error("Cannot deserialize animator without existing instance"); return null; } if ((Object)(object)existingValue == (Object)null) { Log.Error("Cannot deserialize animator with null existing value"); return null; } serializer.Deserialize<AnimatorSnapshot>(reader).Restore(existingValue); return existingValue; } } internal class <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__TransformConverter : NullableJsonConverter<Transform> { private record TransformMirror(Vector3 position, Quaternion rotation, Vector3 scale) { [CompilerGenerated] protected virtual bool PrintMembers(StringBuilder builder) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("position = "); Vector3 val = position; builder.Append(((object)(Vector3)(ref val)).ToString()); builder.Append(", rotation = "); Quaternion val2 = rotation; builder.Append(((object)(Quaternion)(ref val2)).ToString()); builder.Append(", scale = "); val = scale; builder.Append(((object)(Vector3)(ref val)).ToString()); return true; } } public override void WriteJson(JsonWriter writer, Transform? value, JsonSerializer serializer) { //IL_0024: 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_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)value == (Object)null) { writer.WriteNull(); return; } writer.WriteStartObject(); writer.WritePropertyName("position"); serializer.Serialize(writer, (object)value.localPosition); writer.WritePropertyName("rotation"); serializer.Serialize(writer, (object)value.localRotation); writer.WritePropertyName("localScale"); serializer.Serialize(writer, (object)value.localScale); writer.WriteEndObject(); } public override Transform? ReadJson(JsonReader reader, Type objectType, Transform? existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0057: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!hasExistingValue) { Log.Error("Cannot deserialize transform without existing instance"); return null; } if ((Object)(object)existingValue == (Object)null) { Log.Error("Cannot deserialize transform with null existing value"); return null; } TransformMirror transformMirror = serializer.Deserialize<TransformMirror>(reader); if (transformMirror == null) { throw new Exception("Could not deserialize transform"); } if (existingValue.localPosition != transformMirror.position) { existingValue.localPosition = transformMirror.position; } if (existingValue.localRotation != transformMirror.rotation) { existingValue.rotation = transformMirror.rotation; } if (existingValue.localScale != transformMirror.scale) { existingValue.localPosition = transformMirror.scale; } return existingValue; } } internal class <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__Vector4Converter : NullableJsonConverter<Vector4> { public override void WriteJson(JsonWriter writer, Vector4 value, JsonSerializer serializer) { //IL_0012: 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_0040: 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) writer.WriteStartObject(); writer.WritePropertyName("x"); writer.WriteValue(value.x); writer.WritePropertyName("y"); writer.WriteValue(value.y); writer.WritePropertyName("z"); writer.WriteValue(value.z); writer.WritePropertyName("w"); writer.WriteValue(value.w); writer.WriteEndObject(); } public override Vector4 ReadJson(JsonReader reader, Type objectType, Vector4 existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return JsonConvert.DeserializeObject<Vector4>(serializer.Deserialize(reader).ToString()); } } internal class Vector3Converter : NullableJsonConverter<Vector3> { public override void WriteJson(JsonWriter writer, Vector3 value, JsonSerializer serializer) { //IL_0012: 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_0040: Unknown result type (might be due to invalid IL or missing references) writer.WriteStartObject(); writer.WritePropertyName("x"); writer.WriteValue(value.x); writer.WritePropertyName("y"); writer.WriteValue(value.y); writer.WritePropertyName("z"); writer.WriteValue(value.z); writer.WriteEndObject(); } public override Vector3 ReadJson(JsonReader reader, Type objectType, Vector3 existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return JsonConvert.DeserializeObject<Vector3>(serializer.Deserialize(reader).ToString()); } } internal class Vector2Converter : NullableJsonConverter<Vector2> { public override void WriteJson(JsonWriter writer, Vector2 value, JsonSerializer serializer) { //IL_0012: 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) writer.WriteStartObject(); writer.WritePropertyName("x"); writer.WriteValue(value.x); writer.WritePropertyName("y"); writer.WriteValue(value.y); writer.WriteEndObject(); } public override Vector2 ReadJson(JsonReader reader, Type objectType, Vector2 existingValue, bool hasExistingValue, JsonSerializer serializer) { //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) return Vector2.op_Implicit(JsonConvert.DeserializeObject<Vector3>(serializer.Deserialize(reader).ToString())); } } internal class <SnapshotSerializer>F4B2E8E720C4309A61198C9CF69C60D50B69988D4BCA2AD5892DC0CDA1925CCFE__QuatConverter : NullableJsonConverter<Quaternion> { public override void WriteJson(JsonWriter writer, Quaternion value, JsonSerializer serializer) { //IL_0012: 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_0040: 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) writer.WriteStartObject(); writer.WritePropertyName("x"); writer.WriteValue(value.x); writer.WritePropertyName("y"); writer.WriteValue(value.y); writer.WritePropertyName("z"); writer.WriteValue(value.z); writer.WritePropertyName("w"); writer.WriteValue(value.w); writer.WriteEndObject(); } public override Quaternion ReadJson(JsonReader reader, Type objectType, Quaternion existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return JsonConvert.DeserializeObject<Quaternion>(serializer.Deserialize(reader).ToString()); } } public abstract class NullableJsonConverter<T> : JsonConverter { public sealed override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (value == null) { writer.WriteNull(); } else { WriteJson(writer, (T)value, serializer); } } public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer); public sealed override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (existingValue != null && !(existingValue is T)) { throw new JsonSerializationException($"Converter cannot read JSON with the specified existing value. {typeof(T)} is required."); } return ReadJson(reader, objectType, (existingValue == null) ? default(T) : ((T)existingValue), existingValue != null, serializer); } public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer); public sealed override bool CanConvert(Type objectType) { Type c = Nullable.GetUnderlyingType(objectType) ?? objectType; return typeof(T).IsAssignableFrom(c); } } public static class UiUtils { public static Texture2D GetColorTexture(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "DebugModPlus"; public const string PLUGIN_NAME = "DebugModPlus"; public const string PLUGIN_VERSION = "1.8.0"; } } namespace DebugModPlus.Savestates { public static class FlagLogic { public static void LoadFlags(JObject newFlags, GameFlagCollection allFlags) { foreach (KeyValuePair<string, GameFlagBase> item in allFlags.flagDict) { item.Deconstruct(out var key, out var value); string text = key; GameFlagBase val = value; JToken obj = newFlags[text]; JObject val2 = (JObject)(object)((obj is JObject) ? obj : null); if (val2 == null) { continue; } foreach (KeyValuePair<string, FlagFieldBase> fieldCache in val.fieldCaches) { fieldCache.Deconstruct(out key, out var value2); string text2 = key; FlagFieldBase val3 = value2; JToken val4 = val2[text2]; if (val4 == null) { continue; } FlagFieldBool val5 = (FlagFieldBool)(object)((val3 is FlagFieldBool) ? val3 : null); if (val5 == null) { FlagFieldInt val6 = (FlagFieldInt)(object)((val3 is FlagFieldInt) ? val3 : null); if (val6 == null) { FlagFieldString val7 = (FlagFieldString)(object)((val3 is FlagFieldString) ? val3 : null); if (val7 == null) { FlagFieldFloat val8 = (FlagFieldFloat)(object)((val3 is FlagFieldFloat) ? val3 : null); if (val8 == null) { FlagFieldLong val9 = (FlagFieldLong)(object)((val3 is FlagFieldLong) ? val3 : null); if (val9 != null) { ((FlagField<long>)(object)val9).CurrentValue = Extensions.Value<long>((IEnumerable<JToken>)val4); } } else { ((FlagField<float>)(object)val8).CurrentValue = Extensions.Value<float>((IEnumerable<JToken>)val4); } } else { ((FlagField<string>)(object)val7).CurrentValue = Extensions.Value<string>((IEnumerable<JToken>)val4); } } else { ((FlagField<int>)(object)val6).CurrentValue = Extensions.Value<int>((IEnumerable<JToken>)val4); } } else { ((FlagField<bool>)(object)val5).CurrentValue = Extensions.Value<bool>((IEnumerable<JToken>)val4); } } } } } public static class MonobehaviourTracing { private static readonly Type[] FindReferenceIgnoreList = new Type[13] { typeof(EffectDealer), typeof(PlayerInputCommandQueue), typeof(HackDrone), typeof(SpriteFlasher), typeof(PoolObject), typeof(PathArea), typeof(DamageScalarSource), typeof(PathToAreaFinder), typeof(IOnEnableInvokable), typeof(OnEnableHierarchyInvoker), typeof(EffectReceiver), typeof(SoundEmitter), typeof(SoundEmitter) }; private static readonly Type[] FindReferenceIgnoreListBase = new Type[3] { typeof(IAbstractEventReceiver), typeof(ILevelResetPrepare), typeof(ILevelResetStart) }; public static void TraceReferencedMonobehaviours(MonoBehaviour origin, List<MonoBehaviourSnapshot> saved, HashSet<MonoBehaviour> seen, int depth = 0, int? maxDepth = 0, int minDepth = 0) { //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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown Scene scene = ((Component)origin).gameObject.scene; if (!((Scene)(ref scene)).IsValid() || seen.Contains(origin)) { return; } if (depth >= minDepth) { saved.Add(MonoBehaviourSnapshot.Of((Component)(object)origin)); } seen.Add(origin); if (maxDepth.HasValue && depth >= maxDepth) { return; } FieldInfo[] fields = ((object)origin).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo field in fields) { if (!FindReferenceIgnoreList.Contains(field.FieldType) && !Array.Exists(FindReferenceIgnoreListBase, (Type x) => x.IsAssignableFrom(field.FieldType)) && typeof(MonoBehaviour).IsAssignableFrom(field.FieldType)) { MonoBehaviour val = (MonoBehaviour)field.GetValue(origin); if (Object.op_Implicit((Object)(object)val)) { TraceReferencedMonobehaviours(val, saved, seen, depth + 1, maxDepth, minDepth); } } } } } [Flags] public enum SavestateFilter { None = 0, Flags = 2, Player = 4, Monsters = 8, FSMs = 0x10, All = 0x1E } public static class SavestateLogic { public static Savestate Create(SavestateFilter filter) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) if (!SingletonBehaviour<GameCore>.IsAvailable()) { throw new Exception("Can't create savestate outside of game level"); } GameCore instance = SingletonBehaviour<GameCore>.Instance; if (!Object.op_Implicit((Object)(object)instance.gameLevel)) { throw new Exception("Can't create savestate outside of game level"); } Player i = Player.i; List<MonoBehaviourSnapshot> list = new List<MonoBehaviourSnapshot>(); List<MonsterLoveFsmSnapshot> list2 = new List<MonsterLoveFsmSnapshot>(); List<GeneralFsmSnapshot> list3 = new List<GeneralFsmSnapshot>(); List<ReferenceFixups> list4 = new List<ReferenceFixups>(); JObject flags = new JObject(); HashSet<MonoBehaviour> seen = new HashSet<MonoBehaviour>(); if (filter.HasFlag(SavestateFilter.Player)) { MonobehaviourTracing.TraceReferencedMonobehaviours((MonoBehaviour)(object)i, list, seen, 0, null); foreach (var item in FsmInspectorModule.FsmListStates((IStateMachine)(object)i.fsm)) { MonobehaviourTracing.TraceReferencedMonobehaviours((MonoBehaviour)(object)item.Item2, list, seen, 0, 0); } } if (filter.HasFlag(SavestateFilter.Monsters)) { MonsterBase[] array = Object.FindObjectsOfType<MonsterBase>(); foreach (MonsterBase val in array) { MonobehaviourTracing.TraceReferencedMonobehaviours((MonoBehaviour)(object)val, list, seen, 0, null); list2.Add(MonsterLoveFsmSnapshot.Of((IStateMachine)(object)val.fsm)); } } if (filter.HasFlag(SavestateFilter.FSMs)) { StateMachineOwner[] array2 = Object.FindObjectsOfType<StateMachineOwner>(); foreach (StateMachineOwner owner in array2) { list3.Add(GeneralFsmSnapshot.Of(owner)); } } if (filter.HasFlag(SavestateFilter.Player)) { list2.Add(MonsterLoveFsmSnapshot.Of((IStateMachine)(object)i.fsm)); list4.Add(ReferenceFixups.Of((MonoBehaviour)(object)Player.i, new List<ReferenceFixupField>(1) { new ReferenceFixupField("touchingRope", ObjectUtils.ObjectComponentPath((Component)(object)Player.i.touchingRope)) })); } if (filter.HasFlag(SavestateFilter.Flags)) { flags = JObject.Parse(GameFlagManager.FlagsToJson(SingletonBehaviour<SaveManager>.Instance.allFlags)); } Savestate obj = new Savestate { Flags = flags }; Scene scene = ((Component)instance.gameLevel).gameObject.scene; obj.Scene = ((Scene)(ref scene)).name; obj.PlayerPosition = ((Component)i).transform.position; obj.LastTeleportId = ((GameFlagBase)SingletonBehaviour<ApplicationCore>.Instance.lastSaveTeleportPoint).FinalSaveID; obj.MonobehaviourSnapshots = list; obj.FsmSnapshots = list2; obj.GeneralFsmSnapshots = list3; obj.ReferenceFixups = list4; return obj; } public static async Task Load(Savestate savestate, bool forceReload = false) { if (!SingletonBehaviour<GameCore>.IsAvailable()) { throw new Exception("Attempted to load savestate outside of scene"); } Stopwatch sw = Stopwatch.StartNew(); sw.Start(); JObject flags = savestate.Flags; if (flags != null) { FlagLogic.LoadFlags(flags, SingletonBehaviour<SaveManager>.Instance.allFlags); Log.Debug($"- Applied flags in {sw.ElapsedMilliseconds}ms"); } string? scene = savestate.Scene; GameLevel gameLevel = SingletonBehaviour<GameCore>.Instance.gameLevel; bool flag = scene == ((gameLevel != null) ? gameLevel.SceneName : null); if (savestate.Scene != null) { if ((savestate.Scene != null && !flag) || forceReload) { Vector3 playerPosition = savestate.PlayerPosition ?? throw new Exception("Savestate with scene must have `playerPosition`"); sw.Restart(); Task task = ChangeSceneAsync(new ChangeSceneData { sceneName = savestate.Scene, playerSpawnPosition = (SpawnPositionDelegate)(() => playerPosition) }); if (await Task.WhenAny(new Task[2] { task, Task.Delay(5000) }) != task) { ToastManager.Toast((object)"Savestate was not loaded after 5s, aborting"); return; } Log.Info($"- Change scene in {sw.ElapsedMilliseconds}ms"); } } else { Vector3? playerPosition2 = savestate.PlayerPosition; if (playerPosition2.HasValue) { Vector3 valueOrDefault = playerPosition2.GetValueOrDefault(); ((Component)Player.i).transform.position = valueOrDefault; } } SingletonBehaviour<GameCore>.Instance.ResetLevel(false); sw.Restart(); if (savestate.MonobehaviourSnapshots != null) { ApplySnapshots(savestate.MonobehaviourSnapshots); Log.Info($"- Applied snapshots to scene in {sw.ElapsedMilliseconds}ms"); } sw.Stop(); if (savestate.ReferenceFixups != null) { ApplyFixups(savestate.ReferenceFixups); } foreach (MonsterLoveFsmSnapshot item in savestate.FsmSnapshots ?? new List<MonsterLoveFsmSnapshot>()) { GameObject val = ObjectUtils.LookupPath(item.Path); if ((Object)(object)val == (Object)null) { Log.Error("Savestate stored monsterlove fsm state on " + item.Path + ", which does not exist at load time"); continue; } FSMStateMachineRunner component = val.GetComponent<FSMStateMachineRunner>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Savestate stored monsterlove fsm state on " + item.Path + ", which has no FSMStateMachineRunner"); continue; } foreach (IStateMachine item2 in FsmInspectorModule.FsmListMachines(component)) { object stateObj = Enum.ToObject(item2.CurrentStateMap.stateObj.GetType(), item.CurrentState); EnterStateDirectly(item2, stateObj); } } foreach (GeneralFsmSnapshot fsm in savestate?.GeneralFsmSnapshots ?? new List<GeneralFsmSnapshot>()) { GameObject val2 = ObjectUtils.LookupPath(fsm.Path); if ((Object)(object)val2 == (Object)null) { Log.Error("Savestate stored general fsm state on " + fsm.Path + ", which does not exist at load time"); continue; } StateMachineOwner component2 = val2.GetComponent<StateMachineOwner>(); if (!Object.op_Implicit((Object)(object)component2)) { Log.Error("Savestate stored general fsm state on " + fsm.Path + ", which has no FSMStateMachineRunner"); continue; } GeneralState val3 = ((IEnumerable<GeneralState>)((StateMachineContext<GeneralState, GeneralState>)(object)component2.FsmContext).States).FirstOrDefault((Func<GeneralState, bool>)((GeneralState state) => ((Object)state).name == fsm.CurrentState)); if (!Object.op_Implicit((Object)(object)val3)) { Log.Error("State " + fsm.CurrentState + " does not exist on " + fsm.Path); continue; } try { ((StateMachineContext<GeneralState, GeneralState>)(object)component2.FsmContext).ChangeState(val3); } catch (Exception arg) { Log.Error($"Could not apply fsm state on {component2.FsmContext}/{((StateMachineContext<GeneralState, GeneralState>)(object)component2.FsmContext).fsm} {arg}"); } } Player.i.playerInput.RevokeAllMyVote((MonoBehaviour)(object)Player.i.PlayerDeadState); foreach (RuntimeConditionVote item3 in ReflectionUtils.AccessField<List<RuntimeConditionVote>>((object)Player.i.playerInput, "conditionVoteList")) { item3.votes.Clear(); item3.ManualUpdate(); } Player.i.UpdateSpriteFacing(); } private static void ApplySnapshots(List<MonoBehaviourSnapshot> snapshots) { foreach (MonoBehaviourSnapshot snapshot in snapshots) { Component val = ObjectUtils.LookupObjectComponentPath(snapshot.Path); if ((Object)(object)val == (Object)null) { Log.Error("Savestate stored state on " + snapshot.Path + ", which does not exist at load time"); } else { SnapshotSerializer.Populate(val, snapshot.Data); } } } private static void ApplyFixups(List<ReferenceFixups> fixups) { foreach (ReferenceFixups fixup in fixups) { Component val = ObjectUtils.LookupObjectComponentPath(fixup.Path); if ((Object)(object)val == (Object)null) { Log.Error("Savestate stored reference fixup on " + fixup.Path + ", which does not exist at load time"); continue; } foreach (ReferenceFixupField field2 in fixup.Fields) { field2.Deconstruct(out string Field, out string Reference); string text = Field; string text2 = Reference; FieldInfo field = ((object)val).GetType().GetField(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (text2 == null) { field.SetValue(val, null); continue; } Component val2 = ObjectUtils.LookupObjectComponentPath(text2); if ((Object)(object)val2 == (Object)null) { Log.Error("Savestate stored reference fixup on " + fixup.Path + "." + text + ", but the target " + text2 + " does not exist at load time"); } else { field.SetValue(val, val2); } } } } private static void EnterStateDirectly(IStateMachine sm, object stateObj) { FSMStateMachineRunner val = ReflectionUtils.AccessField<FSMStateMachineRunner>((object)sm, "engine"); IDictionary dictionary = ReflectionUtils.AccessField<IDictionary>((object)sm, "stateLookup"); if (!dictionary.Contains(stateObj)) { throw new Exception($"state {stateObj} not found in fsm"); } object value = dictionary[stateObj]; FieldInfo fieldInfo = ReflectionUtils.AccessFieldInfo((object)sm, "queuedChange"); FieldInfo fieldInfo2 = ReflectionUtils.AccessFieldInfo((object)sm, "currentTransition"); FieldInfo fieldInfo3 = ReflectionUtils.AccessFieldInfo((object)sm, "exitRoutine"); FieldInfo fieldInfo4 = ReflectionUtils.AccessFieldInfo((object)sm, "enterRoutine"); FieldInfo fieldInfo5 = ReflectionUtils.AccessFieldInfo((object)sm, "lastState"); FieldInfo fieldInfo6 = ReflectionUtils.AccessFieldInfo((object)sm, "currentState"); FieldInfo fieldInfo7 = ReflectionUtils.AccessFieldInfo((object)sm, "isInTransition"); if (fieldInfo.GetValue(sm) is IEnumerator enumerator) { ((MonoBehaviour)val).StopCoroutine(enumerator); fieldInfo.SetValue(sm, null); } if (fieldInfo2.GetValue(sm) is IEnumerator enumerator2) { ((MonoBehaviour)val).StopCoroutine(enumerator2); fieldInfo2.SetValue(sm, null); } if (fieldInfo3.GetValue(sm) is IEnumerator enumerator3) { ((MonoBehaviour)val).StopCoroutine(enumerator3); fieldInfo3.SetValue(sm, null); } if (fieldInfo4.GetValue(sm) is IEnumerator enumerator4) { ((MonoBehaviour)val).StopCoroutine(enumerator4); fieldInfo4.SetValue(sm, null); } fieldInfo5.SetValue(sm, value); fieldInfo6.SetValue(sm, value); fieldInfo7.SetValue(sm, false); } private static Task ChangeSceneAsync(ChangeSceneData changeSceneData, bool showTip = false) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) TaskCompletionSource<object?> completion = new TaskCompletionSource<object>(); changeSceneData.ChangedDoneEvent = delegate { completion.SetResult(null); }; VersionCompatExtensions.ChangeSceneCompat(SingletonBehaviour<GameCore>.Instance, changeSceneData, showTip, false, 0f); return completion.Task; } } } namespace DebugModPlus.Modules { [HarmonyPatch] public class CheatModule { [BindableMethod(Name = "Refill all")] private static void RefillAll() { Player i = Player.i; if (i != null) { ((Health)i.health).GainFull(); i.ammo.GainFull(); i.chiContainer.GainFull(); } } [BindableMethod(Name = "Unlock all maps")] private static void UnlockMaps() { foreach (GameLevelMapDataCollection allCollection in SingletonBehaviour<GameCore>.Instance.allAreas.allCollections) { foreach (GameLevelMapData levelMapData in allCollection.levelMapDatas) { ((FlagField<bool>)(object)levelMapData.Unlocked).CurrentValue = true; foreach (MistMapDataEntry mistMapDataEntry in levelMapData.MistMapDataEntries) { mistMapDataEntry.BindingFlag.CurrentValue = true; } } } } [BindableMethod(Name = "Give Ledge Storage")] private static void GiveLedgeStorage() { Player i = Player.i; if (i != null) { i.isOnLedge = true; } } } public static class FlagLoggerModule { private const bool LogFlagsOnAwake = false; public static void Awake() { } [BindableMethod] public static void LogFlags() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown try { Dictionary<string, GameFlagBase> flagDict = ScriptableObjectSingleton<GameConfig>.Instance.allGameFlags.flagDict; JsonSerializerSettings val = new JsonSerializerSettings(); val.ReferenceLoopHandling = (ReferenceLoopHandling)1; val.ContractResolver = (IContractResolver)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__IgnoreTypeContractResolver(new string[1] { "AsyncOperationHandle" }, new string[3] { "onChangeActionDict", "assetReference", "CurrentValue" }); val.Converters = new List<JsonConverter>(15) { (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__GameFlagConverter(), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FlagFieldConverter<FlagFieldBool, bool>(), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FlagFieldConverter<FlagFieldInt, int>(), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FlagFieldConverter<FlagFieldFloat, float>(), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FlagFieldConverter<FlagFieldLong, long>(), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FlagFieldConverter<FlagFieldString, string>(), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverterImperative<ScriptableDataBool>(delegate(ScriptableDataBool x, JsonWriter writer, JsonSerializer serializer) { writer.WriteStartObject(); writer.WritePropertyName("name"); serializer.Serialize(writer, (object)((Object)x).name); writer.WritePropertyName("value"); serializer.Serialize(writer, (object)x.CurrentValue); writer.WriteEndObject(); }), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverterImperative<ScriptableDataFloat>(delegate(ScriptableDataFloat x, JsonWriter writer, JsonSerializer serializer) { writer.WriteStartObject(); writer.WritePropertyName("name"); serializer.Serialize(writer, (object)((Object)x).name); writer.WritePropertyName("value"); serializer.Serialize(writer, (object)((AbstractScriptableData<FlagFieldFloat, float>)(object)x).CurrentValue); writer.WriteEndObject(); }), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverterImperative<GameFlagInt>(delegate(GameFlagInt x, JsonWriter writer, JsonSerializer serializer) { writer.WriteStartObject(); writer.WritePropertyName("name"); serializer.Serialize(writer, (object)((Object)x).name); writer.WritePropertyName("value"); serializer.Serialize(writer, (object)((AbstractScriptableData<FlagFieldInt, int>)(object)x).CurrentValue); writer.WriteEndObject(); }), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter<LocalizedString, string>((LocalizedString x) => ((object)(LocalizedString)(ref x)).ToString()), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter<GuidReference, Guid>((GuidReference x) => x.Guid), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter<StatModType, string>((StatModType x) => ((object)(StatModType)(ref x)).ToString()), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter<StatModDurationType, string>((StatModDurationType x) => ((object)(StatModDurationType)(ref x)).ToString()), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter<PoolObject, string>((PoolObject x) => ((Object)x).name), (JsonConverter)(object)new <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverterImperative<CharacterStat>(delegate(CharacterStat stat, JsonWriter writer, JsonSerializer serializer) { writer.WriteStartObject(); writer.WritePropertyName("BaseValue"); serializer.Serialize(writer, (object)stat.BaseValue); writer.WritePropertyName("StatModifiers"); serializer.Serialize(writer, (object)stat.StatModifiers); writer.WritePropertyName("COMPUTED_FinalValue"); serializer.Serialize(writer, (object)stat.Value); writer.WriteEndObject(); }) }; string contents = JsonConvert.SerializeObject((object)flagDict, (Formatting)1, val); File.WriteAllText("/tmp/allFlags.json", contents); } catch (Exception ex) { ToastManager.Toast((object)ex); } } } internal class <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__IgnoreTypeContractResolver : DefaultContractResolver { [CompilerGenerated] private string[] <typesToIgnore>P; [CompilerGenerated] private string[] <fieldsToIgnore>P; public <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__IgnoreTypeContractResolver(string[] typesToIgnore, string[] fieldsToIgnore) { <typesToIgnore>P = typesToIgnore; <fieldsToIgnore>P = fieldsToIgnore; ((DefaultContractResolver)this)..ctor(); } protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) JsonProperty property = ((DefaultContractResolver)this).CreateProperty(member, memberSerialization); if (Array.Exists(<typesToIgnore>P, (string t) => property.PropertyType?.Name == t)) { property.ShouldSerialize = (object _) => false; } return property; } protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); List<JsonProperty> list = new List<JsonProperty>(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (!<fieldsToIgnore>P.Contains(fieldInfo.Name)) { JsonProperty val = ((DefaultContractResolver)this).CreateProperty((MemberInfo)fieldInfo, memberSerialization); val.Readable = true; val.Writable = true; list.Add(val); } } return list; } } internal class <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FlagFieldConverter<TContainer, T> : JsonConverter<TContainer> where TContainer : FlagField<T> { public override void WriteJson(JsonWriter writer, TContainer? value, JsonSerializer serializer) { serializer.Serialize(writer, (value != null) ? ((object)((FlagField<?>)value).CurrentValue) : null); } public override TContainer? ReadJson(JsonReader reader, Type objectType, TContainer? existingValue, bool hasExistingValue, JsonSerializer serializer) { throw new NotImplementedException(); } } internal class <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter<T, TU> : JsonConverter<T> { [CompilerGenerated] private Func<T, TU> <func>P; public <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverter(Func<T, TU> func) { <func>P = func; base..ctor(); } public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer) { serializer.Serialize(writer, (value == null) ? "null" : ((object)<func>P(value))); } public override T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer) { throw new NotImplementedException(); } } internal class <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverterImperative<T> : JsonConverter<T> { [CompilerGenerated] private Action<T, JsonWriter, JsonSerializer> <func>P; public <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__FuncConverterImperative(Action<T, JsonWriter, JsonSerializer> func) { <func>P = func; base..ctor(); } public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer) { if (value == null) { writer.WriteNull(); } else { <func>P(value, writer, serializer); } } public override T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer) { throw new NotImplementedException(); } } internal class <FlagLoggerModule>F7723A2C2E9D404FC48F108B6F1D4AC53243ED9105008C04DD44873C309139A10__GameFlagConverter : JsonConverter<GameFlagBase> { public override void WriteJson(JsonWriter writer, GameFlagBase? value, JsonSerializer serializer) { if ((Object)(object)value == (Object)null) { writer.WriteNull(); } else if (writer.Path.Split('.').Length <= 1) { foreach (JsonConverter item in (Collection<JsonConverter>)(object)serializer.Converters) { if (item != this && item.CanConvert(((object)value).GetType())) { item.WriteJson(writer, (object)value, serializer); return; } } writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteValue(((Object)value).name); serializer.Serialize(writer, (object)value); FieldInfo[] fields = ((object)value).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { bool flag; switch (fieldInfo.Name) { case "gameStateType": case "propertyCache": case "fieldCaches": case "variableEntries": case "_variableEntriesIncludeZDoorMaps": case "MistMapDataEntries": case "weaponPrefab": flag = true; break; default: flag = false; break; } if (!flag) { writer.WritePropertyName(fieldInfo.Name); object value2 = fieldInfo.GetValue(value); serializer.Serialize(writer, value2); } } writer.WriteEndObject(); } else { writer.WriteValue("flagref:" + value.FinalSaveID); } } public override GameFlagBase? ReadJson(JsonReader reader, Type objectType, GameFlagBase? existingValue, bool hasExistingValue, JsonSerializer serializer) { throw new NotImplementedException(); } } [HarmonyPatch] public class FreecamModule { private const float Speed = 200f; private const float FastMultiplier = 3f; private const float ScrollSpeed = 1f; public static bool FreecamActive; private static Camera sceneCamera => SingletonBehaviour<GameCore>.Instance.gameLevel.sceneCamera; private static ProCamera2D proCamera => SingletonBehaviour<CameraManager>.Instance.cameraCore.proCamera2D; [BindableMethod(/*Could not decode attribute arguments.*/)] private static void ToggleFreecam() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) FreecamActive = !FreecamActive; Player i = Player.i; _ = Player.i.playerInput; if (FreecamActive) { ((Behaviour)i).enabled = false; ((Health)i.health).BecomeInvincible((Object)(object)DebugModPlus.Instance); ((Behaviour)proCamera).enabled = false; return; } ((Behaviour)i).enabled = true; ((Health)i.health).RemoveInvincible((Object)(object)DebugModPlus.Instance); ((Behaviour)proCamera).enabled = true; Transform transform = ((Component)sceneCamera).transform; Vector3 position = ((Component)sceneCamera).transform.position; position.z = -240f; transform.position = position; } public static void Update() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0067: 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_0085: Unknown result type (might be due to invalid IL or missing references) if (FreecamActive) { bool key = Input.GetKey((KeyCode)304); float num = 200f * (key ? 3f : 1f); float y = Input.mouseScrollDelta.y; if (y != 0f) { Transform transform = ((Component)sceneCamera).transform; float num2 = ((y < 0f) ? 1.1f : 0.9f); Vector3 position = transform.position; position.z = transform.position.z * num2 * 1f; transform.position = position; } int num3 = (Input.GetKey((KeyCode)100) ? 1 : 0) - (Input.GetKey((KeyCode)97) ? 1 : 0); int num4 = (Input.GetKey((KeyCode)119) ? 1 : 0) - (Input.GetKey((KeyCode)115) ? 1 : 0); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)num3, (float)num4); Player.i.SetPosition(((Component)Player.i).transform.position + Vector2.op_Implicit(val * (Time.deltaTime * num))); SingletonBehaviour<CameraManager>.Instance.camera2D.MoveCameraInstantlyToPosition(Vector2.op_Implicit(((Component)Player.i).transform.position), false); } } } [HarmonyPatch] public class FsmInspectorModule { private static GUIStyle? style; private string? text; private static FieldRef<FSMStateMachineRunner, List<IStateMachine>> stateMachineRunnerStateMachineList = AccessTools.FieldRefAccess<FSMStateMachineRunner, List<IStateMachine>>("stateMachineList"); private static FieldRef<AbstractStateTransition, AbstractConditionComp[]> stateTransitionConditions = AccessTools.FieldRefAccess<AbstractStateTransition, AbstractConditionComp[]>("conditions"); private bool hideAnimationTransitions = true; private bool hideDefaultTransitions = true; private bool showFlagIds = true; public List<GameObject> Objects = new List<GameObject>(); public static List<IStateMachine> FsmListMachines(FSMStateMachineRunner runner) { return stateMachineRunnerStateMachineList.Invoke(runner); } public static IEnumerable<(object, MappingState)> FsmListStates(IStateMachine machine) { return ReflectionUtils.AccessProperty<IList>(ReflectionUtils.AccessField<object>((object)machine, "_stateMapping"), "getAllStates").Cast<object>().Select(delegate(object stateObj) { object item = ReflectionUtils.AccessField<object>(stateObj, "state"); MappingState item2 = ReflectionUtils.AccessField<MappingState>(stateObj, "stateBehavior"); return (item, item2); }); } private string InspectFsmMonsterLove(FSMStateMachineRunner runner) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) string text = ""; List<IStateMachine> list = FsmListMachines(runner); MonsterBase component = ((Component)runner).GetComponent<MonsterBase>(); if (Object.op_Implicit((Object)(object)component)) { text = text + "\nMonster animation state " + ((Actor)component).currentPlayingAnimatorState + "\n\n"; } foreach (IStateMachine item3 in list) { Type arg = ((object)item3).GetType().GenericTypeArguments[0]; text += $"State type: {arg}\n"; object stateObj = item3.CurrentStateMap.stateObj; text += $"Current state: {stateObj}\n"; foreach (var item4 in FsmListStates(item3)) { object item = item4.Item1; MappingState item2 = item4.Item2; text += $" {item} ({((object)item2).GetType().Name})\n"; MonsterState val = (MonsterState)(object)((item2 is MonsterState) ? item2 : null); if (val == null) { continue; } text += $" Exit State: {val.exitState}\n"; StealthPreAttackState val2 = (StealthPreAttackState)(object)((item2 is StealthPreAttackState) ? item2 : null); if (val2 != null) { text += $" Approaching Scheme Index {val2.SchemesIndex}\n"; for (int i = 0; i < val2.ApproachingSchemes.Count; i++) { StealthEngagingScheme val3 = val2.ApproachingSchemes[i]; text += $" Approaching Scheme {i}: {((Object)val3).name}\n"; text += $" exit range: {val3.ExitApproachingRange}\n"; } } if (AccessBaseField<AbstractStateAction[]>(item2, typeof(MonsterState), "stateActions").Length != 0) { text += "HAS STATE ACTIONS\n"; } } } return text; } private string StateName(string name) { return StringExtensions.TrimStartMatches(name, (ReadOnlySpan<char>)"[State] ").ToString(); } private string VariableName(AbstractVariable? variable) { if ((Object)(object)variable == (Object)null) { return "null"; } string obj = StringExtensions.TrimEndMatches(StringExtensions.TrimStartMatches(((object)variable).ToString(), (ReadOnlySpan<char>)"[Variable] "), (ReadOnlySpan<char>)" (VariableBool)").ToString(); GameFlagBase finalData = variable.FinalData; return obj + " " + ((finalData != null) ? finalData.GetSaveID : null); } private string TransitionName(AbstractStateTransition transition) { if (!Object.op_Implicit((Object)(object)transition)) { return "null"; } return StringExtensions.TrimStartMatches(StringExtensions.TrimStartMatches(((Object)transition).name, (ReadOnlySpan<char>)"[Action] ").ToString(), (ReadOnlySpan<char>)"[Transition] ").ToString(); } private bool UnityEventHasCalls(UnityEvent e) { if (((UnityEventBase)e).GetPersistentEventCount() <= 0) { return ((UnityEventBase)e).m_Calls.Count > 0; } return true; } private string InspectFSM(GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return ""; } string text = ""; FSMStateMachineRunner component = gameObject.GetComponent<FSMStateMachineRunner>(); if (Object.op_Implicit((Object)(object)component)) { return InspectFsmMonsterLove(component); } StateMachineOwner component2 = gameObject.GetComponent<StateMachineOwner>(); if (!Object.op_Implicit((Object)(object)component2)) { return "No fsm found"; } GeneralFSMContext fsmContext = component2.FsmContext; if (((StateMachineContext<GeneralState, GeneralState>)(object)fsmContext).fsm == null) { return text + "fsm is null?"; } text = text + "Current State: " + StringExtensions.TrimStartMatches(((Object)((Component)((StateMachineContext<GeneralState, GeneralState>)(object)fsmContext).fsm.State).gameObject).name, (ReadOnlySpan<char>)"[State] ").ToString() + "\n"; text = text + "Last transition: " + TransitionName(fsmContext.LastTransition) + "\n"; GeneralState[] states = ((StateMachineContext<GeneralState, GeneralState>)(object)fsmContext).States; foreach (GeneralState val in states) { text = text + "State " + StateName(((Object)val).name) + ":\n"; text += " Actions:\n"; AbstractStateAction[] actions = val.Actions; foreach (AbstractStateAction val2 in actions) { if (val2 is StateTransitionAction) { continue; } string text2 = ((object)val2).ToString(); AnimatorPlayAction val3 = (AnimatorPlayAction)(object)((val2 is AnimatorPlayAction) ? val2 : null); if (val3 != null) { if (hideAnimationTransitions) { continue; } string[] obj = new string[5] { "play animation ", val3.StateName, " on '", null, null }; Animator animator = val3.animator; obj[3] = ((animator != null) ? ((Object)animator).name : null); obj[4] = "'"; text2 = string.Concat(obj); } else { GameObjectActivateAction val4 = (GameObjectActivateAction)(object)((val2 is GameObjectActivateAction) ? val2 : null); if (val4 != null) { text2 = StringExtensions.TrimStartMatches(((Object)val4).name, (ReadOnlySpan<char>)"[Action] ").ToString() ?? ""; List<GameObject> enableObj = val4.enableObj; if (enableObj != null && enableObj.Count > 0) { text2 = text2 + ", enable object" + ((val4.enableObj.Count > 1) ? "s" : "") + " " + GeneralExtensions.Join<string>(val4.enableObj.Select((GameObject x) => "'" + ((Object)x).name + "'"), (Func<string, string>)null, ", "); } enableObj = val4.disableObj; if (enableObj != null && enableObj.Count > 0) { text2 = text2 + ", disable object" + ((val4.disableObj.Count > 1) ? "s" : "") + " " + GeneralExtensions.Join<string>(val4.disableObj.Select((GameObject x) => "'" + ((Object)x).name + "'"), (Func<string, string>)null, ", "); } } else { StateEventAction val5 = (StateEventAction)(object)((val2 is StateEventAction) ? val2 : null); if (val5 != null) { bool flag = UnityEventHasCalls(val5.OnStateEnterEvent); bool flag2 = UnityEventHasCalls(val5.OnStateUpdateEvent); bool flag3 = UnityEventHasCalls(val5.OnStateExitEvent); text2 = "EventAction " + (flag ? "Enter " : "") + (flag2 ? "Update " : "") + (flag3 ? "Exit " : "") + " " + ((!flag && !flag2 && !flag3) ? "<empty>" : ""); } else { SetVariableBoolAction val6 = (SetVariableBoolAction)(object)((val2 is SetVariableBoolAction) ? val2 : null); if (val6 != null && !val6.Multiple) { text2 = $"set bool {VariableName((AbstractVariable?)(object)val6.targetFlag)} = {val6.TargetValue}"; } } } } RCGEventSender component3 = ((Component)val2).GetComponent<RCGEventSender>(); if (component3 != null) { string obj2 = text2; RCGEventType eventType = component3.eventType; text2 = obj2 + string.Format("sending event {0} to {1} receivers", (eventType != null) ? StringExtensions.TrimEndMatches(((object)eventType).ToString(), (ReadOnlySpan<char>)" (RCGEventType)").ToString() : null, component3.bindReceivers?.Count); } if (!((Behaviour)val2).isActiveAndEnabled) { text2 = "(disabled) " + text2; } text = text + " " + text2 + "\n"; } bool flag4 = true; AbstractStateTransition[] transitions = val.Transitions; foreach (AbstractStateTransition val7 in transitions) { if (hideDefaultTransitions && val7.IsDefaultTransition) { continue; } if (flag4) { text += " Transitions:\n"; flag4 = false; } ReadOnlySpan<char> readOnlySpan = StringExtensions.TrimStartMatches(StringExtensions.TrimStartMatches(((Object)val7).name, (ReadOnlySpan<char>)"[Action] ").ToString(), (ReadOnlySpan<char>)"[Transition] "); text = text + " " + (val7.IsDefaultTransition ? "default" : "") + " to " + StateName(((Object)val7.target).name) + " (" + readOnlySpan.ToString() + ")\n"; AbstractConditionComp[] array = stateTransitionConditions.Invoke(val7); foreach (AbstractConditionComp obj3 in array) { string text3 = StringExtensions.TrimStartMatches(((Object)obj3).name, (ReadOnlySpan<char>)"[Condition] ").ToString(); FlagBoolCondition val8 = (FlagBoolCondition)(object)((obj3 is FlagBoolCondition) ? obj3 : null); if (val8 != null) { string arg = VariableName((AbstractVariable?)(object)val8.flagBool); VariableBool flagBool = val8.flagBool; text3 = $"bool flag {arg} current {((flagBool != null) ? new bool?(flagBool.FlagValue) : null)}"; if (showFlagIds) { string obj4 = text3; VariableBool flagBool2 = val8.flagBool; object obj5; if (flagBool2 == null) { obj5 = null; } else { ScriptableDataBool boolFlag = flagBool2.boolFlag; obj5 = ((boolFlag != null) ? ((GameFlagBase)boolFlag).FinalSaveID : null); } text3 = obj4 + " " + (string?)obj5; } if (showFlagIds) { text3 += $" {val8.flagBool}"; } } if (obj3.FinalResultInverted) { text3 = "!" + text3; } text = text + " " + text3 + "\n"; } } } return text; } public void OnGui() { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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) //IL_0197: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown GameObject[] second = (GameObject[])(object)new GameObject[0]; try { text = ""; foreach (GameObject item in Objects.Concat(second)) { if (!Object.op_Implicit((Object)(object)item)) { text += "\n"; continue; } text = text + ((Object)item).name + "\n"; text = text + " " + ObjectUtils.ObjectPath(item); text += "\n"; try { text += InspectFSM(item); } catch (Exception ex) { text += ex.ToString(); } text += "\n"; } } catch (Exception ex2) { ToastManager.Toast((object)ex2); } text = text?.Trim(); if (style == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 20 }; val.normal.background = UiUtils.GetColorTexture(new Color(0f, 0f, 0f, 0.5f)); style = val; } Vector2 val2 = style.CalcSize(new GUIContent(text)); GUI.Label(new Rect(8f, 8f, val2.x, val2.y), text, style); } private static T AccessBaseField<T>(object val, Type baseType, string fieldName) { return (T)baseType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(val); } } public record GhostFrame(Vector3 Position, string SpriteName, int Facing, double Timestamp) { [CompilerGenerated] protected virtual bool PrintMembers(StringBuilder builder) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) RuntimeHelpers.EnsureSufficientExecutionStac