Decompiled source of DoorBreach v1.1.0

DoorBreach.dll

Decompiled 4 months ago
#define DEBUG
using System;
using System.Collections;
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.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DoorBreach.Dependencies;
using DoorBreach.Functional;
using DoorBreach.Patches;
using DoorBreach.Patches.DoorBreach;
using DoorBreach.Patches.DoorBreach.Mods.PiggyVariety;
using DoorBreach.Patches.DoorBreach.Mods.ToilHead;
using GameNetcodeStuff;
using HarmonyLib;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using PiggyVarietyMod.Patches;
using TestAccount666.DoorBreach.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using com.github.zehsteam.ToilHead.MonoBehaviours;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.DoorBreach")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Open doors with style")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+8eb96750719fd793c3bc5ccf229d31ae0b6a4371")]
[assembly: AssemblyProduct("DoorBreach")]
[assembly: AssemblyTitle("TestAccount666.DoorBreach")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
	[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 DoorBreach
{
	public static class ActionSource
	{
		public enum Source
		{
			UNKNOWN = -666,
			MALFUNCTION = -665,
			TOIL_HEAD = -5,
			LANDMINE = -4,
			TURRET = -3,
			SHOTGUN_ACCIDENT = -2,
			SHOTGUN_ENEMY = -1,
			[Tooltip("Player is actually anything above -1, but this is an enum, so...")]
			PLAYER = 0
		}

		[Flags]
		public enum SelectableSource
		{
			TOIL_HEAD = -5,
			LANDMINE = -4,
			TURRET = -3,
			SHOTGUN_ACCIDENT = -2,
			SHOTGUN_ENEMY = -1,
			[Tooltip("Player is actually anything above -1, but this is an enum, so...")]
			PLAYER = 0,
			ALL = -1
		}

		public static Source? FromInt(this int source)
		{
			if (source >= 0)
			{
				return Source.PLAYER;
			}
			return (Source)source;
		}

		public static Source? FromSelectableSource(this SelectableSource selectableSource)
		{
			return ((int)selectableSource).FromInt();
		}

		public static int ToInt(this Source source)
		{
			return (int)source;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("TestAccount666.DoorBreach", "DoorBreach", "1.1.0")]
	public class DoorBreach : BaseUnityPlugin
	{
		internal static AudioClip? doorHitKnifeSfx;

		internal static AudioClip? doorHitShovelSfx;

		internal static AudioClip? doorBreakSfx;

		public static DoorBreach Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		internal static void Patch()
		{
			//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_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("TestAccount666.DoorBreach");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(typeof(DoorLockPatch));
			Harmony.PatchAll(typeof(LandminePatch));
			Harmony.PatchAll(typeof(MeleeWeaponPatch));
			Harmony.PatchAll(typeof(ShotgunPatch));
			Harmony.PatchAll(typeof(TurretPatch));
			if (DependencyChecker.IsPiggyInstalled())
			{
				Harmony.PatchAll(typeof(RiflePatch));
				Harmony.PatchAll(typeof(RevolverPatch));
			}
			if (DependencyChecker.IsToilHeadInstalled())
			{
				Harmony.PatchAll(typeof(ToilHeadTurretPatch));
			}
			Logger.LogDebug((object)"Finished patching!");
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			if (DependencyChecker.IsLobbyCompatibilityInstalled())
			{
				Logger.LogInfo((object)"Found LobbyCompatibility Mod, initializing support :)");
				LobbyCompatibilitySupport.Initialize();
			}
			DoorBreachConfig.InitializeConfig(((BaseUnityPlugin)this).Config);
			Patch();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				try
				{
					MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array2 = methods;
					foreach (MethodInfo methodInfo in array2)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
				catch (FileNotFoundException)
				{
				}
			}
			((MonoBehaviour)this).StartCoroutine(LoadAudioClips());
			Logger.LogInfo((object)"TestAccount666.DoorBreach v1.1.0 has loaded!");
		}

		private static IEnumerator LoadAudioClips()
		{
			string assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Logger.LogInfo((object)"Loading Sounds...");
			Debug.Assert(assemblyDirectory != null, "assemblyDirectory != null");
			string audioPath2 = Path.Combine(assemblyDirectory, "sounds");
			audioPath2 = (Directory.Exists(audioPath2) ? audioPath2 : Path.Combine(assemblyDirectory));
			LoadDoorAudioClips(audioPath2);
			yield break;
		}

		private static void LoadDoorAudioClips(string audioPath)
		{
			Logger.LogInfo((object)"Loading Door Sounds...");
			string text = Path.Combine(audioPath, "DoorSfx");
			text = (Directory.Exists(text) ? text : Path.Combine(audioPath));
			doorHitKnifeSfx = LoadAudioClipFromFile(new Uri(Path.Combine(text, "DoorHitKnife.wav")), "DoorHitKnife");
			Logger.LogInfo((object)((doorHitKnifeSfx == null) ? "Failed to load clip 'DoorHitKnife'!" : ("Loaded clip '" + ((Object)doorHitKnifeSfx).name + "'!")));
			doorHitShovelSfx = LoadAudioClipFromFile(new Uri(Path.Combine(text, "DoorHitShovel.wav")), "DoorHitShovel");
			Logger.LogInfo((object)((doorHitShovelSfx == null) ? "Failed to load clip 'DoorHitShovel'!" : ("Loaded clip '" + ((Object)doorHitShovelSfx).name + "'!")));
			doorBreakSfx = LoadAudioClipFromFile(new Uri(Path.Combine(text, "DoorBreak.wav")), "DoorBreak");
			Logger.LogInfo((object)((doorBreakSfx == null) ? "Failed to load clip 'DoorBreak'!" : ("Loaded clip '" + ((Object)doorBreakSfx).name + "'!")));
		}

		private static AudioClip? LoadAudioClipFromFile(Uri filePath, string name)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(filePath, (AudioType)20);
			try
			{
				UnityWebRequestAsyncOperation val = audioClip.SendWebRequest();
				while (!((AsyncOperation)val).isDone)
				{
					Thread.Sleep(100);
				}
				if ((int)audioClip.result != 1)
				{
					Logger.LogError((object)("Failed to load AudioClip: " + audioClip.error));
					return null;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
				((Object)content).name = name;
				return content;
			}
			finally
			{
				((IDisposable)audioClip)?.Dispose();
			}
		}
	}
	public static class DoorBreachConfig
	{
		public enum DoorBreachMode
		{
			DESTROY,
			UNUSABLE
		}

		public static readonly List<ActionSource.Source> AllowedDoorBreachSources = new List<ActionSource.Source>();

		public static bool doorBreachEnabled = true;

		public static DoorBreachMode doorBreachMode = DoorBreachMode.DESTROY;

		public static int minimumDoorHealth = 8;

		public static int possibleAdditionalHealth = 16;

		public static void InitializeConfig(ConfigFile configFile)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			doorBreachEnabled = configFile.Bind<bool>("Door Breach", "1. Door Breach Enabled", true, "If true, will enable door breach").Value;
			doorBreachMode = configFile.Bind<DoorBreachMode>("Door Breach", "2. Door Breach Mode", DoorBreachMode.DESTROY, "What mode should door breach use? Destroy will destroy the door and unusable will make it unusable (This may cause bugs)").Value;
			minimumDoorHealth = configFile.Bind<int>("Door Breach", "3. Minimum Door Health", 8, new ConfigDescription("The minimum health a door has", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 16), Array.Empty<object>())).Value;
			possibleAdditionalHealth = configFile.Bind<int>("Door Breach", "4. Possible Additional Door Health", 16, new ConfigDescription("This value defines how much additional health a door can have (On default values, this means a door's health can be between 8 and 24)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 16), Array.Empty<object>())).Value;
			ActionSource.SelectableSource value = configFile.Bind<ActionSource.SelectableSource>("Door Breach", "5. Allowed Door Breach Sources", ActionSource.SelectableSource.SHOTGUN_ENEMY, "Defines what can breach doors").Value;
			foreach (ActionSource.SelectableSource value2 in EnumUtil.GetValues<ActionSource.SelectableSource>())
			{
				if (value.HasFlag(value2))
				{
					ActionSource.Source? source = value2.FromSelectableSource();
					if (source.HasValue && !AllowedDoorBreachSources.Contains(source.Value))
					{
						AllowedDoorBreachSources.Add(source.Value);
					}
				}
			}
			AllowedDoorBreachSources.Add(ActionSource.Source.MALFUNCTION);
			AllowedDoorBreachSources.Add(ActionSource.Source.UNKNOWN);
		}
	}
	public static class EnumUtil
	{
		public static IEnumerable<T> GetValues<T>()
		{
			return Enum.GetValues(typeof(T)).Cast<T>();
		}
	}
	public static class EventHandler
	{
		public delegate void DoorBreachEvent(DoorBreachEventArguments doorBreachEventArguments);

		public class DoorBreachEventArguments : EventArgs
		{
			public readonly ActionSource.Source actionSource;

			public readonly DoorLock doorLock;

			public readonly PlayerControllerB? playerControllerB;

			public readonly DoorBreachConfig.DoorBreachMode doorBreachMode;

			public DoorBreachEventArguments(ActionSource.Source actionSource, DoorLock doorLock, PlayerControllerB? playerControllerB, DoorBreachConfig.DoorBreachMode doorBreachMode)
			{
				this.actionSource = actionSource;
				this.doorLock = doorLock;
				this.playerControllerB = playerControllerB;
				this.doorBreachMode = doorBreachMode;
				base..ctor();
			}
		}

		public static DoorBreachEvent? doorBreach;

		internal static void OnDoorBreach(ActionSource.Source actionSource, DoorLock doorLock, PlayerControllerB? playerControllerB, DoorBreachConfig.DoorBreachMode doorBreachMode)
		{
			doorBreach?.Invoke(new DoorBreachEventArguments(actionSource, doorLock, playerControllerB, doorBreachMode));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TestAccount666.DoorBreach";

		public const string PLUGIN_NAME = "DoorBreach";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace DoorBreach.Patches
{
	[HarmonyPatch(typeof(DoorLock))]
	public static class DoorLockPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void AfterAwake(DoorLock __instance)
		{
			GameObject gameObject = ((Component)__instance).gameObject;
			DoorLocker doorLocker = gameObject.AddComponent<DoorLocker>();
			if (DoorBreachConfig.doorBreachEnabled)
			{
				DoorHealth doorHealth = gameObject.AddComponent<DoorHealth>();
				doorHealth.SetDoorLock(__instance);
				doorHealth.SetDoorLocker(doorLocker);
			}
		}
	}
}
namespace DoorBreach.Patches.DoorBreach
{
	[HarmonyPatch(typeof(Landmine))]
	public class LandminePatch
	{
		[HarmonyPatch("Detonate")]
		[HarmonyPostfix]
		private static void DisintegrateDoors(Landmine __instance)
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)__instance).transform.position;
			Collider[] array = (Collider[])(object)new Collider[12];
			int num = Physics.OverlapSphereNonAlloc(position, 6f, array, 512, (QueryTriggerInteraction)2);
			if (num <= 0)
			{
				return;
			}
			DoorHealth doorHealth = default(DoorHealth);
			for (int i = 0; i < num; i++)
			{
				Collider val = array[i];
				if (((Component)val).TryGetComponent<DoorHealth>(ref doorHealth))
				{
					float num2 = Vector3.Distance(position, ((Component)val).transform.position);
					int damage;
					if (num2 <= 3.6f)
					{
						damage = 666;
					}
					else
					{
						double num3 = Math.Max(Math.Log(num2 + 1f, 4.0), 1.0);
						damage = (int)(11.0 / num3);
					}
					doorHealth.HitDoorServerRpc(ActionSource.Source.LANDMINE.ToInt(), damage);
				}
			}
		}
	}
	[HarmonyPatch]
	public static class MeleeWeaponPatch
	{
		[HarmonyPatch(typeof(Shovel), "HitShovel")]
		[HarmonyPostfix]
		private static void HitDoor(Shovel __instance, bool cancel)
		{
			if (!cancel)
			{
				AudioSource shovelAudio = __instance.shovelAudio;
				shovelAudio.clip = global::DoorBreach.DoorBreach.doorHitShovelSfx;
				HitDoor((GrabbableObject)(object)__instance, __instance.shovelHitForce, 1.5f, 0.8f, -0.35f, shovelAudio);
			}
		}

		[HarmonyPatch(typeof(KnifeItem), "HitKnife")]
		[HarmonyPostfix]
		private static void HitDoor(KnifeItem __instance, bool cancel)
		{
			if (!cancel)
			{
				AudioSource knifeAudio = __instance.knifeAudio;
				knifeAudio.clip = global::DoorBreach.DoorBreach.doorHitKnifeSfx;
				HitDoor((GrabbableObject)(object)__instance, __instance.knifeHitForce, 0.75f, 0.3f, 0.1f, knifeAudio);
			}
		}

		private static void HitDoor(GrabbableObject grabbableObject, int damage, float maxDistance, float radius, float rightMultiplier, AudioSource? hitSoundSource = null)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!grabbableObject.isHeld)
			{
				return;
			}
			PlayerControllerB playerHeldBy = grabbableObject.playerHeldBy;
			object obj;
			if (playerHeldBy == null)
			{
				obj = null;
			}
			else
			{
				Camera gameplayCamera = playerHeldBy.gameplayCamera;
				obj = ((gameplayCamera != null) ? ((Component)gameplayCamera).transform : null);
			}
			Transform val = (Transform)obj;
			if (val == null)
			{
				return;
			}
			RaycastHit[] array = (RaycastHit[])(object)new RaycastHit[12];
			int num = Physics.SphereCastNonAlloc(val.position + val.right * rightMultiplier, radius, val.forward, array, maxDistance, 0x200 | StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)2);
			bool flag = (Object)(object)hitSoundSource == (Object)null;
			DoorHealth doorHealth = default(DoorHealth);
			for (int i = 0; i < num; i++)
			{
				RaycastHit val2 = array[i];
				if (((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref doorHealth))
				{
					if (!doorHealth.IsBroken() && !doorHealth.IsDoorOpen() && !flag && hitSoundSource != null)
					{
						flag = true;
						hitSoundSource.Play();
					}
					Debug.Assert((Object)(object)playerHeldBy != (Object)null, "playerHeldBy != null");
					doorHealth.HitDoorServerRpc((int)playerHeldBy.playerClientId, damage);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	public static class ShotgunPatch
	{
		private static readonly Random _Random = new Random();

		[HarmonyPatch("ShootGun")]
		[HarmonyPostfix]
		private static void ShootDoor(ShotgunItem __instance, Vector3 shotgunPosition, Vector3 shotgunForward)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			int playerWhoHit = ActionSource.Source.SHOTGUN_ACCIDENT.ToInt();
			if (((GrabbableObject)__instance).isHeld)
			{
				playerWhoHit = (int)((GrabbableObject)__instance).playerHeldBy.playerClientId;
			}
			if (((GrabbableObject)__instance).isHeldByEnemy)
			{
				playerWhoHit = ActionSource.Source.SHOTGUN_ENEMY.ToInt();
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(shotgunPosition, shotgunForward);
			RaycastHit val2 = default(RaycastHit);
			DoorHealth doorHealth = default(DoorHealth);
			if (Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2) && ((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref doorHealth))
			{
				float distance = ((RaycastHit)(ref val2)).distance;
				int damage = 666;
				int num = ((distance <= 3f) ? _Random.Next(0, (int)(3f - distance)) : 0);
				if (num <= 0)
				{
					double num2 = Math.Max(Math.Log(distance + 1f, 2.0), 1.0);
					damage = (int)(9.0 / num2);
				}
				doorHealth.HitDoorServerRpc(playerWhoHit, damage);
			}
		}
	}
	[HarmonyPatch(typeof(Turret))]
	public static class TurretPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void DecimateDoors(Turret __instance)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_006f: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			TurretMode turretMode = __instance.turretMode;
			if (((int)turretMode == 2 || (int)turretMode == 3) && (__instance == null || !__instance.enteringBerserkMode || !(__instance.berserkTimer > 0f)) && !((double)__instance.turretInterval < 0.209))
			{
				Ray val = default(Ray);
				((Ray)(ref val))..ctor(__instance.aimPoint.position, __instance.aimPoint.forward);
				RaycastHit val2 = default(RaycastHit);
				DoorHealth doorHealth = default(DoorHealth);
				if (Physics.Raycast(val, ref val2, 23f, 512, (QueryTriggerInteraction)2) && ((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref doorHealth))
				{
					float distance = ((RaycastHit)(ref val2)).distance;
					double num = Math.Max(Math.Log(distance + 1f, 5.0), 1.0);
					int damage = (int)(9.0 / num);
					doorHealth.HitDoorServerRpc(ActionSource.Source.TURRET.ToInt(), damage);
				}
			}
		}
	}
}
namespace DoorBreach.Patches.DoorBreach.Mods.ToilHead
{
	[HarmonyPatch(typeof(ToilHeadTurretBehaviour))]
	public class ToilHeadTurretPatch
	{
		[HarmonyPatch("TurretModeLogic")]
		[HarmonyPrefix]
		private static void FireAwayThosePeskyDoors(ToilHeadTurretBehaviour __instance)
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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)
			TurretMode turretMode = __instance.turretMode;
			if (((int)turretMode == 2 || (int)turretMode == 3) && (__instance == null || !__instance._enteringBerserkMode || !(__instance._berserkTimer > 0f)) && !(__instance._turretInterval < __instance._damageRate))
			{
				Ray val = default(Ray);
				((Ray)(ref val))..ctor(__instance.aimPoint.position, __instance.aimPoint.forward);
				RaycastHit val2 = default(RaycastHit);
				DoorHealth doorHealth = default(DoorHealth);
				if (Physics.Raycast(val, ref val2, 23f, 512, (QueryTriggerInteraction)2) && ((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref doorHealth))
				{
					float distance = ((RaycastHit)(ref val2)).distance;
					double num = Math.Max(Math.Log(distance + 1f, 5.0), 1.0);
					int damage = (int)(9.0 / num);
					doorHealth.HitDoorServerRpc(ActionSource.Source.TOIL_HEAD.ToInt(), damage);
				}
			}
		}
	}
}
namespace DoorBreach.Patches.DoorBreach.Mods.PiggyVariety
{
	[HarmonyPatch(typeof(RevolverItem))]
	public static class RevolverPatch
	{
		private static readonly Random _Random = new Random();

		[HarmonyPatch("ShootGun")]
		[HarmonyPostfix]
		private static void ShredDoors(RevolverItem __instance, Vector3 revolverPosition, Vector3 revolverForward)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			int playerWhoHit = ActionSource.Source.SHOTGUN_ACCIDENT.ToInt();
			if (((GrabbableObject)__instance).isHeld)
			{
				playerWhoHit = (int)((GrabbableObject)__instance).playerHeldBy.playerClientId;
			}
			if (((GrabbableObject)__instance).isHeldByEnemy)
			{
				playerWhoHit = ActionSource.Source.SHOTGUN_ENEMY.ToInt();
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(revolverPosition, revolverForward);
			RaycastHit val2 = default(RaycastHit);
			DoorHealth doorHealth = default(DoorHealth);
			if (Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2) && ((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref doorHealth))
			{
				float distance = ((RaycastHit)(ref val2)).distance;
				int damage = 666;
				int num = ((distance <= 3f) ? _Random.Next(0, (int)(3f - distance)) : 0);
				if (num <= 0)
				{
					double num2 = Math.Max(Math.Log(distance + 1f, 2.0), 1.0);
					damage = (int)(6.0 / num2);
				}
				doorHealth.HitDoorServerRpc(playerWhoHit, damage);
			}
		}
	}
	[HarmonyPatch(typeof(M4Item))]
	public static class RiflePatch
	{
		[HarmonyPatch("ShootGun")]
		[HarmonyPostfix]
		private static void ShredDoors(M4Item __instance, Vector3 gunPosition, Vector3 gunForward)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			int playerWhoHit = ActionSource.Source.SHOTGUN_ACCIDENT.ToInt();
			if (((GrabbableObject)__instance).isHeld)
			{
				playerWhoHit = (int)((GrabbableObject)__instance).playerHeldBy.playerClientId;
			}
			if (((GrabbableObject)__instance).isHeldByEnemy)
			{
				playerWhoHit = ActionSource.Source.SHOTGUN_ENEMY.ToInt();
			}
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(gunPosition, gunForward);
			RaycastHit val2 = default(RaycastHit);
			DoorHealth doorHealth = default(DoorHealth);
			if (Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2) && ((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref doorHealth))
			{
				float distance = ((RaycastHit)(ref val2)).distance;
				double num = Math.Max(Math.Log(distance + 1f, 2.0), 1.0);
				int damage = (int)(2.0 / num);
				doorHealth.HitDoorServerRpc(playerWhoHit, damage);
			}
		}
	}
}
namespace DoorBreach.Functional
{
	public class DoorHealth : NetworkBehaviour
	{
		private bool _broken;

		private bool _hittable = true;

		private DoorLock _doorLock = null;

		private DoorLocker _doorLocker = null;

		private int _health = 8;

		private void Awake()
		{
			int minimumDoorHealth = DoorBreachConfig.minimumDoorHealth;
			int num = minimumDoorHealth + DoorBreachConfig.possibleAdditionalHealth;
			_health = Random.RandomRangeInt(minimumDoorHealth, num + 1);
		}

		public bool IsBroken()
		{
			return _broken;
		}

		public bool IsDoorOpen()
		{
			return _doorLock.isDoorOpened;
		}

		private void Update()
		{
			if (_broken && !_doorLock.isDoorOpened)
			{
				_doorLocker.SetDoorOpenServerRpc(ActionSource.Source.UNKNOWN.ToInt(), open: true);
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			RequestHealthServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestHealthServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2946657366u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2946657366u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetHealthClientRpc(_health);
				}
			}
		}

		internal void SetDoorLock(DoorLock doorLock)
		{
			_doorLock = doorLock;
		}

		internal void SetDoorLocker(DoorLocker doorLocker)
		{
			_doorLocker = doorLocker;
		}

		[ServerRpc(RequireOwnership = false)]
		public void HitDoorServerRpc(int playerWhoHit, int damage)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2076234146u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoHit);
				BytePacker.WriteValueBitPacked(val2, damage);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2076234146u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || damage == 0)
			{
				return;
			}
			ActionSource.Source? source = playerWhoHit.FromInt();
			if (!source.HasValue || !DoorBreachConfig.AllowedDoorBreachSources.Contains(source.Value) || !_hittable)
			{
				return;
			}
			_hittable = false;
			((MonoBehaviour)this).StartCoroutine(ResetHittable());
			DoorBreach.Logger.LogDebug((object)("Broken: " + _broken));
			DoorBreach.Logger.LogDebug((object)("Current health: " + _health));
			DoorBreach.Logger.LogDebug((object)("Damage dealt: " + damage));
			DoorBreach.Logger.LogDebug((object)("Source: " + source.Value));
			if (!_broken)
			{
				SetHealthClientRpc(_health - damage);
				if (_health <= 0)
				{
					BreakDoorClientRpc(playerWhoHit);
				}
			}
		}

		private IEnumerator ResetHittable()
		{
			yield return (object)new WaitForSeconds(0.05f);
			_hittable = true;
		}

		[ClientRpc]
		public void SetHealthClientRpc(int health)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2651502936u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, health);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2651502936u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					_health = health;
				}
			}
		}

		[ClientRpc]
		public void BreakDoorClientRpc(int playerWhoTriggered)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(837781649u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoTriggered);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 837781649u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayAudio(((Component)this).gameObject);
			ActionSource.Source? source = playerWhoTriggered.FromInt();
			if (source.HasValue)
			{
				PlayerControllerB playerControllerB = null;
				if (source == ActionSource.Source.PLAYER)
				{
					playerControllerB = StartOfRound.Instance.allPlayerScripts[playerWhoTriggered];
				}
				EventHandler.OnDoorBreach(source.Value, _doorLock, playerControllerB, DoorBreachConfig.doorBreachMode);
				_broken = true;
				if (DoorBreachConfig.doorBreachMode == DoorBreachConfig.DoorBreachMode.DESTROY)
				{
					Transform transform = ((Component)_doorLock).transform;
					Landmine.SpawnExplosion(transform.position, true, 1f, 1f, 50, 0f, (GameObject)null, false);
					Object.Destroy((Object)(object)((Component)transform.parent).gameObject);
					return;
				}
				_doorLocker.SetDoorOpenServerRpc(playerWhoTriggered, open: true);
				_doorLock.doorTrigger.interactable = false;
				((Behaviour)_doorLock.doorTrigger).enabled = false;
				_doorLock.doorTrigger.holdTip = "";
				_doorLock.doorTrigger.disabledHoverTip = "";
				_doorLock.doorTrigger.hoverIcon = null;
				_doorLock.doorTrigger.disabledHoverIcon = null;
			}
		}

		public int GetHealth()
		{
			return _health;
		}

		private static void PlayAudio(GameObject gameObject)
		{
			if (DoorBreach.doorBreakSfx != null)
			{
				AudioSource val = gameObject.AddComponent<AudioSource>();
				val.spatialBlend = 1f;
				val.maxDistance = 30f;
				val.rolloffMode = (AudioRolloffMode)0;
				val.clip = DoorBreach.doorBreakSfx;
				val.volume = 1f;
				val.Play();
				Object.Destroy((Object)(object)val, DoorBreach.doorBreakSfx.length);
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DoorHealth()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2946657366u, new RpcReceiveHandler(__rpc_handler_2946657366));
			NetworkManager.__rpc_func_table.Add(2076234146u, new RpcReceiveHandler(__rpc_handler_2076234146));
			NetworkManager.__rpc_func_table.Add(2651502936u, new RpcReceiveHandler(__rpc_handler_2651502936));
			NetworkManager.__rpc_func_table.Add(837781649u, new RpcReceiveHandler(__rpc_handler_837781649));
		}

		private static void __rpc_handler_2946657366(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoorHealth)(object)target).RequestHealthServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2076234146(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerWhoHit = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoHit);
				int damage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref damage);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoorHealth)(object)target).HitDoorServerRpc(playerWhoHit, damage);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2651502936(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int healthClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref healthClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DoorHealth)(object)target).SetHealthClientRpc(healthClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_837781649(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerWhoTriggered = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoTriggered);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DoorHealth)(object)target).BreakDoorClientRpc(playerWhoTriggered);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoorHealth";
		}
	}
	public class DoorLocker : NetworkBehaviour
	{
		private DoorLock _doorLock = null;

		private void Awake()
		{
			_doorLock = ((Component)this).GetComponent<DoorLock>();
		}

		[ServerRpc(RequireOwnership = false)]
		public void LockDoorServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1470309040u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1470309040u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					LockDoorClientRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetDoorOpenServerRpc(int playerWhoTriggered, bool open)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3128998829u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerWhoTriggered);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3128998829u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetDoorOpenClientRpc(playerWhoTriggered, open);
				}
			}
		}

		[ClientRpc]
		private void LockDoorClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2451542167u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2451542167u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					_doorLock.LockDoor(30f);
				}
			}
		}

		[ClientRpc]
		private void SetDoorOpenClientRpc(int playerWhoTriggered, bool open)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1253103835u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerWhoTriggered);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1253103835u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					AnimatedObjectTrigger component = ((Component)_doorLock).gameObject.GetComponent<AnimatedObjectTrigger>();
					component.boolValue = open;
					component.triggerAnimator.SetBool(component.animationString, component.boolValue);
					((UnityEvent<bool>)(object)component.onTriggerBool).Invoke(component.boolValue);
					_doorLock.isDoorOpened = component.boolValue;
					((Behaviour)_doorLock.navMeshObstacle).enabled = !component.boolValue;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DoorLocker()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1470309040u, new RpcReceiveHandler(__rpc_handler_1470309040));
			NetworkManager.__rpc_func_table.Add(3128998829u, new RpcReceiveHandler(__rpc_handler_3128998829));
			NetworkManager.__rpc_func_table.Add(2451542167u, new RpcReceiveHandler(__rpc_handler_2451542167));
			NetworkManager.__rpc_func_table.Add(1253103835u, new RpcReceiveHandler(__rpc_handler_1253103835));
		}

		private static void __rpc_handler_1470309040(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoorLocker)(object)target).LockDoorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3128998829(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerWhoTriggered = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoTriggered);
				bool open = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref open, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoorLocker)(object)target).SetDoorOpenServerRpc(playerWhoTriggered, open);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2451542167(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DoorLocker)(object)target).LockDoorClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1253103835(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerWhoTriggered = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoTriggered);
				bool open = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref open, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DoorLocker)(object)target).SetDoorOpenClientRpc(playerWhoTriggered, open);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoorLocker";
		}
	}
}
namespace DoorBreach.Dependencies
{
	internal static class DependencyChecker
	{
		internal static bool IsLobbyCompatibilityInstalled()
		{
			return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("LobbyCompatibility"));
		}

		internal static bool IsPiggyInstalled()
		{
			return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("Piggy.PiggyVarietyMod"));
		}

		internal static bool IsToilHeadInstalled()
		{
			return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("com.github.zehsteam.ToilHead"));
		}
	}
	internal static class LobbyCompatibilitySupport
	{
		internal static void Initialize()
		{
			PluginHelper.RegisterPlugin("TestAccount666.DoorBreach", new Version("1.1.0"), (CompatibilityLevel)2, (VersionStrictness)2);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace TestAccount666.DoorBreach.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}