Decompiled source of Lethal Hardcore Mode v1.0.0

plugins/LethalHardcoreMode.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalHardcoreMode.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("LethalHardcoreMode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalHardcoreMode")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("58477bc3-6e2b-4533-92c1-f5318c72a2ef")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalHardcoreMode
{
	[BepInPlugin("ethereal_chiono.LethalHardcoreMode", "Lethal Hardcore Mode", "1.0.0")]
	public class HardcoreModBase : BaseUnityPlugin
	{
		private const string modGUID = "ethereal_chiono.LethalHardcoreMode";

		private const string modName = "Lethal Hardcore Mode";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("ethereal_chiono.LethalHardcoreMode");

		private static HardcoreModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("ethereal_chiono.LethalHardcoreMode");
			mls.LogInfo((object)string.Format("{0} has risen from its slumber.", "Lethal Hardcore Mode"));
			harmony.PatchAll(typeof(HardcoreModBase));
			harmony.PatchAll(typeof(RevivePatch));
		}
	}
}
namespace LethalHardcoreMode.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class RevivePatch
	{
		[HarmonyPatch("ReviveDeadPlayers")]
		[HarmonyPrefix]
		private static bool stopRevivePatch(StartOfRound __instance, ref int ___livingPlayers)
		{
			bool flag;
			if (___livingPlayers == 0)
			{
				flag = true;
				GameNetworkManager.Instance.gameHasStarted = true;
				__instance.firingPlayersCutsceneRunning = true;
				__instance.FirePlayersAfterDeadlineClientRpc(new int[4]
				{
					__instance.gameStats.daysSpent,
					__instance.gameStats.scrapValueCollected,
					__instance.gameStats.deaths,
					__instance.gameStats.allStepsTaken
				}, false);
			}
			else
			{
				flag = false;
			}
			if (!flag)
			{
				return false;
			}
			return true;
		}
	}
}