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 MakeCriticallyInjured.Patch;
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("TestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9c5780b-afdd-4036-b4f0-44f93d0c02b1")]
[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 MakeCriticallyInjured
{
[BepInPlugin("qh3.MakeCriticallyInjured", "MakeCriticallyInjured", "1.0.0")]
public class MakeCriticallyInjuredBase : BaseUnityPlugin
{
private static MakeCriticallyInjuredBase Instance;
private readonly Harmony harmony = new Harmony("qh3.MakeCriticallyInjured");
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("qh3.MakeCriticallyInjured");
mls.LogInfo((object)"Loading MakeCriticallyInjured Mod");
harmony.PatchAll(typeof(MakeCriticallyInjuredBase));
harmony.PatchAll(typeof(MakeCriticallyInjuredPatch));
}
}
}
namespace MakeCriticallyInjured.Patch
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class MakeCriticallyInjuredPatch
{
private static bool flag;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void MakeCriticallyInjured_Patch(PlayerControllerB __instance)
{
if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController) && ((ButtonControl)Keyboard.current.upArrowKey).wasPressedThisFrame)
{
flag = !flag;
Debug.Log((object)$"重伤效果 {flag} ,目标:{((Object)GameNetworkManager.Instance.localPlayerController).GetInstanceID()}");
GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(flag);
}
}
}
}