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.Configuration;
using BepInEx.Logging;
using CG.Ship.Hull;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("OpenShipDoors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("0.0.3.0")]
[assembly: AssemblyInformationalVersion("0.0.3+b9aee7b2b4a9b9ca6ea9af97c7e2435e48d486c0")]
[assembly: AssemblyProduct("OpenShipDoors")]
[assembly: AssemblyTitle("Opens ship doors at start of session. Host-side.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.3.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 OpenShipDoors
{
[HarmonyPatch(typeof(AbstractDoor), "Awake")]
internal class AbstractDoorPatch
{
private static void Prefix(AbstractDoor __instance, ref bool ___isOpen)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
if (!BepinPlugin.Bindings.OpenDoorsOnStart.Value)
{
return;
}
AirlockDoor val = (AirlockDoor)(object)((__instance is AirlockDoor) ? __instance : null);
if (val != null)
{
if ((BepinPlugin.Bindings.OpenInnerAirlock.Value && (int)val.airlockDoorType == 0) || (BepinPlugin.Bindings.OpenOuterAirlock.Value && (int)val.airlockDoorType == 1))
{
___isOpen = true;
}
}
else
{
___isOpen = true;
}
}
}
[BepInPlugin("18107.OpenShipDoors", "Open Ship Doors", "0.0.3")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal class Bindings
{
internal static ConfigEntry<bool> OpenDoorsOnStart;
internal static ConfigEntry<bool> OpenInnerAirlock;
internal static ConfigEntry<bool> OpenOuterAirlock;
}
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin 18107.OpenShipDoors is loaded!");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "18107.OpenShipDoors");
Bindings.OpenDoorsOnStart = ((BaseUnityPlugin)this).Config.Bind<bool>("OpenShipDoors", "OpenShipDoorsOnStart", true, (ConfigDescription)null);
Bindings.OpenInnerAirlock = ((BaseUnityPlugin)this).Config.Bind<bool>("OpenShipDoors", "OpenInnerAirlock", true, (ConfigDescription)null);
Bindings.OpenOuterAirlock = ((BaseUnityPlugin)this).Config.Bind<bool>("OpenShipDoors", "OpenOuterAirlock", false, (ConfigDescription)null);
}
}
internal class GUI : ModSettingsMenu
{
public override void Draw()
{
if (GUILayout.Button("Open ship doors on start: " + (BepinPlugin.Bindings.OpenDoorsOnStart.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
{
BepinPlugin.Bindings.OpenDoorsOnStart.Value = !BepinPlugin.Bindings.OpenDoorsOnStart.Value;
}
if (GUILayout.Button("Open inner airlock doors: " + (BepinPlugin.Bindings.OpenInnerAirlock.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
{
BepinPlugin.Bindings.OpenInnerAirlock.Value = !BepinPlugin.Bindings.OpenInnerAirlock.Value;
}
if (GUILayout.Button("Open outer airlock doors: " + (BepinPlugin.Bindings.OpenOuterAirlock.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
{
BepinPlugin.Bindings.OpenOuterAirlock.Value = !BepinPlugin.Bindings.OpenOuterAirlock.Value;
}
}
public override string Name()
{
return "OpenShipDoors: " + (BepinPlugin.Bindings.OpenDoorsOnStart.Value ? "Enabled" : "Disabled");
}
}
public class MyPluginInfo
{
public const string PLUGIN_GUID = "18107.OpenShipDoors";
public const string PLUGIN_NAME = "OpenShipDoors";
public const string USERS_PLUGIN_NAME = "Open Ship Doors";
public const string PLUGIN_VERSION = "0.0.3";
public const string PLUGIN_DESCRIPTION = "Opens ship doors at start of session. Host-side.";
public const string PLUGIN_ORIGINAL_AUTHOR = "18107";
public const string PLUGIN_AUTHORS = "18107, Dragon";
public const string PLUGIN_THUNDERSTORE_ID = "VoidCrewModdingTeam/Open_Ship_Doors";
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)8;
public override string Author => "18107, Dragon";
public override string Description => "Opens ship doors at start of session. Host-side.";
public override string ThunderstoreID => "VoidCrewModdingTeam/Open_Ship_Doors";
public override SessionChangedReturn OnSessionChange(SessionChangedInput input)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0024: 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)
//IL_0011: 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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if ((int)input.CallType == 1)
{
SessionChangedReturn result = default(SessionChangedReturn);
result.SetMod_Session = true;
return result;
}
return ((VoidPlugin)this).OnSessionChange(input);
}
}
}