using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Stay Awake While Talking")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Go Go Gadget Alert Conversation")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("Stay Awake While Talking")] [assembly: AssemblyTitle("Stay Awake While Talking")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SleepToggle { [BepInPlugin("com.gogogoadgetjustice.bigwalk.sleeptoggle", "Sleep Toggle", "1.0.0")] public class SleepTogglePlugin : BasePlugin { public const string PluginGuid = "com.gogogoadgetjustice.bigwalk.sleeptoggle"; public const string PluginName = "Sleep Toggle"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry NeverSleepKey; internal static ConfigEntry ForceSleepKey; internal static bool NeverSleepOn; internal static bool ForceSleepOn; public override void Load() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown Log = ((BasePlugin)this).Log; NeverSleepKey = ((BasePlugin)this).Config.Bind("General", "NeverSleepKey", (KeyCode)308, "Toggles 'never fall asleep' for the local player."); ForceSleepKey = ((BasePlugin)this).Config.Bind("General", "ForceSleepKey", (KeyCode)122, "Toggles 'force sleep now' for the local player. Overrides NeverSleepKey while on."); Harmony val = new Harmony("com.gogogoadgetjustice.bigwalk.sleeptoggle"); val.PatchAll(typeof(SleepTogglePlugin).Assembly); ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(44, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted("Sleep Toggle"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" v"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted("1.0.0"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded. Q = never sleep, Z = force sleep."); } log.LogInfo(val2); } } [HarmonyPatch(typeof(PlayerSleeper), "Update")] internal static class PlayerSleeper_Update_Patch { [HarmonyPostfix] private static void Postfix(PlayerSleeper __instance) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown PlayerCharacter playerCharacter = __instance.playerCharacter; if ((Object)(object)playerCharacter == (Object)null || !((NetworkBehaviour)playerCharacter).isLocalPlayer) { return; } bool flag = default(bool); if (Input.GetKeyDown(SleepTogglePlugin.NeverSleepKey.Value)) { SleepTogglePlugin.NeverSleepOn = !SleepTogglePlugin.NeverSleepOn; ManualLogSource log = SleepTogglePlugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Never-sleep: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SleepTogglePlugin.NeverSleepOn ? "ON" : "off"); } log.LogInfo(val); } if (Input.GetKeyDown(SleepTogglePlugin.ForceSleepKey.Value)) { SleepTogglePlugin.ForceSleepOn = !SleepTogglePlugin.ForceSleepOn; ManualLogSource log2 = SleepTogglePlugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Force-sleep: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(SleepTogglePlugin.ForceSleepOn ? "ON" : "off"); } log2.LogInfo(val); } if (SleepTogglePlugin.ForceSleepOn) { __instance.forceSleeping = true; __instance.preventSleeping = false; } else { __instance.forceSleeping = false; __instance.preventSleeping = SleepTogglePlugin.NeverSleepOn; } } } }