using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GodMode.Patches;
using HarmonyLib;
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("InfiniteHealth")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InfiniteHealth")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c1c8da29-cf82-4f02-b98e-c126aa7fd446")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GodMode
{
[BepInPlugin("Bocon.GodMode", "God Mode", "1.1.0")]
public class GodMode : BaseUnityPlugin
{
private const string modGUID = "Bocon.GodMode";
private const string modeName = "God Mode";
private const string modVersion = "1.1.0";
private readonly Harmony harmony = new Harmony("Bocon.GodMode");
private static GodMode Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Bocon.GodMode");
mls.LogInfo((object)"Infinite Health mod loaded");
harmony.PatchAll(typeof(GodMode));
harmony.PatchAll(typeof(GodModePatch));
}
}
}
namespace GodMode.Patches
{
[HarmonyPatch(typeof(PlayerHealth))]
internal class GodModePatch
{
private static bool godModeEnabled;
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPatch(PlayerHealth __instance)
{
Traverse.Create((object)__instance).Field("godMode").SetValue((object)godModeEnabled);
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void UpdatePatch(PlayerHealth __instance)
{
if (Input.GetKeyDown((KeyCode)103))
{
godModeEnabled = !godModeEnabled;
Traverse.Create((object)__instance).Field("godMode").SetValue((object)godModeEnabled);
Debug.Log((object)("God Mode: " + (godModeEnabled ? "Enabled" : "Disabled")));
}
}
}
}