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")] [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"; } public static BoatDamage CurrentBoatDamage; 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] Anti-sinking shield deployed successfully."); } 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, Rigidbody ___rigidbody, float ___baseMass) { __instance.hullDamage = 0f; __instance.waterLevel = 0f; __instance.waterIntakeChunk = 0f; __instance.sunk = false; if ((Object)(object)___rigidbody != (Object)null && ___baseMass > 0f) { ___rigidbody.mass = ___baseMass; } Debug.Log((object)"[NoDamage] Vessel state initialized and dried to factory settings."); } [HarmonyPatch("UpdateWaterAndDrag")] [HarmonyPrefix] public static bool UpdateWaterAndDragPrefix(BoatDamage __instance, Rigidbody ___rigidbody, float ___baseMass) { __instance.hullDamage = 0f; __instance.waterLevel = 0f; __instance.waterIntakeChunk = 0f; __instance.sunk = false; if ((Object)(object)___rigidbody != (Object)null && ___baseMass > 0f) { ___rigidbody.mass = ___baseMass; ___rigidbody.drag = 0f; } return true; } [HarmonyPatch("Impact")] [HarmonyPrefix] public static bool ImpactPrefix() { return false; } [HarmonyPatch("Overflow")] [HarmonyPrefix] public static bool OverflowPrefix() { return false; } }