Decompiled source of PeacefulMode v1.0.0

BepInEx/plugins/Richard-PeacefulMode/PeacefulMode.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PeacefulModeMod.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PeacefulMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Changes the difficulty of the game to Peaceful mode. Make friends with all the hostile mobs!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PeacefulMode")]
[assembly: AssemblyTitle("PeacefulMode")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 PeacefulModeMod
{
	[BepInPlugin("PeacefulMode", "Peaceful Mod Mod", "1.0.0")]
	public class PeacefulModeModBase : BaseUnityPlugin
	{
		public const string modGUID = "PeacefulMode";

		public const string modName = "Peaceful Mod Mod";

		public const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("PeacefulMode");

		internal ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("PeacefulMode");
			mls.LogInfo((object)"Peaceful Mode Mod is up and running!");
			harmony.PatchAll(typeof(PeacefulModeModBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace PeacefulModeMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void InfiniteSprintPatch(ref float ___sprintMeter)
		{
			___sprintMeter = 1f;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void FasterClimbSpeedPatch(ref float ___climbSpeed)
		{
			___climbSpeed = 9f;
		}

		[HarmonyPatch("AllowPlayerDeath")]
		[HarmonyPostfix]
		public static void UnkillablePatch(ref bool __result)
		{
			__result = false;
		}
	}
}