using System;
using System.Collections;
using System.Collections.Generic;
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.4.0")]
public class GodMode : BaseUnityPlugin
{
private const string modGUID = "Bocon.GodMode";
private const string modeName = "God Mode";
private const string modVersion = "1.4.0";
private const string ASCII_LOGO = "\r\n _____ _ ___ ___ _ _ _ _ \r\n | __ \\ | | | \\/ | | | | | | | | | _ \r\n | | \\/ ___ __| | | . . | ___ __| | ___ | | ___ __ _ __| | ___ __| | _| |_ \r\n | | __ / _ \\ / _` | | |\\/| |/ _ \\ / _` |/ _ \\ | | / _ \\ / _` |/ _` |/ _ \\/ _` | |_ _|\r\n | |_\\ \\ (_) | (_| | | | | | (_) | (_| | __/ | |___| (_) | (_| | (_| | __/ (_| | |_|\r\n \\____/\\___/ \\__,_| \\_| |_/\\___/ \\__,_|\\___| \\_____/\\___/ \\__,_|\\__,_|\\___|\\__,_|\r\n";
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)"\r\n _____ _ ___ ___ _ _ _ _ \r\n | __ \\ | | | \\/ | | | | | | | | | _ \r\n | | \\/ ___ __| | | . . | ___ __| | ___ | | ___ __ _ __| | ___ __| | _| |_ \r\n | | __ / _ \\ / _` | | |\\/| |/ _ \\ / _` |/ _ \\ | | / _ \\ / _` |/ _` |/ _ \\/ _` | |_ _|\r\n | |_\\ \\ (_) | (_| | | | | | (_) | (_| | __/ | |___| (_) | (_| | (_| | __/ (_| | |_|\r\n \\____/\\___/ \\__,_| \\_| |_/\\___/ \\__,_|\\___| \\_____/\\___/ \\__,_|\\__,_|\\___|\\__,_|\r\n");
harmony.PatchAll(typeof(GodMode));
harmony.PatchAll(typeof(GodModePatch));
}
}
}
namespace GodMode.Patches
{
[HarmonyPatch(typeof(PlayerHealth))]
internal class GodModePatch
{
[CompilerGenerated]
private sealed class <HideMessageAfterDelay>d__4 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public float delay;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HideMessageAfterDelay>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)BigMessageUI.instance != (Object)null)
{
((SemiUI)BigMessageUI.instance).Hide();
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static bool godModeEnabled;
private static Coroutine messageCoroutine;
[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)
{
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if ((Object)(object)ChatManager.instance != (Object)null)
{
flag = (bool)Traverse.Create((object)ChatManager.instance).Field("chatActive").GetValue();
}
if (flag || !Input.GetKeyDown((KeyCode)103))
{
return;
}
godModeEnabled = !godModeEnabled;
Traverse.Create((object)__instance).Field("godMode").SetValue((object)godModeEnabled);
if ((Object)(object)BigMessageUI.instance != (Object)null)
{
string text = "GOD MODE " + (godModeEnabled ? "ENABLED" : "DISABLED");
string text2 = (godModeEnabled ? "+" : "-");
Color val = (godModeEnabled ? new Color(0.5f, 1f, 0f) : new Color(1f, 0.3f, 0.3f));
Color val2 = (godModeEnabled ? Color.white : Color.black);
if (messageCoroutine != null)
{
((MonoBehaviour)__instance).StopCoroutine(messageCoroutine);
}
BigMessageUI.instance.BigMessage(text, text2, 42f, val, val2);
messageCoroutine = ((MonoBehaviour)__instance).StartCoroutine(HideMessageAfterDelay(2f));
}
Debug.Log((object)("God Mode: " + (godModeEnabled ? "Enabled" : "Disabled")));
}
[IteratorStateMachine(typeof(<HideMessageAfterDelay>d__4))]
private static IEnumerator HideMessageAfterDelay(float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HideMessageAfterDelay>d__4(0)
{
delay = delay
};
}
}
}