Decompiled source of NoDamage v1.1.0

NoDamage.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("NoDamage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f69f00d375b1ecca3e394dcfd6a62d1f3335cea8")]
[assembly: AssemblyProduct("NoDamage")]
[assembly: AssemblyTitle("NoDamage")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoDamage;

[BepInPlugin("com.luizbag.sailwind.nodamage", "NoDamage", "1.0.0")]
public class NoDamagePlugin : BaseUnityPlugin
{
	public static class PluginInfo
	{
		public const string GUID = "com.luizbag.sailwind.nodamage";

		public const string Name = "NoDamage";

		public const string Version = "1.0.0";
	}

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			new Harmony("com.luizbag.sailwind.nodamage").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[NoDamage] Physical damage immunity deployed. Weather danger remains active.");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[NoDamage] Patch injection failed: " + ex.Message));
		}
	}
}
[HarmonyPatch(typeof(BoatDamage))]
public static class BoatDamageForcePatches
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void StartPostfix(BoatDamage __instance)
	{
		if (!((Object)(object)__instance == (Object)null))
		{
			__instance.hullDamage = 0f;
			Debug.Log((object)"[NoDamage] Hull integrity restored to factory settings on load.");
		}
	}

	[HarmonyPatch("UpdateWaterAndDrag")]
	[HarmonyPrefix]
	public static bool UpdateWaterAndDragPrefix(BoatDamage __instance)
	{
		if ((Object)(object)__instance != (Object)null)
		{
			__instance.hullDamage = 0f;
		}
		return true;
	}

	[HarmonyPatch("Impact")]
	[HarmonyPrefix]
	public static bool ImpactPrefix()
	{
		return false;
	}
}