Decompiled source of Divide v0.1.3

plugins/DoubleSidedDoors.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using System.Text.RegularExpressions;
using AIGraph;
using API;
using Agents;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using DoubleSidedDoors.BepInEx;
using DoubleSidedDoors.Patches;
using Enemies;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using MTFO.API;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using StateMachines;
using UnityEngine;
using UnityEngine.Analytics;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DoubleSidedDoors")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+57b8f04500e286a93241e3de3fcf1de581c3ecf7")]
[assembly: AssemblyProduct("DoubleSidedDoors")]
[assembly: AssemblyTitle("DoubleSidedDoors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace API
{
	[HarmonyPatch(typeof(GameDataInit))]
	internal class GameDataInit_Patches
	{
		[HarmonyPatch("Initialize")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		public static void Initialize_Postfix()
		{
			Analytics.enabled = false;
		}
	}
	internal static class APILogger
	{
		private static readonly ManualLogSource logger;

		static APILogger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			logger = new ManualLogSource("Rand-API");
			Logger.Sources.Add((ILogSource)(object)logger);
		}

		private static string Format(string module, object msg)
		{
			return $"[{module}]: {msg}";
		}

		public static void Info(string module, object data)
		{
			logger.LogMessage((object)Format(module, data));
		}

		public static void Verbose(string module, object data)
		{
		}

		public static void Log(object data)
		{
			logger.LogDebug((object)Format("DoubleSidedDoors", data));
		}

		public static void Debug(object data, bool force = false)
		{
			if (ConfigManager.Debug || force)
			{
				Log(data);
			}
		}

		public static void Warn(object data)
		{
			logger.LogWarning((object)Format("DoubleSidedDoors", data));
		}

		public static void Error(object data)
		{
			logger.LogError((object)Format("DoubleSidedDoors", data));
		}
	}
}
namespace DoubleSidedDoors
{
	internal static class JSON
	{
		private static readonly JsonSerializerOptions _setting;

		static JSON()
		{
			_setting = new JsonSerializerOptions
			{
				ReadCommentHandling = JsonCommentHandling.Skip,
				IncludeFields = false,
				PropertyNameCaseInsensitive = true,
				WriteIndented = true,
				IgnoreReadOnlyProperties = true
			};
		}

		public static T Deserialize<T>(string json)
		{
			return JsonSerializer.Deserialize<T>(json, _setting);
		}

		public static object Deserialize(Type type, string json)
		{
			return JsonSerializer.Deserialize(json, type, _setting);
		}

		public static string Serialize(object value, Type type)
		{
			return JsonSerializer.Serialize(value, type, _setting);
		}
	}
	public sealed class LayoutConfig
	{
		public uint LevelLayoutID { get; set; }

		public DoorIdentifier[] Doors { get; set; } = Array.Empty<DoorIdentifier>();


		public BindDoorToPlayer[] BindDoorToPlayer { get; set; } = Array.Empty<BindDoorToPlayer>();


		public DoorIdentifier[] DoorLockedGraphicOverrides { get; set; } = Array.Empty<DoorIdentifier>();


		public DoorMessageOverride[] DoorMessageOverrides { get; set; } = Array.Empty<DoorMessageOverride>();


		public DoorTriggerOverride[] DoorOverrideTrigger { get; set; } = Array.Empty<DoorTriggerOverride>();

	}
	public sealed class BindDoorToPlayer
	{
		public int Slot { get; set; }

		public DoorIdentifier? Door { get; set; }
	}
	public sealed class DoorIdentifier
	{
		public int To { get; set; }

		public int From { get; set; } = -1;


		public string Text { get; set; } = "<color=red>BI-DIRECTIONAL ACCESS DISABLED</color>";


		public string State { get; set; } = "";

	}
	public sealed class DoorMessageOverride
	{
		public DoorIdentifier? Door { get; set; }

		public string Message { get; set; } = string.Empty;

	}
	public sealed class DoorTriggerOverride
	{
		public DoorIdentifier? Door { get; set; }

		public DoorIdentifier? Target { get; set; }

		public bool OpenOnTarget { get; set; }
	}
}
namespace DoubleSidedDoors.Patches
{
	[HarmonyPatch]
	internal static class Spawn
	{
		private static bool patch = true;

		public static Dictionary<uint, LayoutConfig> data = new Dictionary<uint, LayoutConfig>();

		public static Dictionary<int, Dictionary<int, LG_SecurityDoor>> doors = new Dictionary<int, Dictionary<int, LG_SecurityDoor>>();

		private static HashSet<int> reversedSecDoors = new HashSet<int>();

		private static Dictionary<int, GameObject> reversedGates = new Dictionary<int, GameObject>();

		private static bool onDoorSync = false;

		private static Dictionary<int, HashSet<LG_SecurityDoor>> boundDoors = new Dictionary<int, HashSet<LG_SecurityDoor>>();

		private static bool IsTargetReachable(AIG_CourseNode source, AIG_CourseNode target)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Invalid comparison between Unknown and I4
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Invalid comparison between Unknown and I4
			if (source == null || target == null)
			{
				return false;
			}
			if (source.NodeID == target.NodeID)
			{
				return true;
			}
			AIG_SearchID.IncrementSearchID();
			ushort searchID = AIG_SearchID.SearchID;
			Queue<AIG_CourseNode> queue = new Queue<AIG_CourseNode>();
			queue.Enqueue(source);
			while (queue.Count > 0)
			{
				AIG_CourseNode val = queue.Dequeue();
				((AIG_CourseGraphMember)val).m_searchID = searchID;
				Enumerator<AIG_CoursePortal> enumerator = val.m_portals.GetEnumerator();
				while (enumerator.MoveNext())
				{
					AIG_CoursePortal current = enumerator.Current;
					LG_Gate gate = current.Gate;
					object obj;
					if (gate == null)
					{
						obj = null;
					}
					else
					{
						iLG_Door_Core spawnedDoor = gate.SpawnedDoor;
						obj = ((spawnedDoor != null) ? ((Il2CppObjectBase)spawnedDoor).TryCast<LG_SecurityDoor>() : null);
					}
					LG_SecurityDoor val2 = (LG_SecurityDoor)obj;
					if ((Object)(object)val2 != (Object)null)
					{
						DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(16, 2);
						defaultInterpolatedStringHandler.AppendLiteral("SecurityDoor ");
						defaultInterpolatedStringHandler.AppendFormatted(val2.m_serialNumber);
						defaultInterpolatedStringHandler.AppendLiteral(" - ");
						eDoorStatus lastStatus = val2.LastStatus;
						defaultInterpolatedStringHandler.AppendFormatted(((object)(eDoorStatus)(ref lastStatus)).ToString());
						APILogger.Debug(defaultInterpolatedStringHandler.ToStringAndClear());
						if ((int)val2.LastStatus != 10 && (int)val2.LastStatus != 16)
						{
							continue;
						}
					}
					AIG_CourseNode oppositeNode = current.GetOppositeNode(val);
					if (((AIG_CourseGraphMember)oppositeNode).m_searchID != searchID)
					{
						if (oppositeNode.NodeID == target.NodeID)
						{
							return true;
						}
						queue.Enqueue(oppositeNode);
					}
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")]
		[HarmonyPostfix]
		private static void UpdateTracking(EnemyCourseNavigation __instance)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			if (!patch || !SNet.IsMaster)
			{
				return;
			}
			EnemyAgent owner = __instance.m_owner;
			if (((Agent)owner).CourseNode != null && __instance.m_targetRef != null && (int)((StateMachine<ES_Base>)(object)owner.Locomotion).m_currentState.m_stateEnum != 14 && !IsTargetReachable(((Agent)owner).CourseNode, __instance.m_targetRef.m_agent.CourseNode))
			{
				int num = Random.RandomRangeInt(0, PlayerManager.PlayerAgentsInLevel.Count);
				PlayerAgent val = PlayerManager.PlayerAgentsInLevel[num];
				while (PlayerManager.PlayerAgentsInLevel.Count != 1 && ((Object)val).GetInstanceID() == ((Object)__instance.m_targetRef.m_agent).GetInstanceID())
				{
					num = (num + 1) % PlayerManager.PlayerAgentsInLevel.Count;
					val = PlayerManager.PlayerAgentsInLevel[num];
				}
				patch = false;
				((AgentAI)owner.AI).SetTarget((Agent)(object)val);
				patch = true;
			}
		}

		[HarmonyPatch(typeof(SurvivalWave), "GetScoredSpawnPoint_FromElevator")]
		[HarmonyPrefix]
		private static bool GetScoredSpawnPoint_FromElevator(SurvivalWave __instance, ref ScoredSpawnPoint __result)
		{
			//IL_0052: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0095: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			AIG_CourseNode startCourseNode = __instance.m_courseNode.m_dimension.GetStartCourseNode();
			AIG_CourseNode val = null;
			Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PlayerAgent current = enumerator.Current;
				if (IsTargetReachable(startCourseNode, current.m_courseNode))
				{
					val = current.m_courseNode;
					break;
				}
			}
			if (val == null)
			{
				return true;
			}
			Vector3 val2 = startCourseNode.Position - val.Position;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			normalized.y = 0f;
			List<ScoredSpawnPoint> availableSpawnPointsBetweenElevatorAndNode = __instance.GetAvailableSpawnPointsBetweenElevatorAndNode(val, 20);
			ScoredSpawnPoint val3 = new ScoredSpawnPoint
			{
				totalCost = float.MinValue
			};
			Vector3 position = val.Position;
			float num = 1f;
			float num2 = 4f - num;
			for (int i = 0; i < availableSpawnPointsBetweenElevatorAndNode.Count; i++)
			{
				ScoredSpawnPoint val4 = availableSpawnPointsBetweenElevatorAndNode[i];
				Vector3 val5 = val4.firstCoursePortal.Position - position;
				val5.y = 0f;
				((Vector3)(ref val5)).Normalize();
				val4.m_dir = val5;
				val4.totalCost = Mathf.Clamp01(Vector3.Dot(val5, normalized));
				if (val4.pathHeat > num - 0.01f)
				{
					val4.totalCost += 1f + (1f - Mathf.Clamp(val4.pathHeat - num, 0f, num2) / num2);
				}
				if (val3 == null)
				{
					val3 = val4;
				}
				else if (val4.totalCost > val3.totalCost)
				{
					val3 = val4;
				}
			}
			if (val3.courseNode == null)
			{
				val3.courseNode = val;
			}
			__result = val3;
			return false;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "Setup")]
		[HarmonyPostfix]
		private static void SecurityDoor_Setup(LG_SecurityDoor __instance, LG_Gate gate)
		{
			int alias = ((LG_ZoneExpander)gate).m_linksFrom.m_zone.Alias;
			int alias2 = ((LG_ZoneExpander)gate).m_linksTo.m_zone.Alias;
			if (!doors.ContainsKey(alias))
			{
				doors.Add(alias, new Dictionary<int, LG_SecurityDoor>());
			}
			doors[alias].Add(alias2, __instance);
		}

		private static uint GetLayoutIdOfZone(LG_Zone zone)
		{
			//IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected I4, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			Dimension dimension = zone.Dimension;
			if (dimension.IsMainDimension)
			{
				LG_LayerType type = zone.Layer.m_type;
				ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition;
				return (int)type switch
				{
					0 => activeExpedition.LevelLayoutData, 
					1 => activeExpedition.SecondaryLayout, 
					2 => activeExpedition.ThirdLayout, 
					_ => throw new NotSupportedException($"LayerType: {type} is not supported!"), 
				};
			}
			return dimension.DimensionData.LevelLayoutData;
		}

		private static bool reverse(uint layerId, int fromAlias, int toAlias)
		{
			bool flag = false;
			if (data.ContainsKey(layerId))
			{
				flag = data[layerId].Doors.Any((DoorIdentifier d) => d.To == toAlias && (d.From == -1 || d.From == fromAlias));
			}
			APILogger.Debug($"layerId: {layerId}, fromAlias: {fromAlias}, toAlias: {toAlias} -> {(flag ? "reversed" : "not reversed")}");
			return flag;
		}

		private static bool graphic(uint layerId, int fromAlias, int toAlias)
		{
			bool flag = false;
			if (data.ContainsKey(layerId))
			{
				flag = data[layerId].DoorLockedGraphicOverrides.Any((DoorIdentifier d) => d.To == toAlias && (d.From == -1 || d.From == fromAlias));
			}
			APILogger.Debug($"layerId: {layerId}, fromAlias: {fromAlias}, toAlias: {toAlias} -> {(flag ? "override handle light" : "leave handle light")}");
			return flag;
		}

		private static bool overrideMessage(uint layerId, int fromAlias, int toAlias)
		{
			bool flag = false;
			if (data.ContainsKey(layerId))
			{
				flag = data[layerId].DoorMessageOverrides.Any((DoorMessageOverride d) => d.Door != null && d.Door.To == toAlias && (d.Door.From == -1 || d.Door.From == fromAlias));
			}
			APILogger.Debug($"layerId: {layerId}, fromAlias: {fromAlias}, toAlias: {toAlias} -> {(flag ? "override message" : "not overridden")}");
			return flag;
		}

		private static bool overrideTrigger(uint layerId, int fromAlias, int toAlias)
		{
			bool flag = false;
			if (data.ContainsKey(layerId))
			{
				flag = data[layerId].DoorOverrideTrigger.Any((DoorTriggerOverride d) => d.Door != null && d.Door.To == toAlias && (d.Door.From == -1 || d.Door.From == fromAlias));
			}
			APILogger.Debug($"layerId: {layerId}, fromAlias: {fromAlias}, toAlias: {toAlias} -> {(flag ? "override trigger" : "not trigger")}");
			return flag;
		}

		private static bool overrideTriggerOG(uint layerId, int fromAlias, int toAlias)
		{
			bool flag = false;
			if (data.ContainsKey(layerId))
			{
				flag = data[layerId].DoorOverrideTrigger.Any((DoorTriggerOverride d) => d.Target != null && d.Target.To == toAlias && (d.Target.From == -1 || d.Target.From == fromAlias));
			}
			APILogger.Debug($"layerId: {layerId}, fromAlias: {fromAlias}, toAlias: {toAlias} -> {(flag ? "OG trigger" : "not OG trigger")}");
			return flag;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
		[HarmonyPrefix]
		private static void OnSyncDoorStatusChangeOG(LG_SecurityDoor __instance, pDoorState state)
		{
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Invalid comparison between Unknown and I4
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Invalid comparison between Unknown and I4
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Invalid comparison between Unknown and I4
			//IL_019e: 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_01a5: Invalid comparison between Unknown and I4
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Invalid comparison between Unknown and I4
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Invalid comparison between Unknown and I4
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Invalid comparison between Unknown and I4
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			uint layoutIdOfZone = GetLayoutIdOfZone(((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone);
			int fromAlias = ((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone.Alias;
			int toAlias = ((LG_ZoneExpander)__instance.Gate).m_linksTo.m_zone.Alias;
			if (!overrideTriggerOG(layoutIdOfZone, fromAlias, toAlias))
			{
				return;
			}
			DoorTriggerOverride doorTriggerOverride = data[layoutIdOfZone].DoorOverrideTrigger.First((DoorTriggerOverride d) => d.Target != null && d.Target.To == toAlias && (d.Target.From == -1 || d.Target.From == fromAlias));
			if (!doorTriggerOverride.OpenOnTarget)
			{
				if ((int)state.status == 8 && doorTriggerOverride.Door != null && (doorTriggerOverride.Door.From != fromAlias || doorTriggerOverride.Door.To != toAlias) && doors.ContainsKey(doorTriggerOverride.Door.From) && doors[doorTriggerOverride.Door.From].ContainsKey(doorTriggerOverride.Door.To))
				{
					LG_SecurityDoor linkedDoor = doors[doorTriggerOverride.Door.From][doorTriggerOverride.Door.To];
					linkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)4, 0f, 0f, default(Vector3), (Agent)null);
					__instance.m_locks.OnChainedPuzzleSolved += Action.op_Implicit((Action)delegate
					{
						//IL_0018: Unknown result type (might be due to invalid IL or missing references)
						//IL_0022: Unknown result type (might be due to invalid IL or missing references)
						//IL_0027: Unknown result type (might be due to invalid IL or missing references)
						//IL_0028: Unknown result type (might be due to invalid IL or missing references)
						//IL_0034: Unknown result type (might be due to invalid IL or missing references)
						//IL_0046: 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_007c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0082: Unknown result type (might be due to invalid IL or missing references)
						linkedDoor.m_locks.ChainedPuzzleToSolve.AttemptInteract((eChainedPuzzleInteraction)1);
						pDoorState val5 = default(pDoorState);
						val5.status = (eDoorStatus)9;
						pDoorState val6 = val5;
						linkedDoor.m_graphics.OnDoorState(val6, false);
						linkedDoor.m_anim.OnDoorState(val6, false);
						linkedDoor.m_locks.OnDoorState(val6, false);
						((Il2CppObjectBase)linkedDoor.m_sync).Cast<LG_Door_Sync>().AttemptDoorInteraction((eDoorInteractionType)5, 0f, 0f, default(Vector3), (Agent)null);
					});
				}
			}
			else if (((int)state.status == 10 || (int)state.status == 9 || (int)state.status == 8) && doorTriggerOverride.Door != null && (doorTriggerOverride.Door.From != fromAlias || doorTriggerOverride.Door.To != toAlias) && doors.ContainsKey(doorTriggerOverride.Door.From) && doors[doorTriggerOverride.Door.From].ContainsKey(doorTriggerOverride.Door.To))
			{
				LG_SecurityDoor val = doors[doorTriggerOverride.Door.From][doorTriggerOverride.Door.To];
				if ((int)state.status == 10)
				{
					val.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
				}
				else if ((int)state.status == 9)
				{
					pDoorState val2 = default(pDoorState);
					val2.status = (eDoorStatus)9;
					pDoorState val3 = val2;
					val.m_graphics.OnDoorState(val3, false);
					val.m_anim.OnDoorState(val3, false);
				}
				else if ((int)state.status == 8)
				{
					pDoorState val2 = default(pDoorState);
					val2.status = (eDoorStatus)8;
					pDoorState val4 = val2;
					val.m_graphics.OnDoorState(val4, false);
					val.m_anim.OnDoorState(val4, false);
				}
			}
		}

		[HarmonyPatch(typeof(LG_Door_Graphics), "OnDoorState")]
		[HarmonyPrefix]
		private static void Graphic_OnDoorState(LG_Door_Graphics __instance, ref pDoorState state)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0100: 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)
			//IL_010b: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Invalid comparison between Unknown and I4
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Invalid comparison between Unknown and I4
			LG_SecurityDoor val = ((Il2CppObjectBase)__instance.m_core).TryCast<LG_SecurityDoor>();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			uint layoutIdOfZone = GetLayoutIdOfZone(((LG_ZoneExpander)val.Gate).m_linksFrom.m_zone);
			int fromAlias = ((LG_ZoneExpander)val.Gate).m_linksFrom.m_zone.Alias;
			int toAlias = ((LG_ZoneExpander)val.Gate).m_linksTo.m_zone.Alias;
			if (!graphic(layoutIdOfZone, fromAlias, toAlias) || ((int)state.status != 5 && (int)state.status != 4 && (int)state.status != 7 && (int)state.status != 6 && (int)state.status != 15 && (int)state.status != 3))
			{
				return;
			}
			DoorIdentifier doorIdentifier = data[layoutIdOfZone].DoorLockedGraphicOverrides.First((DoorIdentifier d) => d.To == toAlias && (d.From == -1 || d.From == fromAlias));
			if (!(doorIdentifier.State != string.Empty) || !Enum.TryParse<eDoorStatus>(doorIdentifier.State, ignoreCase: true, out eDoorStatus result))
			{
				return;
			}
			state.status = result;
			if ((int)result == 11)
			{
				Transform val2 = ((Component)val.m_doorBladeCuller).transform.Find("securityDoor_8x4_tech/bottomDoor/Security_Display_ScanActive");
				if ((Object)(object)val2 == (Object)null)
				{
					((Component)val.m_doorBladeCuller).transform.Find("securityDoor_4x4_tech/rightDoor/Security_Display_ScanActive");
				}
				if ((Object)(object)val2 != (Object)null)
				{
					((Component)val2).gameObject.SetActive(false);
				}
				Transform val3 = ((Component)val.m_doorBladeCuller).transform.Find("securityDoor_8x4_tech/bottomDoor/Security_Display_Locked");
				if ((Object)(object)val3 == (Object)null)
				{
					((Component)val.m_doorBladeCuller).transform.Find("securityDoor_4x4_tech/rightDoor/Security_Display_Locked");
				}
				if ((Object)(object)val3 != (Object)null)
				{
					((Component)val3).gameObject.SetActive(false);
				}
				Transform val4 = ((Component)val.m_doorBladeCuller).transform.Find("securityDoor_8x4_tech/bottomDoor/Security_Display_LockedAlarm");
				if ((Object)(object)val4 == (Object)null)
				{
					((Component)val.m_doorBladeCuller).transform.Find("securityDoor_4x4_tech/rightDoor/Security_Display_LockedAlarm");
				}
				if ((Object)(object)val4 != (Object)null)
				{
					((Component)val4).gameObject.SetActive(false);
				}
				Transform val5 = ((Component)val.m_doorBladeCuller).transform.Find("securityDoor_8x4_tech/bottomDoor/Security_Display_UnLocked");
				if ((Object)(object)val5 == (Object)null)
				{
					((Component)val.m_doorBladeCuller).transform.Find("securityDoor_4x4_tech/rightDoor/Security_Display_UnLocked");
				}
				if ((Object)(object)val5 != (Object)null)
				{
					((Component)val5).gameObject.SetActive(false);
				}
			}
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
		[HarmonyPrefix]
		private static bool OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state)
		{
			//IL_0068: 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_006f: Invalid comparison between Unknown and I4
			//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)
			uint layoutIdOfZone = GetLayoutIdOfZone(((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone);
			int fromAlias = ((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone.Alias;
			int toAlias = ((LG_ZoneExpander)__instance.Gate).m_linksTo.m_zone.Alias;
			if (!overrideTrigger(layoutIdOfZone, fromAlias, toAlias))
			{
				return true;
			}
			if ((int)state.status != 8)
			{
				return true;
			}
			DoorTriggerOverride doorTriggerOverride = data[layoutIdOfZone].DoorOverrideTrigger.First((DoorTriggerOverride d) => d.Door != null && d.Door.To == toAlias && (d.Door.From == -1 || d.Door.From == fromAlias));
			if (doorTriggerOverride.Target != null && (doorTriggerOverride.Target.From != fromAlias || doorTriggerOverride.Target.To != toAlias) && doors.ContainsKey(doorTriggerOverride.Target.From) && doors[doorTriggerOverride.Target.From].ContainsKey(doorTriggerOverride.Target.To))
			{
				__instance.m_graphics.OnDoorState(state, false);
				__instance.m_anim.OnDoorState(state, false);
				LG_SecurityDoor_Locks obj = ((Il2CppObjectBase)__instance.m_locks).Cast<LG_SecurityDoor_Locks>();
				((Interact_Base)obj.m_intUseKeyItem).SetActive(false);
				((Interact_Base)obj.m_intOpenDoor).SetActive(false);
				((Interact_Base)obj.m_intHack).SetActive(false);
				((Interact_Base)obj.m_intCustomMessage).SetActive(false);
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
		[HarmonyPrefix]
		private static void OnSyncDoorStatusChange_Reverse(LG_SecurityDoor __instance, pDoorState state)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			uint layoutIdOfZone = GetLayoutIdOfZone(((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone);
			int alias = ((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone.Alias;
			int alias2 = ((LG_ZoneExpander)__instance.Gate).m_linksTo.m_zone.Alias;
			if (reverse(layoutIdOfZone, alias, alias2) && (int)state.status == 10)
			{
				int instanceID = ((Object)__instance.Gate).GetInstanceID();
				if (reversedGates.ContainsKey(instanceID))
				{
					reversedGates[instanceID].SetActive(false);
				}
			}
		}

		[HarmonyPatch(typeof(LG_Door_Sync), "AttemptInteract")]
		[HarmonyPrefix]
		private static void AttemptInteract(LG_Door_Sync __instance, pDoorInteraction interaction)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			LG_SecurityDoor val = ((Il2CppObjectBase)__instance.m_core).TryCast<LG_SecurityDoor>();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			uint layoutIdOfZone = GetLayoutIdOfZone(((LG_ZoneExpander)val.Gate).m_linksFrom.m_zone);
			int fromAlias = ((LG_ZoneExpander)val.Gate).m_linksFrom.m_zone.Alias;
			int toAlias = ((LG_ZoneExpander)val.Gate).m_linksTo.m_zone.Alias;
			if (overrideTrigger(layoutIdOfZone, fromAlias, toAlias) && (int)interaction.type == 4)
			{
				DoorTriggerOverride doorTriggerOverride = data[layoutIdOfZone].DoorOverrideTrigger.First((DoorTriggerOverride d) => d.Door != null && d.Door.To == toAlias && (d.Door.From == -1 || d.Door.From == fromAlias));
				if (doorTriggerOverride.Target != null && (doorTriggerOverride.Target.From != fromAlias || doorTriggerOverride.Target.To != toAlias) && doors.ContainsKey(doorTriggerOverride.Target.From) && doors[doorTriggerOverride.Target.From].ContainsKey(doorTriggerOverride.Target.To))
				{
					doors[doorTriggerOverride.Target.From][doorTriggerOverride.Target.To].m_sync.AttemptDoorInteraction((eDoorInteractionType)4, 0f, 0f, default(Vector3), (Agent)null);
				}
			}
		}

		[HarmonyPatch(typeof(ElevatorRide), "StartElevatorRide")]
		[HarmonyPostfix]
		private static void StartElevatorRide()
		{
			reversedSecDoors.Clear();
			reversedGates.Clear();
			doors.Clear();
			boundDoors.Clear();
		}

		[HarmonyPatch(typeof(ChainedPuzzleManager), "CreatePuzzleInstance", new Type[]
		{
			typeof(ChainedPuzzleDataBlock),
			typeof(LG_Area),
			typeof(LG_Area),
			typeof(Vector3),
			typeof(Transform),
			typeof(bool)
		})]
		[HarmonyPrefix]
		private static void CreateChainedPuzzle(ChainedPuzzleDataBlock data, ref LG_Area sourceArea, ref LG_Area targetArea, Vector3 sourcePos, Transform parent, bool overrideUseStaticBioscanPoints)
		{
			if (reversedSecDoors.Contains(((Object)parent).GetInstanceID()))
			{
				LG_Area val = sourceArea;
				sourceArea = targetArea;
				targetArea = val;
			}
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
		[HarmonyPrefix]
		private static void Prefix_OnSyncDoorStatusChange()
		{
			onDoorSync = true;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
		[HarmonyPostfix]
		private static void Postfix_OnSyncDoorStatusChange()
		{
			onDoorSync = false;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "OnDoorState")]
		[HarmonyPostfix]
		private static void Postfix_OnDoorState(LG_SecurityDoor_Locks __instance, pDoorState state)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)state.status != 9)
			{
				_overrideText(__instance);
			}
		}

		[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "SetupAsLockedNoKey")]
		[HarmonyPostfix]
		private static void Postfix_OnDoorState(LG_SecurityDoor_Locks __instance)
		{
			_overrideText(__instance);
		}

		private static void _overrideText(LG_SecurityDoor_Locks __instance)
		{
			uint layoutIdOfZone = GetLayoutIdOfZone(((LG_ZoneExpander)__instance.m_door.Gate).m_linksFrom.m_zone);
			int fromAlias = ((LG_ZoneExpander)__instance.m_door.Gate).m_linksFrom.m_zone.Alias;
			int toAlias = ((LG_ZoneExpander)__instance.m_door.Gate).m_linksTo.m_zone.Alias;
			if (overrideMessage(layoutIdOfZone, fromAlias, toAlias))
			{
				string text = Regex.Replace(data[layoutIdOfZone].DoorMessageOverrides.First((DoorMessageOverride d) => d.Door != null && d.Door.To == toAlias && (d.Door.From == -1 || d.Door.From == fromAlias)).Message, "\\[DOOR\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\]", delegate(Match m)
				{
					int num = int.Parse(m.Groups[1].Value);
					int num2 = int.Parse(m.Groups[2].Value);
					return (doors.ContainsKey(num) && doors[num].ContainsKey(num2)) ? $"SEC_DOOR_{doors[num][num2].m_serialNumber}" : $"DEBUG_FROM({num})_TO({num2})";
				});
				__instance.m_intOpenDoor.InteractionMessage = text;
				((Interact_Timed)__instance.m_intUseKeyItem).InteractionMessage = text;
				((Interact_Timed)__instance.m_intHack).InteractionMessage = text;
				__instance.m_intCustomMessage.m_message = text;
			}
		}

		[HarmonyPatch(typeof(LG_ZoneExpander), "GetOppositeArea")]
		[HarmonyPrefix]
		private static bool GetOppositeArea(LG_ZoneExpander __instance, ref LG_Area __result, LG_Area area)
		{
			if (onDoorSync)
			{
				LG_Gate gate = __instance.GetGate();
				if ((Object)(object)gate == (Object)null)
				{
					return true;
				}
				if (reversedGates.ContainsKey(((Object)gate).GetInstanceID()))
				{
					__result = area;
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "SetNavInfo")]
		[HarmonyPrefix]
		private static bool SecDoor_NavInfo(LG_SecurityDoor __instance, string infoFwd, string infoBwd, List<string> infoFwdClean, List<string> infoBwdClean)
		{
			if (!reverse(GetLayoutIdOfZone(((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone), ((LG_ZoneExpander)__instance.Gate).m_linksFrom.m_zone.Alias, ((LG_ZoneExpander)__instance.Gate).m_linksTo.m_zone.Alias))
			{
				return true;
			}
			__instance.m_graphics.SetNavInfoFwd(infoBwd);
			__instance.m_graphics.SetNavInfoBwd(infoFwd);
			__instance.m_terminalNavInfoForward = infoBwdClean;
			__instance.m_terminalNavInfoBackward = infoFwdClean;
			return false;
		}

		[HarmonyPatch(typeof(WardenObjectiveManager), "CheckExpeditionFailed")]
		[HarmonyPostfix]
		private static void CheckExpeditionFailed(WardenObjectiveManager __instance, ref bool __result)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Invalid comparison between Unknown and I4
			if (__result)
			{
				return;
			}
			for (int i = 0; i < PlayerManager.PlayerAgentsInLevel.Count; i++)
			{
				PlayerAgent val = PlayerManager.PlayerAgentsInLevel[i];
				if (((Agent)val).Alive || !boundDoors.ContainsKey(val.PlayerSlotIndex))
				{
					continue;
				}
				bool flag = true;
				foreach (LG_SecurityDoor item in boundDoors[val.PlayerSlotIndex])
				{
					APILogger.Debug($"{val.PlayerSlotIndex} -> {((LG_ZoneExpander)item.Gate).m_linksTo.m_zone.Alias} {item.LastStatus}");
					if ((int)item.LastStatus != 10)
					{
						flag = false;
						break;
					}
				}
				if (!flag)
				{
					APILogger.Debug($"{val.PlayerSlotIndex} -> end run");
					__result = true;
					break;
				}
			}
		}

		private static bool bind(uint layerId, int fromAlias, int toAlias, out List<int> slots)
		{
			slots = new List<int>();
			bool flag = false;
			if (data.ContainsKey(layerId))
			{
				BindDoorToPlayer[] bindDoorToPlayer = data[layerId].BindDoorToPlayer;
				foreach (BindDoorToPlayer bindDoorToPlayer2 in bindDoorToPlayer)
				{
					DoorIdentifier door = bindDoorToPlayer2.Door;
					if (door != null && door.To == toAlias && (door.From == -1 || door.From == fromAlias))
					{
						slots.Add(bindDoorToPlayer2.Slot);
						flag = true;
					}
				}
			}
			APILogger.Debug($"layerId: {layerId}, fromAlias: {fromAlias}, toAlias: {toAlias} -> {(flag ? "bound" : "not bound")}");
			return flag;
		}

		[HarmonyPatch(typeof(LG_SecurityDoor), "Setup")]
		[HarmonyPostfix]
		private static void SecDoor_Setup(LG_SecurityDoor __instance, LG_Gate gate)
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			LG_Gate gate2 = gate;
			if (bind(GetLayoutIdOfZone(((LG_ZoneExpander)gate2).m_linksFrom.m_zone), ((LG_ZoneExpander)gate2).m_linksFrom.m_zone.Alias, ((LG_ZoneExpander)gate2).m_linksTo.m_zone.Alias, out List<int> slots))
			{
				foreach (int item in slots)
				{
					if (!boundDoors.ContainsKey(item))
					{
						boundDoors.Add(item, new HashSet<LG_SecurityDoor>());
					}
					boundDoors[item].Add(__instance);
				}
			}
			if (!reverse(GetLayoutIdOfZone(((LG_ZoneExpander)gate2).m_linksFrom.m_zone), ((LG_ZoneExpander)gate2).m_linksFrom.m_zone.Alias, ((LG_ZoneExpander)gate2).m_linksTo.m_zone.Alias))
			{
				return;
			}
			Transform val = ((Component)__instance).transform.Find("crossing");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			val.localRotation *= Quaternion.Euler(0f, 180f, 0f);
			Transform val2 = ((Component)__instance.m_doorBladeCuller).transform.Find("securityDoor_8x4_tech/bottomDoor/g_securityDoor_bottomDoor_capback");
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((Component)__instance.m_doorBladeCuller).transform.Find("securityDoor_4x4_tech (1)/rightDoor/g_securityDoor_bottomDoor_capback001");
				if ((Object)(object)val2 == (Object)null)
				{
					return;
				}
			}
			((Component)val2).gameObject.SetActive(false);
			Transform val3 = ((Component)__instance.m_doorBladeCuller).transform.Find("securityDoor_8x4_tech/bottomDoor/InteractionInterface");
			bool flag = false;
			if ((Object)(object)val3 == (Object)null)
			{
				val3 = ((Component)__instance.m_doorBladeCuller).transform.Find("securityDoor_4x4_tech (1)/rightDoor/InteractionInterface");
				flag = true;
				if ((Object)(object)val3 == (Object)null)
				{
					return;
				}
			}
			GameObject val4 = Object.Instantiate<GameObject>(((Component)val3).gameObject, val3.parent);
			val4.transform.localRotation = val3.localRotation * Quaternion.Euler(180f, 180f, 0f);
			if (flag)
			{
				val4.transform.localPosition = val3.localPosition + new Vector3(0f, 0.28f, 0f);
			}
			else
			{
				val4.transform.localPosition = val3.localPosition + new Vector3(0f, 0f, -0.25f);
			}
			Transform val5 = ((Component)__instance).transform.Find("crossing/Interaction_Message");
			if (!((Object)(object)val5 == (Object)null))
			{
				GameObject val6 = Object.Instantiate<GameObject>(((Component)val5).gameObject, val5.parent);
				val6.transform.position = val4.transform.position;
				Interact_MessageOnScreen component = val6.GetComponent<Interact_MessageOnScreen>();
				component.MessageType = (eMessageOnScreenType)1;
				component.m_message = data[GetLayoutIdOfZone(((LG_ZoneExpander)gate2).m_linksFrom.m_zone)].Doors.First((DoorIdentifier d) => d.To == ((LG_ZoneExpander)gate2).m_linksTo.m_zone.Alias && (d.From == -1 || d.From == ((LG_ZoneExpander)gate2).m_linksFrom.m_zone.Alias)).Text;
				val6.SetActive(true);
				((Interact_Base)component).SetActive(true);
				reversedSecDoors.Add(((Object)((Component)__instance).transform).GetInstanceID());
				reversedGates.Add(((Object)gate2).GetInstanceID(), val6);
			}
		}
	}
}
namespace DoubleSidedDoors.BepInEx
{
	public static class Module
	{
		public const string GUID = "randomuserhi.DoubleSidedDoors";

		public const string Name = "DoubleSidedDoors";

		public const string Version = "0.0.1";
	}
	public static class ConfigManager
	{
		public static ConfigFile configFile;

		private static ConfigEntry<bool> debug;

		public static bool Debug
		{
			get
			{
				return debug.Value;
			}
			set
			{
				debug.Value = value;
			}
		}

		static ConfigManager()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "DoubleSidedDoors.cfg"), true);
			debug = configFile.Bind<bool>("Debug", "enable", false, "Enables debug messages when true.");
			DirectoryInfo directoryInfo = Directory.CreateDirectory(Path.Combine(MTFOPathAPI.CustomPath, "DoubleSidedDoors"));
			FileInfo[] files = directoryInfo.GetFiles();
			APILogger.Debug("Searching: " + directoryInfo.FullName, force: true);
			FileInfo[] array = files;
			foreach (FileInfo fileInfo in array)
			{
				APILogger.Debug("Found: " + fileInfo.FullName, force: true);
				string extension = fileInfo.Extension;
				bool flag = extension.Equals(".json", StringComparison.InvariantCultureIgnoreCase);
				bool flag2 = extension.Equals(".jsonc", StringComparison.InvariantCultureIgnoreCase);
				if (flag || flag2)
				{
					LayoutConfig layoutConfig = JSON.Deserialize<LayoutConfig>(File.ReadAllText(fileInfo.FullName));
					if (Spawn.data.ContainsKey(layoutConfig.LevelLayoutID))
					{
						APILogger.Error($"Duplicated ID found!: {fileInfo.Name}, {layoutConfig.LevelLayoutID}");
					}
					else
					{
						Spawn.data.Add(layoutConfig.LevelLayoutID, layoutConfig);
					}
				}
			}
		}
	}
	[BepInPlugin("randomuserhi.DoubleSidedDoors", "DoubleSidedDoors", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		private static Harmony? harmony;

		public override void Load()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			APILogger.Log("Plugin is loaded!");
			harmony = new Harmony("randomuserhi.DoubleSidedDoors");
			harmony.PatchAll();
			APILogger.Log("Debug is " + (ConfigManager.Debug ? "Enabled" : "Disabled"));
		}
	}
}