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 OctolarFirstMod.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OctolarFirstMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OctolarFirstMod")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a761e7d0-2e73-4d38-b7ad-3010bdcd4702")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OctolarFirstMod
{
[BepInPlugin("Octolar.Healthstation", "Health Station mod", "1.0.0.1")]
public class OctolarFirstMod : BaseUnityPlugin
{
private const string modGUID = "Octolar.Healthstation";
private const string modName = "Health Station mod";
private const string modVersion = "1.0.0.1";
private readonly Harmony harmony = new Harmony("Octolar.Healthstation");
private static OctolarFirstMod Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Octolar.Healthstation");
mls.LogInfo((object)"Octolar HealthStation mod is now active");
harmony.PatchAll(typeof(OctolarFirstMod));
harmony.PatchAll(typeof(ItemChargerPatch));
}
}
}
namespace OctolarFirstMod.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch(typeof(ItemCharger))]
internal class ItemChargerPatch
{
[HarmonyPatch("ChargeItem")]
[HarmonyPostfix]
private static void ChargerHealsPatch()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
GameNetworkManager.Instance.localPlayerController.DamagePlayer(-100, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
if (GameNetworkManager.Instance.localPlayerController.health >= 10 && GameNetworkManager.Instance.localPlayerController.criticallyInjured)
{
GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false);
}
}
}
}