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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SecureDoors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("Secure Doors")]
[assembly: AssemblyTitle("SecureDoors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 SecureDoors
{
[BepInPlugin("SecureDoors", "Secure Doors", "1.0.1")]
public class Plugin : BasePlugin
{
internal static ManualLogSource Log;
internal static ConfigEntry<bool> AlarmOnBargeAttempt;
internal static ConfigEntry<bool> RequireTresspassing;
public override void Load()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
AlarmOnBargeAttempt = ((BasePlugin)this).Config.Bind<bool>("General.Toggles", "Alarm On Barge Attempt", false, "Alarms triggered on any barge attempt. Even unsuccesful ones.");
RequireTresspassing = ((BasePlugin)this).Config.Bind<bool>("General.Toggles", "Barger must be tresspassing", false, "Limits alarm protection to internal doors and not those facing the public.");
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>("SecureDoors");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
Harmony val2 = new Harmony("SecureDoors");
val2.PatchAll(Assembly.GetExecutingAssembly());
ManualLogSource log2 = Log;
val = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SecureDoors");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
}
log2.LogInfo(val);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SecureDoors";
public const string PLUGIN_NAME = "Secure Doors";
public const string PLUGIN_VERSION = "1.0.1";
}
}
namespace SecureDoors.Patches
{
internal class NewDoorPatches
{
[HarmonyPatch(typeof(NewDoor), "Barge")]
internal class NewDoor_Barge
{
[HarmonyPostfix]
internal static void Postfix(NewDoor __instance, Actor barger)
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Invalid comparison between Unknown and I4
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Invalid comparison between Unknown and I4
Human val = default(Human);
((Component)barger).TryGetComponent<Human>(ref val);
if (!((Object)(object)val != (Object)null) || SessionData.Instance.isFloorEdit)
{
Plugin.Log.LogInfo((object)"SecureDoors: Barger is null or floor edit");
}
else
{
if (!Plugin.AlarmOnBargeAttempt.Value && __instance.wall.currentDoorStrength > 0f)
{
return;
}
if ((int)__instance.preset.lockType != 2)
{
if ((int)__instance.preset.lockType == 1)
{
}
return;
}
Interactable breakerSecurity = __instance.wall.otherWall.node.gameLocation.thisAsAddress.GetBreakerSecurity();
if ((breakerSecurity == null || breakerSecurity.sw0) && (!Plugin.RequireTresspassing.Value || ((Actor)val).isTrespassing))
{
__instance.wall.otherWall.node.gameLocation.thisAsAddress.SetAlarm(true, val);
}
}
}
}
}
}