Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of MoreRealisticSleeping v1.0.5
MoreRealisticSleeping.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Il2CppFluffyUnderware.DevTools.Extensions; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Effects; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Law; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.Networking; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.UI; using Il2CppSystem; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using MoreRealisticSleeping; using MoreRealisticSleeping.Config; using MoreRealisticSleeping.EventManager; using MoreRealisticSleeping.PhoneApp; using MoreRealisticSleeping.Util; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(MRSCore), "MoreRealisticSleeping (Forked by HazDS)", "1.0.5", "KampfBallerina", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("MoreRealisticSleeping")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.0+2c28303d368189ea8f68c037741098d5afd250a3")] [assembly: AssemblyProduct("MoreRealisticSleeping")] [assembly: AssemblyTitle("MoreRealisticSleeping")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class PropertyManager { [CompilerGenerated] private sealed class <AddPropertyToPlayer>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Player player; public string propertyName; public PropertyManager <>4__this; private string <>s__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AddPropertyToPlayer>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if ((Object)(object)player == (Object)null) { MelonLogger.Warning("Player is null. Cannot remove property."); return false; } if (propertyName == null) { MelonLogger.Warning("Property name is null. Cannot remove property."); return false; } string text = propertyName.ToLower(); <>s__1 = text; switch (<>s__1) { case "antigravitiy": case "anti_gravity": if ((Object)(object)<>4__this.antiGravity == (Object)null) { <>4__this.antiGravity = ScriptableObject.CreateInstance<AntiGravity>(); } if ((Object)(object)<>4__this.antiGravity != (Object)null) { ((Effect)<>4__this.antiGravity).ApplyToPlayer(player); } break; case "athletic": if ((Object)(object)<>4__this.athletic == (Object)null) { <>4__this.athletic = ScriptableObject.CreateInstance<Athletic>(); } if ((Object)(object)<>4__this.athletic != (Object)null) { ((Effect)<>4__this.athletic).ApplyToPlayer(player); } break; case "balding": if ((Object)(object)<>4__this.balding == (Object)null) { <>4__this.balding = ScriptableObject.CreateInstance<Balding>(); } if ((Object)(object)<>4__this.balding != (Object)null) { ((Effect)<>4__this.balding).ApplyToPlayer(player); } break; case "brighteyed": case "bright_eyed": if ((Object)(object)<>4__this.brightEyed == (Object)null) { <>4__this.brightEyed = ScriptableObject.CreateInstance<BrightEyed>(); } if ((Object)(object)<>4__this.brightEyed != (Object)null) { ((Effect)<>4__this.brightEyed).ApplyToPlayer(player); } break; case "calming": if ((Object)(object)<>4__this.calming == (Object)null) { <>4__this.calming = ScriptableObject.CreateInstance<Calming>(); } if ((Object)(object)<>4__this.calming != (Object)null) { ((Effect)<>4__this.calming).ApplyToPlayer(player); } break; case "caloriedense": case "calorie_dense": if ((Object)(object)<>4__this.calorieDense == (Object)null) { <>4__this.calorieDense = ScriptableObject.CreateInstance<CalorieDense>(); } if ((Object)(object)<>4__this.calorieDense != (Object)null) { ((Effect)<>4__this.calorieDense).ApplyToPlayer(player); } break; case "cyclopean": if ((Object)(object)<>4__this.cyclopean == (Object)null) { <>4__this.cyclopean = ScriptableObject.CreateInstance<Cyclopean>(); } if ((Object)(object)<>4__this.cyclopean != (Object)null) { ((Effect)<>4__this.cyclopean).ApplyToPlayer(player); } break; case "disorienting": if ((Object)(object)<>4__this.disorienting == (Object)null) { <>4__this.disorienting = ScriptableObject.CreateInstance<Disorienting>(); } if ((Object)(object)<>4__this.disorienting != (Object)null) { ((Effect)<>4__this.disorienting).ApplyToPlayer(player); } break; case "electrifying": if ((Object)(object)<>4__this.electrifying == (Object)null) { <>4__this.electrifying = ScriptableObject.CreateInstance<Electrifying>(); } if ((Object)(object)<>4__this.electrifying != (Object)null) { ((Effect)<>4__this.electrifying).ApplyToPlayer(player); } break; case "energizing": if ((Object)(object)<>4__this.energizing == (Object)null) { <>4__this.energizing = ScriptableObject.CreateInstance<Energizing>(); } if ((Object)(object)<>4__this.energizing != (Object)null) { ((Effect)<>4__this.energizing).ApplyToPlayer(player); } break; case "euphoric": if ((Object)(object)<>4__this.euphoric == (Object)null) { <>4__this.euphoric = ScriptableObject.CreateInstance<Euphoric>(); } if ((Object)(object)<>4__this.euphoric != (Object)null) { ((Effect)<>4__this.euphoric).ApplyToPlayer(player); } break; case "explosive": if ((Object)(object)<>4__this.explosive == (Object)null) { <>4__this.explosive = ScriptableObject.CreateInstance<Explosive>(); } if ((Object)(object)<>4__this.explosive != (Object)null) { ((Effect)<>4__this.explosive).ApplyToPlayer(player); } break; case "foggy": if ((Object)(object)<>4__this.foggy == (Object)null) { <>4__this.foggy = ScriptableObject.CreateInstance<Foggy>(); } if ((Object)(object)<>4__this.foggy != (Object)null) { ((Effect)<>4__this.foggy).ApplyToPlayer(player); } break; case "focused": if ((Object)(object)<>4__this.focused == (Object)null) { <>4__this.focused = ScriptableObject.CreateInstance<Focused>(); } if ((Object)(object)<>4__this.focused != (Object)null) { ((Effect)<>4__this.focused).ApplyToPlayer(player); } break; case "gingeritis": if ((Object)(object)<>4__this.gingeritis == (Object)null) { <>4__this.gingeritis = ScriptableObject.CreateInstance<Gingeritis>(); } if ((Object)(object)<>4__this.gingeritis != (Object)null) { ((Effect)<>4__this.gingeritis).ApplyToPlayer(player); } break; case "glowing": case "glowie": if ((Object)(object)<>4__this.glowie == (Object)null) { <>4__this.glowie = ScriptableObject.CreateInstance<Glowie>(); } if ((Object)(object)<>4__this.glowie != (Object)null) { ((Effect)<>4__this.glowie).ApplyToPlayer(player); } break; case "jennerising": if ((Object)(object)<>4__this.jennerising == (Object)null) { <>4__this.jennerising = ScriptableObject.CreateInstance<Jennerising>(); } if ((Object)(object)<>4__this.jennerising != (Object)null) { ((Effect)<>4__this.jennerising).ApplyToPlayer(player); } break; case "laxative": if ((Object)(object)<>4__this.laxative == (Object)null) { <>4__this.laxative = ScriptableObject.CreateInstance<Laxative>(); } if ((Object)(object)<>4__this.laxative != (Object)null) { ((Effect)<>4__this.laxative).ApplyToPlayer(player); } break; case "lethal": if ((Object)(object)<>4__this.lethal == (Object)null) { <>4__this.lethal = ScriptableObject.CreateInstance<Lethal>(); } if ((Object)(object)<>4__this.lethal != (Object)null) { ((Effect)<>4__this.lethal).ApplyToPlayer(player); } break; case "longfaced": case "long_faced": if ((Object)(object)<>4__this.longFaced == (Object)null) { <>4__this.longFaced = ScriptableObject.CreateInstance<LongFaced>(); } if ((Object)(object)<>4__this.longFaced != (Object)null) { ((Effect)<>4__this.longFaced).ApplyToPlayer(player); } break; case "munchies": if ((Object)(object)<>4__this.munchies == (Object)null) { <>4__this.munchies = ScriptableObject.CreateInstance<Munchies>(); } if ((Object)(object)<>4__this.munchies != (Object)null) { ((Effect)<>4__this.munchies).ApplyToPlayer(player); } break; case "paranoia": if ((Object)(object)<>4__this.paranoia == (Object)null) { <>4__this.paranoia = ScriptableObject.CreateInstance<Paranoia>(); } if ((Object)(object)<>4__this.paranoia != (Object)null) { ((Effect)<>4__this.paranoia).ApplyToPlayer(player); } break; case "refreshing": if ((Object)(object)<>4__this.refreshing == (Object)null) { <>4__this.refreshing = ScriptableObject.CreateInstance<Refreshing>(); } if ((Object)(object)<>4__this.refreshing != (Object)null) { ((Effect)<>4__this.refreshing).ApplyToPlayer(player); } break; case "schizophrenic": if ((Object)(object)<>4__this.schizophrenic == (Object)null) { <>4__this.schizophrenic = ScriptableObject.CreateInstance<Schizophrenic>(); } if ((Object)(object)<>4__this.schizophrenic != (Object)null) { ((Effect)<>4__this.schizophrenic).ApplyToPlayer(player); } break; case "sedating": if ((Object)(object)<>4__this.sedating == (Object)null) { <>4__this.sedating = ScriptableObject.CreateInstance<Sedating>(); } if ((Object)(object)<>4__this.sedating != (Object)null) { ((Effect)<>4__this.sedating).ApplyToPlayer(player); } break; case "seizure_inducing": case "seizureinducing": case "seizure": if ((Object)(object)<>4__this.seizure == (Object)null) { <>4__this.seizure = ScriptableObject.CreateInstance<Seizure>(); } if ((Object)(object)<>4__this.seizure != (Object)null) { ((Effect)<>4__this.seizure).ApplyToPlayer(player); } break; case "shrinking": if ((Object)(object)<>4__this.shrinking == (Object)null) { <>4__this.shrinking = ScriptableObject.CreateInstance<Shrinking>(); } if ((Object)(object)<>4__this.shrinking != (Object)null) { ((Effect)<>4__this.shrinking).ApplyToPlayer(player); } break; case "slippery": if ((Object)(object)<>4__this.slippery == (Object)null) { <>4__this.slippery = ScriptableObject.CreateInstance<Slippery>(); } if ((Object)(object)<>4__this.slippery != (Object)null) { ((Effect)<>4__this.slippery).ApplyToPlayer(player); } break; case "smelly": if ((Object)(object)<>4__this.smelly == (Object)null) { <>4__this.smelly = ScriptableObject.CreateInstance<Smelly>(); } if ((Object)(object)<>4__this.smelly != (Object)null) { ((Effect)<>4__this.smelly).ApplyToPlayer(player); } break; case "sneaky": if ((Object)(object)<>4__this.sneaky == (Object)null) { <>4__this.sneaky = ScriptableObject.CreateInstance<Sneaky>(); } if ((Object)(object)<>4__this.sneaky != (Object)null) { ((Effect)<>4__this.sneaky).ApplyToPlayer(player); } break; case "spicy": if ((Object)(object)<>4__this.spicy == (Object)null) { <>4__this.spicy = ScriptableObject.CreateInstance<Spicy>(); } if ((Object)(object)<>4__this.spicy != (Object)null) { ((Effect)<>4__this.spicy).ApplyToPlayer(player); } break; case "thoughtprovoking": case "thought_provoking": if ((Object)(object)<>4__this.thoughtProvoking == (Object)null) { <>4__this.thoughtProvoking = ScriptableObject.CreateInstance<ThoughtProvoking>(); } if ((Object)(object)<>4__this.thoughtProvoking != (Object)null) { ((Effect)<>4__this.thoughtProvoking).ApplyToPlayer(player); } break; case "toxic": if ((Object)(object)<>4__this.toxic == (Object)null) { <>4__this.toxic = ScriptableObject.CreateInstance<Toxic>(); } if ((Object)(object)<>4__this.toxic != (Object)null) { ((Effect)<>4__this.toxic).ApplyToPlayer(player); } break; case "tropicthunder": case "tropic_thunder": if ((Object)(object)<>4__this.tropicThunder == (Object)null) { <>4__this.tropicThunder = ScriptableObject.CreateInstance<TropicThunder>(); } if ((Object)(object)<>4__this.tropicThunder != (Object)null) { ((Effect)<>4__this.tropicThunder).ApplyToPlayer(player); } break; case "zombifying": if ((Object)(object)<>4__this.zombifying == (Object)null) { <>4__this.zombifying = ScriptableObject.CreateInstance<Zombifying>(); } if ((Object)(object)<>4__this.zombifying != (Object)null) { ((Effect)<>4__this.zombifying).ApplyToPlayer(player); } break; default: MelonLogger.Warning("Property '" + propertyName + "' not found in the available properties."); break; } <>s__1 = null; 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 <RemovePropertyFromPlayerAfterTime>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Player player; public float timeInSeconds; public string propertyName; public PropertyManager <>4__this; private string <>s__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RemovePropertyFromPlayerAfterTime>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)player == (Object)null) { MelonLogger.Warning("Player is null. Cannot remove property."); return false; } <>2__current = (object)new WaitForSeconds(timeInSeconds); <>1__state = 1; return true; case 1: { <>1__state = -1; <>4__this.appliedEffect = null; string text = propertyName.ToLower(); <>s__1 = text; switch (<>s__1) { case "antigravitiy": case "anti_gravity": if ((Object)(object)<>4__this.antiGravity == (Object)null) { <>4__this.antiGravity = ScriptableObject.CreateInstance<AntiGravity>(); } if ((Object)(object)<>4__this.antiGravity != (Object)null) { ((Effect)<>4__this.antiGravity).ClearFromPlayer(player); } break; case "athletic": if ((Object)(object)<>4__this.athletic == (Object)null) { <>4__this.athletic = ScriptableObject.CreateInstance<Athletic>(); } if ((Object)(object)<>4__this.athletic != (Object)null) { ((Effect)<>4__this.athletic).ClearFromPlayer(player); } break; case "balding": if ((Object)(object)<>4__this.balding == (Object)null) { <>4__this.balding = ScriptableObject.CreateInstance<Balding>(); } if ((Object)(object)<>4__this.balding != (Object)null) { ((Effect)<>4__this.balding).ClearFromPlayer(player); } break; case "brighteyed": case "bright_eyed": if ((Object)(object)<>4__this.brightEyed == (Object)null) { <>4__this.brightEyed = ScriptableObject.CreateInstance<BrightEyed>(); } if ((Object)(object)<>4__this.brightEyed != (Object)null) { ((Effect)<>4__this.brightEyed).ClearFromPlayer(player); } break; case "calming": if ((Object)(object)<>4__this.calming == (Object)null) { <>4__this.calming = ScriptableObject.CreateInstance<Calming>(); } if ((Object)(object)<>4__this.calming != (Object)null) { ((Effect)<>4__this.calming).ClearFromPlayer(player); } break; case "caloriedense": case "calorie_dense": if ((Object)(object)<>4__this.calorieDense == (Object)null) { <>4__this.calorieDense = ScriptableObject.CreateInstance<CalorieDense>(); } if ((Object)(object)<>4__this.calorieDense != (Object)null) { ((Effect)<>4__this.calorieDense).ClearFromPlayer(player); } break; case "cyclopean": if ((Object)(object)<>4__this.cyclopean == (Object)null) { <>4__this.cyclopean = ScriptableObject.CreateInstance<Cyclopean>(); } if ((Object)(object)<>4__this.cyclopean != (Object)null) { ((Effect)<>4__this.cyclopean).ClearFromPlayer(player); } break; case "disorienting": if ((Object)(object)<>4__this.disorienting == (Object)null) { <>4__this.disorienting = ScriptableObject.CreateInstance<Disorienting>(); } if ((Object)(object)<>4__this.disorienting != (Object)null) { ((Effect)<>4__this.disorienting).ClearFromPlayer(player); } break; case "electrifying": if ((Object)(object)<>4__this.electrifying == (Object)null) { <>4__this.electrifying = ScriptableObject.CreateInstance<Electrifying>(); } if ((Object)(object)<>4__this.electrifying != (Object)null) { ((Effect)<>4__this.electrifying).ClearFromPlayer(player); } break; case "energizing": if ((Object)(object)<>4__this.energizing == (Object)null) { <>4__this.energizing = ScriptableObject.CreateInstance<Energizing>(); } if ((Object)(object)<>4__this.energizing != (Object)null) { ((Effect)<>4__this.energizing).ClearFromPlayer(player); } break; case "euphoric": if ((Object)(object)<>4__this.euphoric == (Object)null) { <>4__this.euphoric = ScriptableObject.CreateInstance<Euphoric>(); } if ((Object)(object)<>4__this.euphoric != (Object)null) { ((Effect)<>4__this.euphoric).ClearFromPlayer(player); } break; case "explosive": if ((Object)(object)<>4__this.explosive == (Object)null) { <>4__this.explosive = ScriptableObject.CreateInstance<Explosive>(); } if ((Object)(object)<>4__this.explosive != (Object)null) { ((Effect)<>4__this.explosive).ClearFromPlayer(player); } break; case "foggy": if ((Object)(object)<>4__this.foggy == (Object)null) { <>4__this.foggy = ScriptableObject.CreateInstance<Foggy>(); } if ((Object)(object)<>4__this.foggy != (Object)null) { ((Effect)<>4__this.foggy).ClearFromPlayer(player); } break; case "focused": if ((Object)(object)<>4__this.focused == (Object)null) { <>4__this.focused = ScriptableObject.CreateInstance<Focused>(); } if ((Object)(object)<>4__this.focused != (Object)null) { ((Effect)<>4__this.focused).ClearFromPlayer(player); } break; case "gingeritis": if ((Object)(object)<>4__this.gingeritis == (Object)null) { <>4__this.gingeritis = ScriptableObject.CreateInstance<Gingeritis>(); } if ((Object)(object)<>4__this.gingeritis != (Object)null) { ((Effect)<>4__this.gingeritis).ClearFromPlayer(player); } break; case "glowing": case "glowie": if ((Object)(object)<>4__this.glowie == (Object)null) { <>4__this.glowie = ScriptableObject.CreateInstance<Glowie>(); } if ((Object)(object)<>4__this.glowie != (Object)null) { ((Effect)<>4__this.glowie).ClearFromPlayer(player); } break; case "jennerising": if ((Object)(object)<>4__this.jennerising == (Object)null) { <>4__this.jennerising = ScriptableObject.CreateInstance<Jennerising>(); } if ((Object)(object)<>4__this.jennerising != (Object)null) { ((Effect)<>4__this.jennerising).ClearFromPlayer(player); } break; case "laxative": if ((Object)(object)<>4__this.laxative == (Object)null) { <>4__this.laxative = ScriptableObject.CreateInstance<Laxative>(); } if ((Object)(object)<>4__this.laxative != (Object)null) { ((Effect)<>4__this.laxative).ClearFromPlayer(player); } break; case "lethal": if ((Object)(object)<>4__this.lethal == (Object)null) { <>4__this.lethal = ScriptableObject.CreateInstance<Lethal>(); } if ((Object)(object)<>4__this.lethal != (Object)null) { ((Effect)<>4__this.lethal).ClearFromPlayer(player); } break; case "longfaced": case "long_faced": if ((Object)(object)<>4__this.longFaced == (Object)null) { <>4__this.longFaced = ScriptableObject.CreateInstance<LongFaced>(); } if ((Object)(object)<>4__this.longFaced != (Object)null) { ((Effect)<>4__this.longFaced).ClearFromPlayer(player); } break; case "munchies": if ((Object)(object)<>4__this.munchies == (Object)null) { <>4__this.munchies = ScriptableObject.CreateInstance<Munchies>(); } if ((Object)(object)<>4__this.munchies != (Object)null) { ((Effect)<>4__this.munchies).ClearFromPlayer(player); } break; case "paranoia": if ((Object)(object)<>4__this.paranoia == (Object)null) { <>4__this.paranoia = ScriptableObject.CreateInstance<Paranoia>(); } if ((Object)(object)<>4__this.paranoia != (Object)null) { ((Effect)<>4__this.paranoia).ClearFromPlayer(player); } break; case "refreshing": if ((Object)(object)<>4__this.refreshing == (Object)null) { <>4__this.refreshing = ScriptableObject.CreateInstance<Refreshing>(); } if ((Object)(object)<>4__this.refreshing != (Object)null) { ((Effect)<>4__this.refreshing).ClearFromPlayer(player); } break; case "schizophrenic": if ((Object)(object)<>4__this.schizophrenic == (Object)null) { <>4__this.schizophrenic = ScriptableObject.CreateInstance<Schizophrenic>(); } if ((Object)(object)<>4__this.schizophrenic != (Object)null) { ((Effect)<>4__this.schizophrenic).ClearFromPlayer(player); } break; case "sedating": if ((Object)(object)<>4__this.sedating == (Object)null) { <>4__this.sedating = ScriptableObject.CreateInstance<Sedating>(); } if ((Object)(object)<>4__this.sedating != (Object)null) { ((Effect)<>4__this.sedating).ClearFromPlayer(player); } break; case "seizure_inducing": case "seizureinducing": case "seizure": if ((Object)(object)<>4__this.seizure == (Object)null) { <>4__this.seizure = ScriptableObject.CreateInstance<Seizure>(); } if ((Object)(object)<>4__this.seizure != (Object)null) { ((Effect)<>4__this.seizure).ClearFromPlayer(player); } break; case "shrinking": if ((Object)(object)<>4__this.shrinking == (Object)null) { <>4__this.shrinking = ScriptableObject.CreateInstance<Shrinking>(); } if ((Object)(object)<>4__this.shrinking != (Object)null) { ((Effect)<>4__this.shrinking).ClearFromPlayer(player); } break; case "slippery": if ((Object)(object)<>4__this.slippery == (Object)null) { <>4__this.slippery = ScriptableObject.CreateInstance<Slippery>(); } if ((Object)(object)<>4__this.slippery != (Object)null) { ((Effect)<>4__this.slippery).ClearFromPlayer(player); } break; case "smelly": if ((Object)(object)<>4__this.smelly == (Object)null) { <>4__this.smelly = ScriptableObject.CreateInstance<Smelly>(); } if ((Object)(object)<>4__this.smelly != (Object)null) { ((Effect)<>4__this.smelly).ClearFromPlayer(player); } break; case "sneaky": if ((Object)(object)<>4__this.sneaky == (Object)null) { <>4__this.sneaky = ScriptableObject.CreateInstance<Sneaky>(); } if ((Object)(object)<>4__this.sneaky != (Object)null) { ((Effect)<>4__this.sneaky).ClearFromPlayer(player); } break; case "spicy": if ((Object)(object)<>4__this.spicy == (Object)null) { <>4__this.spicy = ScriptableObject.CreateInstance<Spicy>(); } if ((Object)(object)<>4__this.spicy != (Object)null) { ((Effect)<>4__this.spicy).ClearFromPlayer(player); } break; case "thoughtprovoking": case "thought_provoking": if ((Object)(object)<>4__this.thoughtProvoking == (Object)null) { <>4__this.thoughtProvoking = ScriptableObject.CreateInstance<ThoughtProvoking>(); } if ((Object)(object)<>4__this.thoughtProvoking != (Object)null) { ((Effect)<>4__this.thoughtProvoking).ClearFromPlayer(player); } break; case "toxic": if ((Object)(object)<>4__this.toxic == (Object)null) { <>4__this.toxic = ScriptableObject.CreateInstance<Toxic>(); } if ((Object)(object)<>4__this.toxic != (Object)null) { ((Effect)<>4__this.toxic).ClearFromPlayer(player); } break; case "tropicthunder": case "tropic_thunder": if ((Object)(object)<>4__this.tropicThunder == (Object)null) { <>4__this.tropicThunder = ScriptableObject.CreateInstance<TropicThunder>(); } if ((Object)(object)<>4__this.tropicThunder != (Object)null) { ((Effect)<>4__this.tropicThunder).ClearFromPlayer(player); } break; case "zombifying": if ((Object)(object)<>4__this.zombifying == (Object)null) { <>4__this.zombifying = ScriptableObject.CreateInstance<Zombifying>(); } if ((Object)(object)<>4__this.zombifying != (Object)null) { ((Effect)<>4__this.zombifying).ClearFromPlayer(player); } break; default: MelonLogger.Warning("Property '" + propertyName + "' not found in the available properties."); break; } <>s__1 = null; 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 Dictionary<string, Action<Player>> negativeProperties; private readonly Dictionary<string, Action<Player>> positiveProperties; public string appliedEffect = null; public AntiGravity antiGravity; public Athletic athletic; public Balding balding; public BrightEyed brightEyed; public Calming calming; public CalorieDense calorieDense; public Cyclopean cyclopean; public Disorienting disorienting; public Electrifying electrifying; public Energizing energizing; public Euphoric euphoric; public Explosive explosive; public Focused focused; public Foggy foggy; public Gingeritis gingeritis; public Glowie glowie; public Jennerising jennerising; public Laxative laxative; public Lethal lethal; public LongFaced longFaced; public Munchies munchies; public Paranoia paranoia; public Refreshing refreshing; public Schizophrenic schizophrenic; public Sedating sedating; public Seizure seizure; public Shrinking shrinking; public Slippery slippery; public Smelly smelly; public Sneaky sneaky; public Spicy spicy; public ThoughtProvoking thoughtProvoking; public Toxic toxic; public TropicThunder tropicThunder; public Zombifying zombifying; public static Sprite appIconSprite; public Coroutine removeEffectCoroutine = null; public PropertyManager() { positiveProperties = new Dictionary<string, Action<Player>> { { "Anti_Gravity", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<AntiGravity>()).ApplyToPlayer(player); } }, { "Athletic", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Athletic>()).ApplyToPlayer(player); } }, { "Bright_Eyed", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<BrightEyed>()).ApplyToPlayer(player); } }, { "Calming", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Calming>()).ApplyToPlayer(player); } }, { "Calorie_Dense", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<CalorieDense>()).ApplyToPlayer(player); } }, { "Electrifying", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Electrifying>()).ApplyToPlayer(player); } }, { "Energizing", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Energizing>()).ApplyToPlayer(player); } }, { "Euphoric", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Euphoric>()).ApplyToPlayer(player); } }, { "Focused", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Focused>()).ApplyToPlayer(player); } }, { "Munchies", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Munchies>()).ApplyToPlayer(player); } }, { "Refreshing", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Refreshing>()).ApplyToPlayer(player); } }, { "Sneaky", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Sneaky>()).ApplyToPlayer(player); } } }; negativeProperties = new Dictionary<string, Action<Player>> { { "Balding", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Balding>()).ApplyToPlayer(player); } }, { "Bright_Eyed", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<BrightEyed>()).ApplyToPlayer(player); } }, { "Calming", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Calming>()).ApplyToPlayer(player); } }, { "Calorie_Dense", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<CalorieDense>()).ApplyToPlayer(player); } }, { "Cyclopean", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Cyclopean>()).ApplyToPlayer(player); } }, { "Disorienting", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Disorienting>()).ApplyToPlayer(player); } }, { "Electrifying", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Electrifying>()).ApplyToPlayer(player); } }, { "Explosive", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Explosive>()).ApplyToPlayer(player); } }, { "Foggy", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Foggy>()).ApplyToPlayer(player); } }, { "Gingeritis", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Gingeritis>()).ApplyToPlayer(player); } }, { "Glowing", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Glowie>()).ApplyToPlayer(player); } }, { "Laxative", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Laxative>()).ApplyToPlayer(player); } }, { "Long_Faced", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<LongFaced>()).ApplyToPlayer(player); } }, { "Paranoia", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Paranoia>()).ApplyToPlayer(player); } }, { "Sedating", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Sedating>()).ApplyToPlayer(player); } }, { "Seizure_Inducing", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Seizure>()).ApplyToPlayer(player); } }, { "Shrinking", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Shrinking>()).ApplyToPlayer(player); } }, { "Slippery", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Slippery>()).ApplyToPlayer(player); } }, { "Smelly", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Smelly>()).ApplyToPlayer(player); } }, { "Spicy", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Spicy>()).ApplyToPlayer(player); } }, { "Lethal", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Lethal>()).ApplyToPlayer(player); } }, { "Jennerising", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Jennerising>()).ApplyToPlayer(player); } }, { "Schizophrenic", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Schizophrenic>()).ApplyToPlayer(player); } }, { "Thought_Provoking", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<ThoughtProvoking>()).ApplyToPlayer(player); } }, { "Toxic", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Toxic>()).ApplyToPlayer(player); } }, { "Tropic_Thunder", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<TropicThunder>()).ApplyToPlayer(player); } }, { "Zombifying", delegate(Player player) { ((Effect)ScriptableObject.CreateInstance<Zombifying>()).ApplyToPlayer(player); } } }; } public void ApplyNegativePropertyToPlayer(Player player, string propertyName = null) { //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown if ((Object)(object)player == (Object)null) { MelonLogger.Warning("Player is null. Cannot apply property."); return; } if (MRSCore.Instance.config == null || MRSCore.Instance.config.EffectSettings == null) { MelonLogger.Warning("Config or EffectSettings is null. Cannot apply property."); return; } try { if (string.IsNullOrEmpty(propertyName)) { List<string> list = new List<string>(); foreach (string key in negativeProperties.Keys) { if (ConfigManager.GetNegativePropertyValue(MRSCore.Instance.config, key)) { list.Add(key); } } if (list.Count == 0) { MelonLogger.Warning("No enabled negative properties found in the config."); return; } Random random = new Random(); propertyName = list[random.Next(list.Count)]; } if (!ConfigManager.GetNegativePropertyValue(MRSCore.Instance.config, propertyName)) { MelonLogger.Msg("Property '" + propertyName + "' is disabled in the config. Skipping."); } else if (appliedEffect == null) { MelonCoroutines.Start(AddPropertyToPlayer(player, propertyName)); MelonLogger.Msg("Applied '" + propertyName + "' to player: " + ((Object)player).name); appliedEffect = propertyName; float num = MRSCore.Instance.config.SleepSettings.Negative_Effects_Duration; if (num <= 0f || float.IsNaN(num)) { num = 60f; } if (MRSCore.Instance.config.SleepSettings.Enable_Effect_Notifications) { string text = FormatPropertyName(propertyName); Sprite val = LoadSpriteFromUserData(text); MRSCore.Instance.notificationsManager.SendNotification("Negative Effect", text ?? "", val, num, true); } removeEffectCoroutine = (Coroutine)MelonCoroutines.Start(RemovePropertyFromPlayerAfterTime(player, num, appliedEffect)); } } catch (Exception ex) { MelonLogger.Error("Error while applying property: " + ex.Message + "\n" + ex.StackTrace); } } public void ApplyPositivePropertyToPlayer(Player player, string propertyName = null) { if ((Object)(object)player == (Object)null) { MelonLogger.Warning("Player is null. Cannot apply property."); return; } if (MRSCore.Instance.config == null || MRSCore.Instance.config.EffectSettings == null) { MelonLogger.Warning("Config or EffectSettings is null. Cannot apply property."); return; } try { if (string.IsNullOrEmpty(propertyName)) { List<string> list = new List<string>(); foreach (string key in positiveProperties.Keys) { if (ConfigManager.GetPositivePropertyValue(MRSCore.Instance.config, key)) { list.Add(key); } } if (list.Count == 0) { MelonLogger.Warning("No enabled positive properties found in the config."); return; } Random random = new Random(); propertyName = list[random.Next(list.Count)]; } if (!ConfigManager.GetPositivePropertyValue(MRSCore.Instance.config, propertyName)) { MelonLogger.Warning("Property '" + propertyName + "' is disabled in the config. Skipping."); return; } if (appliedEffect != null) { MelonLogger.Warning($"Property '{appliedEffect}' is already applied to player: {((Object)player).name}. Skipping."); return; } MelonCoroutines.Start(AddPropertyToPlayer(player, propertyName)); appliedEffect = propertyName; float num = MRSCore.Instance.config.SleepSettings.Positive_Effects_Duration; if (num <= 0f || float.IsNaN(num)) { num = 60f; } MelonLogger.Msg($"Applied {propertyName} to player: {((Object)player).name} for {num} seconds."); if (MRSCore.Instance.config.SleepSettings.Enable_Effect_Notifications) { string text = FormatPropertyName(propertyName); Sprite val = LoadSpriteFromUserData(text); MRSCore.Instance.notificationsManager.SendNotification("Positive Effect", text ?? "", val, num, true); } MelonCoroutines.Start(RemovePropertyFromPlayerAfterTime(player, num, appliedEffect)); } catch (Exception ex) { MelonLogger.Error("Error while applying property: " + ex.Message + "\n" + ex.StackTrace); } } public static string FormatPropertyName(string propertyName) { if (string.IsNullOrEmpty(propertyName)) { return string.Empty; } string text = propertyName.Replace("_", " "); return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text.ToLower()); } [IteratorStateMachine(typeof(<RemovePropertyFromPlayerAfterTime>d__7))] public IEnumerator RemovePropertyFromPlayerAfterTime(Player player, float timeInSeconds, string propertyName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RemovePropertyFromPlayerAfterTime>d__7(0) { <>4__this = this, player = player, timeInSeconds = timeInSeconds, propertyName = propertyName }; } [IteratorStateMachine(typeof(<AddPropertyToPlayer>d__8))] public IEnumerator AddPropertyToPlayer(Player player, string propertyName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AddPropertyToPlayer>d__8(0) { <>4__this = this, player = player, propertyName = propertyName }; } private static Sprite LoadSpriteFromUserData(string fileName) { Sprite val = EmbeddedAssets.LoadEffectSprite(fileName); if ((Object)(object)val != (Object)null) { return val; } if ((Object)(object)appIconSprite == (Object)null) { appIconSprite = EmbeddedAssets.LoadAppIcon(); } return appIconSprite; } } namespace MoreRealisticSleeping { public class MRSCore : MelonMod { [CompilerGenerated] private sealed class <DelayDailySummaryPress>d__50 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public MRSCore <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayDailySummaryPress>d__50(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 WaitForSeconds(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; Instance.dailySummary = Object.FindObjectOfType<DailySummary>(); if ((Object)(object)Instance.dailySummary != (Object)null) { ((UnityEvent)((Component)((Component)Instance.dailySummary).transform.Find("Container/Continue")).GetComponent<Button>().onClick).Invoke(); Instance.dailySummary.SleepEnd(); Instance.dailySummary.Close(); } else { ((MelonBase)<>4__this).LoggerInstance.Error("Could not find DailySummary instance."); } 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 <ForceSleepDelay>d__48 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; private float <delayTime>5__1; private float <elapsedTime>5__2; private Player[] <players>5__3; private Player[] <>s__4; private int <>s__5; private Player <player>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ForceSleepDelay>d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <players>5__3 = null; <>s__4 = null; <player>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <delayTime>5__1 = Instance.config.SleepSettings.Forced_Sleep_Delay; if (<delayTime>5__1 <= 0f) { ((MelonBase)<>4__this).LoggerInstance.Msg("Forced_Sleep_Delay is set to 0 or less. Skipping delay and triggering forced sleep immediately."); <>4__this.ForceSleep(); if (<>4__this.startCooldownCoroutine == null) { <>4__this.startCooldownCoroutine = (Coroutine)MelonCoroutines.Start(<>4__this.StartCooldown()); } <>4__this.forceSleepDelayCoroutine = null; return false; } ((MelonBase)<>4__this).LoggerInstance.Msg($"Force sleep delay started for {<delayTime>5__1} seconds."); if ((Object)(object)<>4__this.localPlayer == (Object)null) { <players>5__3 = Il2CppArrayBase<Player>.op_Implicit(Object.FindObjectsOfType<Player>()); <>s__4 = <players>5__3; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { <player>5__6 = <>s__4[<>s__5]; if (<player>5__6.IsLocalPlayer) { <>4__this.localPlayer = <player>5__6; break; } <player>5__6 = null; } <>s__4 = null; <players>5__3 = null; } if ((Object)(object)<>4__this.localPlayer == (Object)null) { MelonLogger.Error("Local player not found. Cannot proceed with forced sleep."); <>4__this.forceSleepDelayCoroutine = null; return false; } <elapsedTime>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsedTime>5__2 < <delayTime>5__1) { if (<>4__this.localPlayer.IsSleeping || <>4__this.localPlayer.IsReadyToSleep) { ((MelonBase)<>4__this).LoggerInstance.Msg("Player is already sleeping. Force sleep canceled."); <>4__this.forceSleepDelayCoroutine = null; return false; } <elapsedTime>5__2 += 1f; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } ((MelonBase)<>4__this).LoggerInstance.Msg("Force sleep delay ended. Triggering forced sleep."); <>4__this.ForceSleep(); if (<>4__this.startCooldownCoroutine == null) { <>4__this.startCooldownCoroutine = (Coroutine)MelonCoroutines.Start(<>4__this.StartCooldown()); } <>4__this.forceSleepDelayCoroutine = null; 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 <InitTimeManager>d__43 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitTimeManager>d__43(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)<>4__this.timeManager == (Object)null) { <>4__this.timeManager = Object.FindObjectOfType<TimeManager>(); if (!((Object)(object)<>4__this.timeManager != (Object)null)) { <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; } Instance.sleepCanvas = Object.FindObjectOfType<SleepCanvas>(); if ((Object)(object)Instance.sleepCanvas != (Object)null && <>4__this.isFirstSleep) { Instance.sleepCanvas.onSleepEndFade.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsOtherFunc)); Instance.sleepCanvas.onSleepEndFade.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsCooldownFunc)); <>4__this.isFirstSleep = false; } <>4__this.monitorTimeForSleepCoroutine = (Coroutine)MelonCoroutines.Start(<>4__this.MonitorTimeForSleep()); } return false; void FuncThatCallsCooldownFunc() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (Instance.startCooldownCoroutine == null && !Instance.isStartCooldownRunning) { Instance.startCooldownCoroutine = (Coroutine)MelonCoroutines.Start(StartCooldown()); } } void FuncThatCallsOtherFunc() { TriggerAfterSleepEffect(); } } 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 <InitializeLocalPlayer>d__44 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeLocalPlayer>d__44(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; MelonLogger.Msg("Searching for local player..."); break; case 1: <>1__state = -1; break; } while ((Object)(object)<>4__this.localPlayer == (Object)null) { <>4__this.localPlayer = ((IEnumerable<Player>)Object.FindObjectsOfType<Player>())?.FirstOrDefault((Func<Player, bool>)((Player player) => player.IsLocalPlayer)); if ((Object)(object)<>4__this.localPlayer == (Object)null) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } } <>4__this.localPlayerCrimeData = <>4__this.localPlayer.CrimeData; MelonLogger.Msg("Local player found: " + ((Object)<>4__this.localPlayer).name); <>4__this.initLocalPlayerCoroutine = null; 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 <MonitorTimeForSleep>d__46 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MonitorTimeForSleep>d__46(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isMonitorTimeForSleepRunning = true; ((MelonBase)<>4__this).LoggerInstance.Msg("Monitoring time for sleep..."); break; case 1: <>1__state = -1; break; } if ((Object)(object)<>4__this.timeManager != (Object)null) { if (400 <= <>4__this.timeManager.CurrentTime && <>4__this.timeManager.CurrentTime < 650 && <>4__this.canTriggerSleep && !<>4__this.isStartCooldownRunning) { if (Instance.config.SleepSettings.Enable_Forced_Sleep) { if (<>4__this.forceSleepDelayCoroutine == null) { ((MelonBase)<>4__this).LoggerInstance.Msg("Triggering sleep delay as CurrentTime is 4:00AM."); <>4__this.forceSleepDelayCoroutine = (Coroutine)MelonCoroutines.Start(<>4__this.ForceSleepDelay()); } } else { ((MelonBase)<>4__this).LoggerInstance.Msg("Forced sleep is disabled in the config."); if (<>4__this.startCooldownCoroutine == null) { <>4__this.startCooldownCoroutine = (Coroutine)MelonCoroutines.Start(<>4__this.StartCooldown()); } } } } else { ((MelonBase)<>4__this).LoggerInstance.Warning("TimeManager is null. Waiting for initialization..."); } <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; 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 <StartAppCoroutinesAfterDelay>d__47 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; private bool <delayedInit>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartAppCoroutinesAfterDelay>d__47(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <delayedInit>5__1 = false; break; case 1: <>1__state = -1; break; } if (!<delayedInit>5__1 && !<>4__this.isLegitVersion) { <delayedInit>5__1 = true; <>2__current = (object)new WaitForSeconds(7f); <>1__state = 1; return true; } if (!<>4__this.isLegitVersion) { if (<>4__this.initializeLaunderAppCoroutine == null) { <>4__this.initializeLaunderAppCoroutine = (Coroutine)MelonCoroutines.Start(sleepingApp.InitializeLaunderApp()); } else { ((MelonBase)<>4__this).LoggerInstance.Msg("InitializeLaunderApp coroutine is already running. Skipping initialization."); } if (<>4__this.waitForSleepingAppCoroutine == null) { <>4__this.waitForSleepingAppCoroutine = (Coroutine)MelonCoroutines.Start(<>4__this.WaitForSleepingAppAndCreateEntry()); } else { ((MelonBase)<>4__this).LoggerInstance.Msg("WaitForSleepingAppAndCreateEntry coroutine is already running. Skipping initialization."); } } 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 <StartCooldown>d__51 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; private float <cooldownTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartCooldown>d__51(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this.isCooldownActive || <>4__this.isStartCooldownRunning || <>4__this.startCooldownCoroutine != null) { return false; } <>4__this.isStartCooldownRunning = true; <cooldownTime>5__1 = Instance.config.SleepSettings.Cooldown_Time; if (<cooldownTime>5__1 <= 10f) { ((MelonBase)<>4__this).LoggerInstance.Error("Cooldown time is not set or invalid. Using default (300sec)."); <cooldownTime>5__1 = 300f; } <>4__this.isCooldownActive = true; ((MelonBase)<>4__this).LoggerInstance.Msg($"Started {<cooldownTime>5__1}sec cooldown before next sleep can be triggered."); <>4__this.canTriggerSleep = false; <>2__current = (object)new WaitForSeconds(<cooldownTime>5__1); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.canTriggerSleep = true; <>4__this.isCooldownActive = false; <>4__this.isStartCooldownRunning = false; ((MelonBase)<>4__this).LoggerInstance.Msg("Cooldown ended. Sleep triggering is now enabled again."); <>4__this.startCooldownCoroutine = null; 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 <WaitForSleepingAppAndCreateEntry>d__53 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MRSCore <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForSleepingAppAndCreateEntry>d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!sleepingApp._isSleepingAppLoaded) { <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; } <>4__this.CreateAppEntries(); 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(); } } public bool isLegitVersion = false; public bool canTriggerSleep = true; private bool isCooldownActive = false; private bool isForcedSleep = false; private bool isFirstSleep = true; public SleepCanvas sleepCanvas; public DailySummary dailySummary; public TimeManager timeManager = null; public ConfigState config = null; public NotificationsManager notificationsManager; public MoneyManager moneyManager; public PropertyManager propertyManager; public MoreRealisticSleeping.EventManager.EventManager eventManager; public static SleepingApp sleepingApp = new SleepingApp(); public bool isMonitorTimeForSleepRunning = false; public bool isStartCooldownRunning = false; public Coroutine monitorTimeForSleepCoroutine; public Coroutine startCooldownCoroutine; public Coroutine forceSleepDelayCoroutine; public Coroutine initializeLaunderAppCoroutine; public Coroutine waitForSleepingAppCoroutine; public Coroutine startAppCoroutinesAfterDelayCoroutine; public Coroutine initTimeManagerCoroutine; public Coroutine initLocalPlayerCoroutine; public Coroutine murderPlayerCoroutine; public Coroutine onLocalPlayerInitializedCoroutine; private bool isFirstStart = true; private string sSceneName = null; public static MRSCore Instance { get; private set; } public Player localPlayer { get; private set; } public PlayerCrimeData localPlayerCrimeData { get; private set; } public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("Initialized."); Instance = this; } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown if (sceneName == "Main") { isFirstStart = false; sSceneName = sceneName.ToString(); Instance.config = ConfigManager.Load(); Instance.propertyManager = new PropertyManager(); Instance.moneyManager = Object.FindObjectOfType<MoneyManager>(); Instance.notificationsManager = Object.FindObjectOfType<NotificationsManager>(); Instance.eventManager = new MoreRealisticSleeping.EventManager.EventManager(); if (Instance.config.Use_Legit_Version) { ((MelonBase)this).LoggerInstance.Msg("Use_Legit_Version is enabled. Adjusting behavior accordingly."); isLegitVersion = true; } else { ((MelonBase)this).LoggerInstance.Msg("Use_Legit_Version is disabled. Proceeding with default behavior."); startAppCoroutinesAfterDelayCoroutine = (Coroutine)MelonCoroutines.Start(StartAppCoroutinesAfterDelay()); } initLocalPlayerCoroutine = (Coroutine)MelonCoroutines.Start(InitializeLocalPlayer()); initTimeManagerCoroutine = (Coroutine)MelonCoroutines.Start(InitTimeManager()); if (!Singleton<Lobby>.Instance.IsHost) { } } else if (sceneName.Equals("Menu", StringComparison.OrdinalIgnoreCase) && !isFirstStart) { sSceneName = sceneName.ToString(); ResetAllVariables(); isFirstStart = false; if (!Singleton<Lobby>.Instance.IsHost) { } } } private void ResetAllVariables() { if (initializeLaunderAppCoroutine != null) { MelonCoroutines.Stop((object)initializeLaunderAppCoroutine); initializeLaunderAppCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped InitializeLaunderApp coroutine."); } if (waitForSleepingAppCoroutine != null) { MelonCoroutines.Stop((object)waitForSleepingAppCoroutine); waitForSleepingAppCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped WaitForSleepingAppAndCreateEntry coroutine."); } if (startAppCoroutinesAfterDelayCoroutine != null) { MelonCoroutines.Stop((object)startAppCoroutinesAfterDelayCoroutine); startAppCoroutinesAfterDelayCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped StartAppCoroutinesAfterDelay coroutine."); } if (initTimeManagerCoroutine != null) { MelonCoroutines.Stop((object)initTimeManagerCoroutine); initTimeManagerCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped InitTimeManager coroutine."); } if (propertyManager != null && propertyManager.removeEffectCoroutine != null) { MelonCoroutines.Stop((object)propertyManager.removeEffectCoroutine); propertyManager.removeEffectCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped RemoveEffect coroutine."); } if (murderPlayerCoroutine != null) { MelonCoroutines.Stop((object)murderPlayerCoroutine); murderPlayerCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped MurderPlayer coroutine."); } StopAllCoroutines(); Instance.config = null; isLegitVersion = false; timeManager = null; sleepCanvas = null; dailySummary = null; eventManager = null; localPlayer = null; isFirstSleep = true; isForcedSleep = false; canTriggerSleep = true; isCooldownActive = false; propertyManager = null; notificationsManager = null; moneyManager = null; isMonitorTimeForSleepRunning = false; isStartCooldownRunning = false; sleepingApp._isSleepingAppLoaded = false; ((MelonBase)this).LoggerInstance.Msg("All variables reset."); } [IteratorStateMachine(typeof(<InitTimeManager>d__43))] public IEnumerator InitTimeManager() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitTimeManager>d__43(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<InitializeLocalPlayer>d__44))] private IEnumerator InitializeLocalPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeLocalPlayer>d__44(0) { <>4__this = this }; } public void StopAllCoroutines() { if (forceSleepDelayCoroutine != null) { MelonCoroutines.Stop((object)forceSleepDelayCoroutine); ((MelonBase)this).LoggerInstance.Msg("Stopped ForceSleepDelay coroutine."); forceSleepDelayCoroutine = null; } if (monitorTimeForSleepCoroutine != null) { MelonCoroutines.Stop((object)monitorTimeForSleepCoroutine); monitorTimeForSleepCoroutine = null; isMonitorTimeForSleepRunning = false; ((MelonBase)this).LoggerInstance.Msg("Stopped MonitorTimeForSleep coroutine."); } if (startCooldownCoroutine != null) { MelonCoroutines.Stop((object)startCooldownCoroutine); startCooldownCoroutine = null; isStartCooldownRunning = false; ((MelonBase)this).LoggerInstance.Msg("Stopped StartCooldown coroutine."); } if (initLocalPlayerCoroutine != null) { MelonCoroutines.Stop((object)initLocalPlayerCoroutine); initLocalPlayerCoroutine = null; ((MelonBase)this).LoggerInstance.Msg("Stopped InitializeLocalPlayer coroutine."); } isForcedSleep = false; canTriggerSleep = true; isCooldownActive = false; } [IteratorStateMachine(typeof(<MonitorTimeForSleep>d__46))] public IEnumerator MonitorTimeForSleep() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MonitorTimeForSleep>d__46(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<StartAppCoroutinesAfterDelay>d__47))] public IEnumerator StartAppCoroutinesAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartAppCoroutinesAfterDelay>d__47(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<ForceSleepDelay>d__48))] private IEnumerator ForceSleepDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ForceSleepDelay>d__48(0) { <>4__this = this }; } private void ForceSleep() { if (!canTriggerSleep) { ((MelonBase)this).LoggerInstance.Msg("TriggerSleep() is on cooldown. Skipping execution."); return; } try { if ((Object)(object)Instance.sleepCanvas == (Object)null) { Instance.sleepCanvas = Object.FindObjectOfType<SleepCanvas>(); } if ((Object)(object)Instance.sleepCanvas != (Object)null) { if (isFirstSleep) { Instance.sleepCanvas.onSleepEndFade.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsOtherFunc)); Instance.sleepCanvas.onSleepEndFade.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsCooldownFunc)); isFirstSleep = false; } canTriggerSleep = false; Instance.sleepCanvas.SetIsOpen(true); Instance.sleepCanvas.SleepStart(); if (Instance.config.SleepSettings.Auto_Skip_Daily_Summary) { MelonCoroutines.Start(DelayDailySummaryPress(3f)); } isForcedSleep = true; } else { ((MelonBase)this).LoggerInstance.Error("Could not find SleepCanvas instance."); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Error in TriggerSleep: " + ex.Message + "\n" + ex.StackTrace); } void FuncThatCallsCooldownFunc() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (Instance.startCooldownCoroutine == null && !Instance.isStartCooldownRunning) { Instance.startCooldownCoroutine = (Coroutine)MelonCoroutines.Start(StartCooldown()); } } void FuncThatCallsOtherFunc() { TriggerAfterSleepEffect(); } } [IteratorStateMachine(typeof(<DelayDailySummaryPress>d__50))] public IEnumerator DelayDailySummaryPress(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayDailySummaryPress>d__50(0) { <>4__this = this, seconds = seconds }; } [IteratorStateMachine(typeof(<StartCooldown>d__51))] public IEnumerator StartCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartCooldown>d__51(0) { <>4__this = this }; } private void TriggerAfterSleepEffect() { //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown if (isForcedSleep) { if (Instance.config.SleepSettings.Enable_Negative_Effects) { Player[] array = Il2CppArrayBase<Player>.op_Implicit(Object.FindObjectsOfType<Player>()); Player[] array2 = array; foreach (Player val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { float num = Instance.config.SleepSettings.Negative_Effects_Probability / 100f; Random random = new Random(); if (random.NextDouble() <= (double)num) { propertyManager.ApplyNegativePropertyToPlayer(val); } else { ((MelonBase)this).LoggerInstance.Msg("No negative effect applied due to probability."); } isForcedSleep = false; } else { ((MelonBase)this).LoggerInstance.Error("Player or Player GameObject is null."); } } } else { ((MelonBase)this).LoggerInstance.Msg("Negative effects are disabled in the config."); } if (Instance.config.ArrestedEventSettings.Enable_GetArrested_Event) { if ((Object)(object)localPlayer != (Object)null && (Object)(object)((Component)localPlayer).gameObject != (Object)null) { float num2 = Instance.config.ArrestedEventSettings.GetArrested_Event_Probability / 100f; Random random2 = new Random(); if (random2.NextDouble() <= (double)num2) { if (Instance.config.ArrestedEventSettings.Enable_GetArrested_Event_SaveSpaces && eventManager.IsPlayerNearSaveProperty()) { ((MelonBase)this).LoggerInstance.Msg("Not arrested due to save space proximity."); return; } eventManager.AddNewPublicSleepingCrime(); localPlayer.Arrest_Server(); } else { ((MelonBase)this).LoggerInstance.Msg("Not arrested due to probability."); } isForcedSleep = false; } else { ((MelonBase)this).LoggerInstance.Error("Player or Player GameObject is null."); } } else { ((MelonBase)this).LoggerInstance.Msg("Arrested Event is disabled in the config."); } if (Instance.config.MurderedEventSettings.Enable_GetMurdered_Event) { if (!((Object)(object)localPlayer != (Object)null) || !((Object)(object)((Component)localPlayer).gameObject != (Object)null)) { return; } float num3 = Instance.config.MurderedEventSettings.GetMurdered_Event_Probability / 100f; Random random3 = new Random(); if (random3.NextDouble() <= (double)num3) { if (Instance.config.MurderedEventSettings.Enable_GetMurdered_Event_SaveSpaces && eventManager.IsPlayerNearSaveProperty()) { ((MelonBase)this).LoggerInstance.Msg("Not murdered due to save space proximity."); } else { murderPlayerCoroutine = (Coroutine)MelonCoroutines.Start(eventManager.MurderPlayer()); } } } else { ((MelonBase)this).LoggerInstance.Msg("Murdered Event is disabled in the config."); } } else if (Instance.config.SleepSettings.Enable_Positive_Effects) { Player[] array3 = Il2CppArrayBase<Player>.op_Implicit(Object.FindObjectsOfType<Player>()); Player[] array4 = array3; foreach (Player val2 in array4) { if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null) { float num4 = Instance.config.SleepSettings.Positive_Effects_Probability / 100f; Random random4 = new Random(); if (random4.NextDouble() <= (double)num4) { propertyManager.ApplyPositivePropertyToPlayer(val2); } else { ((MelonBase)this).LoggerInstance.Msg("No positive effect applied due to probability."); } } else { ((MelonBase)this).LoggerInstance.Error("Player or Player GameObject is null."); } } } else { ((MelonBase)this).LoggerInstance.Msg("Positive effects are disabled in the config."); } } [IteratorStateMachine(typeof(<WaitForSleepingAppAndCreateEntry>d__53))] private IEnumerator WaitForSleepingAppAndCreateEntry() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForSleepingAppAndCreateEntry>d__53(0) { <>4__this = this }; } public void CreateAppEntries() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0047: Expected O, but got Unknown if (!isLegitVersion) { if (!sleepingApp._isSleepingAppLoaded && waitForSleepingAppCoroutine == null) { waitForSleepingAppCoroutine = (Coroutine)MelonCoroutines.Start(WaitForSleepingAppAndCreateEntry()); return; } sleepingApp.AddEntryFromTemplate("GeneralSettingsSection", "General Settings", "~Forced Sleep, Enable/Disable Effects, Probabilitys, Durations~", null, Color32.op_Implicit(ColorUtil.GetColor("Cyan")), EmbeddedAssets.LoadUIElementSprite("Settings")); sleepingApp.AddEntryFromTemplate("PositiveEffectsSection", "Positive Effects", "~Choose positive Early-Sleep-Effects~", null, Color32.op_Implicit(ColorUtil.GetColor("Cyan")), EmbeddedAssets.LoadUIElementSprite("PositiveEffects")); sleepingApp.AddEntryFromTemplate("NegativeEffectsSection", "Negative Effects", "~Choose negative Forced-Sleep-Effects~", null, Color32.op_Implicit(ColorUtil.GetColor("Cyan")), EmbeddedAssets.LoadUIElementSprite("NegativeEffects")); sleepingApp.AddEntryFromTemplate("ArrestedEventSection", "Arrested Event", "~Adjust settings for the Arrested Event~", null, Color32.op_Implicit(ColorUtil.GetColor("Cyan")), EmbeddedAssets.LoadUIElementSprite("ArrestedEvent")); sleepingApp.AddEntryFromTemplate("MurderedEventSection", "Murdered Event", "~Adjust settings for the Murdered Event~", null, Color32.op_Implicit(ColorUtil.GetColor("Cyan")), EmbeddedAssets.LoadUIElementSprite("MurderedEvent")); } } public void ChangeAppIconImage(GameObject appIcon, Sprite iconSprite) { if ((Object)(object)iconSprite == (Object)null) { ((MelonBase)this).LoggerInstance.Msg("Icon sprite is null, skipping image change."); return; } Transform val = appIcon.transform.Find("Mask/Image"); GameObject val2 = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); if (!((Object)(object)val2 == (Object)null)) { Image component = val2.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { component.sprite = iconSprite; } } } public void RegisterApp(GameObject App, string Title = "Unknown App") { GameObject val = GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/AppIcons"); App.transform.SetParent(val.transform, false); ((MelonBase)this).LoggerInstance.Msg("Added " + Title + " to Homescreen."); } } } namespace MoreRealisticSleeping.Util { public static class FontLoader { [CompilerGenerated] private sealed class <InitializeFonts>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeFonts>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; openSansBold = FindFontFromOtherApp("openSansBold"); openSansSemiBold = FindFontFromOtherApp("openSansSemiBold"); 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(); } } public static Font openSansBold; public static bool openSansBoldIsInitialized; public static Font openSansSemiBold; public static bool openSansSemiBoldIsInitialized; [IteratorStateMachine(typeof(<InitializeFonts>d__0))] public static IEnumerator InitializeFonts() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeFonts>d__0(0); } public static Font FindFontFromOtherApp(string fontName) { Font result = Resources.GetBuiltinResource<Font>("Arial.ttf"); if (fontName == "openSansBold") { GameObject appCanvasByName = Utils.GetAppCanvasByName("ProductManagerApp/Container/Topbar"); Text componentInChildren = appCanvasByName.GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { result = componentInChildren.font; openSansBoldIsInitialized = true; } else { MelonLogger.Msg("openSansBold Font not found"); } return result; } if (fontName == "openSansSemiBold") { GameObject appCanvasByName2 = Utils.GetAppCanvasByName("DeliveryApp/Container/Scroll View/Viewport/Content/Albert Hoover/Header"); Text componentInChildren2 = appCanvasByName2.GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren2 != (Object)null) { result = componentInChildren2.font; openSansSemiBoldIsInitialized = true; } else { MelonLogger.Msg("openSansSemiBold Font not found"); } return result; } return Resources.GetBuiltinResource<Font>("Arial.ttf"); } } public static class ColorUtil { public static Dictionary<string, Color32> GetColors() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_008d: 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_00c5: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) return new Dictionary<string, Color32> { { "Dark Blue", new Color32((byte)33, (byte)64, (byte)115, byte.MaxValue) }, { "Light Blue", new Color32((byte)83, (byte)126, (byte)158, byte.MaxValue) }, { "Light Purple", new Color32((byte)87, (byte)82, (byte)153, (byte)127) }, { "Purple", new Color32((byte)108, (byte)35, (byte)114, byte.MaxValue) }, { "Bright Green", new Color32((byte)85, (byte)198, (byte)30, byte.MaxValue) }, { "Olive Green", new Color32((byte)67, (byte)99, (byte)33, byte.MaxValue) }, { "Dark Green", new Color32((byte)91, (byte)127, (byte)9, byte.MaxValue) }, { "Cyan", new Color32((byte)9, (byte)115, (byte)119, byte.MaxValue) }, { "Dark Red", new Color32((byte)99, (byte)33, (byte)37, byte.MaxValue) }, { "Yellow", new Color32((byte)208, (byte)174, (byte)54, byte.MaxValue) }, { "Orange", new Color32((byte)178, (byte)78, (byte)44, byte.MaxValue) }, { "Grey", new Color32((byte)49, (byte)49, (byte)49, byte.MaxValue) }, { "Light Grey", new Color32((byte)90, (byte)90, (byte)90, byte.MaxValue) }, { "Ultra Light Grey", new Color32((byte)150, (byte)150, (byte)150, byte.MaxValue) }, { "Dark Grey", new Color32((byte)30, (byte)30, (byte)30, byte.MaxValue) }, { "Redpurple", new Color32((byte)112, (byte)21, (byte)37, byte.MaxValue) }, { "White", new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) }, { "Black", new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue) } }; } public static Color32 GetColor(string colorName) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, Color32> colors = GetColors(); if (colors.TryGetValue(colorName, out var value)) { return value; } throw new KeyNotFoundException("Color '" + colorName + "' not found."); } } public static class Utils { [CompilerGenerated] private sealed class <WaitForObject>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; public Action<GameObject> callback; public float timeout; private GameObject <obj>5__1; private float <timer>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForObject>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <obj>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <obj>5__1 = null; <timer>5__2 = 0f; break; case 1: <>1__state = -1; <timer>5__2 += 0.1f; break; } if ((Object)(object)<obj>5__1 == (Object)null && <timer>5__2 < timeout) { <obj>5__1 = GameObject.Find(path); if (!((Object)(object)<obj>5__1 != (Object)null)) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } } callback?.Invoke(<obj>5__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(); } } [CompilerGenerated] private sealed class <WaitForObjectByFrame>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; public Action<GameObject> callback; private GameObject <obj>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForObjectByFrame>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <obj>5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <obj>5__1 = null; break; case 1: <>1__state = -1; break; } if ((Object)(object)<obj>5__1 == (Object)null) { <obj>5__1 = GameObject.Find(path); <>2__current = null; <>1__state = 1; return true; } callback?.Invoke(<obj>5__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(); } } public static GameObject GetAppIconByName(string Name, int? Index, string newObjectName = null) { int valueOrDefault = Index.GetValueOrDefault(); GameObject[] array = (from t in (IEnumerable<Transform>)GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/AppIcons/").GetComponentsInChildren<Transform>(true) let labelTransform = ((Component)t).gameObject.transform.Find("Label") let textComponent = ((Object)(object)labelTransform != (Object)null) ? ((Component)labelTransform).GetComponent<Text>() : null where (Object)(object)textComponent != (Object)null && textComponent.text != null && textComponent.text.StartsWith(Name) select ((Component)t).gameObject).ToArray(); if (valueOrDefault >= array.Length) { MelonLogger.Error($"Index {valueOrDefault} is out of range. Returning null."); return null; } GameObject val = array[valueOrDefault]; if (newObjectName != null) { ((Object)val).name = newObjectName; } return val; } public static GameObject ChangeLabelFromAppIcon(string appIconName, string newLabel) { if (string.IsNullOrEmpty(appIconName) || string.IsNullOrEmpty(newLabel)) { MelonLogger.Error("AppIcon name or new label is null or empty."); return null; } GameObject appIconByName = GetAppIconByName(appIconName, 1, newLabel); Transform val = appIconByName.transform.Find("Label"); GameObject val2 = (((Object)(object)appIconByName != (Object)null) ? ((Component)val).gameObject : null); if ((Object)(object)val2 != (Object)null) { Text component = val2.GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.text = newLabel; } } return appIconByName; } public static GameObject GetAppCanvasByName(string Name) { return ((Component)GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/AppsCanvas/").transform.Find(Name)).gameObject; } [IteratorStateMachine(typeof(<WaitForObjectByFrame>d__3))] public static IEnumerator WaitForObjectByFrame(string path, Action<GameObject> callback) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForObjectByFrame>d__3(0) { path = path, callback = callback }; } [IteratorStateMachine(typeof(<WaitForObject>d__4))] public static IEnumerator WaitForObject(string path, Action<GameObject> callback, float timeout = 30f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForObject>d__4(0) { path = path, callback = callback, timeout = timeout }; } public static void ClearChildren(Transform parent, Func<GameObject, bool> keepFilter = null) { GameObject[] array = (from t in (IEnumerable<Transform>)((Component)parent).GetComponentsInChildren<Transform>(true) select ((Component)t).gameObject into obj where (Object)(object)obj.transform != (Object)(object)parent select obj).ToArray(); GameObject[] array2 = array; foreach (GameObject val in array2) { if (keepFilter == null || !keepFilter(val)) { val.transform.parent = null; Object.Destroy((Object)(object)val); } } } public static Texture2D LoadCustomImage(string path) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown string path2 = Path.Combine(MelonEnvironment.UserDataDirectory, path); Texture2D result; if (!File.Exists(path2)) { result = null; Debug.LogError(Object.op_Implicit("Specified path does not exist.")); } else { byte[] array = File.ReadAllBytes(path2); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)); result = val; } return result; } } public static class EmbeddedAssets { private static readonly Assembly _assembly = Assembly.GetExecutingAssembly(); private static readonly Dictionary<string, Sprite> _spriteCache = new Dictionary<string, Sprite>(); private static readonly Dictionary<string, Texture2D> _textureCache = new Dictionary<string, Texture2D>(); public static Sprite LoadSprite(string category, string fileName) { //IL_0064: 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) string key = (category ?? "root") + "/" + fileName; if (_spriteCache.TryGetValue(key, out var value)) { return value; } Texture2D val = LoadTexture(category, fileName); if ((Object)(object)val == (Object)null) { return null; } Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); _spriteCache[key] = val2; return val2; } public static Texture2D LoadTexture(string category, string fileName) { string text = (category ?? "root") + "/" + fileName; if (_textureCache.TryGetValue(text, out var value)) { return value; } string text2 = ((!string.IsNullOrEmpty(category)) ? $"MoreRealisticSleeping.Assets.{category}.{fileName}.png" : ("MoreRealisticSleeping.Assets." + fileName + ".png")); text2 = text2.Replace(" ", "_"); try { using Stream stream = _assembly.GetManifestResourceStream(text2); if (stream == null) { string name = text2.Replace("_", " "); stream?.Dispose(); using Stream stream2 = _assembly.GetManifestResourceStream(name); if (stream2 == null) { MelonLogger.Warning("[EmbeddedAssets] Resource not found: " + text2); return null; } return LoadTextureFromStream(stream2, text); } return LoadTextureFromStream(stream, text); } catch (Exception ex) { MelonLogger.Error("[EmbeddedAssets] Failed to load resource " + text2 + ": " + ex.Message); return null; } } private static Texture2D LoadTextureFromStream(Stream stream, string cacheKey) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array))) { _textureCache[cacheKey] = val; return val; } MelonLogger.Warning("[EmbeddedAssets] Failed to load image data for: " + cacheKey); return null; } public static Sprite LoadAppIcon() { return LoadSprite(null, "SleepingAppIcon"); } public static Sprite LoadEffectSprite(string effectName) { return LoadSprite("EffectImages", effectName); } public static Sprite LoadUIElementSprite(string elementName) { return LoadSprite("UIElements", elementName); } public static Texture2D LoadUIElementTexture(string elementName) { return LoadTexture("UIElements", elementName); } public static void ClearCache() { _spriteCache.Clear(); _textureCache.Clear(); } public static void LogAllResources() { string[] manifestResourceNames = _assembly.GetManifestResourceNames(); MelonLogger.Msg($"[EmbeddedAssets] Found {manifestResourceNames.Length} embedded resources:"); string[] array = manifestResourceNames; foreach (string text in array) { MelonLogger.Msg(" - " + text); } } } } namespace MoreRealisticSleeping.EventManager { public class EventManager { private class SaveProperty { public Vector3 Position { get; } public float Radius { get; } public SaveProperty(Vector3 position, float radius) { //IL_0009: 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) Position = position; Radius = radius; } } [CompilerGenerated] private sealed class <MurderPlayer>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EventManager <>4__this; private DeathScreen <deathScreen>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MurderPlayer>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <deathScreen>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; if (!((Object)(object)MRSCore.Instance.localPlayer != (Object)null)) { goto IL_0112; } MRSCore.Instance.localPlayer.Health.TakeDamage(100f, true, true); <deathScreen>5__1 = Object.FindObjectOfType<DeathScreen>(); if (!((Object)(object)<deathScreen>5__1 != (Object)null)) { MelonLogger.Warning("Death screen is not found."); goto IL_010a; } <>4__this.cachedDeathScreen = <deathScreen>5__1; MelonLogger.Msg("Death screen found."); } if (!((Component)<deathScreen>5__1.Container).gameObject.activeSelf) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } if (MRSCore.Instance.config.MurderedEventSettings.Allow_GetMurdered_Event_Respawning) { <deathScreen>5__1.RespawnClicked(); } goto IL_010a; IL_010a: <deathScreen>5__1 = null; goto IL_0112; IL_0112: 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 DeathScreen cachedDeathScreen; public string[] crimeNames = new string[42] { "Street Snoozing", "Sidewalk Slumber", "Public Napping", "Unauthorized Resting", "Curbside Coma", "Dreaming on Duty", "Concrete Cuddling", "Nap Dealing", "Loitering Horizontal", "Dozing Without Permit", "Urban Hibernation", "Bench Bedtime", "Crash Landing", "Sleep Trafficking", "Illegal REM Cycle", "Pavement Pilgrimage", "Vagrancy Nap Offense", "Blocking the park bench", "Passing Out Publicly", "Slumber Under Surveillance", "Unauthorized Zoning", "Resting in Restricted Area", "Curbside Nap Offense", "Public Resting Violation", "Unauthorized Siesta", "Street Slumbering", "Sidewalk Snoozing", "Public Dozing", "Unauthorized Napping", "Curbside Sleeping", "Dreaming on the Job", "Concrete Sleeping", "Nap Trafficking", "Loitering in a Horizontal Position", "Dozing Without a Permit", "Urban Sleeping", "Bench Sleeping", "Crash Sleeping", "Sleep Smuggling", "Illegal REM Offense", "Pavement Sleeping", "Vagrancy Sleeping Offense" }; private Dictionary<string, SaveProperty> SaveProperties = new Dictionary<string, SaveProperty> { { "Laundromat", new SaveProperty(new Vector3(-28.689548f, 1.5649998f, 25.043943f), 6f) }, { "Post Office", new SaveProperty(new Vector3(47.377815f, 1.1149997f, 0.7196727f), 7f) }, { "Car Wash", new SaveProperty(new Vector3(-4.6848783f, 1.215f, -18.462233f), 5f) }, { "Taco Ticklers", new SaveProperty(new Vector3(-30.715487f, 1.065f, 73.0847f), 12f) }, { "RV", new SaveProperty(new Vector3(13.743962f, 2.040004f, -83.97922f), 5f) }, { "Storage Unit", new SaveProperty(new Vector3(-2.3448243f, 1.0649998f, 103.91907f), 10f) }, { "Motel Room", new SaveProperty(new Vector3(-71.374756f, 2.8194952f, 84.27474f), 5f) }, { "Sweatshop", new SaveProperty(new Vector3(-61.0836f, 0.8124299f, 141.54001f), 6.5f) }, { "Bungalow", new SaveProperty(new Vector3(-171.36903f, -2.7349997f, 115.365295f), 10f) }, { "Barn", new SaveProperty(new Vector3(190.93658f, 1.0649998f, -10.902634f), 20f) }, { "Docks Warehouse", new SaveProperty(new Vector3(-90.65439f, -1.2549964f, -51.6541f), 15f) }, { "Manor", new SaveProperty(new Vector3(163.3927f, 11.464999f, -57.151375f), 25f) } }; [IteratorStateMachine(typeof(<MurderPlayer>d__2))] public IEnumerator MurderPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MurderPlayer>d__2(0) { <>4__this = this }; } public void AddNewPublicSleepingCrime() { //IL_0003: Unknown result typ