Decompiled source of SmartGodMode v1.0.1

Mods/SmartGodMode.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BasicGodMode;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSLZ.Marrow;
using LabFusion.Network;
using LabFusion.Utilities;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "SmartGodMode", "1.0.0", "yTornado", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BasicGodMode")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BasicGodMode")]
[assembly: AssemblyTitle("BasicGodMode")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 BasicGodMode
{
	public class Core : MelonMod
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UpdateEvent <0>__CheckAllowed;

			public static ServerEvent <1>__ReEnableGodMode;
		}

		private Page BasicGodModePage;

		private static BoolElement GodModeBool = null;

		private static string[] FilterPhrases = new string[118]
		{
			"no god mode", "no godmode", "nogodmode", "no-god-mode", "no_god_mode", "godmode off", "god mode off", "godmode disabled", "god mode disabled", "no godmode allowed",
			"godmode not allowed", "godmode banned", "godmode prohibited", "disable godmode", "turn off god mode", "please disable godmode", "kindly turn off godmode", "godmode = ban", "godmode gets you kicked", "using godmode will get you banned",
			"we do not allow god mode", "this server bans godmode", "god mode users will be removed", "no gm", "gm banned", "gm off", "no gm allowed", "no invincibility", "no invincible", "invincibility off",
			"invincibility disabled", "no invuln", "invuln off", "no invulnerability", "invulnerability off", "invulnerability banned", "no immortality", "not immortal", "no immortal mode", "immortal mode banned",
			"no immortal players", "mortality required", "must be killable", "no invincible players", "players must be vulnerable", "vulnerability required", "damage must be enabled", "take damage", "damage enabled", "real damage only",
			"no dmg immunity", "damage immunity off", "no dmg reduction cheats", "no dmg cheats", "no dmg hacks", "no tank mode", "no super armor", "super armor banned", "no unlimited health", "no infinite health",
			"no unlimited hp", "no infinite hp", "hp cheats banned", "health cheats banned", "no health cheats", "no health hacks", "health hacking banned", "no super health", "vanilla health only", "normal health only",
			"standard health rules", "health mods banned", "no unkillable", "no unkillable mode", "no unkillable characters", "characters must take damage", "killable only", "respect health rules", "no easy mode", "legit only",
			"no cheats", "no cheat mode", "cheats disabled", "no cheating", "no hacks", "hacks banned", "no mods that give godmode", "fair play only", "no op mode", "no shield mods",
			"no invincibility mods", "invincibility mods banned", "no unlimited lives", "limited lives only", "one life rules", "no respawn cheats", "respawn abuse banned", "no infinite respawns", "fair combat only", "pvp fairness required",
			"no unfair advantages", "no cheese tactics", "no cheesing with godmode", "godmode ruins the game", "survival mode only", "hardcore mode", "permadeath", "god mode = ban", "godmode = ban", "no god",
			"horror", "rp", "roleplay", "wendigo", "elder mimic", "the walten files", "fnaf", " rp"
		};

		private MelonPreferences_Category SmartGodModeCategory;

		private MelonPreferences_Entry<bool> AutoGodModeEntry;

		private MelonPreferences_Entry<bool> GodModeEntry;

		public static bool isGodMode;

		public static bool isAutoGodMode;

		public override void OnInitializeMelon()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			((MelonBase)this).LoggerInstance.Msg("smart god mode intialized :3");
			SmartGodModeCategory = MelonPreferences.CreateCategory("SmartGodModeCategory");
			GodModeEntry = SmartGodModeCategory.CreateEntry<bool>("GodMode", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			AutoGodModeEntry = SmartGodModeCategory.CreateEntry<bool>("AutoGodMode", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			isGodMode = GodModeEntry.Value;
			isAutoGodMode = AutoGodModeEntry.Value;
			BasicGodModePage = Page.Root.CreatePage("Smart God Mode", Color.red, 8, true);
			GodModeBool = BasicGodModePage.CreateBool("God Mode", Color.green, GodModeEntry.Value, (Action<bool>)delegate(bool b)
			{
				isGodMode = b;
				GodModeEntry.Value = b;
				Notification(isGodMode ? "God Mode enabled" : "God Mode disabled");
			});
			BasicGodModePage.CreateBool("Auto God Mode", Color.cyan, AutoGodModeEntry.Value, (Action<bool>)delegate(bool b)
			{
				isAutoGodMode = b;
				AutoGodModeEntry.Value = b;
				Notification(isAutoGodMode ? "Auto God Mode enabled" : "Auto God Mode disabled");
			});
			object obj = <>O.<0>__CheckAllowed;
			if (obj == null)
			{
				UpdateEvent val = CheckAllowed;
				<>O.<0>__CheckAllowed = val;
				obj = (object)val;
			}
			MultiplayerHooking.OnMainSceneInitialized += (UpdateEvent)obj;
			object obj2 = <>O.<1>__ReEnableGodMode;
			if (obj2 == null)
			{
				ServerEvent val2 = ReEnableGodMode;
				<>O.<1>__ReEnableGodMode = val2;
				obj2 = (object)val2;
			}
			MultiplayerHooking.OnDisconnected += (ServerEvent)obj2;
		}

		public override void OnUpdate()
		{
			if (Player.RightController != null && Player.RightController.GetAButton() && Player.RightController.GetBButtonDown())
			{
				KeybindGodMode();
			}
			if (Input.GetKeyDown((KeyCode)289))
			{
				KeybindGodMode();
			}
			if (isGodMode && Player.RigManager != null && Player.RigManager.health != null)
			{
				Player_Health val = ((Il2CppObjectBase)Player.RigManager.health).TryCast<Player_Health>();
				((Health)val).healthMode = (HealthMode)0;
				if (val != null && ((Health)val).curr_Health < ((Health)val).max_Health)
				{
					((Health)val).curr_Health = ((Health)val).max_Health;
				}
			}
		}

		public static void CheckAllowed()
		{
			if (!isAutoGodMode || LobbyInfoManager.LobbyInfo.LobbyDescription == null || LobbyInfoManager.LobbyInfo.LobbyName == null)
			{
				return;
			}
			string[] filterPhrases = FilterPhrases;
			foreach (string value in filterPhrases)
			{
				if ((LobbyInfoManager.LobbyInfo.LobbyDescription.ToLower().Contains(value) && isGodMode) || (LobbyInfoManager.LobbyInfo.LobbyName.ToLower().Contains(value) && isGodMode))
				{
					isGodMode = false;
					GodModeBool.Value = false;
					Notification("God Mode disabled due to Server Guidelines.");
					break;
				}
			}
		}

		public static void ReEnableGodMode()
		{
			if (isAutoGodMode && !isGodMode)
			{
				isGodMode = true;
				GodModeBool.Value = true;
				Notification("God mode re-enabled!");
			}
		}

		public static void KeybindGodMode()
		{
			isGodMode = !isGodMode;
			GodModeBool.Value = !GodModeBool.Value;
			Notification(isGodMode ? "God mode enabled" : "God mode disabled");
		}

		public static void Notification(string message, string title = "Smart God Mode")
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			Notifier.Send(new Notification
			{
				Title = NotificationText.op_Implicit(title),
				Message = NotificationText.op_Implicit(message)
			});
		}
	}
	[HarmonyPatch(typeof(Player_Health), "TAKEDAMAGE", new Type[] { typeof(float) })]
	public class DamagePatch
	{
		public static bool Prefix()
		{
			return !Core.isGodMode;
		}
	}
}