Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DoorBreach v1.5.0
DoorBreach.dll
Decompiled 6 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.Text; 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.Moonswept; using DoorBreach.Patches.DoorBreach.Mods.PiggyVariety; using DoorBreach.Patches.DoorBreach.Mods.ToilHead; using DoorBreach.Patches.Networking; using GameNetcodeStuff; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using Moonswept.Enemies.MovingTurret; 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("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [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.Components")] [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.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0+472b7f0c4795cb61a9a1b813ccfc4c19cca2ae5c")] [assembly: AssemblyProduct("DoorBreach")] [assembly: AssemblyTitle("TestAccount666.DoorBreach")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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 = int.MinValue, MALFUNCTION = 1073741824, MOBILE_TURRET = 64, TOIL_HEAD = 32, LANDMINE = 16, TURRET = 8, SHOTGUN_ACCIDENT = 4, SHOTGUN_ENEMY = 2, [Tooltip("Player is actually anything above 12, but this is an enum, so...")] PLAYER = 4096 } [Flags] public enum SelectableSource { MOBILE_TURRET = 0x40, TOIL_HEAD = 0x20, LANDMINE = 0x10, TURRET = 8, SHOTGUN_ACCIDENT = 4, SHOTGUN_ENEMY = 2, [Tooltip("Player is actually anything above 12, but this is an enum, so...")] PLAYER = 0x1000, ALL = 0x107E } public static Source? FromInt(this int source) { if (source >= Source.PLAYER.ToInt()) { 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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("TestAccount666.DoorBreach", "DoorBreach", "1.5.0")] public class DoorBreach : BaseUnityPlugin { [CompilerGenerated] private sealed class <LoadAudioClips>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private string <assemblyDirectory>5__1; private string <audioPath>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadAudioClips>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <assemblyDirectory>5__1 = null; <audioPath>5__2 = null; <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <assemblyDirectory>5__1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Logger.LogInfo((object)"Loading Sounds..."); Debug.Assert(<assemblyDirectory>5__1 != null, "assemblyDirectory != null"); <audioPath>5__2 = Path.Combine(<assemblyDirectory>5__1, "sounds"); <audioPath>5__2 = (Directory.Exists(<audioPath>5__2) ? <audioPath>5__2 : Path.Combine(<assemblyDirectory>5__1)); LoadDoorAudioClips(<audioPath>5__2); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static AudioClip? doorHitKnifeSfx; internal static AudioClip? doorHitShovelSfx; internal static AudioClip? doorBreakSfx; private static GameObject _doorNetworkManagerPrefab; private static AssetBundle _doorNetworkManagerBundle; public static DoorBreach Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } internal static DoorNetworkManager DoorNetworkManager { 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(GameNetworkManagerPatch)); 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)); } if (DependencyChecker.IsMoonsweptInstalled()) { Harmony.PatchAll(typeof(MobileTurretPatch)); } 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.5.0 has loaded!"); } [IteratorStateMachine(typeof(<LoadAudioClips>d__23))] private static IEnumerator LoadAudioClips() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadAudioClips>d__23(0); } 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 GameObject GetNetworkManagerPrefab() { if (Object.op_Implicit((Object)(object)_doorNetworkManagerPrefab)) { return _doorNetworkManagerPrefab; } if (!Object.op_Implicit((Object)(object)_doorNetworkManagerBundle) && !LoadBundle(Assembly.GetExecutingAssembly(), "doorbreach")) { return null; } _doorNetworkManagerPrefab = _doorNetworkManagerBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/plugins/DoorBreach/PrefabNetworkManager.prefab"); return _doorNetworkManagerPrefab; } public static bool LoadBundle(Assembly assembly, string assetBundleName) { string directoryName = Path.GetDirectoryName(assembly.Location); if (directoryName == null) { Logger.LogError((object)("Failed to determine assembly '" + assembly.FullName + "' location.")); return false; } string text = Path.Combine(directoryName, assetBundleName); if (!File.Exists(text)) { Logger.LogFatal((object)new StringBuilder("Asset bundle '" + assetBundleName + "' not found at " + text + ".").Append(" ").Append("Check if the asset bundle is in the same directory as the plugin.").ToString()); return false; } try { _doorNetworkManagerBundle = AssetBundle.LoadFromFile(text); return true; } catch (Exception ex) { Logger.LogError((object)("Failed to load asset bundle '" + assetBundleName + "' for assembly " + assembly.FullName + ": " + ex.Message)); return false; } } } public static class DoorBreachConfig { public enum DoorBreachMode { DESTROY, UNUSABLE, OPEN } 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.ALL, "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 class DoorNetworkManager : NetworkBehaviour { public static readonly Dictionary<NetworkObject, DoorHealth> DoorHealthCache = new Dictionary<NetworkObject, DoorHealth>(); public static readonly Dictionary<NetworkObject, DoorLocker> DoorLockerCache = new Dictionary<NetworkObject, DoorLocker>(); public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); DoorBreach.DoorNetworkManager = this; } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); DoorBreach.DoorNetworkManager = null; DoorHealthCache.Clear(); DoorLockerCache.Clear(); } [ServerRpc(RequireOwnership = false)] public void HitDoorServerRpc(NetworkObjectReference doorHit, 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) 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(2676922231u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerWhoHit); BytePacker.WriteValueBitPacked(val2, damage); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2676922231u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorHealth(doorHit, out DoorHealth doorHealth)) { doorHealth.HitDoorServer(playerWhoHit, damage); } } } [ServerRpc(RequireOwnership = false)] public void RequestHealthServerRpc(NetworkObjectReference doorHit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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(3846887123u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3846887123u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorHealth(doorHit, out DoorHealth doorHealth)) { doorHealth.RequestHealthServer(); } } } [ClientRpc] public void BreakDoorClientRpc(NetworkObjectReference doorHit, 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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1071942844u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerWhoTriggered); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1071942844u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorHealth(doorHit, out DoorHealth doorHealth)) { doorHealth.BreakDoorClient(playerWhoTriggered); } } } [ClientRpc] public void SetHealthClientRpc(NetworkObjectReference doorHit, 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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1531705122u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, health); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1531705122u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorHealth(doorHit, out DoorHealth doorHealth)) { doorHealth.SetHealthClient(health); } } } private static bool TryGetDoorHealth(NetworkObjectReference networkObjectReference, out DoorHealth doorHealth) { doorHealth = null; NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val, (NetworkManager)null)) { return false; } if (DoorHealthCache.TryGetValue(val, out doorHealth)) { return true; } doorHealth = ((Component)val).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)doorHealth)) { return false; } DoorHealthCache.Add(val, doorHealth); return true; } [ServerRpc(RequireOwnership = false)] public void LockDoorServerRpc(NetworkObjectReference door) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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(2819506289u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2819506289u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorLocker(door, out DoorLocker doorLocker)) { doorLocker.LockDoorServer(); } } } [ClientRpc] public void LockDoorClientRpc(NetworkObjectReference door) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1256125948u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1256125948u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorLocker(door, out DoorLocker doorLocker)) { doorLocker.LockDoorClient(); } } } [ServerRpc(RequireOwnership = false)] public void SetDoorOpenServerRpc(NetworkObjectReference door, 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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(2488408296u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerWhoTriggered); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2488408296u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorLocker(door, out DoorLocker doorLocker)) { doorLocker.SetDoorOpenServer(playerWhoTriggered, open); } } } [ClientRpc] public void SetDoorOpenClientRpc(NetworkObjectReference door, 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(898393521u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, playerWhoTriggered); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 898393521u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (TryGetDoorLocker(door, out DoorLocker doorLocker)) { doorLocker.SetDoorOpenClient(playerWhoTriggered, open); } } } private static bool TryGetDoorLocker(NetworkObjectReference networkObjectReference, out DoorLocker doorLocker) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) doorLocker = null; NetworkObject val = NetworkObjectReference.op_Implicit(networkObjectReference); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (DoorLockerCache.TryGetValue(val, out doorLocker)) { return true; } doorLocker = ((Component)val).GetComponentInChildren<DoorLocker>(); if (!Object.op_Implicit((Object)(object)doorLocker)) { return false; } DoorLockerCache.Add(val, doorLocker); return true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2676922231u, new RpcReceiveHandler(__rpc_handler_2676922231), "HitDoorServerRpc"); ((NetworkBehaviour)this).__registerRpc(3846887123u, new RpcReceiveHandler(__rpc_handler_3846887123), "RequestHealthServerRpc"); ((NetworkBehaviour)this).__registerRpc(1071942844u, new RpcReceiveHandler(__rpc_handler_1071942844), "BreakDoorClientRpc"); ((NetworkBehaviour)this).__registerRpc(1531705122u, new RpcReceiveHandler(__rpc_handler_1531705122), "SetHealthClientRpc"); ((NetworkBehaviour)this).__registerRpc(2819506289u, new RpcReceiveHandler(__rpc_handler_2819506289), "LockDoorServerRpc"); ((NetworkBehaviour)this).__registerRpc(1256125948u, new RpcReceiveHandler(__rpc_handler_1256125948), "LockDoorClientRpc"); ((NetworkBehaviour)this).__registerRpc(2488408296u, new RpcReceiveHandler(__rpc_handler_2488408296), "SetDoorOpenServerRpc"); ((NetworkBehaviour)this).__registerRpc(898393521u, new RpcReceiveHandler(__rpc_handler_898393521), "SetDoorOpenClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2676922231(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference doorHit = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); int playerWhoHit = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoHit); int damage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damage); target.__rpc_exec_stage = (__RpcExecStage)1; ((DoorNetworkManager)(object)target).HitDoorServerRpc(doorHit, playerWhoHit, damage); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3846887123(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference doorHit = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((DoorNetworkManager)(object)target).RequestHealthServerRpc(doorHit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1071942844(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) { NetworkObjectReference doorHit = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); int playerWhoTriggered = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoTriggered); target.__rpc_exec_stage = (__RpcExecStage)1; ((DoorNetworkManager)(object)target).BreakDoorClientRpc(doorHit, playerWhoTriggered); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1531705122(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) { NetworkObjectReference doorHit = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorHit, default(ForNetworkSerializable)); int health = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref health); target.__rpc_exec_stage = (__RpcExecStage)1; ((DoorNetworkManager)(object)target).SetHealthClientRpc(doorHit, health); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2819506289(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference door = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((DoorNetworkManager)(object)target).LockDoorServerRpc(door); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1256125948(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference door = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((DoorNetworkManager)(object)target).LockDoorClientRpc(door); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2488408296(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0057: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference door = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); 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; ((DoorNetworkManager)(object)target).SetDoorOpenServerRpc(door, playerWhoTriggered, open); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_898393521(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0057: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference door = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref door, default(ForNetworkSerializable)); 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; ((DoorNetworkManager)(object)target).SetDoorOpenClientRpc(door, playerWhoTriggered, open); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "DoorNetworkManager"; } } 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.5.0"; } } namespace DoorBreach.Patches { [HarmonyPatch(typeof(PlayerControllerB))] public static class DebugPatch { [HarmonyPatch("ScrollMouse_performed")] [HarmonyPrefix] public static void FindTwinDoor() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; DoorLock[] array = Object.FindObjectsByType<DoorLock>((FindObjectsInactive)0, (FindObjectsSortMode)0); bool flag = false; DoorLock[] array2 = array; foreach (DoorLock val in array2) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.doorTriggerB) && !((Object)(object)val.doorTriggerB == (Object)(object)val.doorTrigger)) { localPlayerController.TeleportPlayer(val.lockPickerPosition.position, false, 0f, false, true); flag = true; } } HUDManager.Instance.AddChatMessage(flag ? "Found twin door!" : "No twin door found!", "", -1, false); } } [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.Networking { [HarmonyPatch(typeof(GameNetworkManager))] public static class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void RegisterNetworkPrefab() { GameObject networkManagerPrefab = global::DoorBreach.DoorBreach.GetNetworkManagerPrefab(); if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(networkManagerPrefab)) { NetworkManager.Singleton.AddNetworkPrefab(networkManagerPrefab); } } [HarmonyPatch("Disconnect")] [HarmonyPrefix] public static void DestroyNetworkManager(GameNetworkManager __instance) { if (!__instance.isHostingGame) { global::DoorBreach.DoorBreach.DoorNetworkManager = null; } else { ((NetworkBehaviour)global::DoorBreach.DoorBreach.DoorNetworkManager).NetworkObject.Despawn(true); } } [HarmonyPatch("SetLobbyJoinable")] [HarmonyPostfix] public static void SpawnNetworkManager(GameNetworkManager __instance) { if (__instance.isHostingGame) { if (Object.op_Implicit((Object)(object)global::DoorBreach.DoorBreach.DoorNetworkManager) && Object.op_Implicit((Object)(object)((NetworkBehaviour)global::DoorBreach.DoorBreach.DoorNetworkManager).NetworkObject)) { global::DoorBreach.DoorBreach.Logger.LogDebug((object)"Network manager already exists! Destroying..."); ((NetworkBehaviour)global::DoorBreach.DoorBreach.DoorNetworkManager).NetworkObject.Despawn(true); } GameObject val = Object.Instantiate<GameObject>(global::DoorBreach.DoorBreach.GetNetworkManagerPrefab()); NetworkObject component = val.GetComponent<NetworkObject>(); component.Spawn(false); Object.DontDestroyOnLoad((Object)(object)val); } } } } 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_00be: 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_0138: 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 componentInChildren = default(DoorHealth); for (int i = 0; i < num; i++) { Collider val = array[i]; if (!((Component)val).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)val).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { continue; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { continue; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { continue; } } 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); } global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), ActionSource.Source.LANDMINE.ToInt(), damage); } } } [HarmonyPatch] public static class MeleeWeaponPatch { [HarmonyPatch(typeof(Shovel), "HitShovel")] [HarmonyPostfix] private static void HitDoor(Shovel __instance, bool cancel) { global::DoorBreach.DoorBreach.Logger.LogDebug((object)$"Hit door {__instance} Cancel? {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) //IL_0182: 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 componentInChildren = default(DoorHealth); for (int i = 0; i < num; i++) { RaycastHit val2 = array[i]; if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { continue; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { continue; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { continue; } } if (!componentInChildren.IsBroken() && !componentInChildren.IsDoorOpen() && !flag && hitSoundSource != null) { flag = true; hitSoundSource.Play(); } Debug.Assert((Object)(object)playerHeldBy != (Object)null, "playerHeldBy != null"); global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), ActionSource.Source.PLAYER.ToInt() + (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_0041: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) int playerWhoHit = ActionSource.Source.SHOTGUN_ACCIDENT.ToInt(); if (((GrabbableObject)__instance).isHeld) { playerWhoHit = ActionSource.Source.PLAYER.ToInt() + (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); if (!Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2)) { return; } DoorHealth componentInChildren = default(DoorHealth); if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { return; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { return; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } } 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); } global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), 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) //IL_0170: 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) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(__instance.aimPoint.position, __instance.aimPoint.forward); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 23f, 512, (QueryTriggerInteraction)2)) { return; } DoorHealth componentInChildren = default(DoorHealth); if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { return; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { return; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } } float distance = ((RaycastHit)(ref val2)).distance; double num = Math.Max(Math.Log(distance + 1f, 5.0), 1.0); int damage = (int)(9.0 / num); global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), 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) //IL_016f: 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) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(__instance.aimPoint.position, __instance.aimPoint.forward); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 23f, 512, (QueryTriggerInteraction)2)) { return; } DoorHealth componentInChildren = default(DoorHealth); if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { return; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { return; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } } float distance = ((RaycastHit)(ref val2)).distance; double num = Math.Max(Math.Log(distance + 1f, 5.0), 1.0); int damage = (int)(9.0 / num); global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) 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); if (!Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2)) { return; } DoorHealth componentInChildren = default(DoorHealth); if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { return; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { return; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } } 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); } global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), playerWhoHit, damage); } } [HarmonyPatch(typeof(M4Item))] public static class RiflePatch { [HarmonyPatch("ShootGun")] [HarmonyPostfix] private static void ShredDoors(M4Item __instance, Vector3 gunPosition, Vector3 gunForward) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) 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); if (!Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2)) { return; } DoorHealth componentInChildren = default(DoorHealth); if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { return; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { return; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } } float distance = ((RaycastHit)(ref val2)).distance; double num = Math.Max(Math.Log(distance + 1f, 2.0), 1.0); int damage = (int)(2.0 / num); global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), playerWhoHit, damage); } } } namespace DoorBreach.Patches.DoorBreach.Mods.Moonswept { [HarmonyPatch(typeof(MovingTurret))] public class MobileTurretPatch { [HarmonyPatch("Update")] [HarmonyPrefix] public static void IncinerateDoor(MovingTurret __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).currentBehaviourStateIndex != 3 || __instance._firingDelay + Time.fixedDeltaTime < 0.21f) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((EnemyAI)__instance).eye.position, ((EnemyAI)__instance).eye.forward); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val, ref val2, 8f, 512, (QueryTriggerInteraction)2)) { return; } DoorHealth componentInChildren = default(DoorHealth); if (!((Component)((RaycastHit)(ref val2)).collider).TryGetComponent<DoorHealth>(ref componentInChildren)) { Transform parent = ((Component)((RaycastHit)(ref val2)).collider).transform.parent; if (!Object.op_Implicit((Object)(object)parent)) { return; } Transform parent2 = parent.parent; if (!Object.op_Implicit((Object)(object)parent2)) { return; } componentInChildren = ((Component)parent2).GetComponentInChildren<DoorHealth>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } } float distance = ((RaycastHit)(ref val2)).distance; double num = Math.Max(Math.Log(distance + 1f, 5.0), 1.0); int damage = (int)(9.0 / num); global::DoorBreach.DoorBreach.DoorNetworkManager.HitDoorServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren.DoorLock).NetworkObject), ActionSource.Source.MOBILE_TURRET.ToInt(), damage); } } } namespace DoorBreach.Functional { public class DoorHealth : MonoBehaviour { [CompilerGenerated] private sealed class <ResetHittable>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public DoorHealth <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetHittable>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this._hittable = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool _broken; private bool _hittable = true; private DoorLocker _doorLocker = null; private int _health = 8; public DoorLock DoorLock { get; private set; } = null; private void Awake() { int minimumDoorHealth = DoorBreachConfig.minimumDoorHealth; int num = minimumDoorHealth + DoorBreachConfig.possibleAdditionalHealth; _health = Random.RandomRangeInt(minimumDoorHealth, num + 1); } private void OnDestroy() { DoorNetworkManager.DoorHealthCache.Remove(((NetworkBehaviour)DoorLock).NetworkObject); } public bool IsBroken() { return _broken; } public bool IsDoorOpen() { return DoorLock.isDoorOpened; } private void Update() { if (_broken && !DoorLock.isDoorOpened) { _doorLocker.SetDoorOpenServer(ActionSource.Source.UNKNOWN.ToInt(), open: true); } } private void Start() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) DoorBreach.DoorNetworkManager.RequestHealthServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)DoorLock).NetworkObject)); } public void RequestHealthServer() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) DoorBreach.DoorNetworkManager.SetHealthClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)DoorLock).NetworkObject), _health); } internal void SetDoorLock(DoorLock doorLock) { DoorLock = doorLock; } internal void SetDoorLocker(DoorLocker doorLocker) { _doorLocker = doorLocker; } public void HitDoorServer(int playerWhoHit, int damage) { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if (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) { DoorBreach.DoorNetworkManager.SetHealthClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)DoorLock).NetworkObject), _health - damage); if (_health <= 0) { DoorBreach.DoorNetworkManager.BreakDoorClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)DoorLock).NetworkObject), playerWhoHit); } } } [IteratorStateMachine(typeof(<ResetHittable>d__18))] private IEnumerator ResetHittable() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetHittable>d__18(0) { <>4__this = this }; } public void SetHealthClient(int health) { _health = health; } public void BreakDoorClient(int playerWhoTriggered) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) PlayAudio(((Component)this).gameObject); ActionSource.Source? source = playerWhoTriggered.FromInt(); if (!source.HasValue) { return; } PlayerControllerB playerControllerB = null; if (source.GetValueOrDefault() == ActionSource.Source.PLAYER) { playerControllerB = StartOfRound.Instance.allPlayerScripts[playerWhoTriggered - ActionSource.Source.PLAYER.ToInt()]; } 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.SetDoorOpenServer(playerWhoTriggered, open: true); if (DoorBreachConfig.doorBreachMode == DoorBreachConfig.DoorBreachMode.OPEN) { _broken = false; _health = 1; return; } 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); } } } public class DoorLocker : NetworkBehaviour { private DoorLock _doorLock = null; private void Awake() { _doorLock = ((Component)this).GetComponent<DoorLock>(); } public override void OnDestroy() { DoorNetworkManager.DoorLockerCache.Remove(((NetworkBehaviour)_doorLock).NetworkObject); } public void LockDoorServer() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) DoorBreach.DoorNetworkManager.LockDoorClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)_doorLock).NetworkObject)); } public void SetDoorOpenServer(int playerWhoTriggered, bool open) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) DoorBreach.DoorNetworkManager.SetDoorOpenClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)_doorLock).NetworkObject), playerWhoTriggered, open); } public void LockDoorClient() { _doorLock.LockDoor(30f); } public void SetDoorOpenClient(int playerWhoTriggered, bool open) { 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(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [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 bool IsMoonsweptInstalled() { return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("MoonsweptTeam.Moonswept")); } } internal static class LobbyCompatibilitySupport { internal static void Initialize() { PluginHelper.RegisterPlugin("TestAccount666.DoorBreach", new Version("1.5.0"), (CompatibilityLevel)2, (VersionStrictness)2); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace TestAccount666.DoorBreach.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }