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.2")]
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 v1.0.2: 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_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)___col == (Object)null || (Object)(object)___rigidbody == (Object)null)
{
return true;
}
if ((Object)(object)GameState.currentBoat != (Object)null)
{
string text = ((Object)GameState.currentBoat).name.ToLower();
string text2 = ((Object)((Component)___rigidbody).transform).name.ToLower();
bool num = text2.Contains(text) || text.Contains(text2);
bool flag = (text.Contains("small") && text2.Contains("small")) || (text.Contains("medium") && text2.Contains("medium")) || (text.Contains("large") && text2.Contains("large"));
if (num || flag)
{
if (___col.enabled)
{
___col.enabled = false;
}
return true;
}
}
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 num2 = Vector3.Distance(((Component)value2).transform.position, ((Component)__instance).transform.position);
if (___pushStartDistance < 0f)
{
___pushStartDistance = num2;
}
if (!(num2 > ___pushStartDistance + 0.25f))
{
float num3 = 1f;
Vector3 velocity = ___rigidbody.velocity;
float num4 = ((Vector3)(ref velocity)).magnitude;
if (num4 < 1f)
{
num4 = 1f;
}
Vector3 val = ___pushForceMult * ___baseMass * ((Component)value2).transform.forward;
Vector3 val2 = ___upForceMult * ___baseMass * Vector3.up;
Vector3 val3 = Vector3.up * ___verticalOffset;
Vector3 val4 = (val + val2) * num3 / num4;
___rigidbody.AddForceAtPosition(val4, ((Component)value2).transform.position + val3);
}
}
else
{
___pushStartDistance = -1f;
}
return false;
}
}
}