using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalAfterDark.Patches;
using TerminalApi;
using TerminalApi.Classes;
using UnityEngine;
using UnityEngine.Events;
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("LethalAfterDark")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalAfterDark")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("54a91281-4136-4fdd-b37c-4d285aafed9a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalAfterDark
{
[BepInPlugin("_Darkspy.LethalAfterDark", "LethalAfterDark", "1.0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class LethalBase : BaseUnityPlugin
{
private const string modGUID = "_Darkspy.LethalAfterDark";
private const string modName = "LethalAfterDark";
private const string modVersion = "1.0.1.0";
private readonly Harmony harmony = new Harmony("_Darkspy.LethalAfterDark");
internal ManualLogSource mls;
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
mls = Logger.CreateLogSource("_Darkspy.LethalAfterDark");
mls.LogInfo((object)"LethalAfterDark loaded.");
TerminalApi.AddCommand("lights", new CommandInfo
{
Category = "other",
Description = "Turns the lights on or off!",
DisplayTextSupplier = ToggleLights
}, (string)null, true);
TerminalApi.AddCommand("tp", new CommandInfo
{
Category = "other",
Description = "Teleports the selected player to the ship!",
DisplayTextSupplier = TelePlayer
}, (string)null, true);
harmony.PatchAll(typeof(LethalBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
}
private string ToggleLights()
{
StartOfRound.Instance.shipRoomLights.ToggleShipLights();
return GameNetworkManager.Instance.localPlayerController.playerUsername + " toggled the lights\n";
}
private string TelePlayer()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
ShipTeleporter teleporter = GetTeleporter();
if (Object.op_Implicit((Object)teleporter))
{
if (!teleporter.buttonTrigger.interactable)
{
return "Teleporter currently on cooldown!\n";
}
((UnityEvent<PlayerControllerB>)(object)teleporter.buttonTrigger.onInteract).Invoke(GameNetworkManager.Instance.localPlayerController);
}
return StartOfRound.Instance.mapScreen.targetedPlayer.playerUsername + " teleported to the ship!\n";
}
private ShipTeleporter GetTeleporter(bool selectInverse = false)
{
ShipTeleporter[] array = Object.FindObjectsOfType<ShipTeleporter>();
for (int i = 0; i < array.Length; i++)
{
if (selectInverse == array[i].isInverseTeleporter)
{
return array[i];
}
}
return null;
}
}
}
namespace LethalAfterDark.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPostfix]
private static void PlayerUpdate(PlayerControllerB __instance)
{
if ((((ButtonControl)Keyboard.current.rightArrowKey).wasPressedThisFrame && __instance.inTerminalMenu) || (((ButtonControl)Keyboard.current.leftArrowKey).wasPressedThisFrame && __instance.inTerminalMenu))
{
StartOfRound.Instance.mapScreen.SwitchRadarTargetForward(true);
}
}
}
}