Please disclose if any significant portion of your mod was created 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 BunkbedRevive v2.0.0
BunkbedRevive.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BunkbedRevive.Configuration; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using StaticNetcodeLib; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("BunkbedRevive")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Revive dead players at the bunkbeds")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0")] [assembly: AssemblyProduct("BunkbedRevive")] [assembly: AssemblyTitle("BunkbedRevive")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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 BunkbedRevive { public class BunkbedController : MonoBehaviour { private static InteractTrigger interactTrigger; private static Sprite defaultIcon; private static Sprite disabledIcon; public static BunkbedController Instance; public static int remainingOverallRevives = 0; public static List<int> teleportedBodies = new List<int>(); public static Dictionary<int, int> remainingPlayerRevives = new Dictionary<int, int>(); public static int GetReviveCost() { CostMethods reviveCostMethod = NetworkSync.Config.ReviveCostMethod; int reviveCostPercent = NetworkSync.Config.ReviveCostPercent; int reviveCostAmount = NetworkSync.Config.ReviveCostAmount; if (reviveCostMethod == CostMethods.SetAmount) { if (reviveCostAmount > 0) { return reviveCostAmount; } return 0; } if (reviveCostPercent <= 0) { return 0; } return (int)Math.Floor((float)TimeOfDay.Instance.profitQuota * ((float)reviveCostPercent / 100f)); } public static bool CanRevive(int id, bool logStuff = false) { ReviveLimits reviveLimitMethod = NetworkSync.Config.ReviveLimitMethod; if (!NetworkSync.Config.ReviveTeleported && teleportedBodies.Contains(id)) { return false; } switch (reviveLimitMethod) { case ReviveLimits.None: return true; case ReviveLimits.Overall: return remainingOverallRevives > 0; case ReviveLimits.PerPlayer: if (remainingPlayerRevives.ContainsKey(id)) { return remainingPlayerRevives[id] > 0; } remainingPlayerRevives.Add(id, NetworkSync.Config.ReviveLimitPer); return true; default: return true; } } public static void UpdateReviveCount(int id) { ReviveLimits reviveLimitMethod = NetworkSync.Config.ReviveLimitMethod; switch (reviveLimitMethod) { case ReviveLimits.None: return; case ReviveLimits.Overall: remainingOverallRevives--; break; } if (reviveLimitMethod == ReviveLimits.PerPlayer) { if (!remainingPlayerRevives.ContainsKey(id)) { remainingPlayerRevives.Add(id, NetworkSync.Config.ReviveLimitPer); } remainingPlayerRevives[id]--; } } private static void CreateTrigger() { //IL_0025: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0061: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown GameObject val = new GameObject("Bed", new Type[2] { typeof(BoxCollider), typeof(InteractTrigger) }); Transform transform = ((Component)Instance).transform; val.transform.SetParent(transform); val.transform.localPosition = Vector3.zero; val.layer = LayerMask.NameToLayer("InteractableObject"); val.tag = "InteractTrigger"; BoxCollider component = val.GetComponent<BoxCollider>(); component.center = Vector3.zero; component.size = new Vector3(2.5f, 3f, 1f); ((Collider)component).enabled = true; int reviveCost = GetReviveCost(); interactTrigger = val.GetComponent<InteractTrigger>(); interactTrigger.twoHandedItemAllowed = true; interactTrigger.interactable = true; interactTrigger.holdInteraction = false; interactTrigger.timeToHold = 0.4f; interactTrigger.cooldownTime = 0.25f; interactTrigger.timeToHoldSpeedMultiplier = 1f; interactTrigger.hoverTip = "Revive for " + ((reviveCost <= 0) ? "free" : (reviveCost + " scrap")) + " : [E]"; interactTrigger.hoverIcon = defaultIcon; interactTrigger.disabledHoverIcon = disabledIcon; interactTrigger.disabledHoverTip = "No dead players"; interactTrigger.onCancelAnimation = new InteractEvent(); interactTrigger.holdingInteractEvent = new InteractEventFloat(); interactTrigger.onInteractEarly = new InteractEvent(); interactTrigger.onInteract = new InteractEvent(); interactTrigger.onStopInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate { OnInteract(); }); ((UnityEvent<PlayerControllerB>)(object)interactTrigger.onStopInteract).AddListener((UnityAction<PlayerControllerB>)delegate { OnStopInteract(); }); } public static void ResetValues() { remainingOverallRevives = NetworkSync.Config.ReviveLimitOverall; remainingPlayerRevives.Clear(); teleportedBodies.Clear(); } private void Awake() { Instance = this; GetIcons(); CreateTrigger(); ResetValues(); } private void Update() { if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } bool flag = StartOfRound.Instance.connectedPlayersAmount + 1 - StartOfRound.Instance.livingPlayers > 0; RagdollGrabbableObject heldBody = GetHeldBody(); interactTrigger.interactable = flag && Object.op_Implicit((Object)(object)heldBody); if (Object.op_Implicit((Object)(object)heldBody)) { string text = (Object.op_Implicit((Object)(object)heldBody.ragdoll) ? heldBody.ragdoll.playerScript.playerUsername : "Player"); if (!CanRevive(heldBody.bodyID.Value)) { interactTrigger.hoverTip = "Can't revive " + text; return; } int reviveCost = GetReviveCost(); interactTrigger.hoverTip = "Revive " + text + " for " + ((reviveCost <= 0) ? "free" : (reviveCost + " scrap")) + " : [E]"; } } private static void GetIcons() { StartMatchLever obj = Object.FindObjectOfType<StartMatchLever>(); defaultIcon = obj.triggerScript.hoverIcon; disabledIcon = obj.triggerScript.disabledHoverIcon; } private static RagdollGrabbableObject? GetHeldBody() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer; if (!localPlayerController.isHoldingObject || (Object)(object)currentlyHeldObjectServer == (Object)null || !Object.op_Implicit((Object)(object)currentlyHeldObjectServer) || !(currentlyHeldObjectServer is RagdollGrabbableObject)) { return null; } return (RagdollGrabbableObject?)(object)((currentlyHeldObjectServer is RagdollGrabbableObject) ? currentlyHeldObjectServer : null); } private static PlayerControllerB GetLocalPlayer() { return GameNetworkManager.Instance.localPlayerController; } public static void RevivePlayer(int playerId) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val == (Object)null) { return; } UpdateReviveCount(playerId); if (val.isPlayerDead || val.isPlayerControlled) { val.ResetPlayerBloodObjects(val.isPlayerDead); val.isClimbingLadder = false; val.clampLooking = false; val.inVehicleAnimation = false; val.disableMoveInput = false; val.ResetZAndXRotation(); ((Collider)val.thisController).enabled = true; val.health = 100; val.disableLookInput = false; val.disableInteract = false; if (val.isPlayerDead) { val.isPlayerDead = false; val.isPlayerControlled = true; val.isInElevator = true; val.isInHangarShipRoom = true; val.isInsideFactory = false; val.parentedToElevatorLastFrame = false; val.overrideGameOverSpectatePivot = null; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); val.TeleportPlayer(StartOfRound.Instance.GetPlayerSpawnPosition(playerId, false), false, 0f, false, true); val.setPositionOfDeadPlayer = false; val.DisablePlayerModel(StartOfRound.Instance.allPlayerObjects[playerId], true, true); ((Behaviour)val.helmetLight).enabled = false; val.Crouch(false); val.criticallyInjured = false; if ((Object)(object)val.playerBodyAnimator != (Object)null) { val.playerBodyAnimator.SetBool("Limp", false); } val.bleedingHeavily = false; val.activatingItem = false; val.twoHanded = false; val.inShockingMinigame = false; val.inSpecialInteractAnimation = false; val.freeRotationInInteractAnimation = false; val.disableSyncInAnimation = false; val.inAnimationWithEnemy = null; val.holdingWalkieTalkie = false; val.speakingToWalkieTalkie = false; val.isSinking = false; val.isUnderwater = false; val.sinkingValue = 0f; val.statusEffectAudio.Stop(); val.DisableJetpackControlsLocally(); val.health = 100; val.mapRadarDotAnimator.SetBool("dead", false); val.deadBody = null; val.externalForceAutoFade = Vector3.zero; if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); val.hasBegunSpectating = false; HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); val.hinderedMultiplier = 1f; val.isMovementHindered = 0; val.sourcesCausingSinking = 0; val.reverbPreset = StartOfRound.Instance.shipReverb; } } SoundManager.Instance.earsRingingTimer = 0f; val.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[playerId] = 1f; SoundManager.Instance.SetPlayerPitch(1f, playerId); if ((Object)(object)val.currentVoiceChatIngameSettings == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { val.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)val.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { return; } ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false; } } StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; StartOfRound.Instance.allPlayersDead = false; if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val) { val.bleedingHeavily = false; val.criticallyInjured = false; val.playerBodyAnimator.SetBool("Limp", false); val.health = 100; HUDManager.Instance.UpdateHealthUI(100, false); val.spectatedPlayerScript = null; ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val); TimeOfDay.Instance.DisableAllWeather(false); StartOfRound.Instance.UpdatePlayerVoiceEffects(); ((Renderer)val.thisPlayerModel).enabled = true; HUDManager.Instance.HideHUD(false); } else { ((Renderer)val.thisPlayerModel).enabled = true; ((Renderer)val.thisPlayerModelLOD1).enabled = true; ((Renderer)val.thisPlayerModelLOD2).enabled = true; } } public static void OnInteract() { PlayerControllerB localPlayer = GetLocalPlayer(); RagdollGrabbableObject heldBody = GetHeldBody(); if (!Object.op_Implicit((Object)(object)heldBody)) { return; } int reviveCost = GetReviveCost(); if (HUDManager.Instance.terminalScript.groupCredits < reviveCost) { HUDManager.Instance.DisplayGlobalNotification("Not enough credits"); interactTrigger.StopInteraction(); return; } if (!CanRevive(heldBody.bodyID.Value, logStuff: true)) { HUDManager.Instance.DisplayGlobalNotification("Can't Revive"); interactTrigger.StopInteraction(); return; } Terminal terminalScript = HUDManager.Instance.terminalScript; terminalScript.groupCredits -= reviveCost; HUDManager.Instance.terminalScript.SyncGroupCreditsServerRpc(HUDManager.Instance.terminalScript.groupCredits, HUDManager.Instance.terminalScript.numberOfItemsInDropship); BunkbedNetworking.RevivePlayerServerRpc(heldBody.bodyID.Value); if (Object.op_Implicit((Object)(object)localPlayer)) { localPlayer.DespawnHeldObject(); } string text = (Object.op_Implicit((Object)(object)heldBody.ragdoll) ? heldBody.ragdoll.playerScript.playerUsername : "Player"); HUDManager.Instance.DisplayGlobalNotification(text + " has been revived"); } private static void OnStopInteract() { int reviveCost = GetReviveCost(); interactTrigger.hoverTip = "Revive for " + ((reviveCost <= 0) ? "free" : (reviveCost + " scrap")) + " : [E]"; } } [StaticNetcode] internal class BunkbedNetworking { [ServerRpc(RequireOwnership = false)] public static void RevivePlayerServerRpc(int id) { RevivePlayerClientRpc(id); } [ClientRpc] public static void RevivePlayerClientRpc(int id) { BunkbedController.RevivePlayer(id); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("viviko.BunkbedRevive", "BunkbedRevive", "2.0.0")] public sealed class BunkbedRevive : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static CanModifyDelegate <0>__CanModifyCallback; } private readonly Harmony harmony = new Harmony("viviko.BunkbedRevive"); public static BunkbedRevive Instance; internal static ManualLogSource Logger { get; private set; } private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0057: 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_0063: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0089: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00c5: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_0101: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_013d: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0179: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_01b5: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01f1: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; CustomConfig.Init(); ConfigEntry<CostMethods> reviveCostMethod = CustomConfig.ReviveCostMethod; EnumDropDownOptions val = new EnumDropDownOptions { RequiresRestart = false }; object obj = <>O.<0>__CanModifyCallback; if (obj == null) { CanModifyDelegate val2 = CanModifyCallback; <>O.<0>__CanModifyCallback = val2; obj = (object)val2; } ((BaseOptions)val).CanModifyCallback = (CanModifyDelegate)obj; LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<CostMethods>(reviveCostMethod, val)); ConfigEntry<int> reviveCostPercent = CustomConfig.ReviveCostPercent; IntSliderOptions val3 = new IntSliderOptions { RequiresRestart = false }; object obj2 = <>O.<0>__CanModifyCallback; if (obj2 == null) { CanModifyDelegate val4 = CanModifyCallback; <>O.<0>__CanModifyCallback = val4; obj2 = (object)val4; } ((BaseOptions)val3).CanModifyCallback = (CanModifyDelegate)obj2; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(reviveCostPercent, val3)); ConfigEntry<int> reviveCostAmount = CustomConfig.ReviveCostAmount; IntSliderOptions val5 = new IntSliderOptions { RequiresRestart = false }; object obj3 = <>O.<0>__CanModifyCallback; if (obj3 == null) { CanModifyDelegate val6 = CanModifyCallback; <>O.<0>__CanModifyCallback = val6; obj3 = (object)val6; } ((BaseOptions)val5).CanModifyCallback = (CanModifyDelegate)obj3; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(reviveCostAmount, val5)); ConfigEntry<ReviveLimits> reviveLimitMethod = CustomConfig.ReviveLimitMethod; EnumDropDownOptions val7 = new EnumDropDownOptions { RequiresRestart = false }; object obj4 = <>O.<0>__CanModifyCallback; if (obj4 == null) { CanModifyDelegate val8 = CanModifyCallback; <>O.<0>__CanModifyCallback = val8; obj4 = (object)val8; } ((BaseOptions)val7).CanModifyCallback = (CanModifyDelegate)obj4; LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<ReviveLimits>(reviveLimitMethod, val7)); ConfigEntry<int> reviveLimitPer = CustomConfig.ReviveLimitPer; IntSliderOptions val9 = new IntSliderOptions { RequiresRestart = false }; object obj5 = <>O.<0>__CanModifyCallback; if (obj5 == null) { CanModifyDelegate val10 = CanModifyCallback; <>O.<0>__CanModifyCallback = val10; obj5 = (object)val10; } ((BaseOptions)val9).CanModifyCallback = (CanModifyDelegate)obj5; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(reviveLimitPer, val9)); ConfigEntry<int> reviveLimitOverall = CustomConfig.ReviveLimitOverall; IntSliderOptions val11 = new IntSliderOptions { RequiresRestart = false }; object obj6 = <>O.<0>__CanModifyCallback; if (obj6 == null) { CanModifyDelegate val12 = CanModifyCallback; <>O.<0>__CanModifyCallback = val12; obj6 = (object)val12; } ((BaseOptions)val11).CanModifyCallback = (CanModifyDelegate)obj6; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(reviveLimitOverall, val11)); ConfigEntry<bool> reviveTeleported = CustomConfig.ReviveTeleported; BoolCheckBoxOptions val13 = new BoolCheckBoxOptions { RequiresRestart = false }; object obj7 = <>O.<0>__CanModifyCallback; if (obj7 == null) { CanModifyDelegate val14 = CanModifyCallback; <>O.<0>__CanModifyCallback = val14; obj7 = (object)val14; } ((BaseOptions)val13).CanModifyCallback = (CanModifyDelegate)obj7; LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(reviveTeleported, val13)); ConfigEntry<float> reviveBodyWeight = CustomConfig.ReviveBodyWeight; FloatSliderOptions val15 = new FloatSliderOptions { RequiresRestart = false }; object obj8 = <>O.<0>__CanModifyCallback; if (obj8 == null) { CanModifyDelegate val16 = CanModifyCallback; <>O.<0>__CanModifyCallback = val16; obj8 = (object)val16; } ((BaseOptions)val15).CanModifyCallback = (CanModifyDelegate)obj8; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(reviveBodyWeight, val15)); harmony.PatchAll(); Logger.LogInfo((object)"Plugin BunkbedRevive v2.0.0 is loaded!"); } private static CanModifyResult CanModifyCallback() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) && GameNetworkManager.Instance.gameHasStarted) { return CanModifyResult.op_Implicit((false, "This setting cant be changed while in a game")); } return CanModifyResult.True(); } } internal static class GeneratedPluginInfo { public const string Identifier = "viviko.BunkbedRevive"; public const string Name = "BunkbedRevive"; public const string Version = "2.0.0"; } } namespace BunkbedRevive.Patches { [HarmonyPatch(typeof(RagdollGrabbableObject))] public class RagdollGrabbableObjectPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatch(RagdollGrabbableObject __instance) { ((GrabbableObject)__instance).itemProperties.weight = NetworkSync.Config.ReviveBodyWeight; } } [HarmonyPatch(typeof(RoundManager))] public class RoundManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch() { NetworkSync.Init(); } [HarmonyPatch("OnDestroy")] [HarmonyPostfix] private static void DestroyPatch() { NetworkSync.Cleanup(); } [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpcPatch() { NetworkSync.FinishSync(hostSynced: false); } } [HarmonyPatch(typeof(ShipTeleporter))] public class ShipTeleporterPatch { [HarmonyPatch("SetPlayerTeleporterId")] [HarmonyPrefix] private static void SetPlayerTeleporterIdPatch(PlayerControllerB playerScript, int teleporterId) { if (teleporterId == 1) { int item = (int)playerScript.playerClientId; if (!BunkbedController.teleportedBodies.Contains(item)) { BunkbedController.teleportedBodies.Add(item); } } } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(StartOfRound __instance) { int bunkBedId = __instance.unlockablesList.unlockables.FindIndex((UnlockableItem un) => un.unlockableName.Contains("bunkbeds", StringComparison.CurrentCultureIgnoreCase)); ((Component)Object.FindObjectsOfType<PlaceableShipObject>().First((PlaceableShipObject pc) => pc.unlockableID == bunkBedId)).gameObject.AddComponent<BunkbedController>(); } [HarmonyPatch("EndOfGame")] [HarmonyPrefix] private static void EndOfGamePatch() { BunkbedController.ResetValues(); } [HarmonyPatch("openingDoorsSequence")] [HarmonyPrefix] private static void openingDoorsSequencePatch() { BunkbedController.ResetValues(); } } } namespace BunkbedRevive.Configuration { internal class CustomConfig { internal static ConfigEntry<CostMethods> ReviveCostMethod; internal static ConfigEntry<int> ReviveCostPercent; internal static ConfigEntry<int> ReviveCostAmount; internal static ConfigEntry<ReviveLimits> ReviveLimitMethod; internal static ConfigEntry<int> ReviveLimitPer; internal static ConfigEntry<int> ReviveLimitOverall; internal static ConfigEntry<bool> ReviveTeleported; internal static ConfigEntry<float> ReviveBodyWeight; internal static void Init() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)BunkbedRevive.Instance).Config; config.SaveOnConfigSet = false; ReviveCostMethod = config.Bind<CostMethods>("Cost", "Cost Method", CostMethods.PercentOfQuota, "Which method to use for revive cost"); ReviveCostPercent = config.Bind<int>("Cost", "Percent Of Quota", 30, new ConfigDescription("Adjust the percent of quota a revive will cost", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ReviveCostAmount = config.Bind<int>("Cost", "Set Amount", 50, new ConfigDescription("Adjust the amount a revive will cost", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); ReviveLimitMethod = config.Bind<ReviveLimits>("Limits", "Revive Limit Method", ReviveLimits.None, "Which method to use for revive limits"); ReviveLimitPer = config.Bind<int>("Limits", "Revives per Player", 2, new ConfigDescription("Adjust the amount of revives per player", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ReviveLimitOverall = config.Bind<int>("Limits", "Overall Revives", 4, new ConfigDescription("Adjust the amount of overall revives", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); ReviveTeleported = config.Bind<bool>("Limits", "Can Revive Teleported bodies", true, (ConfigDescription)null); ReviveBodyWeight = config.Bind<float>("Other", "Dead Body Weight", 1.1f, new ConfigDescription("Adjust the weight of dead bodies\n Default is 1.1 as of v56", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); ((Dictionary<ConfigDefinition, string>)((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(config, null)).Clear(); config.Save(); config.SaveOnConfigSet = true; } } public enum CostMethods { PercentOfQuota, SetAmount } public enum ReviveLimits { None, PerPlayer, Overall } internal class NetworkConfig : INetworkSerializable { public CostMethods ReviveCostMethod; public int ReviveCostPercent = 30; public int ReviveCostAmount = 50; public ReviveLimits ReviveLimitMethod; public int ReviveLimitPer = 2; public int ReviveLimitOverall = 4; public bool ReviveTeleported; public float ReviveBodyWeight = 1.1f; public void CopyLocalConfig() { ReviveCostMethod = CustomConfig.ReviveCostMethod.Value; ReviveCostPercent = CustomConfig.ReviveCostPercent.Value; ReviveCostAmount = CustomConfig.ReviveCostAmount.Value; ReviveLimitMethod = CustomConfig.ReviveLimitMethod.Value; ReviveLimitPer = CustomConfig.ReviveLimitPer.Value; ReviveLimitOverall = CustomConfig.ReviveLimitOverall.Value; ReviveTeleported = CustomConfig.ReviveTeleported.Value; ReviveBodyWeight = CustomConfig.ReviveBodyWeight.Value; } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00aa: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer<CostMethods>*)(&serializer))->SerializeValue<CostMethods>(ref ReviveCostMethod, default(ForEnums)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref ReviveCostPercent, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref ReviveCostAmount, default(ForPrimitives)); ((BufferSerializer<ReviveLimits>*)(&serializer))->SerializeValue<ReviveLimits>(ref ReviveLimitMethod, default(ForEnums)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref ReviveLimitPer, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref ReviveLimitOverall, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref ReviveTeleported, default(ForPrimitives)); ((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref ReviveBodyWeight, default(ForPrimitives)); } } internal static class NetworkSync { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__ContactServerRpc; public static Action<ulong> <1>__OnClientDisconnect; public static HandleNamedMessageDelegate <2>__SendConfigClientRpc; } public static NetworkConfig Config; public static bool SyncedWithHost; public static bool FinishedSync; public static List<ulong> HostSyncedList; public static void Init() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown Config = new NetworkConfig(); Config.CopyLocalConfig(); SyncedWithHost = false; FinishedSync = false; if (NetworkManager.Singleton.IsHost) { BunkbedRevive.Logger.LogMessage((object)"Setup as host!"); HostSyncedList = new List<ulong>(); SyncedWithHost = true; object obj = <>O.<0>__ContactServerRpc; if (obj == null) { HandleNamedMessageDelegate val = ContactServerRpc; <>O.<0>__ContactServerRpc = val; obj = (object)val; } SetupMessageHandler("ContactServerRpc", (HandleNamedMessageDelegate)obj); FinishSync(hostSynced: true); NetworkManager.Singleton.OnClientDisconnectCallback += OnClientDisconnect; } else if (NetworkManager.Singleton.IsClient) { object obj2 = <>O.<2>__SendConfigClientRpc; if (obj2 == null) { HandleNamedMessageDelegate val2 = SendConfigClientRpc; <>O.<2>__SendConfigClientRpc = val2; obj2 = (object)val2; } SetupMessageHandler("SendConfigClientRpc", (HandleNamedMessageDelegate)obj2); string text = "2.0.0".ToString(); FastBufferWriter buffer = default(FastBufferWriter); ((FastBufferWriter)(ref buffer))..ctor(text.Length * 2, (Allocator)2, -1); ((FastBufferWriter)(ref buffer)).WriteValue(text, false); SendToHost("ContactServerRpc", buffer, forceSend: true); BunkbedRevive.Logger.LogMessage((object)"Setup as client!"); } } public static void Cleanup() { Config = null; SyncedWithHost = false; HostSyncedList = null; FinishedSync = false; NetworkManager.Singleton.OnClientDisconnectCallback -= OnClientDisconnect; } public static void OnClientDisconnect(ulong clientId) { if (HostSyncedList.Remove(clientId)) { BunkbedRevive.Logger.LogMessage((object)("BunkbedRevive client " + clientId + " disconnected.")); } } public static void SetupMessageHandler(string name, HandleNamedMessageDelegate del) { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("BunkbedRevive." + name, del); } public static void DeleteMessageHandler(string name) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("BunkbedRevive." + name); } public static void SendToClients(string name, IReadOnlyList<ulong> clients, ref FastBufferWriter buffer) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsHost) { BunkbedRevive.Logger.LogError((object)"SendToClients called from client!"); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BunkbedRevive." + name, clients, buffer, (NetworkDelivery)3); } } public static void SendToClients(string name, ref FastBufferWriter buffer) { SendToClients(name, HostSyncedList, ref buffer); } public static void SendToHost(string name, FastBufferWriter buffer, bool forceSend = false) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (forceSend || SyncedWithHost) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BunkbedRevive." + name, 0uL, buffer, (NetworkDelivery)3); } } public static void ContactServerRpc(ulong clientId, FastBufferReader reader) { string text = default(string); ((FastBufferReader)(ref reader)).ReadValue(ref text, false); BunkbedRevive.Logger.LogMessage((object)("Client " + clientId + " connected with BunkbedRevive")); HostSyncedList.Add(clientId); FastBufferWriter buffer = default(FastBufferWriter); ((FastBufferWriter)(ref buffer))..ctor(128, (Allocator)2, 1024); ((FastBufferWriter)(ref buffer)).WriteNetworkSerializable<NetworkConfig>(ref Config); SendToClients("SendConfigClientRpc", new <>z__ReadOnlyArray<ulong>(new ulong[1] { clientId }), ref buffer); } public static void SendConfigClientRpc(ulong clientId, FastBufferReader reader) { ((FastBufferReader)(ref reader)).ReadNetworkSerializableInPlace<NetworkConfig>(ref Config); BunkbedRevive.Logger.LogMessage((object)"Host successfuly synced with BunkbedRevive"); FinishSync(hostSynced: true); } public static void FinishSync(bool hostSynced) { if (!FinishedSync) { SyncedWithHost = hostSynced; FinishedSync = true; if (!SyncedWithHost) { BunkbedRevive.Logger.LogMessage((object)"Could not sync with host BunkbedRevive instance. Only client-side effects will apply."); } } } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } } internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }