using System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreButtons")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("More hotkeys for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+eb339285108de628ea9833da1502c35fc327e17c")] [assembly: AssemblyProduct("MoreButtons")] [assembly: AssemblyTitle("MoreButtons")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 MoreButtons { [BepInPlugin("com.invertigo.morebuttons", "MoreButtons", "1.0.1")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.invertigo.morebuttons"; public const string PLUGIN_NAME = "MoreButtons"; public const string PLUGIN_VERSION = "1.0.1"; public static Plugin Instance; public ConfigEntry TeleportKey; public ConfigEntry LightSwitchKey; private Harmony harmony; private void Awake() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Instance = this; TeleportKey = ((BaseUnityPlugin)this).Config.Bind("General", "TeleportKey", (Key)98, "Hotkey to teleport. Contextual based on if you are in the ship."); LightSwitchKey = ((BaseUnityPlugin)this).Config.Bind("General", "LightSwitchKey", (Key)100, "Hotkey to toggle the ship lights."); harmony = new Harmony("com.invertigo.morebuttons"); harmony.PatchAll(); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Plugin MoreButtons is loaded!"); } internal static void DoUpdate() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (Keyboard.current == null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isTypingChat || localPlayerController.inTerminalMenu || localPlayerController.isPlayerDead) { return; } if (((ButtonControl)Keyboard.current[Instance.TeleportKey.Value]).wasPressedThisFrame) { ShipTeleporter[] array = Object.FindObjectsOfType(); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"F5 triggered! Found {array.Length} teleporters."); if (localPlayerController.isInHangarShipRoom) { if (RoundManager.Instance.insideAINodes != null && RoundManager.Instance.insideAINodes.Length != 0) { Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position; localPlayerController.isInElevator = false; localPlayerController.isInHangarShipRoom = false; localPlayerController.isInsideFactory = true; localPlayerController.averageVelocity = 0f; localPlayerController.velocityLastFrame = Vector3.zero; localPlayerController.TeleportPlayer(position, false, 0f, false, true); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Standalone Inverse Teleport triggered!"); } else { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)"No AI nodes available yet to teleport to!"); } } else { AudioReverbPresets val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null && val.audioPresets.Length > 3) { val.audioPresets[3].ChangeAudioReverbForPlayer(localPlayerController); } localPlayerController.isInElevator = true; localPlayerController.isInHangarShipRoom = true; localPlayerController.isInsideFactory = false; localPlayerController.averageVelocity = 0f; localPlayerController.velocityLastFrame = Vector3.zero; Vector3 position2 = StartOfRound.Instance.playerSpawnPositions[0].position; localPlayerController.TeleportPlayer(position2, true, 160f, false, true); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Standalone Regular Teleport triggered!"); } } if (((ButtonControl)Keyboard.current[Instance.LightSwitchKey.Value]).wasPressedThisFrame) { ShipLights val2 = Object.FindObjectOfType(); if ((Object)(object)val2 != (Object)null) { val2.ToggleShipLights(); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Ship lights toggled!"); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerBPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePostfix(PlayerControllerB __instance) { if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Plugin.DoUpdate(); } } } [HarmonyPatch(typeof(NetworkManager))] internal static class NetworkPrefabPatch { [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("com.invertigo.morebuttons Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj, GetHash("com.invertigo.morebuttons")); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } } }