using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShipSpeed;
[BepInPlugin("jhedin.BetterSailing", "Better Sailing", "0.1.1")]
public class BepInExPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(Ship), "Awake")]
private static class Awake_Patch
{
private static void Postfix(Ship __instance, ref float ___m_upsideDownDmg, ref float ___m_sailForceFactor, ref float ___m_waterImpactDamage)
{
___m_upsideDownDmg = 0f;
___m_sailForceFactor = sailForceFactor.Value;
___m_waterImpactDamage = 0f;
}
}
[HarmonyPatch(typeof(Ship), "GetWindAngleFactor")]
private static class GetWindAngleFactor_Patch
{
private static bool Prefix(Ship __instance, ref float __result)
{
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if (!modEnabled.Value)
{
float num = Vector3.Dot(EnvMan.instance.GetWindDir(), -((Component)__instance).transform.forward);
float num2 = Mathf.Lerp(0.7f, 1f, 1f - Mathf.Abs(num));
float num3 = 1f - Utils.LerpStep(0.75f, 0.8f, num);
__result = num2 * num3;
return true;
}
float[] array = new float[6] { 0f, 8.5f, 13.5f, 19f, 25f, 30f };
float[] obj = new float[14]
{
0f, 7f, 0f, 0f, 45f, 60f, 75f, 90f, 105f, 120f,
135f, 150f, 165f, 180f
};
obj[2] = Mathf.Clamp(minSailAngle.Value - 10f, 7.5f, minSailAngle.Value);
obj[3] = minSailAngle.Value;
float[] array2 = obj;
float[] array3 = new float[14];
float[] array4 = new float[14]
{
0f, 0f, 2f, 3f, 4.5f, 5.5f, 6f, 6.4f, 6.5f, 6.4f,
6.3f, 6.1f, 6f, 6f
};
float[] array5 = new float[14]
{
0f, 0f, 2f, 3.5f, 5f, 6.1f, 7f, 7.4f, 7.6f, 7.7f,
7.8f, 7.4f, 7.2f, 7.1f
};
float[] array6 = new float[14]
{
0f, 0f, 2f, 3.5f, 5.6f, 7f, 8.1f, 10.1f, 11.9f, 12f,
11.9f, 11.2f, 10.6f, 10.5f
};
float[] array7 = new float[14]
{
0f, 0f, 2f, 3.7f, 5.7f, 7.7f, 9.5f, 13.7f, 15.6f, 15.5f,
15.4f, 14f, 13.2f, 13.1f
};
float[] array8 = new float[14]
{
0f, 0f, 2f, 4f, 5.9f, 8.2f, 11.7f, 17.9f, 19.8f, 19.5f,
19f, 18.8f, 18f, 17.9f
};
float[][] array9 = new float[6][] { array3, array4, array5, array6, array7, array8 };
Vector3 windDir = EnvMan.instance.GetWindDir();
float windIntensity = EnvMan.instance.GetWindIntensity();
float num4 = Mathf.Lerp(0f, 1f, windIntensity);
float num5 = num4 * num4;
float num6 = Vector3.Dot(windDir, -((Component)__instance).transform.forward);
float num7 = 57.29578f * Mathf.Acos(num6);
float num8 = Mathf.Lerp(3f, 30f, num5);
int num9 = 0;
int num10 = 0;
int num11 = 0;
int num12 = 0;
for (int i = 0; i < array2.Length && array2[i] <= num7; i++)
{
num9 = i;
}
int num13 = array2.Length - 1;
while (num13 >= 0 && array2[num13] >= num7)
{
num10 = num13;
num13--;
}
for (int j = 0; j < array.Length && array[j] <= num8; j++)
{
num11 = j;
}
int num14 = array.Length - 1;
while (num14 >= 0 && array[num14] >= num8)
{
num12 = num14;
num14--;
}
float num15 = 0f;
float num16 = array2[num9];
float num17 = array2[num10];
float num18 = array[num11];
float num19 = array[num12];
float num20 = array9[num11][num9];
float num21 = array9[num12][num9];
float num22 = array9[num11][num10];
float num23 = array9[num12][num10];
float num24 = num7;
float num25 = num8;
num15 = ((num9 == num10 && num11 == num12) ? array9[num11][num9] : ((num11 == num12) ? Mathf.Lerp(num20, num21, (num24 - num16) / (num17 - num16)) : ((num9 != num10) ? (num20 * (num17 - num24) * (num19 - num25) / ((num17 - num16) * (num19 - num18)) + num22 * (num24 - num16) * (num19 - num25) / ((num17 - num16) * (num19 - num18)) + num21 * (num17 - num24) * (num25 - num18) / ((num17 - num16) * (num19 - num18)) + num23 * (num24 - num16) * (num25 - num18) / ((num17 - num16) * (num19 - num18))) : Mathf.Lerp(num20, num22, (num25 - num18) / (num19 - num18)))));
float num26 = num15 / 19.8f;
__result = num26;
return false;
}
}
[HarmonyPatch(typeof(Ship), "GetSailForce")]
private static class GetSailForce_Patch
{
private static bool Prefix(Ship __instance, ref Vector3 __result, ref Vector3 ___m_sailForce, ref Vector3 ___m_windChangeVelocity, ref GameObject ___m_mastObject, float sailSize, float dt)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00d1: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
Vector3 windDir = EnvMan.instance.GetWindDir();
float num = Vector3.Dot(windDir, -((Component)__instance).transform.forward);
float num2 = 57.29578f * Mathf.Acos(num);
float windIntensity = EnvMan.instance.GetWindIntensity();
float windAngleFactor = __instance.GetWindAngleFactor();
Vector3 val = Vector3.Normalize(windDir) * windIntensity * windForceFactor.Value;
if (num2 > 90f)
{
val = Vector3.Normalize(Vector3.up + windDir) * windIntensity * windForceFactor.Value;
}
Vector3 val2 = Vector3.Normalize(Vector3.ProjectOnPlane(((Component)__instance).transform.forward, Vector3.up));
Vector3 val3 = val2 * (windAngleFactor * sailSize * sailForceFactor.Value) + val;
___m_sailForce = Vector3.SmoothDamp(___m_sailForce, val3, ref ___m_windChangeVelocity, 1f, 99f);
__result = ___m_sailForce;
return false;
}
}
[HarmonyPatch(typeof(Ship), "FixTilt")]
private static class FixTilt_Patch
{
private static bool Prefix(Ship __instance)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Asin(((Component)__instance).transform.right.y);
float num2 = Mathf.Asin(((Component)__instance).transform.forward.y);
if (Mathf.Abs(num) > (float)Math.PI / 6f)
{
if (num > 0f)
{
((Component)__instance).transform.RotateAround(((Component)__instance).transform.position, ((Component)__instance).transform.forward, (0f - Time.fixedDeltaTime) * 20f);
}
else
{
((Component)__instance).transform.RotateAround(((Component)__instance).transform.position, ((Component)__instance).transform.forward, Time.fixedDeltaTime * 20f);
}
}
if (Mathf.Abs(num2) > (float)Math.PI / 6f)
{
if (num2 > 0f)
{
((Component)__instance).transform.RotateAround(((Component)__instance).transform.position, ((Component)__instance).transform.right, (0f - Time.fixedDeltaTime) * 30f);
}
else
{
((Component)__instance).transform.RotateAround(((Component)__instance).transform.position, ((Component)__instance).transform.right, Time.fixedDeltaTime * 30f);
}
}
return false;
}
}
[HarmonyPatch(typeof(GlobalWind), "UpdateWind")]
private static class UpdateWind_Patch
{
private static bool Prefix(GlobalWind __instance, ref bool ___m_alignToWindDirection, ref ParticleSystem ___m_ps, ref float ___m_multiplier, bool ___m_particleVelocity, bool ___m_particleForce, bool ___m_particleEmission, int ___m_particleEmissionMin, int ___m_particleEmissionMax)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
if (___m_alignToWindDirection)
{
Vector3 windDir = EnvMan.instance.GetWindDir();
((Component)__instance).transform.rotation = Quaternion.LookRotation(windDir, Vector3.up);
}
if (Object.op_Implicit((Object)(object)___m_ps))
{
EmissionModule emission = ___m_ps.emission;
if (!((EmissionModule)(ref emission)).enabled)
{
return false;
}
Vector3 windForce = EnvMan.instance.GetWindForce();
if (___m_particleVelocity)
{
VelocityOverLifetimeModule velocityOverLifetime = ___m_ps.velocityOverLifetime;
((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = MinMaxCurve.op_Implicit(windForce.x * ___m_multiplier);
((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = MinMaxCurve.op_Implicit(windForce.z * ___m_multiplier);
}
if (___m_particleForce)
{
ForceOverLifetimeModule forceOverLifetime = ___m_ps.forceOverLifetime;
((ForceOverLifetimeModule)(ref forceOverLifetime)).space = (ParticleSystemSimulationSpace)1;
((ForceOverLifetimeModule)(ref forceOverLifetime)).x = MinMaxCurve.op_Implicit(windForce.x * ___m_multiplier);
((ForceOverLifetimeModule)(ref forceOverLifetime)).z = MinMaxCurve.op_Implicit(windForce.z * ___m_multiplier);
}
if (___m_particleEmission)
{
EmissionModule emission2 = ___m_ps.emission;
((EmissionModule)(ref emission2)).rateOverTimeMultiplier = Mathf.Lerp((float)___m_particleEmissionMin, (float)___m_particleEmissionMax, EnvMan.instance.GetWindIntensity());
}
}
return false;
}
}
[HarmonyPatch(typeof(Ship), "UpdateSail")]
private static class UpdateSail_Patch
{
private static bool Prefix(Ship __instance, ref Speed ___m_speed, ref GameObject ___m_mastObject, ref Cloth ___m_sailCloth, float dt)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00e9: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: 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_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: 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_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
MethodInfo method = ((object)__instance).GetType().GetMethod("UpdateSailSize", BindingFlags.Instance | BindingFlags.NonPublic);
method.Invoke(__instance, new object[1] { dt });
Vector3 windDir = EnvMan.instance.GetWindDir();
float windAngleFactor = __instance.GetWindAngleFactor();
float windIntensity = EnvMan.instance.GetWindIntensity();
windDir = Vector3.Cross(Vector3.Cross(windDir, ((Component)__instance).transform.up), ((Component)__instance).transform.up);
if ((int)___m_speed == 4 || (int)___m_speed == 3)
{
float num = 0.5f + Vector3.Dot(((Component)__instance).transform.forward, windDir) * 0.5f;
Quaternion val = Quaternion.LookRotation(-Vector3.Lerp(windDir, Vector3.Normalize(windDir - ((Component)__instance).transform.forward), num), ((Component)__instance).transform.up);
___m_mastObject.transform.rotation = Quaternion.RotateTowards(___m_mastObject.transform.rotation, val, windAngleFactor * dt);
___m_sailCloth.externalAcceleration = windDir * windAngleFactor * sailAccelerationFactor.Value;
___m_sailCloth.randomAcceleration = windDir * windIntensity * windAngleFactor * sailLuffingFactor.Value;
}
else if ((int)___m_speed == 1)
{
Quaternion val2 = Quaternion.LookRotation(-((Component)__instance).transform.forward, ((Component)__instance).transform.up);
Quaternion val3 = Quaternion.LookRotation(-windDir, ((Component)__instance).transform.up);
val3 = Quaternion.RotateTowards(val2, val3, 80f);
___m_mastObject.transform.rotation = Quaternion.RotateTowards(___m_mastObject.transform.rotation, val3, 30f * dt);
}
return false;
}
}
[HarmonyPatch(typeof(EnvMan), "Awake")]
private static class Awake_EnvMan_Patch
{
private static void Postfix(ref Vector4 ___m_windDir1, ref Vector4 ___m_windDir2)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
___m_windDir1 = Vector4.op_Implicit(Vector3.left);
___m_windDir2 = Vector4.op_Implicit(Vector3.left);
}
}
[HarmonyPatch(typeof(EnvMan), "SetTargetWind")]
private static class SetTargetWind_Patch
{
private static bool Prefix(Vector3 dir, float intensity, ref float ___m_windTransitionTimer, ref Vector4 ___m_windDir1, ref Vector4 ___m_windDir2)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if (!(___m_windTransitionTimer >= 0f))
{
intensity = Mathf.Clamp(intensity, 0.05f, 1f);
if (!Mathf.Approximately(dir.x, ___m_windDir1.x) || !Mathf.Approximately(dir.y, ___m_windDir1.y) || !Mathf.Approximately(dir.z, ___m_windDir1.z) || !Mathf.Approximately(intensity, ___m_windDir1.w))
{
___m_windTransitionTimer = 0f;
if (modEnabled.Value)
{
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(dir.x, dir.y, dir.z);
Vector3 val2 = Vector3.Normalize(Vector3.Project(val, Vector3.left));
___m_windDir2 = new Vector4(val2.x, val2.y, val2.z, intensity);
return false;
}
return true;
}
return false;
}
return false;
}
}
private static readonly bool isDebug = true;
private static BepInExPlugin context;
private static ConfigEntry<bool> modEnabled;
private static ConfigEntry<float> sailForceFactor;
private static ConfigEntry<float> windForceFactor;
private static ConfigEntry<float> minSailAngle;
private static ConfigEntry<float> sailAccelerationFactor;
private static ConfigEntry<float> sailLuffingFactor;
private Harmony harmony;
public static void Dbgl(string str = "", bool pref = true)
{
if (isDebug)
{
Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str));
}
}
private void Awake()
{
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
context = this;
modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
sailForceFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Ships", "Sail Force Multiplier", 0.1f, "Conversion for how much the sail angle results affects the ship");
windForceFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Ships", "Wind Force Multiplier", 0.02f, "Conversion for much the wind direction pushes on the boat");
minSailAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Ships", "Minimum Sailing Angle", 30f, "Degrees for when the boat starts going fast");
sailAccelerationFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Sail", "Sail Acceleration Factor", 1f, "How full the sail should be based on the wind");
sailLuffingFactor = ((BaseUnityPlugin)this).Config.Bind<float>("Sail", "Sail Luffing Factor", 1f, "How full the sail should luff");
if (modEnabled.Value)
{
harmony = new Harmony("jhedin.BetterSailing");
harmony.PatchAll();
}
}
private void OnDestroy()
{
Dbgl("Destroying plugin");
harmony.UnpatchAll((string)null);
}
}