using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RemoteLever")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RemoteLever")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0947733e-d699-4472-8c49-1d8d08d42652")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace RemoteLever; [BepInPlugin("azumi.remotelever", "RemoteLever", "1.0.2")] public class RemoteLeverPlugin : BaseUnityPlugin { public const string ModGUID = "azumi.remotelever"; public const string ModName = "RemoteLever"; public const string ModVersion = "1.0.2"; internal static ManualLogSource Log; internal static ConfigEntry LeverKeybind; private Harmony harmony; private void Awake() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; LeverKeybind = ((BaseUnityPlugin)this).Config.Bind("General", "LeverKey", (Key)98, "Key used for remote ship lever activation."); harmony = new Harmony("azumi.remotelever"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"RemoteLever loaded successfully."); } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { private static float lastPressTime; [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Keyboard.current == null || !((ButtonControl)Keyboard.current[RemoteLeverPlugin.LeverKeybind.Value]).wasPressedThisFrame || Time.time - lastPressTime < 0.5f) { return; } lastPressTime = Time.time; if (!GameNetworkManager.Instance.isHostingGame) { HUDManager.Instance.DisplayTip("Remote Lever", "Only the host can control the ship.", false, false, "LC_Tip1"); return; } StartMatchLever val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { RemoteLeverPlugin.Log.LogWarning((object)"StartMatchLever not found."); return; } if ((Object)(object)StartOfRound.Instance == (Object)null) { RemoteLeverPlugin.Log.LogWarning((object)"StartOfRound.Instance is null."); return; } try { if (StartOfRound.Instance.inShipPhase) { RemoteLeverPlugin.Log.LogInfo((object)"Triggering landing remotely..."); val.LeverAnimation(); val.StartGame(); HUDManager.Instance.AddTextToChatOnServer("[RemoteLever] Ship landing initiated remotely.", -1); } else if (!StartOfRound.Instance.shipHasLanded) { RemoteLeverPlugin.Log.LogWarning((object)"Ship has not landed yet."); } else if (StartOfRound.Instance.shipIsLeaving) { RemoteLeverPlugin.Log.LogWarning((object)"Ship is already leaving."); } else if (StartOfRound.Instance.shipLeftAutomatically) { RemoteLeverPlugin.Log.LogWarning((object)"Ship already left automatically."); } else { RemoteLeverPlugin.Log.LogInfo((object)"Triggering departure remotely..."); val.LeverAnimation(); val.EndGame(); HUDManager.Instance.AddTextToChatOnServer("[RemoteLever] Ship departure initiated remotely.", -1); } } catch (Exception ex) { RemoteLeverPlugin.Log.LogError((object)ex); } } }