Decompiled source of Sailwind Water Push Restored v1.0.0

SailwindWaterPushRestored.dll

Decompiled 8 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("SailwindWaterPushRestored")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SailwindWaterPushRestored")]
[assembly: AssemblyTitle("SailwindWaterPushRestored")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SailwindWaterPushRestored
{
	[BepInPlugin("com.kemylar.sailwind.waterpushrestored", "Water Push Restored", "1.0.0")]
	public class WaterPushPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("com.kemylar.sailwind.waterpushrestored").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Water Push Restored: Loaded successfully!");
		}
	}
	[HarmonyPatch(typeof(GPButtonBoatPushCol), "ExtraFixedUpdate")]
	public static class PushPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(GPButtonBoatPushCol __instance, ref float ___pushStartDistance, float ___pushForceMult, float ___baseMass, float ___upForceMult, float ___verticalOffset, ref Collider ___col, ref Rigidbody ___rigidbody)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			bool value = Traverse.Create((object)__instance).Field("isClicked").GetValue<bool>();
			GoPointerMovement value2 = Traverse.Create((object)__instance).Field("isClickedBy").GetValue<GoPointerMovement>();
			if (!___col.enabled)
			{
				___col.enabled = true;
			}
			if (value && (Object)(object)value2 != (Object)null)
			{
				float num = Vector3.Distance(((Component)value2).transform.position, ((Component)__instance).transform.position);
				if (___pushStartDistance < 0f)
				{
					___pushStartDistance = num;
				}
				if (!(num > ___pushStartDistance + 0.25f))
				{
					float num2 = 1f;
					Vector3 velocity = ___rigidbody.velocity;
					float num3 = ((Vector3)(ref velocity)).magnitude;
					if (num3 < 1f)
					{
						num3 = 1f;
					}
					Vector3 val = ___pushForceMult * ___baseMass * ((Component)value2).transform.forward;
					Vector3 val2 = ___upForceMult * ___baseMass * Vector3.up;
					Vector3 val3 = Vector3.up * ___verticalOffset;
					Vector3 val4 = (val + val2) * num2 / num3;
					___rigidbody.AddForceAtPosition(val4, ((Component)value2).transform.position + val3);
				}
			}
			else
			{
				___pushStartDistance = -1f;
			}
			return false;
		}
	}
}