using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using NineSolsAPI; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HallwaySkip")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A Nine Sols mod that lets you skip the long hallway fight sequence after the Point of no Return")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a1506f77850caa8932b042eac16bf86055121cb3")] [assembly: AssemblyProduct("HallwaySkip")] [assembly: AssemblyTitle("HallwaySkip")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HallwaySkip { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("HallwaySkip", "HallwaySkip", "1.0.0")] public class HallwaySkip : BaseUnityPlugin { private static ConfigEntry skipKeybind; private Harmony harmony; public static SimpleCutsceneManager activeHallwayCutscene; public static string SkipKeybindText() { //IL_0005: 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) KeyboardShortcut value = skipKeybind.Value; return ((KeyboardShortcut)(ref value)).Serialize(); } private void Awake() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); RCGLifeCycle.DontDestroyForever(((Component)this).gameObject); harmony = Harmony.CreateAndPatchAll(typeof(HallwaySkip).Assembly, (string)null); skipKeybind = ((BaseUnityPlugin)this).Config.Bind("", "Skip Keybind", new KeyboardShortcut((KeyCode)107, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "The keyboard shortcut to actually skip the hallway."); KeybindManager.Add((MonoBehaviour)(object)this, (Action)SkipHallwayCutscene, (Func)(() => skipKeybind.Value)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HallwaySkip is loaded!"); TextDisplay.Awake(); } private void SkipHallwayCutscene() { if ((Object)(object)activeHallwayCutscene != (Object)null) { Log.Info("calling TrySkip() on " + ((Object)activeHallwayCutscene).name); AccessTools.Method(typeof(SimpleCutsceneManager), "TrySkip", (Type[])null, (Type[])null).Invoke(activeHallwayCutscene, Array.Empty()); activeHallwayCutscene = null; ((TMP_Text)TextDisplay.TextComponent).text = null; } } private void OnDestroy() { harmony.UnpatchSelf(); TextDisplay.OnDestroy(); } } internal static class Log { private static ManualLogSource? logSource; internal static void Init(ManualLogSource logSource) { Log.logSource = logSource; } internal static void Debug(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogDebug(data); } } internal static void Error(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogError(data); } } internal static void Fatal(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogFatal(data); } } internal static void Info(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogInfo(data); } } internal static void Message(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogMessage(data); } } internal static void Warning(object data) { ManualLogSource? obj = logSource; if (obj != null) { obj.LogWarning(data); } } } [HarmonyPatch] public class Patches { private static string hallwayCutsceneGOPath = "A11_S2/Room/Prefab/EventBinder/OldBoy FSM Object/FSM Animator/LogicRoot/[CutScene]OldBoyFighting/[Timeline]"; [HarmonyPrefix] [HarmonyPatch(typeof(SimpleCutsceneManager), "PlayAnimation")] private static void SimpleCutsceneManager_PlayAnimation(SimpleCutsceneManager __instance) { GameObject val = GameObject.Find(hallwayCutsceneGOPath); if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)((Component)__instance).gameObject) { HallwaySkip.activeHallwayCutscene = __instance; ((TMP_Text)TextDisplay.TextComponent).text = "Press " + HallwaySkip.SkipKeybindText() + " to Skip The Hallway Fight"; } } [HarmonyPrefix] [HarmonyPatch(typeof(SimpleCutsceneManager), "End")] private static void SimpleCutsceneManager_End(SimpleCutsceneManager __instance) { Log.Debug("SimpleCutsceneManager_End " + ((Object)__instance).name); if ((Object)(object)HallwaySkip.activeHallwayCutscene == (Object)(object)__instance) { HallwaySkip.activeHallwayCutscene = null; ((TMP_Text)TextDisplay.TextComponent).text = null; } } } internal class TextDisplay { private static Canvas CanvasComponent; public static TextMeshProUGUI TextComponent; public static void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("NineSolsAPI-FullscreenCanvas"); RCGLifeCycle.DontDestroyForever(val); CanvasComponent = val.AddComponent(); CanvasComponent.renderMode = (RenderMode)0; TextComponent = val.AddComponent(); ((TMP_Text)TextComponent).alignment = (TextAlignmentOptions)1028; ((TMP_Text)TextComponent).fontSize = 20f; ((Graphic)TextComponent).color = Color.white; } public static void OnDestroy() { Object.Destroy((Object)(object)((Component)CanvasComponent).gameObject); } } public static class PluginInfo { public const string PLUGIN_GUID = "HallwaySkip"; public const string PLUGIN_NAME = "HallwaySkip"; public const string PLUGIN_VERSION = "1.0.0"; } }