Decompiled source of GlassSol v1.0.0

NineSolsNohit.dll

Decompiled a month 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 NineSolsNohit.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NineSolsNohit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NineSolsNohit")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("35405476-8ed7-4539-a7d7-6d6506f009e5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NineSolsNohit
{
	[BepInPlugin("flyingRozenbaum.NineSolsNohit", "NineSolsNohit", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public class Result<T> where T : class
		{
			public T value;
		}

		private const string modGUID = "flyingRozenbaum.NineSolsNohit";

		private const string modName = "NineSolsNohit";

		private const string modVersion = "0.1.0";

		public static Plugin instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("flyingRozenbaum.NineSolsNohit");
			mls.LogInfo((object)"СТАРТУЕМ");
			instance = this;
			Harmony.CreateAndPatchAll(typeof(PlayerHealthPatch), (string)null);
			mls.LogInfo((object)"СТАРТАНУЛИ");
		}
	}
}
namespace NineSolsNohit.Patches
{
	internal class PlayerHealthPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerHealth), "ReceiveDamage")]
		public static void ReceiveDamagePreFix(ref PlayerHealth __instance)
		{
			if (!((Health)__instance).IsInvincible)
			{
				((Health)__instance).Die();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerHealth), "ReceiveDamage")]
		public static void ReceiveDamagePostFix(ref PlayerHealth __instance)
		{
			if (!((Health)__instance).IsInvincible)
			{
				((Health)__instance).Die();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerHealth), "ReceiveDOT_Damage")]
		public static void ReceiveDOT_DamagePostFix(ref PlayerHealth __instance)
		{
			if (!((Health)__instance).IsInvincible)
			{
				((Health)__instance).Die();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerHealth), "ReceiveRecoverableDamage")]
		public static void ReceiveRecoverableDamagePostFix(ref PlayerHealth __instance)
		{
			((Health)__instance).currentValue = 1f;
		}
	}
}