Decompiled source of GodMode v1.2.9

Mods/GodMode.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using InvMod;
using MelonLoader;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "godMod", "1.0", "You", null)]
[assembly: MelonGame(null, null)]
[assembly: AssemblyTitle("inv mod bonelab")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("inv mod bonelab")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c651a2e3-ec97-4b6f-a29a-840004b43a9c")]
[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 InvMod;

public class Main : MelonMod
{
	private bool godMode = false;

	private GameObject player;

	public override void OnInitializeMelon()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		MelonLogger.Msg("godMod Loading...");
		Page val = Page.Root.CreatePage("Inv Mod", Color.green, 0, true);
		val.CreateBool("God Mode", Color.yellow, false, (Action<bool>)delegate(bool value)
		{
			godMode = value;
			MelonLogger.Msg("God Mode: " + (godMode ? "ON ✅" : "OFF ❌"));
		});
		MelonLogger.Msg("godMod Loaded!");
	}

	public override void OnUpdate()
	{
		if ((Object)(object)player == (Object)null)
		{
			player = GameObject.Find("Player");
			if ((Object)(object)player == (Object)null)
			{
				player = GameObject.Find("Rig");
			}
		}
		else
		{
			if (!godMode)
			{
				return;
			}
			Component component = player.GetComponent("Health");
			if (!((Object)(object)component != (Object)null))
			{
				return;
			}
			try
			{
				FieldInfo field = ((Object)component).GetIl2CppType().GetField("_health");
				if (field != (FieldInfo)null)
				{
					field.SetValue((Object)(object)component, Object.op_Implicit(100f));
				}
				FieldInfo field2 = ((Object)component).GetIl2CppType().GetField("_maxHealth");
				if (field2 != (FieldInfo)null)
				{
					field2.SetValue((Object)(object)component, Object.op_Implicit(100f));
				}
			}
			catch
			{
			}
		}
	}
}