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 UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("KillPlayerButton")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("KillPlayerButton")]
[assembly: AssemblyCopyright("Copyright © HP 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("753206c5-8d7e-480d-bd0f-444903cdd890")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KillPlayerButton;
[BepInPlugin("SilasMeyer.KillPlayerButton", "KillPlayerButton", "0.0.1")]
public class KillButton : BaseUnityPlugin
{
public const string modGUID = "SilasMeyer.KillPlayerButton";
public const string modName = "KillPlayerButton";
public const string modVersion = "0.0.1";
private readonly Harmony harmony = new Harmony("SilasMeyer.KillPlayerButton");
public static KillButton Instance;
internal ManualLogSource mls;
public InputAction killPlayerAction;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("SilasMeyer.KillPlayerButton");
mls.LogMessage((object)"SilasMeyer.KillPlayerButton is loading.");
InputActionMap val = InputActionSetupExtensions.AddActionMap(ScriptableObject.CreateInstance<InputActionAsset>(), "PlayerActions");
killPlayerAction = InputActionSetupExtensions.AddAction(val, "KillPlayer", (InputActionType)0, "<keyboard>/equals", (string)null, (string)null, (string)null, (string)null);
killPlayerAction.Enable();
harmony.PatchAll(typeof(KillPlayerFix));
mls.LogMessage((object)"SilasMeyer.KillPlayerButton has loaded succesfully.");
}
private void OnDestroy()
{
killPlayerAction.Disable();
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
public static class KillPlayerFix
{
[HarmonyPostfix]
public static void Postfix()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (KillButton.Instance.killPlayerAction != null && KillButton.Instance.killPlayerAction.triggered)
{
StartOfRound.Instance.localPlayerController.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, Vector3.zero);
}
}
}