Decompiled source of Hardcore Company v1.2.0

Hardcore Company.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
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("Hardcore Company")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hardcore Company")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f9574642-270e-44f7-bc56-8c3aa047c3bc")]
[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 Hardcore_Company
{
	[BepInPlugin("Waflecat.HardcoreCompany", "Hardcore Company", "1.2.0")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "Waflecat.HardcoreCompany";

		private const string modName = "Hardcore Company";

		private const string modVersion = "1.2.0";

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("Waflecat.HardcoreCompany");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hardcore Company loaded successfully");
		}
	}
}
namespace Hardcore_Company.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class OneHitDeathPatch
	{
		[HarmonyPatch("DamagePlayer")]
		[HarmonyPrefix]
		private static bool DamagePlayer_Prefix(PlayerControllerB __instance, ref int damageNumber, ref bool hasDamageSFX, ref bool callRPC, ref CauseOfDeath causeOfDeath)
		{
			//IL_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.isPlayerDead)
			{
				__instance.KillPlayer(Vector3.zero, true, causeOfDeath, 0, default(Vector3));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class WeatherServerPatch
	{
		[HarmonyPatch("SetPlanetsWeather")]
		[HarmonyPostfix]
		private static void AlwaysEclipse(StartOfRound __instance)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)__instance).IsServer)
			{
				SelectableLevel[] levels = __instance.levels;
				foreach (SelectableLevel val in levels)
				{
					val.currentWeather = (LevelWeatherType)5;
				}
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class WeatherClientPatch
	{
		[HarmonyPatch("GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void ForceClientWeather(RoundManager __instance)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance.currentLevel == (Object)null))
			{
				__instance.currentLevel.currentWeather = (LevelWeatherType)5;
				MethodInfo methodInfo = AccessTools.Method(typeof(RoundManager), "RefreshWeather", (Type[])null, (Type[])null);
				if (methodInfo != null)
				{
					methodInfo.Invoke(__instance, null);
				}
				else
				{
					Traverse.Create((object)__instance).Method("SetWeatherEffects", Array.Empty<object>()).GetValue();
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class WeatherClientUISyncPatch
	{
		[HarmonyPatch("OnClientConnect")]
		[HarmonyPostfix]
		private static void ForceClientWeatherUI(StartOfRound __instance)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			SelectableLevel[] levels = __instance.levels;
			foreach (SelectableLevel val in levels)
			{
				val.currentWeather = (LevelWeatherType)5;
			}
			RoundManager instance = RoundManager.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				MethodInfo methodInfo = AccessTools.Method(typeof(RoundManager), "RefreshWeather", (Type[])null, (Type[])null);
				if (methodInfo != null)
				{
					methodInfo.Invoke(instance, null);
				}
				else
				{
					Traverse.Create((object)instance).Method("SetWeatherEffects", Array.Empty<object>()).GetValue();
				}
			}
		}
	}
}