using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using SimpleGodMode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Mod), "SimpleGodMode", "1.0.0", "The Dynamic Team", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SimpleGodMode")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SimpleGodMode")]
[assembly: AssemblyTitle("SimpleGodMode")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SimpleGodMode
{
public class Mod : MelonMod
{
public static MelonPreferences_Category Cat;
public static MelonPreferences_Entry<bool> Enabled;
public static Instance Log { get; private set; }
public static bool IsOn
{
get
{
if (Enabled != null)
{
return Enabled.Value;
}
return false;
}
}
public override void OnInitializeMelon()
{
Log = ((MelonBase)this).LoggerInstance;
Cat = MelonPreferences.CreateCategory("SimpleGodMode");
Enabled = Cat.CreateEntry<bool>("Enabled", false, "God mode on/off (kept across restarts)", (string)null, false, false, (ValueValidator)null, (string)null);
Cat.SaveToFile(false);
BuildMenu();
Log.Msg(IsOn ? "SimpleGodMode loaded — god mode is ON (remembered from last time)." : "SimpleGodMode loaded — god mode is OFF.");
}
public override void OnUpdate()
{
if (!IsOn)
{
return;
}
try
{
RigManager rigManager = Player.RigManager;
if ((Object)(object)rigManager == (Object)null)
{
return;
}
Health health = rigManager.health;
Player_Health val = ((health != null) ? ((Il2CppObjectBase)health).TryCast<Player_Health>() : null);
if (!((Object)(object)val == (Object)null))
{
if (((Health)val).max_Health > 0f && ((Health)val).curr_Health < ((Health)val).max_Health)
{
((Health)val).curr_Health = ((Health)val).max_Health;
}
if (val.isInstaDying)
{
val.isInstaDying = false;
}
}
}
catch
{
}
}
private static void BuildMenu()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
Color val = default(Color);
((Color)(ref val))..ctor(1f, 0.82f, 0.25f);
Page obj = Page.Root.CreatePage("SimpleGodMode", val, 0, true);
obj.CreateBool("God Mode", Color.green, Enabled.Value, (Action<bool>)delegate(bool v)
{
Enabled.Value = v;
Cat.SaveToFile(false);
Notify(v ? "God Mode ON — nothing can drop you." : "God Mode OFF — you're mortal again.", (NotificationType)(v ? 3 : 0));
});
obj.CreateFunction(" - bullets, blades, falls, crushers: all ignored", new Color(0.6f, 0.6f, 0.6f), (Action)delegate
{
});
obj.CreateFunction(" - works in story and Fusion, and saves your choice", new Color(0.6f, 0.6f, 0.6f), (Action)delegate
{
});
}
private static void Notify(string message, NotificationType type)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
try
{
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("SimpleGodMode"),
Message = NotificationText.op_Implicit(message),
PopupLength = 2.5f,
Type = type
});
}
catch
{
}
}
}
[HarmonyPatch(typeof(Player_Health), "TAKEDAMAGE", new Type[] { typeof(float) })]
public static class GodMode_TakeDamage_Patch
{
public static bool Prefix()
{
return !Mod.IsOn;
}
}
[HarmonyPatch(typeof(Player_Health), "ApplyKillDamage")]
public static class GodMode_ApplyKillDamage_Patch
{
public static bool Prefix()
{
return !Mod.IsOn;
}
}
}