Decompiled source of MMs Helper Mod v1.0.0

MisterMakersCheatMod.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using MisterMakersCheatMod.Confiuration;
using MisterMakersCheatMod.Patches;
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("MisterMakersCheatMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MisterMakersCheatMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7bf77e60-0811-4727-9f08-c4ce01f202b0")]
[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 MisterMakersCheatMod
{
	[BepInPlugin("MisterMaker_71.lethalcompany.MMHelpeMod", "MisterMaker_71s Helpe Mod", "1.0.0")]
	public class MisterMakersCheatModBase : BaseUnityPlugin
	{
		private const string modGUID = "MisterMaker_71.lethalcompany.MMHelpeMod";

		private const string modName = "MisterMaker_71s Helpe Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("MisterMaker_71.lethalcompany.MMHelpeMod");

		private static MisterMakersCheatModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("MisterMaker_71.lethalcompany.MMHelpeMod");
			LogInfo("MisterMakers Help Mod is Starting");
			ConfigD.Init();
			LogInfo("MisterMakers Help Mod is Online and Redy");
			harmony.PatchAll(typeof(MisterMakersCheatModBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}

		internal static void LogInfo(string message)
		{
			Instance.Log(message);
		}

		private void Log(string message)
		{
			mls.LogInfo((object)message);
		}
	}
}
namespace MisterMakersCheatMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void ResetHelthPatch(ref float ___jumpForce, ref float ___movementSpeed, ref float ___sprintMeter, ref bool ___takingFallDamage)
		{
			___jumpForce = ConfigD.Jumpforce;
			___movementSpeed = ConfigD.MovementSpeed;
			if (ConfigD.InfinitSprint)
			{
				___sprintMeter = 10f;
			}
			if (!ConfigD.NoFallDamage)
			{
				___takingFallDamage = false;
			}
		}
	}
}
namespace MisterMakersCheatMod.Confiuration
{
	internal static class ConfigD
	{
		private const string CONFIG_FILE_NAME = "MMHelperMod.cfg";

		private static ConfigFile _config;

		private static ConfigEntry<bool> _NoFallDamage;

		private static ConfigEntry<bool> _InfinitSprint;

		private static ConfigEntry<float> _Jumpforce;

		private static ConfigEntry<float> _MovementSpeed;

		public static bool NoFallDamage => _NoFallDamage.Value;

		public static bool InfinitSprint => _InfinitSprint.Value;

		public static float Jumpforce => _Jumpforce.Value;

		public static float MovementSpeed => _MovementSpeed.Value;

		public static void Init()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			MisterMakersCheatModBase.LogInfo("Initializing config...");
			_config = new ConfigFile(Path.Combine(Paths.ConfigPath, "MMHelperMod.cfg"), true);
			_InfinitSprint = _config.Bind<bool>("Config", "Infinit Sprint", false, "Use infinit sprint");
			_NoFallDamage = _config.Bind<bool>("Config", "Take Fall Damage", true, "Use fall damage");
			_Jumpforce = _config.Bind<float>("Config", "jump force", 15f, "The jump force (Recomanded Max: 100)");
			_MovementSpeed = _config.Bind<float>("Config", "Movement Speed", 5f, "The max speed of the player");
			MisterMakersCheatModBase.LogInfo("Config initialized!");
			PrintConfig();
		}

		private static void PrintConfig()
		{
			MisterMakersCheatModBase.LogInfo("Settings{");
			MisterMakersCheatModBase.LogInfo($"\tno fall damage: {_NoFallDamage.Value}");
			MisterMakersCheatModBase.LogInfo($"\tinfinit sprint: {_InfinitSprint.Value}");
			MisterMakersCheatModBase.LogInfo($"\tjump force: {_Jumpforce.Value}");
			MisterMakersCheatModBase.LogInfo($"\tmovement speed: {_MovementSpeed.Value}");
			MisterMakersCheatModBase.LogInfo("}");
		}
	}
}