Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of ScheduleToolbox v1.1.1
ScheduleToolbox-IL2CPP.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; 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 HarmonyLib; using Il2CppFishNet; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.UI.MainMenu; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using ScheduleToolbox; using ScheduleToolbox.Commands; using ScheduleToolbox.Helpers; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::ScheduleToolbox.ScheduleToolbox), "ScheduleToolbox", "1.1.1", "k073l", null)] [assembly: MelonColor(1, 255, 0, 0)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ScheduleToolbox-IL2CPP")] [assembly: AssemblyConfiguration("Release IL2CPP")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9b4672b6ae86270c48114d6b3a8f603ea3175ad9")] [assembly: AssemblyProduct("ScheduleToolbox-IL2CPP")] [assembly: AssemblyTitle("ScheduleToolbox-IL2CPP")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 ScheduleToolbox { public static class BuildInfo { public const string Name = "ScheduleToolbox"; public const string Description = "Testing tools for Schedule I"; public const string Author = "k073l"; public const string Version = "1.1.1"; } public class ScheduleToolbox : MelonMod { [CompilerGenerated] private sealed class <ConsoleCoro>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScheduleToolbox <>4__this; private List<ConsoleCommand> <commands>5__1; private List<ConsoleCommand>.Enumerator <>s__2; private ConsoleCommand <command>5__3; private string <commandWord>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ConsoleCoro>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <commands>5__1 = null; <>s__2 = default(List<ConsoleCommand>.Enumerator); <command>5__3 = null; <commandWord>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._addedCommands) { Logger.Msg("Console commands already added, skipping."); return false; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; <commands>5__1 = new List<ConsoleCommand> { (ConsoleCommand)(object)new FlyCommand(), (ConsoleCommand)(object)new TeleportCommand(), (ConsoleCommand)(object)new SavePosCommand(), (ConsoleCommand)(object)new PosCommand(), (ConsoleCommand)(object)new TimeWarpCommand() }; <>s__2 = <commands>5__1.GetEnumerator(); try { while (<>s__2.MoveNext()) { <command>5__3 = <>s__2.Current; <commandWord>5__4 = <command>5__3.CommandWord; Console.commands.Add(<commandWord>5__4, <command>5__3); Console.Commands.Add(<command>5__3); Logger.Msg("Registered command: " + <commandWord>5__4); <commandWord>5__4 = null; <command>5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(List<ConsoleCommand>.Enumerator); <>4__this._addedCommands = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static Instance Logger; private readonly Dictionary<KeyCode, float> holdTimers = new Dictionary<KeyCode, float> { { (KeyCode)49, 0f }, { (KeyCode)50, 0f }, { (KeyCode)51, 0f }, { (KeyCode)52, 0f }, { (KeyCode)53, 0f } }; private bool _shouldResetTimers = false; private bool _addedCommands = false; public override void OnInitializeMelon() { Logger = ((MelonBase)this).LoggerInstance; Logger.Msg("ScheduleToolbox initialized"); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Menu") { _shouldResetTimers = true; } if (sceneName == "Main") { Logger.Msg("Main scene loaded, starting console commands coroutine"); MelonCoroutines.Start(Utils.WaitForSingleton<Console>(ConsoleCoro())); } } public override void OnUpdate() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_010d: Expected I4, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) if (_shouldResetTimers) { _shouldResetTimers = false; List<KeyCode> list = new List<KeyCode>(holdTimers.Keys); foreach (KeyCode item in list) { holdTimers[item] = 0f; } } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "Menu") { return; } List<KeyCode> list2 = new List<KeyCode>(holdTimers.Keys); foreach (KeyCode item2 in list2) { if (Input.GetKey(item2)) { holdTimers[item2] += Time.deltaTime; if (holdTimers[item2] >= 0.5f) { int num = item2 - 48; Logger.Msg($"Trying to load save in slot: {num}"); holdTimers[item2] = -999f; if (num <= ((Il2CppArrayBase<SaveInfo>)(object)LoadManager.SaveGames).Length) { Singleton<LoadManager>.Instance.StartGame(((Il2CppArrayBase<SaveInfo>)(object)LoadManager.SaveGames)[num - 1], false); continue; } Logger.Warning($"Save slot {num} doesn't exist."); } } else if (holdTimers[item2] >= 0f) { holdTimers[item2] = 0f; } } } [IteratorStateMachine(typeof(<ConsoleCoro>d__7))] private IEnumerator ConsoleCoro() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ConsoleCoro>d__7(0) { <>4__this = this }; } public override void OnGUI() { PosCommand.OnGUI(); SavePosCommand.OnGUI(); } } } namespace ScheduleToolbox.Patches { [HarmonyPatch(typeof(Disclaimer), "Awake")] public class DisclaimerSkip { public static bool Prefix(MonoBehaviour __instance) { ((Component)__instance).gameObject.SetActive(false); return false; } } [HarmonyPatch(typeof(PlayerCamera), "Exit")] public class FlyEscFunctionality { private static bool Prefix(PlayerCamera __instance, ExitAction action) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (action.Used) { return true; } if (!__instance.FreeCamEnabled || (int)action.exitType != 1) { return true; } action.Used = true; FlyCommand.TeleportToCameraPos(); __instance.SetFreeCam(false, true); return false; } } [HarmonyPatch(typeof(ConsoleCommand), "Execute")] public static class Il2CppConsolePatch { public static bool Prefix(ConsoleCommand __instance, List<string> args) { __instance.Execute(args); return false; } } } namespace ScheduleToolbox.Helpers { public static class MelonLoggerExtensions { public static void Debug(this Instance logger, string message, bool stacktrace = true) { } private static string GetLoggerName(Instance logger) { return typeof(Instance).GetField("Name", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(logger) as string; } private static void InvokeNativeMsg(Color namesectionColor, Color textColor, string nameSection, string message) { typeof(MelonLogger).GetMethod("NativeMsg", BindingFlags.Static | BindingFlags.NonPublic)?.Invoke(null, new object[5] { namesectionColor, textColor, nameSection, message ?? "null", false }); } private static string GetCallerInfo() { StackTrace stackTrace = new StackTrace(); for (int i = 2; i < stackTrace.FrameCount; i++) { StackFrame frame = stackTrace.GetFrame(i); MethodBase method = frame.GetMethod(); if (!(method?.DeclaringType == null)) { return method.DeclaringType.FullName + "." + method.Name; } } return "unknown"; } } [Serializable] public class SerializableVector3 { public float x; public float y; public float z; public SerializableVector3() { } public SerializableVector3(Vector3 v) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) x = v.x; y = v.y; z = v.z; } public Vector3 ToUnity() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } } [Serializable] public class SerializableQuaternion { public float x; public float y; public float z; public float w; public SerializableQuaternion() { } public SerializableQuaternion(Quaternion q) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) x = q.x; y = q.y; z = q.z; w = q.w; } public Quaternion ToUnity() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(x, y, z, w); } } [Serializable] public class SavedPosition { public SerializableVector3 position; public SerializableQuaternion rotation; } [Serializable] public class SavedPositionsData { public Dictionary<string, SavedPosition> Positions = new Dictionary<string, SavedPosition>(); } public static class PositionManager { private static readonly string SaveFilePath; private static readonly Instance Logger; private static SavedPositionsData _data; static PositionManager() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown SaveFilePath = Path.Combine(MelonEnvironment.UserDataDirectory, "ScheduleToolbox.json"); Logger = new Instance("ScheduleToolbox-PositionManager"); Load(); } public static void SavePosition(string name, Vector3 position, Quaternion rotation) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) _data.Positions[name] = new SavedPosition { position = new SerializableVector3(position), rotation = new SerializableQuaternion(rotation) }; Save(); } public static bool TryGetPosition(string name, out Vector3 position, out Quaternion rotation) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (_data.Positions.TryGetValue(name, out var value)) { position = value.position.ToUnity(); rotation = value.rotation.ToUnity(); return true; } position = default(Vector3); rotation = default(Quaternion); return false; } public static void Save() { try { string contents = JsonConvert.SerializeObject((object)_data, (Formatting)1); File.WriteAllText(SaveFilePath, contents); Logger.Debug($"Saved {_data.Positions.Count} positions to: {SaveFilePath}"); } catch (Exception value) { Logger.Error($"Save failed: {value}"); } } public static void Load() { try { if (File.Exists(SaveFilePath)) { string text = File.ReadAllText(SaveFilePath); _data = JsonConvert.DeserializeObject<SavedPositionsData>(text) ?? new SavedPositionsData(); Logger.Debug($"Loaded {_data.Positions.Count} positions."); } else { Logger.Debug("Save file not found. Starting fresh."); _data = new SavedPositionsData(); } } catch (Exception value) { Logger.Error($"Load failed: {value}"); _data = new SavedPositionsData(); } } } public static class Il2CppListExtensions { public static IEnumerable<T> AsEnumerable<T>(this List<T> list) { return list ?? new List<T>(); } public static List<T> ToIl2CppList<T>(this IEnumerable<T> source) { List<T> val = new List<T>(); foreach (T item in source) { val.Add(item); } return val; } public static List<T> ConvertToList<T>(List<T> il2CppList) { List<T> list = new List<T>(); T[] collection = Il2CppArrayBase<T>.op_Implicit(il2CppList.ToArray()); list.AddRange(collection); return list; } public static IEnumerable<T> AsEnumerable<T>(this List<T> list) { IEnumerable<T> result; if (list != null) { result = ((IEnumerable<T>)list._items).Take(list._size); } else { IEnumerable<T> enumerable = Array.Empty<T>(); result = enumerable; } return result; } } public static class Utils { [CompilerGenerated] private sealed class <WaitForNetwork>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator routine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForNetwork>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!InstanceFinder.IsServer && !InstanceFinder.IsClient) { <>2__current = null; <>1__state = 1; return true; } MelonCoroutines.Start(routine); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForNetworkSingleton>d__8<T> : IEnumerator<object>, IEnumerator, IDisposable where T : notnull, NetworkSingleton<T> { private int <>1__state; private object <>2__current; public IEnumerator coroutine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForNetworkSingleton>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0044; case 1: <>1__state = -1; goto IL_0044; case 2: { <>1__state = -1; return false; } IL_0044: if (!NetworkSingleton<T>.InstanceExists) { <>2__current = null; <>1__state = 1; return true; } <>2__current = coroutine; <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForNotNull>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public object obj; public float timeout; public Action onTimeout; public Action onFinish; private float <startTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForNotNull>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <startTime>5__1 = Time.time; break; case 1: <>1__state = -1; break; } if (obj == null) { if (!float.IsNaN(timeout) && Time.time - <startTime>5__1 > timeout) { onTimeout?.Invoke(); return false; } <>2__current = null; <>1__state = 1; return true; } onFinish?.Invoke(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForPlayer>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator routine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForPlayer>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)Player.Local == (Object)null || (Object)(object)((Component)Player.Local).gameObject == (Object)null) { <>2__current = null; <>1__state = 1; return true; } MelonCoroutines.Start(routine); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForSingleton>d__9<T> : IEnumerator<object>, IEnumerator, IDisposable where T : notnull, Singleton<T> { private int <>1__state; private object <>2__current; public IEnumerator coroutine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForSingleton>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0044; case 1: <>1__state = -1; goto IL_0044; case 2: { <>1__state = -1; return false; } IL_0044: if (!Singleton<T>.InstanceExists) { <>2__current = null; <>1__state = 1; return true; } <>2__current = coroutine; <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Instance Logger = new Instance("ScheduleToolbox-Utils"); public static T FindObjectByName<T>(string objectName) where T : Object { try { foreach (T item in Resources.FindObjectsOfTypeAll<T>()) { if (((Object)item).name != objectName) { continue; } Logger.Debug($"Found {typeof(T).Name} '{objectName}' directly in loaded objects"); return item; } return default(T); } catch (Exception ex) { Logger.Error($"Error finding {typeof(T).Name} '{objectName}': {ex.Message}"); return default(T); } } public static List<T> GetAllComponentsInChildrenRecursive<T>(GameObject obj) where T : Component { List<T> list = new List<T>(); if ((Object)(object)obj == (Object)null) { return list; } T[] array = Il2CppArrayBase<T>.op_Implicit(obj.GetComponents<T>()); if (array.Length != 0) { list.AddRange(array); } for (int i = 0; i < obj.transform.childCount; i++) { Transform child = obj.transform.GetChild(i); list.AddRange(GetAllComponentsInChildrenRecursive<T>(((Component)child).gameObject)); } return list; } public static bool Is<T>(object obj, out T result) where T : Object { Object val = (Object)((obj is Object) ? obj : null); if (val != null) { Type val2 = Il2CppType.Of<T>(); Type il2CppType = val.GetIl2CppType(); if (val2.IsAssignableFrom(il2CppType)) { result = ((Il2CppObjectBase)val).TryCast<T>(); return result != null; } } result = default(T); return false; } public static List<StorableItemDefinition> GetAllStorableItemDefinitions() { List<ItemRegister> list = Il2CppListExtensions.ConvertToList<ItemRegister>(Singleton<Registry>.Instance.ItemRegistry); List<StorableItemDefinition> list2 = new List<StorableItemDefinition>(); foreach (ItemRegister item in list) { if (Utils.Is<StorableItemDefinition>((object)item.Definition, out StorableItemDefinition result)) { list2.Add(result); } else { Logger.Warning("Definition " + ((object)item.Definition)?.GetType().FullName + " is not a StorableItemDefinition"); } } return list2.ToList(); } [IteratorStateMachine(typeof(<WaitForPlayer>d__5))] public static IEnumerator WaitForPlayer(IEnumerator routine) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForPlayer>d__5(0) { routine = routine }; } [IteratorStateMachine(typeof(<WaitForNetwork>d__6))] public static IEnumerator WaitForNetwork(IEnumerator routine) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForNetwork>d__6(0) { routine = routine }; } [IteratorStateMachine(typeof(<WaitForNotNull>d__7))] public static IEnumerator WaitForNotNull(object? obj, float timeout = float.NaN, Action onTimeout = null, Action onFinish = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForNotNull>d__7(0) { obj = obj, timeout = timeout, onTimeout = onTimeout, onFinish = onFinish }; } [IteratorStateMachine(typeof(<WaitForNetworkSingleton>d__8<>))] public static IEnumerator WaitForNetworkSingleton<T>(IEnumerator coroutine) where T : NetworkSingleton<T> { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForNetworkSingleton>d__8<T>(0) { coroutine = coroutine }; } [IteratorStateMachine(typeof(<WaitForSingleton>d__9<>))] public static IEnumerator WaitForSingleton<T>(IEnumerator coroutine) where T : Singleton<T> { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForSingleton>d__9<T>(0) { coroutine = coroutine }; } } } namespace ScheduleToolbox.Commands { [RegisterTypeInIl2Cpp] public class FlyCommand : ConsoleCommand { public override string CommandWord => "fly"; public override string CommandDescription => "Toggles fly mode (enhanced freecam)"; public override string ExampleUsage => "fly"; public FlyCommand(IntPtr ptr) : base(ptr) { } public FlyCommand() : base(ClassInjector.DerivedConstructorPointer<FlyCommand>()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public override void Execute(List<string> args) { if (PlayerSingleton<PlayerCamera>.Instance.FreeCamEnabled) { TeleportToCameraPos(); PlayerSingleton<PlayerCamera>.Instance.SetFreeCam(false, true); } else { PlayerSingleton<PlayerCamera>.Instance.SetFreeCam(true, true); } } public static void TeleportToCameraPos() { //IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.position; Quaternion rotation = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.rotation; PlayerSingleton<PlayerCamera>.Instance.SetFreeCam(false, true); PlayerSingleton<PlayerMovement>.Instance.Teleport(position); ((Component)Player.Local).transform.rotation = rotation; ((Component)Player.Local).transform.forward = Vector3.forward; PlayerSingleton<PlayerMovement>.Instance.SetResidualVelocity(Vector3.zero, 0f, 0f); } } [RegisterTypeInIl2Cpp] public class PosCommand : ConsoleCommand { private static readonly Instance Logger = new Instance("ScheduleToolbox-PosCommand"); private static string _guiMessage = ""; private static float _guiMessageEndTime = 5f; public override string CommandWord => "pos"; public override string CommandDescription => "Logs the player's current position and rotation"; public override string ExampleUsage => "pos"; public PosCommand(IntPtr ptr) : base(ptr) { } public PosCommand() : base(ClassInjector.DerivedConstructorPointer<PosCommand>()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public override void Execute(List<string> args) { //IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.position; Quaternion rotation = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.rotation; string text = $"Pos: ({position.x:F2}, {position.y:F2}, {position.z:F2}); Rot: ({((Quaternion)(ref rotation)).eulerAngles.x:F1}, {((Quaternion)(ref rotation)).eulerAngles.y:F1}, {((Quaternion)(ref rotation)).eulerAngles.z:F1})"; Logger.Msg(text); _guiMessage = text; _guiMessageEndTime = Time.time + 3f; } public static void OnGUI() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _guiMessageEndTime) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 14 }; val.normal.textColor = Color.white; GUIStyle val2 = val; GUI.Label(new Rect(10f, (float)(Screen.height - 30), (float)(Screen.width - 20), 25f), _guiMessage, val2); } } } [RegisterTypeInIl2Cpp] public class SavePosCommand : ConsoleCommand { private static readonly Instance Logger = new Instance("ScheduleToolbox-SavePosCommand"); private static string _guiMessage = ""; private static float _guiMessageEndTime; public override string CommandWord => "savepos"; public override string CommandDescription => "Saves the player's current position and rotation to a named location."; public override string ExampleUsage => "savepos home"; public SavePosCommand(IntPtr ptr) : base(ptr) { } public SavePosCommand() : base(ClassInjector.DerivedConstructorPointer<SavePosCommand>()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public override void Execute(List<string> args) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (args.Count != 1) { Logger.Warning("Usage: savepos <name>"); return; } string text = args.AsEnumerable<string>().ElementAt(0); Vector3 position = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.position; Quaternion rotation = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.rotation; PositionManager.SavePosition(text, position, rotation); Logger.Msg($"Saved position '{text}': {position.x},{position.y},{position.z} | {rotation.x},{rotation.y},{rotation.z}"); _guiMessage = $"Saved '{text}' at {position.x}, {position.y}, {position.z}!"; _guiMessageEndTime = Time.time + 3f; } public static void OnGUI() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_guiMessage) && Time.time < _guiMessageEndTime) { GUI.Label(new Rect(10f, (float)(Screen.height - 60), 300f, 45f), _guiMessage); } } } [RegisterTypeInIl2Cpp] public class TeleportCommand : ConsoleCommand { private static readonly Instance Logger = new Instance("ScheduleToolbox-TeleportCommand"); public override string CommandWord => "tp"; public override string CommandDescription => "Teleports the player to a specified location."; public override string ExampleUsage => "(tp <x> [y] <z>) or (tp location)"; public TeleportCommand(IntPtr ptr) : base(ptr) { } public TeleportCommand() : base(ClassInjector.DerivedConstructorPointer<TeleportCommand>()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public override void Execute(List<string> args) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) switch (args.Count) { case 1: { string text = args.AsEnumerable<string>().ElementAt(0); if (PositionManager.TryGetPosition(text, out var position, out var rotation)) { PlayerSingleton<PlayerMovement>.Instance.Teleport(position); ((Component)Player.Local).transform.rotation = rotation; ((Component)Player.Local).transform.forward = Vector3.forward; Logger.Msg($"Teleported to '{text}' at {position}"); } else { ConsoleCommand val4 = Console.commands["teleport"]; val4.Execute(args); } break; } case 2: { float result4; bool flag4 = float.TryParse(args.AsEnumerable<string>().ElementAt(0), out result4); float result5; bool flag5 = float.TryParse(args.AsEnumerable<string>().ElementAt(1), out result5); if (flag4 && flag5) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(result4, 1000f, result5); Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(val, Vector3.down); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, float.PositiveInfinity)) { Vector3 point = ((RaycastHit)(ref val3)).point; PlayerSingleton<PlayerMovement>.Instance.Teleport(point + Vector3.up); } else { Logger.Error("Could not find ground below given X/Z coordinates."); } } else { Logger.Error("Invalid coordinates. Please provide valid numbers."); } break; } case 3: { float result; bool flag = float.TryParse(args.AsEnumerable<string>().ElementAt(0), out result); float result2; bool flag2 = float.TryParse(args.AsEnumerable<string>().ElementAt(1), out result2); float result3; bool flag3 = float.TryParse(args.AsEnumerable<string>().ElementAt(2), out result3); if (flag && flag2 && flag3) { PlayerSingleton<PlayerMovement>.Instance.Teleport(new Vector3(result, result2, result3)); } else { Logger.Error("Invalid coordinates. Please provide valid numbers."); } break; } default: Logger.Warning("Invalid usage. Use: tp <x> [y] <z> or tp <location>"); break; } } } [RegisterTypeInIl2Cpp] public class TimeWarpCommand : ConsoleCommand { [CompilerGenerated] private sealed class <ResetTimeWarp>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public TimeWarpCommand <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetTimeWarp>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this._timeScaleCommand.Execute(_warpStop); MelonLogger.Msg("Time warp " + ((seconds > 0f) ? "ended" : "stopped") + ". Time scale reset to 1."); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly ConsoleCommand _timeScaleCommand = Console.commands["settimescale"]; private static List<string> _warpDefault = new string[1] { "10" }.ToIl2CppList(); private static List<string> _warpStop = new string[1] { "1" }.ToIl2CppList(); public override string CommandWord => "timewarp"; public override string CommandDescription => "Temporarily speeds up time in the game world."; public override string ExampleUsage => "timewarp [seconds] [timescale] | timewarp stop"; public TimeWarpCommand(IntPtr ptr) : base(ptr) { } public TimeWarpCommand() : base(ClassInjector.DerivedConstructorPointer<TimeWarpCommand>()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public override void Execute(List<string> args) { switch (args.Count) { case 0: MelonLogger.Msg("No duration specified. Defaulting to 10 seconds."); ((ConsoleCommand)this).Execute(_warpDefault); break; case 1: { float result2; if (args.AsEnumerable<string>().ElementAt(0) == "stop") { MelonCoroutines.Start(ResetTimeWarp(0f)); } else if (float.TryParse(args.AsEnumerable<string>().ElementAt(0), out result2)) { if (result2 <= 0f) { MelonLogger.Warning("Time warp duration must be a positive number."); break; } _timeScaleCommand.Execute(_warpDefault); MelonLogger.Msg($"Time warp started for {result2} seconds. Timescale set to 10."); MelonCoroutines.Start(ResetTimeWarp(result2)); } else { MelonLogger.Warning("Invalid argument. Use 'timewarp stop' to stop or 'timewarp <seconds>' to start."); } break; } case 2: { if (!float.TryParse(args.AsEnumerable<string>().ElementAt(0), out var result)) { MelonLogger.Warning("Invalid time value. Please provide a valid number of seconds."); } if (result <= 0f) { MelonLogger.Warning("Time warp duration must be a positive number."); break; } string text = args.AsEnumerable<string>().ElementAt(1); List<string> val = new string[1] { text }.ToIl2CppList(); _timeScaleCommand.Execute(val); MelonLogger.Msg($"Time warp started for {result} seconds. Time scale set to {text}."); MelonCoroutines.Start(ResetTimeWarp(result)); break; } default: MelonLogger.Warning("Usage: timewarp [seconds] | timewarp stop"); break; } } [IteratorStateMachine(typeof(<ResetTimeWarp>d__12))] private IEnumerator ResetTimeWarp(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetTimeWarp>d__12(0) { <>4__this = this, seconds = seconds }; } } }
ScheduleToolbox-Mono.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; 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 FishNet; using HarmonyLib; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using ScheduleOne; using ScheduleOne.DevUtilities; using ScheduleOne.ItemFramework; using ScheduleOne.Persistence; using ScheduleOne.PlayerScripts; using ScheduleOne.UI.MainMenu; using ScheduleToolbox; using ScheduleToolbox.Commands; using ScheduleToolbox.Helpers; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::ScheduleToolbox.ScheduleToolbox), "ScheduleToolbox", "1.1.1", "k073l", null)] [assembly: MelonColor(1, 255, 0, 0)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ScheduleToolbox-Mono")] [assembly: AssemblyConfiguration("Release Mono")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9b4672b6ae86270c48114d6b3a8f603ea3175ad9")] [assembly: AssemblyProduct("ScheduleToolbox-Mono")] [assembly: AssemblyTitle("ScheduleToolbox-Mono")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 ScheduleToolbox { public static class BuildInfo { public const string Name = "ScheduleToolbox"; public const string Description = "Testing tools for Schedule I"; public const string Author = "k073l"; public const string Version = "1.1.1"; } public class ScheduleToolbox : MelonMod { [CompilerGenerated] private sealed class <ConsoleCoro>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScheduleToolbox <>4__this; private List<ConsoleCommand> <commands>5__1; private List<ConsoleCommand>.Enumerator <>s__2; private ConsoleCommand <command>5__3; private string <commandWord>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ConsoleCoro>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <commands>5__1 = null; <>s__2 = default(List<ConsoleCommand>.Enumerator); <command>5__3 = null; <commandWord>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._addedCommands) { Logger.Msg("Console commands already added, skipping."); return false; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; <commands>5__1 = new List<ConsoleCommand> { (ConsoleCommand)(object)new FlyCommand(), (ConsoleCommand)(object)new TeleportCommand(), (ConsoleCommand)(object)new SavePosCommand(), (ConsoleCommand)(object)new PosCommand(), (ConsoleCommand)(object)new TimeWarpCommand() }; <>s__2 = <commands>5__1.GetEnumerator(); try { while (<>s__2.MoveNext()) { <command>5__3 = <>s__2.Current; <commandWord>5__4 = <command>5__3.CommandWord; Console.commands.Add(<commandWord>5__4, <command>5__3); Console.Commands.Add(<command>5__3); Logger.Msg("Registered command: " + <commandWord>5__4); <commandWord>5__4 = null; <command>5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(List<ConsoleCommand>.Enumerator); <>4__this._addedCommands = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static Instance Logger; private readonly Dictionary<KeyCode, float> holdTimers = new Dictionary<KeyCode, float> { { (KeyCode)49, 0f }, { (KeyCode)50, 0f }, { (KeyCode)51, 0f }, { (KeyCode)52, 0f }, { (KeyCode)53, 0f } }; private bool _shouldResetTimers = false; private bool _addedCommands = false; public override void OnInitializeMelon() { Logger = ((MelonBase)this).LoggerInstance; Logger.Msg("ScheduleToolbox initialized"); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Menu") { _shouldResetTimers = true; } if (sceneName == "Main") { Logger.Msg("Main scene loaded, starting console commands coroutine"); MelonCoroutines.Start(Utils.WaitForSingleton<Console>(ConsoleCoro())); } } public override void OnUpdate() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_010d: Expected I4, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) if (_shouldResetTimers) { _shouldResetTimers = false; List<KeyCode> list = new List<KeyCode>(holdTimers.Keys); foreach (KeyCode item in list) { holdTimers[item] = 0f; } } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "Menu") { return; } List<KeyCode> list2 = new List<KeyCode>(holdTimers.Keys); foreach (KeyCode item2 in list2) { if (Input.GetKey(item2)) { holdTimers[item2] += Time.deltaTime; if (holdTimers[item2] >= 0.5f) { int num = item2 - 48; Logger.Msg($"Trying to load save in slot: {num}"); holdTimers[item2] = -999f; if (num <= LoadManager.SaveGames.Length) { Singleton<LoadManager>.Instance.StartGame(LoadManager.SaveGames[num - 1], false); } else { Logger.Warning($"Save slot {num} doesn't exist."); } } } else if (holdTimers[item2] >= 0f) { holdTimers[item2] = 0f; } } } [IteratorStateMachine(typeof(<ConsoleCoro>d__7))] private IEnumerator ConsoleCoro() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ConsoleCoro>d__7(0) { <>4__this = this }; } public override void OnGUI() { PosCommand.OnGUI(); SavePosCommand.OnGUI(); } } } namespace ScheduleToolbox.Patches { [HarmonyPatch(typeof(Disclaimer), "Awake")] public class DisclaimerSkip { public static bool Prefix(MonoBehaviour __instance) { ((Component)__instance).gameObject.SetActive(false); return false; } } [HarmonyPatch(typeof(PlayerCamera), "Exit")] public class FlyEscFunctionality { private static bool Prefix(PlayerCamera __instance, ExitAction action) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (action.Used) { return true; } if (!__instance.FreeCamEnabled || (int)action.exitType != 1) { return true; } action.Used = true; FlyCommand.TeleportToCameraPos(); __instance.SetFreeCam(false, true); return false; } } } namespace ScheduleToolbox.Helpers { public static class MelonLoggerExtensions { public static void Debug(this Instance logger, string message, bool stacktrace = true) { } private static string GetLoggerName(Instance logger) { return typeof(Instance).GetField("Name", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(logger) as string; } private static void InvokeNativeMsg(Color namesectionColor, Color textColor, string nameSection, string message) { typeof(MelonLogger).GetMethod("NativeMsg", BindingFlags.Static | BindingFlags.NonPublic)?.Invoke(null, new object[5] { namesectionColor, textColor, nameSection, message ?? "null", false }); } private static string GetCallerInfo() { StackTrace stackTrace = new StackTrace(); for (int i = 2; i < stackTrace.FrameCount; i++) { StackFrame frame = stackTrace.GetFrame(i); MethodBase method = frame.GetMethod(); if (!(method?.DeclaringType == null)) { return method.DeclaringType.FullName + "." + method.Name; } } return "unknown"; } } [Serializable] public class SerializableVector3 { public float x; public float y; public float z; public SerializableVector3() { } public SerializableVector3(Vector3 v) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) x = v.x; y = v.y; z = v.z; } public Vector3 ToUnity() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } } [Serializable] public class SerializableQuaternion { public float x; public float y; public float z; public float w; public SerializableQuaternion() { } public SerializableQuaternion(Quaternion q) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) x = q.x; y = q.y; z = q.z; w = q.w; } public Quaternion ToUnity() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(x, y, z, w); } } [Serializable] public class SavedPosition { public SerializableVector3 position; public SerializableQuaternion rotation; } [Serializable] public class SavedPositionsData { public Dictionary<string, SavedPosition> Positions = new Dictionary<string, SavedPosition>(); } public static class PositionManager { private static readonly string SaveFilePath; private static readonly Instance Logger; private static SavedPositionsData _data; static PositionManager() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown SaveFilePath = Path.Combine(MelonEnvironment.UserDataDirectory, "ScheduleToolbox.json"); Logger = new Instance("ScheduleToolbox-PositionManager"); Load(); } public static void SavePosition(string name, Vector3 position, Quaternion rotation) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) _data.Positions[name] = new SavedPosition { position = new SerializableVector3(position), rotation = new SerializableQuaternion(rotation) }; Save(); } public static bool TryGetPosition(string name, out Vector3 position, out Quaternion rotation) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (_data.Positions.TryGetValue(name, out var value)) { position = value.position.ToUnity(); rotation = value.rotation.ToUnity(); return true; } position = default(Vector3); rotation = default(Quaternion); return false; } public static void Save() { try { string contents = JsonConvert.SerializeObject((object)_data, (Formatting)1); File.WriteAllText(SaveFilePath, contents); Logger.Debug($"Saved {_data.Positions.Count} positions to: {SaveFilePath}"); } catch (Exception arg) { Logger.Error($"Save failed: {arg}"); } } public static void Load() { try { if (File.Exists(SaveFilePath)) { string text = File.ReadAllText(SaveFilePath); _data = JsonConvert.DeserializeObject<SavedPositionsData>(text) ?? new SavedPositionsData(); Logger.Debug($"Loaded {_data.Positions.Count} positions."); } else { Logger.Debug("Save file not found. Starting fresh."); _data = new SavedPositionsData(); } } catch (Exception arg) { Logger.Error($"Load failed: {arg}"); _data = new SavedPositionsData(); } } } public static class Il2CppListExtensions { public static IEnumerable<T> AsEnumerable<T>(this List<T> list) { return list ?? new List<T>(); } } public static class Utils { [CompilerGenerated] private sealed class <WaitForNetwork>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator routine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForNetwork>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!InstanceFinder.IsServer && !InstanceFinder.IsClient) { <>2__current = null; <>1__state = 1; return true; } MelonCoroutines.Start(routine); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForNetworkSingleton>d__8<T> : IEnumerator<object>, IEnumerator, IDisposable where T : notnull, NetworkSingleton<T> { private int <>1__state; private object <>2__current; public IEnumerator coroutine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForNetworkSingleton>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0044; case 1: <>1__state = -1; goto IL_0044; case 2: { <>1__state = -1; return false; } IL_0044: if (!NetworkSingleton<T>.InstanceExists) { <>2__current = null; <>1__state = 1; return true; } <>2__current = coroutine; <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForNotNull>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public object obj; public float timeout; public Action onTimeout; public Action onFinish; private float <startTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForNotNull>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <startTime>5__1 = Time.time; break; case 1: <>1__state = -1; break; } if (obj == null) { if (!float.IsNaN(timeout) && Time.time - <startTime>5__1 > timeout) { onTimeout?.Invoke(); return false; } <>2__current = null; <>1__state = 1; return true; } onFinish?.Invoke(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForPlayer>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator routine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForPlayer>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)Player.Local == (Object)null || (Object)(object)((Component)Player.Local).gameObject == (Object)null) { <>2__current = null; <>1__state = 1; return true; } MelonCoroutines.Start(routine); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForSingleton>d__9<T> : IEnumerator<object>, IEnumerator, IDisposable where T : notnull, Singleton<T> { private int <>1__state; private object <>2__current; public IEnumerator coroutine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForSingleton>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0044; case 1: <>1__state = -1; goto IL_0044; case 2: { <>1__state = -1; return false; } IL_0044: if (!Singleton<T>.InstanceExists) { <>2__current = null; <>1__state = 1; return true; } <>2__current = coroutine; <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly Instance Logger = new Instance("ScheduleToolbox-Utils"); public static T FindObjectByName<T>(string objectName) where T : Object { try { T[] array = Resources.FindObjectsOfTypeAll<T>(); foreach (T val in array) { if (!(((Object)val).name != objectName)) { Logger.Debug("Found " + typeof(T).Name + " '" + objectName + "' directly in loaded objects"); return val; } } return default(T); } catch (Exception ex) { Logger.Error("Error finding " + typeof(T).Name + " '" + objectName + "': " + ex.Message); return default(T); } } public static List<T> GetAllComponentsInChildrenRecursive<T>(GameObject obj) where T : Component { List<T> list = new List<T>(); if ((Object)(object)obj == (Object)null) { return list; } T[] components = obj.GetComponents<T>(); if (components.Length != 0) { list.AddRange(components); } for (int i = 0; i < obj.transform.childCount; i++) { Transform child = obj.transform.GetChild(i); list.AddRange(GetAllComponentsInChildrenRecursive<T>(((Component)child).gameObject)); } return list; } public static bool Is<T>(object obj, out T result) where T : class { if (obj is T val) { result = val; return true; } result = null; return false; } public static List<StorableItemDefinition> GetAllStorableItemDefinitions() { List<ItemRegister> list = Singleton<Registry>.Instance.ItemRegistry.ToList(); List<StorableItemDefinition> list2 = new List<StorableItemDefinition>(); foreach (ItemRegister item in list) { if (Is<StorableItemDefinition>(item.Definition, out var result)) { list2.Add(result); } else { Logger.Warning("Definition " + ((object)item.Definition)?.GetType().FullName + " is not a StorableItemDefinition"); } } return list2.ToList(); } [IteratorStateMachine(typeof(<WaitForPlayer>d__5))] public static IEnumerator WaitForPlayer(IEnumerator routine) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForPlayer>d__5(0) { routine = routine }; } [IteratorStateMachine(typeof(<WaitForNetwork>d__6))] public static IEnumerator WaitForNetwork(IEnumerator routine) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForNetwork>d__6(0) { routine = routine }; } [IteratorStateMachine(typeof(<WaitForNotNull>d__7))] public static IEnumerator WaitForNotNull(object? obj, float timeout = float.NaN, Action onTimeout = null, Action onFinish = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForNotNull>d__7(0) { obj = obj, timeout = timeout, onTimeout = onTimeout, onFinish = onFinish }; } [IteratorStateMachine(typeof(<WaitForNetworkSingleton>d__8<>))] public static IEnumerator WaitForNetworkSingleton<T>(IEnumerator coroutine) where T : NetworkSingleton<T> { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForNetworkSingleton>d__8<T>(0) { coroutine = coroutine }; } [IteratorStateMachine(typeof(<WaitForSingleton>d__9<>))] public static IEnumerator WaitForSingleton<T>(IEnumerator coroutine) where T : Singleton<T> { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForSingleton>d__9<T>(0) { coroutine = coroutine }; } } } namespace ScheduleToolbox.Commands { [RegisterTypeInIl2Cpp] public class FlyCommand : ConsoleCommand { public override string CommandWord => "fly"; public override string CommandDescription => "Toggles fly mode (enhanced freecam)"; public override string ExampleUsage => "fly"; public override void Execute(List<string> args) { if (PlayerSingleton<PlayerCamera>.Instance.FreeCamEnabled) { TeleportToCameraPos(); PlayerSingleton<PlayerCamera>.Instance.SetFreeCam(false, true); } else { PlayerSingleton<PlayerCamera>.Instance.SetFreeCam(true, true); } } public static void TeleportToCameraPos() { //IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.position; Quaternion rotation = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.rotation; PlayerSingleton<PlayerCamera>.Instance.SetFreeCam(false, true); PlayerSingleton<PlayerMovement>.Instance.Teleport(position); ((Component)Player.Local).transform.rotation = rotation; ((Component)Player.Local).transform.forward = Vector3.forward; PlayerSingleton<PlayerMovement>.Instance.SetResidualVelocity(Vector3.zero, 0f, 0f); } } [RegisterTypeInIl2Cpp] public class PosCommand : ConsoleCommand { private static readonly Instance Logger = new Instance("ScheduleToolbox-PosCommand"); private static string _guiMessage = ""; private static float _guiMessageEndTime = 5f; public override string CommandWord => "pos"; public override string CommandDescription => "Logs the player's current position and rotation"; public override string ExampleUsage => "pos"; public override void Execute(List<string> args) { //IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.position; Quaternion rotation = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.rotation; string text = $"Pos: ({position.x:F2}, {position.y:F2}, {position.z:F2}); Rot: ({((Quaternion)(ref rotation)).eulerAngles.x:F1}, {((Quaternion)(ref rotation)).eulerAngles.y:F1}, {((Quaternion)(ref rotation)).eulerAngles.z:F1})"; Logger.Msg(text); _guiMessage = text; _guiMessageEndTime = Time.time + 3f; } public static void OnGUI() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _guiMessageEndTime) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 14 }; val.normal.textColor = Color.white; GUIStyle val2 = val; GUI.Label(new Rect(10f, (float)(Screen.height - 30), (float)(Screen.width - 20), 25f), _guiMessage, val2); } } } [RegisterTypeInIl2Cpp] public class SavePosCommand : ConsoleCommand { private static readonly Instance Logger = new Instance("ScheduleToolbox-SavePosCommand"); private static string _guiMessage = ""; private static float _guiMessageEndTime; public override string CommandWord => "savepos"; public override string CommandDescription => "Saves the player's current position and rotation to a named location."; public override string ExampleUsage => "savepos home"; public override void Execute(List<string> args) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (args.Count != 1) { Logger.Warning("Usage: savepos <name>"); return; } string text = args.AsEnumerable().ElementAt(0); Vector3 position = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.position; Quaternion rotation = ((Component)PlayerSingleton<PlayerCamera>.Instance).transform.rotation; PositionManager.SavePosition(text, position, rotation); Logger.Msg($"Saved position '{text}': {position.x},{position.y},{position.z} | {rotation.x},{rotation.y},{rotation.z}"); _guiMessage = $"Saved '{text}' at {position.x}, {position.y}, {position.z}!"; _guiMessageEndTime = Time.time + 3f; } public static void OnGUI() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_guiMessage) && Time.time < _guiMessageEndTime) { GUI.Label(new Rect(10f, (float)(Screen.height - 60), 300f, 45f), _guiMessage); } } } [RegisterTypeInIl2Cpp] public class TeleportCommand : ConsoleCommand { private static readonly Instance Logger = new Instance("ScheduleToolbox-TeleportCommand"); public override string CommandWord => "tp"; public override string CommandDescription => "Teleports the player to a specified location."; public override string ExampleUsage => "(tp <x> [y] <z>) or (tp location)"; public override void Execute(List<string> args) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) switch (args.Count) { case 1: { string text = args.AsEnumerable().ElementAt(0); if (PositionManager.TryGetPosition(text, out var position, out var rotation)) { PlayerSingleton<PlayerMovement>.Instance.Teleport(position); ((Component)Player.Local).transform.rotation = rotation; ((Component)Player.Local).transform.forward = Vector3.forward; Logger.Msg($"Teleported to '{text}' at {position}"); } else { ConsoleCommand val4 = Console.commands["teleport"]; val4.Execute(args); } break; } case 2: { float result4; bool flag4 = float.TryParse(args.AsEnumerable().ElementAt(0), out result4); float result5; bool flag5 = float.TryParse(args.AsEnumerable().ElementAt(1), out result5); if (flag4 && flag5) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(result4, 1000f, result5); Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(val, Vector3.down); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, float.PositiveInfinity)) { Vector3 point = ((RaycastHit)(ref val3)).point; PlayerSingleton<PlayerMovement>.Instance.Teleport(point + Vector3.up); } else { Logger.Error("Could not find ground below given X/Z coordinates."); } } else { Logger.Error("Invalid coordinates. Please provide valid numbers."); } break; } case 3: { float result; bool flag = float.TryParse(args.AsEnumerable().ElementAt(0), out result); float result2; bool flag2 = float.TryParse(args.AsEnumerable().ElementAt(1), out result2); float result3; bool flag3 = float.TryParse(args.AsEnumerable().ElementAt(2), out result3); if (flag && flag2 && flag3) { PlayerSingleton<PlayerMovement>.Instance.Teleport(new Vector3(result, result2, result3)); } else { Logger.Error("Invalid coordinates. Please provide valid numbers."); } break; } default: Logger.Warning("Invalid usage. Use: tp <x> [y] <z> or tp <location>"); break; } } } [RegisterTypeInIl2Cpp] public class TimeWarpCommand : ConsoleCommand { [CompilerGenerated] private sealed class <ResetTimeWarp>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public TimeWarpCommand <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetTimeWarp>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this._timeScaleCommand.Execute(_warpStop); MelonLogger.Msg("Time warp " + ((seconds > 0f) ? "ended" : "stopped") + ". Time scale reset to 1."); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly ConsoleCommand _timeScaleCommand = Console.commands["settimescale"]; private static List<string> _warpDefault = new List<string>(1) { "10" }; private static List<string> _warpStop = new List<string>(1) { "1" }; public override string CommandWord => "timewarp"; public override string CommandDescription => "Temporarily speeds up time in the game world."; public override string ExampleUsage => "timewarp [seconds] [timescale] | timewarp stop"; public override void Execute(List<string> args) { switch (args.Count) { case 0: MelonLogger.Msg("No duration specified. Defaulting to 10 seconds."); ((ConsoleCommand)this).Execute(_warpDefault); break; case 1: { float result2; if (args.AsEnumerable().ElementAt(0) == "stop") { MelonCoroutines.Start(ResetTimeWarp(0f)); } else if (float.TryParse(args.AsEnumerable().ElementAt(0), out result2)) { if (result2 <= 0f) { MelonLogger.Warning("Time warp duration must be a positive number."); break; } _timeScaleCommand.Execute(_warpDefault); MelonLogger.Msg($"Time warp started for {result2} seconds. Timescale set to 10."); MelonCoroutines.Start(ResetTimeWarp(result2)); } else { MelonLogger.Warning("Invalid argument. Use 'timewarp stop' to stop or 'timewarp <seconds>' to start."); } break; } case 2: { if (!float.TryParse(args.AsEnumerable().ElementAt(0), out var result)) { MelonLogger.Warning("Invalid time value. Please provide a valid number of seconds."); } if (result <= 0f) { MelonLogger.Warning("Time warp duration must be a positive number."); break; } string text = args.AsEnumerable().ElementAt(1); List<string> list = new List<string> { text }; _timeScaleCommand.Execute(list); MelonLogger.Msg($"Time warp started for {result} seconds. Time scale set to {text}."); MelonCoroutines.Start(ResetTimeWarp(result)); break; } default: MelonLogger.Warning("Usage: timewarp [seconds] | timewarp stop"); break; } } [IteratorStateMachine(typeof(<ResetTimeWarp>d__10))] private IEnumerator ResetTimeWarp(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetTimeWarp>d__10(0) { <>4__this = this, seconds = seconds }; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }