using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using WildSkies.Input;
using WildSkies.ShipParts;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DoubleTapSails")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoubleTapSails")]
[assembly: AssemblyTitle("DoubleTapSails")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 DoubleTapSails
{
[BepInPlugin("DoubleTapSails", "DoubleTapSails", "1.0.0")]
public class Plugin : BasePlugin
{
internal static ManualLogSource Log;
internal static Harmony harmonyInstance;
private static float LastThrottleValue = 0f;
private static DateTime LastAccelTime = DateTime.Now;
private static DateTime LastDecelTime = DateTime.Now;
public override void Load()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DoubleTapSails");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
}
public override bool Unload()
{
Harmony obj = harmonyInstance;
if (obj != null)
{
obj.UnpatchSelf();
}
return true;
}
[HarmonyPatch(typeof(UserControlShip), "DoUpdate")]
[HarmonyPostfix]
public static void UserControlShip_DoUpdate(UserControlShip __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0044: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_00ee: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: 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)
if ((int)__instance._inputService.CurrentPriorityInput != 4)
{
return;
}
float num = __instance._inputService.ShipControls.Ship.Throttle.ReadValue<float>();
if (num != 0f && LastThrottleValue == 0f)
{
DateTime now = DateTime.Now;
if (num > 0f)
{
if (now - LastAccelTime <= TimeSpan.FromSeconds(2.0))
{
__instance.ShipToControl.ShipController.GetPartsOfType<Mast>().FindAll(Predicate<Mast>.op_Implicit((Func<Mast, bool>)((Mast x) => !x.IsOpen))).ForEach(Action<Mast>.op_Implicit((Action<Mast>)delegate(Mast mast)
{
mast.SetFurl();
}));
}
LastAccelTime = now;
}
if (num < 0f)
{
if (now - LastDecelTime <= TimeSpan.FromSeconds(2.0))
{
__instance.ShipToControl.ShipController.GetPartsOfType<Mast>().FindAll(Predicate<Mast>.op_Implicit((Func<Mast, bool>)((Mast x) => x.IsOpen))).ForEach(Action<Mast>.op_Implicit((Action<Mast>)delegate(Mast mast)
{
mast.SetFurl();
}));
}
LastDecelTime = now;
}
}
LastThrottleValue = num;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DoubleTapSails";
public const string PLUGIN_NAME = "DoubleTapSails";
public const string PLUGIN_VERSION = "1.0.0";
}
}