Decompiled source of ShipInventory v1.2.5
WarperSan-ShipInventory/ShipInventory.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
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.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using CustomItemBehaviourLibrary.AbstractItems; using GameNetcodeStuff; using HarmonyLib; using InteractiveTerminalAPI.Compat; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using InteractiveTerminalAPI.UI.Cursor; using InteractiveTerminalAPI.UI.Page; using InteractiveTerminalAPI.UI.Screen; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OpenMonitors.Monitors; using ShipInventory.Applications; using ShipInventory.Compatibility; using ShipInventory.Helpers; using ShipInventory.NetcodePatcher; using ShipInventory.Objects; using ShipInventory.Patches; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("OpenMonitors")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WarperSan")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds an inventory to the ship, allowing it to store items and retrieve them.")] [assembly: AssemblyFileVersion("1.2.5.0")] [assembly: AssemblyInformationalVersion("1.2.5+2edbcf78c06b576e4272395adcd8eb4522b486e1")] [assembly: AssemblyProduct("ShipInventory")] [assembly: AssemblyTitle("ShipInventory")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ShipInventory { public class Config : SyncedConfig2<Config> { public enum PermissionLevel { HOST_ONLY, CLIENTS_ONLY, EVERYONE, NO_ONE } public enum SortOrder { NONE, NAME_ASC, NAME_DESC, VALUE_ASC, VALUE_DESC } public readonly ConfigEntry<string> LangUsed; [SyncedEntryField] public readonly SyncedEntry<PermissionLevel> ChutePermission; [SyncedEntryField] public readonly SyncedEntry<bool> RequireInOrbit; [SyncedEntryField] public readonly SyncedEntry<float> TimeToStore; [SyncedEntryField] public readonly SyncedEntry<float> TimeToRetrieve; [SyncedEntryField] public readonly SyncedEntry<int> StopAfter; [SyncedEntryField] public readonly SyncedEntry<string> Blacklist; [SyncedEntryField] public readonly SyncedEntry<PermissionLevel> InventoryPermission; [SyncedEntryField] public readonly SyncedEntry<bool> ActAsSafe; [SyncedEntryField] public readonly SyncedEntry<bool> PersistThroughFire; [SyncedEntryField] public readonly SyncedEntry<int> MaxItemCount; [SyncedEntryField] public readonly SyncedEntry<float> KeepRate; [SyncedEntryField] public readonly SyncedEntry<SortOrder> InventorySortOrder; [SyncedEntryField] public readonly SyncedEntry<bool> KeepRemoveAll; [SyncedEntryField] public readonly SyncedEntry<string> InventoryCommand; [SyncedEntryField] public readonly SyncedEntry<bool> YesPlease; [SyncedEntryField] public readonly SyncedEntry<bool> ShowConfirmation; [SyncedEntryField] public readonly SyncedEntry<bool> ShowTrademark; [SyncedEntryField] public readonly SyncedEntry<float> InventoryRefreshRate; [SyncedEntryField] public readonly SyncedEntry<bool> InventoryUpdateCheckSilencer; [SyncedEntryField] public readonly SyncedEntry<bool> ForceUpdateUponAdding; [SyncedEntryField] public readonly SyncedEntry<bool> ForceUpdateUponRemoving; [SyncedEntryField] public readonly SyncedEntry<bool> ChuteIsUnlock; [SyncedEntryField] public readonly SyncedEntry<int> ChuteUnlockCost; [SyncedEntryField] public readonly SyncedEntry<string> ChuteUnlockName; public Config(ConfigFile cfg) : base("ShipInventory") { //IL_004d: 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_006d: Expected O, but got Unknown //IL_006d: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_009a: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00cb: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_012a: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_015b: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_01cf: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_01fc: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0229: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_025a: Expected O, but got Unknown //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_028b: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Expected O, but got Unknown //IL_02b8: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02e5: Expected O, but got Unknown //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Expected O, but got Unknown //IL_0321: Expected O, but got Unknown //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Expected O, but got Unknown //IL_034e: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_037b: Expected O, but got Unknown //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03a8: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Expected O, but got Unknown //IL_03e4: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Expected O, but got Unknown //IL_0411: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Expected O, but got Unknown //IL_0469: Expected O, but got Unknown //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Expected O, but got Unknown //IL_0496: Expected O, but got Unknown //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Expected O, but got Unknown //IL_04d0: Expected O, but got Unknown //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Expected O, but got Unknown //IL_04ff: Expected O, but got Unknown //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Expected O, but got Unknown //IL_055c: Expected O, but got Unknown LangUsed = cfg.Bind<string>("Language", "Language", "en", (ConfigDescription)null); Lang.LoadLang(LangUsed.Value); string text = Lang.Get("CHUTE_SECTION"); ChutePermission = SyncedBindingExtensions.BindSyncedEntry<PermissionLevel>(cfg, new ConfigDefinition(text, "ChutePermission"), PermissionLevel.EVERYONE, new ConfigDescription(Lang.Get("DESCRIPTION_CHUTE_PERMISSION"), (AcceptableValueBase)null, Array.Empty<object>())); RequireInOrbit = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "ChuteInOrbit"), false, new ConfigDescription(Lang.Get("DESCRIPTION_REQUIRE_IN_ORBIT"), (AcceptableValueBase)null, Array.Empty<object>())); TimeToStore = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, new ConfigDefinition(text, "TimeToStore"), 0.5f, new ConfigDescription(Lang.Get("DESCRIPTION_TIME_TO_STORE"), (AcceptableValueBase)null, Array.Empty<object>())); TimeToRetrieve = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, new ConfigDefinition(text, "ChuteDelay"), 0.5f, new ConfigDescription(Lang.Get("DESCRIPTION_TIME_TO_RETRIEVE"), (AcceptableValueBase)null, Array.Empty<object>())); StopAfter = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, new ConfigDefinition(text, "ChuteMaxCapacity"), 30, new ConfigDescription(Lang.Get("DESCRIPTION_STOP_AFTER"), (AcceptableValueBase)null, Array.Empty<object>())); Blacklist = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, new ConfigDefinition(text, "ChuteBlacklist"), "", new ConfigDescription(Lang.Get("DESCRIPTION_BLACKLIST"), (AcceptableValueBase)null, Array.Empty<object>())); Blacklist.Changed += delegate(object _, SyncedSettingChangedEventArgs<string> e) { ItemManager.UpdateBlacklist(e.NewValue); }; ItemManager.UpdateBlacklist(Blacklist.Value); string text2 = Lang.Get("INVENTORY_SECTION"); InventoryPermission = SyncedBindingExtensions.BindSyncedEntry<PermissionLevel>(cfg, new ConfigDefinition(text2, "InventoryPermission"), PermissionLevel.EVERYONE, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_PERMISSION"), (AcceptableValueBase)null, Array.Empty<object>())); ActAsSafe = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text2, "ChuteSafe"), false, new ConfigDescription(Lang.Get("DESCRIPTION_AS_SAFE"), (AcceptableValueBase)null, Array.Empty<object>())); PersistThroughFire = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text2, "PersistThroughFire"), false, new ConfigDescription(Lang.Get("DESCRIPTION_PERSIST_THROUGH_FIRE"), (AcceptableValueBase)null, Array.Empty<object>())); MaxItemCount = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, new ConfigDefinition(text2, "MaxItemCount"), 5000, new ConfigDescription(Lang.Get("DESCRIPTION_MAX_ITEM_COUNT"), (AcceptableValueBase)null, Array.Empty<object>())); KeepRate = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, new ConfigDefinition(text2, "KeepRate"), 0f, new ConfigDescription(Lang.Get("DESCRIPTION_KEEP_RATE"), (AcceptableValueBase)null, Array.Empty<object>())); InventorySortOrder = SyncedBindingExtensions.BindSyncedEntry<SortOrder>(cfg, new ConfigDefinition(text2, "InventorySortOrder"), SortOrder.NAME_ASC, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_SORT_ORDER"), (AcceptableValueBase)null, Array.Empty<object>())); KeepRemoveAll = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text2, "KeepRemoveAll"), true, new ConfigDescription(Lang.Get("DESCRIPTION_KEEP_REMOVE_ALL"), (AcceptableValueBase)null, Array.Empty<object>())); string text3 = Lang.Get("TERMINAL_SECTION"); InventoryCommand = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, new ConfigDefinition(text3, "InventoryCommand"), "ship", new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_COMMAND"), (AcceptableValueBase)null, Array.Empty<object>())); YesPlease = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text3, "YesPlease"), false, new ConfigDescription(Lang.Get("DESCRIPTION_YES_PLEASE"), (AcceptableValueBase)null, Array.Empty<object>())); ShowConfirmation = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text3, "ShowConfirmation"), true, new ConfigDescription(Lang.Get("DESCRIPTION_SHOW_CONFIRMATION"), (AcceptableValueBase)null, Array.Empty<object>())); ShowTrademark = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text3, "ShowTrademark"), true, new ConfigDescription(Lang.Get("DESCRIPTION_SHOW_TRADEMARK"), (AcceptableValueBase)null, Array.Empty<object>())); string text4 = Lang.Get("NETWORK_SECTION"); InventoryRefreshRate = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, new ConfigDefinition(text4, "InventoryRefreshRate"), 15f, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_REFRESH_RATE"), (AcceptableValueBase)null, Array.Empty<object>())); InventoryUpdateCheckSilencer = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text4, "InventoryUpdateCheckSilencer"), false, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_UPDATE_CHECK_SILENCER"), (AcceptableValueBase)null, Array.Empty<object>())); InventoryUpdateCheckSilencer.Changed += delegate(object _, SyncedSettingChangedEventArgs<bool> e) { if (!e.OldValue && e.NewValue) { Logger.Debug("Inventory Update Check has been silenced."); } }; ForceUpdateUponAdding = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text4, "ForceUpdateUponAdding"), true, new ConfigDescription(Lang.Get("DESCRIPTION_FORCE_UPDATE_UPON_ADDING"), (AcceptableValueBase)null, Array.Empty<object>())); ForceUpdateUponRemoving = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text4, "ForceUpdateUponRemoving"), true, new ConfigDescription(Lang.Get("DESCRIPTION_FORCE_UPDATE_UPON_REMOVING"), (AcceptableValueBase)null, Array.Empty<object>())); string text5 = Lang.Get("UNLOCK_SECTION"); ChuteIsUnlock = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text5, "ChuteIsUnlock"), true, new ConfigDescription(Lang.Get("DESCRIPTION_CHUTE_IS_UNLOCK"), (AcceptableValueBase)null, Array.Empty<object>())); ChuteUnlockCost = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, new ConfigDefinition(text5, "ChuteUnlockCost"), 60, new ConfigDescription(Lang.Get("DESCRIPTION_UNLOCK_COST"), (AcceptableValueBase)null, Array.Empty<object>())); ChuteUnlockCost.Changed += delegate(object _, SyncedSettingChangedEventArgs<int> e) { if (ChuteInteract.UnlockableItem != null) { Unlockables.UpdateUnlockablePrice(ChuteInteract.UnlockableItem, e.NewValue); } }; ChuteUnlockName = SyncedBindingExtensions.BindSyncedEntry<string>(cfg, new ConfigDefinition(text5, "ChuteUnlockName"), "ship inventory", new ConfigDescription(Lang.Get("DESCRIPTION_UNLOCK_NAME"), (AcceptableValueBase)null, Array.Empty<object>())); if (LethalConfigCompatibility.Enabled) { LethalConfigCompatibility.AddConfigs(this); } } } public static class Constants { public const string DROP_NODE_PATH = "DropNode"; public const string STORED_ITEMS = "shipInventoryItems"; public const string BAD_ITEM_KEYS = "shipInventoryMissingKeys"; public const string VENT_PREFAB = "VentChute"; public const string MOD_ICON = "icon"; public const string BUNDLE = "ShipInventory.Resources.si-bundle"; public const string ERROR_ITEM_ASSET = "ErrorItem"; public const string INVENTORY_BUY_TERMINAL_NODE = "InventoryBuy"; public const string LAYER_PROPS = "Props"; public const string LAYER_IGNORE = "Ignore Raycast"; public const string LAYER_INTERACTABLE = "InteractableObject"; public const int ITEMS_PER_PAGE = 10; } [BepInPlugin("ShipInventory", "ShipInventory", "1.2.5")] [BepInDependency("WhiteSpike.InteractiveTerminalAPI", "1.2.0")] [BepInDependency("com.sigurd.csync", "5.0.1")] [BepInDependency("evaisa.lethallib", "0.16.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ShipInventory : BaseUnityPlugin { public static Config Config; private Harmony? _harmony; private void Awake() { Logger.SetLogger(((BaseUnityPlugin)this).Logger); if (!Bundle.LoadBundle("ShipInventory.Resources.si-bundle")) { Logger.Error("Failed to load the bundle. This mod will not continue further."); return; } Config = new Config(((BaseUnityPlugin)this).Config); PrepareNetwork(); PrepareItems(); ApplyPatches(); InteractiveTerminalManager.RegisterApplication<ShipApplication>(Config.InventoryCommand.Value, true); Logger.Info("ShipInventory v1.2.5 has loaded!"); } private void ApplyPatches() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Logger.Debug("Applying patches..."); if (_harmony == null) { _harmony = new Harmony("ShipInventory"); } _harmony.PatchAll(typeof(GameNetworkManager_Patches)); _harmony.PatchAll(typeof(RoundManager_Patches)); _harmony.PatchAll(typeof(StartOfRound_Patches)); _harmony.PatchAll(typeof(NetworkPrefabUtils.GameNetworkManager_Patches)); if (OpenMonitorsCompatibility.Enabled) { OpenMonitorsCompatibility.PatchAll(_harmony); } Logger.Debug("Finished applying patches!"); } private void RemovePatches() { Logger.Debug("Removing patches..."); Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.Debug("Finished removing patches!"); } private static void PrepareNetwork() { Logger.Debug("Prepare RPCs..."); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { 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); } } } Logger.Debug("RPCs prepared!"); Logger.Debug("Registering all prefabs..."); NetworkPrefabUtils.Register("VentChute", LoadVent); Logger.Debug("All prefabs registered!"); } private static void LoadVent(GameObject vent) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006d: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown TerminalNode val = Bundle.LoadAsset<TerminalNode>("InventoryBuy"); if ((Object)(object)val == (Object)null) { throw new NullReferenceException("Could not find the terminal node for the inventory."); } vent.AddComponent<ChuteInteract>(); AutoParentToShip component = vent.GetComponent<AutoParentToShip>(); ChuteInteract.SetOffsets(component); component.overrideOffset = true; UnlockableItem val2 = new UnlockableItem { unlockableName = Config.ChuteUnlockName.Value, prefabObject = vent, unlockableType = 1, shopSelectionNode = null, alwaysInStock = true, IsPlaceable = true, canBeStored = true, maxNumber = 1, spawnPrefab = true }; Unlockables.RegisterUnlockable(val2, (StoreType)1, (TerminalNode)null, (TerminalNode)null, val, Config.ChuteUnlockCost.Value); ChuteInteract.UnlockableItem = val2; } public static void PrepareItems() { Logger.Debug("Preparing items..."); Item val = Bundle.LoadAsset<Item>("ErrorItem"); if ((Object)(object)val != (Object)null) { BadItem badItem = val.spawnPrefab.AddComponent<BadItem>(); ((GrabbableObject)badItem).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterItem(val); ItemData.FALLBACK_ITEM = val; } else { Item[] array = Resources.FindObjectsOfTypeAll<Item>(); ItemData.FALLBACK_ITEM = ((IEnumerable<Item>)array).FirstOrDefault((Func<Item, bool>)((Item i) => i.itemName == "Gold bar")) ?? array[0]; } Logger.Debug("Items prepared!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ShipInventory"; public const string PLUGIN_NAME = "ShipInventory"; public const string PLUGIN_VERSION = "1.2.5"; } } namespace ShipInventory.Patches { [HarmonyPatch(typeof(GameNetworkManager))] public class GameNetworkManager_Patches { [HarmonyPrefix] [HarmonyPatch("SaveItemsInShip")] private static void SaveChuteItems(GameNetworkManager __instance) { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; ES3.DeleteKey("shipGrabbableItemIDs", currentSaveFileName); ES3.DeleteKey("shipGrabbableItemPos", currentSaveFileName); ES3.DeleteKey("shipScrapValues", currentSaveFileName); ES3.DeleteKey("shipItemSaveData", currentSaveFileName); ItemData.SaveStoredItems(currentSaveFileName); BadItem.SaveKeys(currentSaveFileName); } } [HarmonyPatch(typeof(LootMonitor))] public class OpenMonitors_Patches { [HarmonyPostfix] [HarmonyPatch("Calculate")] private static void AddToLootMonitor(ref float __result) { __result += ItemManager.GetTotalValue(onlyScraps: false, onlyFromRound: false); } } [HarmonyPatch(typeof(RoundManager))] public class RoundManager_Patches { [HarmonyPostfix] [HarmonyPatch("DespawnPropsAtEndOfRound")] private static void ClearInventory(RoundManager __instance) { if (!((NetworkBehaviour)__instance).IsServer) { return; } ItemManager.SetAllPersisted(); if (!StartOfRound.Instance.allPlayersDead) { return; } List<ItemData> list = ItemManager.GetItems().ToList(); float num = (ShipInventory.Config.ActAsSafe.Value ? 1f : (ShipInventory.Config.KeepRate.Value / 100f)); for (int num2 = list.Count - 1; num2 >= 0; num2--) { if (Random.value <= num) { list.RemoveAt(num2); } } ItemManager.RemoveItems(list.ToArray()); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRound_Patches { [HarmonyPrefix] [HarmonyPatch("LoadShipGrabbableItems")] private static void LoadStoredItems() { string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName; ItemData.LoadStoredItems(currentSaveFileName); BadItem.LoadKeys(currentSaveFileName); } [HarmonyPostfix] [HarmonyPatch("ResetShip")] private static void ResetInventory() { if (!ShipInventory.Config.PersistThroughFire.Value) { ItemManager.ClearCache(); } } [HarmonyPostfix] [HarmonyPatch("GetValueOfAllScrap")] private static void GetValueOfAllScrap(ref int __result, bool onlyScrapCollected, bool onlyNewScrap) { __result += ItemManager.GetTotalValue(onlyScraps: true, onlyFromRound: true); } [HarmonyPostfix] [HarmonyPatch("LoadUnlockables")] private static void UnlockChute(StartOfRound __instance) { if (SyncedEntry<bool>.op_Implicit(ShipInventory.Config.ChuteIsUnlock)) { return; } int num = -1; for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++) { if (__instance.unlockablesList.unlockables[i] == ChuteInteract.UnlockableItem) { num = i; break; } } if (num == -1) { Logger.Error("Could not find the chute as an unlockable."); } else { __instance.UnlockShipObject(num); } } [HarmonyPostfix] [HarmonyPatch("ResetShip")] private static void UnlockChuteBack(StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsServer) { UnlockChute(__instance); } } } } namespace ShipInventory.Objects { public class BadItem : PhysicsProp { public string? ID; private ItemData? _data; private int _index; private static ItemData[]? _loadedData; public override void Start() { ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).grabbableToEnemies = true; ((GrabbableObject)this).isInFactory = true; ((GrabbableObject)this).Start(); CheckForItem(); } public static ItemData[]? PrepareItems() { BadItem[] array = Object.FindObjectsByType<BadItem>((FindObjectsInactive)0, (FindObjectsSortMode)1); List<ItemData> list = new List<ItemData>(); BadItem[] array2 = array; foreach (BadItem badItem in array2) { if (badItem.ID != null) { badItem._index = list.Count; list.Add(new ItemData((GrabbableObject)(object)badItem) { ID = badItem.ID }); } } return (list.Count == 0) ? null : list.ToArray(); } public override int GetItemDataToSave() { return _index; } public override void LoadItemSaveData(int saveData) { _index = saveData; if (_loadedData != null) { _data = _loadedData[saveData]; ID = _data.Value.ID; } } private void CheckForItem() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!_data.HasValue) { return; } Item item = LethalLibCompatibility.GetItem(_data.Value.ID); if (!((Object)(object)item == (Object)null)) { Logger.Debug("The item '" + ID + "' was found! Replacing the bad item with it..."); GrabbableObject component = Object.Instantiate<GameObject>(item.spawnPrefab, ((Component)this).transform.position, Quaternion.identity, ((Component)this).transform.parent).GetComponent<GrabbableObject>(); component.fallTime = 1f; component.hasHitGround = true; component.scrapPersistedThroughRounds = true; component.isInElevator = true; component.isInShipRoom = true; if (item.isScrap) { component.SetScrapValue(_data.Value.SCRAP_VALUE); } if (item.saveItemVariable) { component.LoadItemSaveData(_data.Value.SAVE_DATA); } ((NetworkBehaviour)component).NetworkObject.Spawn(false); ((NetworkBehaviour)this).NetworkObject.Despawn(true); Logger.Debug("The replacement was spawned and the bad item was despawned!"); } } public static void SaveKeys(string saveFileName) { ItemData[] array = PrepareItems(); if (array == null || array.Length == 0) { ES3.DeleteKey("shipInventoryMissingKeys", saveFileName); Logger.Debug("Bad item keys cleared!"); } else { Logger.Debug("Saving bad item keys..."); ES3.Save<string>("shipInventoryMissingKeys", JsonConvert.SerializeObject((object)array), saveFileName); Logger.Debug($"Successfully saved {array.Length} keys!"); } } public static void LoadKeys(string saveFileName) { _loadedData = null; if (!ES3.KeyExists("shipInventoryMissingKeys", saveFileName)) { Logger.Debug("No bad item keys found."); return; } Logger.Debug("Loading bad item keys..."); string text = ES3.Load<string>("shipInventoryMissingKeys", saveFileName); ItemData[] array = JsonConvert.DeserializeObject<ItemData[]>(text); if (array == null) { Logger.Error("Could not load the bad item keys from the save file."); return; } _loadedData = array; Logger.Debug($"Successfully loaded {array.Length} keys!"); } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "BadItem"; } } public class ChuteInteract : NetworkBehaviour { public static ChuteInteract? Instance; private Transform itemRestorePoint = null; private ParticleSystem? spawnParticles; private readonly Queue<ItemData> spawnQueue = new Queue<ItemData>(); private Coroutine? spawnCoroutine; private string? updateKey; private Collider[] itemsInChute = Array.Empty<Collider>(); private InteractTrigger _trigger = null; public static UnlockableItem? UnlockableItem; private Coroutine? updateCoroutine; private int LAYER_IGNORE = -1; private int LAYER_INTERACTABLE = -1; private int LAYER_PROPS = -1; private void StoreHeldItem(PlayerControllerB player) { GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer; if (currentlyHeldObjectServer == null) { Logger.Info("Player '" + player.playerUsername + "' is not holding any item."); return; } StoreItem(currentlyHeldObjectServer); currentlyHeldObjectServer.isInShipRoom = false; currentlyHeldObjectServer.scrapPersistedThroughRounds = true; player.SetItemInElevator(true, true, currentlyHeldObjectServer); Logger.Debug("Despawn held object..."); player.DestroyItemInSlotAndSync(player.currentItemSlot); } private void StoreItem(GrabbableObject item) { ItemData[] items = ConvertItemHelper.ConvertItem(item); StoreItems(items); } public void StoreItems(params ItemData[] items) { Logger.Debug($"Sending {items.Length} new items..."); StoreItemsServerRpc(items, GetClientID()); if (OpenMonitorsCompatibility.Enabled) { OpenMonitorsCompatibility.UpdateMonitor(); } } public void RetrieveItems(params ItemData[] items) { RetrieveItemsServerRpc(items, GetClientID()); } private IEnumerator SpawnCoroutine() { while (spawnQueue.Count > 0) { if (itemsInChute.Length >= ShipInventory.Config.StopAfter.Value) { yield return (object)new WaitForEndOfFrame(); continue; } ItemData data = spawnQueue.Dequeue(); NetworkObject obj = SpawnItemServer(data); if ((Object)(object)obj != (Object)null) { SpawnItemClientRpc(NetworkObjectReference.op_Implicit(obj), data); } yield return (object)new WaitForSeconds(ShipInventory.Config.TimeToRetrieve.Value); } spawnCoroutine = null; } private NetworkObject? SpawnItemServer(ItemData data) { Item item = data.GetItem(); if ((Object)(object)item == (Object)null) { Logger.Debug("Tried to spawn '" + data.ID + "', but no item could have been found for it."); return null; } if ((Object)(object)item.spawnPrefab == (Object)null) { Logger.Debug("Cannot spawn '" + data.ID + "', because no prefab is assigned to it."); return null; } GameObject val = Object.Instantiate<GameObject>(item.spawnPrefab, itemRestorePoint, false); if ((Object)(object)val == (Object)null) { return null; } NetworkBehaviour val2 = default(NetworkBehaviour); if (!val.TryGetComponent<NetworkBehaviour>(ref val2)) { return null; } NetworkObject networkObject = val2.NetworkObject; networkObject.Spawn(false); return networkObject; } [ClientRpc] private void SpawnItemClientRpc(NetworkObjectReference networkObject, ItemData data) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2565643691u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObject, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<ItemData>(ref data, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2565643691u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref networkObject)).TryGet(ref val3, (NetworkManager)null)) { return; } ((Component)val3).transform.SetParent(itemRestorePoint, false); ((Component)val3).transform.position = itemRestorePoint.position; ((Component)val3).transform.rotation = itemRestorePoint.rotation; GrabbableObject val4 = default(GrabbableObject); if (((Component)val3).TryGetComponent<GrabbableObject>(ref val4)) { if (val4.itemProperties.itemSpawnsOnGround) { ((Component)val3).transform.localRotation = Quaternion.Euler(val4.itemProperties.restingRotation); } else { val4.OnHitGround(); } val4.scrapPersistedThroughRounds = data.PERSISTED_THROUGH_ROUNDS; if (val4 is BadItem badItem) { badItem.ID = data.ID; } Item item = data.GetItem(); if (item.isScrap) { val4.SetScrapValue(data.SCRAP_VALUE); } if (item.saveItemVariable) { val4.LoadItemSaveData(data.SAVE_DATA); } val4.isInShipRoom = true; val4.isInElevator = true; ((MonoBehaviour)val4).StartCoroutine(PlayDropSound(val4)); ParticleSystem? obj = spawnParticles; if (obj != null) { obj.Play(); } } } private static IEnumerator PlayDropSound(GrabbableObject grabbable) { yield return null; yield return null; grabbable.PlayDropSFX(); grabbable.OnHitGround(); } [ServerRpc(RequireOwnership = false)] private void CheckInventoryServerRpc(string? _updateKey, string? key, params ulong[] ids) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0088: 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_0185: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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) //IL_0143: 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_012e: 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(151875304u, val, (RpcDelivery)0); bool flag = _updateKey != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(_updateKey, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(key, false); } bool flag3 = ids != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ids, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 151875304u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams routing = default(ClientRpcParams); routing.Send.TargetClientIds = ids; string key2 = ItemManager.GetKey(); if (key2 != key) { UpdateInventoryClientRpc(_updateKey, key2, ItemManager.GetItems(), routing); } else { InventoryUpToDateClientRpc(_updateKey, routing); } } } [ServerRpc(RequireOwnership = false)] private void StoreItemsServerRpc(ItemData[] items, params ulong[] ids) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0088: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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(1862908525u, val, (RpcDelivery)0); bool flag = items != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<ItemData>(items, default(ForNetworkSerializable)); } bool flag2 = ids != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ids, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1862908525u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Logger.Debug($"Adding {items.Length} new items..."); ItemManager.AddItems(items); Logger.Debug("The inventory has been updated: '" + ItemManager.GetKey() + "'."); if (ShipInventory.Config.ForceUpdateUponAdding.Value) { ForceUpdateClientRpc(new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = ids } }); } } } [ServerRpc(RequireOwnership = false)] private void RetrieveItemsServerRpc(ItemData[] items, params ulong[] ids) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0088: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: 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(208058828u, val, (RpcDelivery)0); bool flag = items != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<ItemData>(items, default(ForNetworkSerializable)); } bool flag2 = ids != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(ids, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 208058828u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ItemData[] array = ItemManager.FilterExtras(items); if (array.Length != items.Length) { Logger.Debug("Tried to retrieve an item that is not in the inventory anymore."); } if (array.Length != 0) { Logger.Debug($"Removing '{array.Length}' items..."); ItemManager.RemoveItems(array); ItemData[] array2 = array; foreach (ItemData item in array2) { spawnQueue.Enqueue(item); } if (spawnCoroutine == null) { spawnCoroutine = ((MonoBehaviour)this).StartCoroutine(SpawnCoroutine()); } Logger.Debug($"{array.Length} items enqueued!"); if (ShipInventory.Config.ForceUpdateUponRemoving.Value) { ForceUpdateClientRpc(new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = ids } }); } } } private static ulong GetClientID(PlayerControllerB? player = null) { return (player ?? GameNetworkManager.Instance.localPlayerController).actualClientId; } [ClientRpc] private void UpdateInventoryClientRpc(string? _updateKey, string? key, ItemData[] data, ClientRpcParams routing = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0088: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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) //IL_0143: 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_012e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2064218959u, routing, (RpcDelivery)0); bool flag = _updateKey != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(_updateKey, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(key, false); } bool flag3 = data != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe<ItemData>(data, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2064218959u, routing, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (updateKey != _updateKey) { Logger.Debug("Received an update that was not the one expected."); return; } Logger.Debug("Updating the cache with: '" + (key ?? "null") + "'"); ItemManager.UpdateCache(key, data.ToList()); Logger.Debug("Cached updated!"); updateKey = null; } } [ClientRpc] private void InventoryUpToDateClientRpc(string? _updateKey, ClientRpcParams routing = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0088: 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_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3035705154u, routing, (RpcDelivery)0); bool flag = _updateKey != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(_updateKey, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3035705154u, routing, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if (updateKey != _updateKey) { Logger.Debug("Received an inventory check that was not the one expected."); return; } updateKey = null; if (!ShipInventory.Config.InventoryUpdateCheckSilencer.Value) { Logger.Debug("The inventory is up to date! (" + ItemManager.GetKey() + ")"); } } [ClientRpc] private void ForceUpdateClientRpc(ClientRpcParams routing = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1540314797u, routing, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1540314797u, routing, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { StartNewCheck(); } } } private void UpdateTrigger() { //IL_0079: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_trigger) && GameNetworkManager.Instance != null && NetworkManager.Singleton != null) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController != null && localPlayerController.isInHangarShipRoom) { _trigger.UpdateChuteTrigger(localPlayerController); itemsInChute = Physics.OverlapBox(itemRestorePoint.position, new Vector3(1f, 0.25f, 1.25f) / 2f, itemRestorePoint.rotation, 1 << LAYER_PROPS); ((Component)this).gameObject.layer = ((itemsInChute.Length != 0) ? LAYER_IGNORE : LAYER_INTERACTABLE); } } } public static void SetOffsets(AutoParentToShip autoParent) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) autoParent.positionOffset = new Vector3(1.9f, 1f, -4.5f); autoParent.rotationOffset = new Vector3(35f, 0f, 0f); } private void StartNewCheck() { if (updateCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(updateCoroutine); updateCoroutine = null; } updateCoroutine = ((MonoBehaviour)this).StartCoroutine(UpdateInventory()); } private IEnumerator UpdateInventory() { PlayerControllerB player; do { player = GameNetworkManager.Instance?.localPlayerController; yield return null; } while ((Object)(object)player == (Object)null); if (((NetworkBehaviour)player).IsHost) { yield break; } while (true) { updateKey = Guid.NewGuid().ToString(); CheckInventoryServerRpc(updateKey, ItemManager.GetKey(), GetClientID(player)); yield return (object)new WaitForSeconds(ShipInventory.Config.InventoryRefreshRate.Value); } } private void Start() { LAYER_IGNORE = LayerMask.NameToLayer("Ignore Raycast"); LAYER_INTERACTABLE = LayerMask.NameToLayer("InteractableObject"); LAYER_PROPS = LayerMask.NameToLayer("Props"); _trigger = ((Component)this).GetComponent<InteractTrigger>(); ((UnityEvent<PlayerControllerB>)(object)_trigger.onInteract).AddListener((UnityAction<PlayerControllerB>)StoreHeldItem); _trigger.timeToHold = ShipInventory.Config.TimeToStore.Value; itemRestorePoint = ((Component)this).transform.Find("DropNode"); spawnParticles = ((Component)this).GetComponentInChildren<ParticleSystem>(); Instance = this; StartNewCheck(); } private void Update() { UpdateTrigger(); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); Instance = null; if (StartOfRound.Instance.firingPlayersCutsceneRunning && !ShipInventory.Config.PersistThroughFire.Value) { Logger.Debug("Clearing cache from fire!"); ItemManager.ClearCache(); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ChuteInteract() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2565643691u, new RpcReceiveHandler(__rpc_handler_2565643691)); NetworkManager.__rpc_func_table.Add(151875304u, new RpcReceiveHandler(__rpc_handler_151875304)); NetworkManager.__rpc_func_table.Add(1862908525u, new RpcReceiveHandler(__rpc_handler_1862908525)); NetworkManager.__rpc_func_table.Add(208058828u, new RpcReceiveHandler(__rpc_handler_208058828)); NetworkManager.__rpc_func_table.Add(2064218959u, new RpcReceiveHandler(__rpc_handler_2064218959)); NetworkManager.__rpc_func_table.Add(3035705154u, new RpcReceiveHandler(__rpc_handler_3035705154)); NetworkManager.__rpc_func_table.Add(1540314797u, new RpcReceiveHandler(__rpc_handler_1540314797)); } private static void __rpc_handler_2565643691(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObject = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObject, default(ForNetworkSerializable)); ItemData data = default(ItemData); ((FastBufferReader)(ref reader)).ReadValueSafe<ItemData>(ref data, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((ChuteInteract)(object)target).SpawnItemClientRpc(networkObject, data); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_151875304(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_0067: 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_009f: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string text = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string key = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives)); ulong[] ids = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref ids, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ChuteInteract)(object)target).CheckInventoryServerRpc(text, key, ids); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1862908525(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_0074: 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_0058: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); ItemData[] items = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<ItemData>(ref items, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); ulong[] ids = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref ids, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ChuteInteract)(object)target).StoreItemsServerRpc(items, ids); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_208058828(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_0074: 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_0058: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); ItemData[] items = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<ItemData>(ref items, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); ulong[] ids = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref ids, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ChuteInteract)(object)target).RetrieveItemsServerRpc(items, ids); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2064218959(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_0067: 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_009f: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string text = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string key = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives)); ItemData[] data = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe<ItemData>(ref data, default(ForNetworkSerializable)); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((ChuteInteract)(object)target).UpdateInventoryClientRpc(text, key, data, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3035705154(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_005b: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string text = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((ChuteInteract)(object)target).InventoryUpToDateClientRpc(text, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1540314797(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((ChuteInteract)(object)target).ForceUpdateClientRpc(client); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ChuteInteract"; } } [Serializable] public struct ItemData : INetworkSerializable { public static Item FALLBACK_ITEM; public string ID; public int SCRAP_VALUE; public int SAVE_DATA; public bool PERSISTED_THROUGH_ROUNDS; public ItemData(GrabbableObject item) { SCRAP_VALUE = 0; SAVE_DATA = 0; ID = LethalLibCompatibility.GetID(item.itemProperties); if (item.itemProperties.isScrap) { SCRAP_VALUE = item.scrapValue; } if (item.itemProperties.saveItemVariable) { SAVE_DATA = item.GetItemDataToSave(); } PERSISTED_THROUGH_ROUNDS = item.scrapPersistedThroughRounds; } public Item GetItem() { return LethalLibCompatibility.GetItem(ID) ?? FALLBACK_ITEM; } public string GetItemName() { return GetItem().itemName; } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_001a: 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_0031: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) serializer.SerializeValue(ref ID, false); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref SCRAP_VALUE, default(ForPrimitives)); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref SAVE_DATA, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref PERSISTED_THROUGH_ROUNDS, default(ForPrimitives)); } public static void SaveStoredItems(string saveFileName) { if (!ItemManager.HasItems()) { ES3.DeleteKey("shipInventoryItems", saveFileName); Logger.Debug("Stored items cleared!"); return; } ItemData[] items = ItemManager.GetItems(); Logger.Debug("Saving stored items..."); ES3.Save<string>("shipInventoryItems", JsonConvert.SerializeObject((object)items), saveFileName); Logger.Debug($"Successfully saved {ItemManager.GetCount()} items!"); } public static void LoadStoredItems(string saveFileName) { ItemManager.ClearCache(); if (!ES3.KeyExists("shipInventoryItems", saveFileName)) { Logger.Debug("No items found."); return; } Logger.Debug("Loading stored items..."); string text = ES3.Load<string>("shipInventoryItems", saveFileName); IEnumerable<ItemData> enumerable = JsonConvert.DeserializeObject<IEnumerable<ItemData>>(text); if (enumerable == null) { Logger.Error("Could not load items from the save file."); return; } ItemManager.AddItems(enumerable.ToArray()); Logger.Debug("Loaded stored items!"); } } } namespace ShipInventory.Helpers { internal static class Bundle { private static AssetBundle? loadedBundle; public static bool LoadBundle(string name) { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); if (manifestResourceStream == null) { Logger.Error("No bundle named '" + name + "'."); return false; } loadedBundle = AssetBundle.LoadFromStream(manifestResourceStream); if ((Object)(object)loadedBundle == (Object)null) { Logger.Error("Failed to load custom assets."); return false; } return true; } public static T? LoadAsset<T>(string name) where T : Object { if ((Object)(object)loadedBundle == (Object)null) { Logger.Error("Tried to load asset from unloaded bundle."); return default(T); } T val = loadedBundle.LoadAsset<T>(name); if ((Object)(object)val == (Object)null) { Logger.Error("No asset named '" + name + "' was found."); } return val; } } public static class ConvertItemHelper { private static readonly List<Func<GrabbableObject, ItemData[]?>> conversions; static ConvertItemHelper() { conversions = new List<Func<GrabbableObject, ItemData[]>>(); AddConversion(CustomItemBehaviourLibraryCompatibility.ConvertContainer); AddConversion(BeltBagConversion); AddConversion(NormalConversion, appendToStart: false); } public static ItemData[] ConvertItem(GrabbableObject item) { ItemData[] array = null; foreach (Func<GrabbableObject, ItemData[]> conversion in conversions) { if (conversion != null) { array = conversion(item); if (array != null) { break; } } } return array ?? Array.Empty<ItemData>(); } public static void AddConversion(Func<GrabbableObject, ItemData[]?> conversion, bool appendToStart = true) { int index = ((!appendToStart) ? conversions.Count : 0); conversions.Insert(index, conversion); } private static ItemData[]? BeltBagConversion(GrabbableObject item) { BeltBagItem val = (BeltBagItem)(object)((item is BeltBagItem) ? item : null); if (val == null) { return null; } List<ItemData> list = new List<ItemData>(); for (int num = val.objectsInBag.Count - 1; num >= 0; num--) { GrabbableObject val2 = val.objectsInBag[num]; if (!((Object)(object)val2 == (Object)null)) { list.AddRange(ConvertItem(val2)); } } list.Add(new ItemData((GrabbableObject)(object)val)); return list.ToArray(); } private static ItemData[] NormalConversion(GrabbableObject item) { return new ItemData[1] { new ItemData(item) }; } } public static class InteractionHelper { private static readonly List<(Func<PlayerControllerB, bool>, string)> triggerConditions; static InteractionHelper() { triggerConditions = new List<(Func<PlayerControllerB, bool>, string)>(); AddCondition(IsHoldingObject, Lang.Get("NOT_HOLDING_ITEM")); AddCondition(HasPermission, Lang.Get("CHUTE_PERMISSION_MISSING")); AddCondition(RequireInOrbit, Lang.Get("NOT_IN_ORBIT")); AddCondition(HasFreeSpace, Lang.Get("INVENTORY_FULL")); AddCondition(IsAllowed, Lang.Get("ITEM_BLACKLISTED")); AddCondition(IsValid, Lang.Get("ITEM_NOT_ALLOWED")); } public static void UpdateChuteTrigger(this InteractTrigger trigger, PlayerControllerB local) { foreach (var (func, disabledHoverTip) in triggerConditions) { if (func(local)) { continue; } trigger.interactable = false; trigger.disabledHoverTip = disabledHoverTip; return; } trigger.interactable = true; trigger.disabledHoverTip = ""; } public static void AddCondition(Func<PlayerControllerB, bool> condition, string error, bool appendToStart = false) { int index = ((!appendToStart) ? triggerConditions.Count : 0); triggerConditions.Insert(index, (condition, error)); } private static bool IsHoldingObject(PlayerControllerB p) { return p.isHoldingObject && (Object)(object)p.currentlyHeldObjectServer != (Object)null; } private static bool HasPermission(PlayerControllerB p) { switch (ShipInventory.Config.ChutePermission.Value) { case Config.PermissionLevel.HOST_ONLY: if (((NetworkBehaviour)p).IsHost) { break; } goto case Config.PermissionLevel.NO_ONE; case Config.PermissionLevel.CLIENTS_ONLY: if (!((NetworkBehaviour)p).IsHost) { break; } goto case Config.PermissionLevel.NO_ONE; case Config.PermissionLevel.NO_ONE: return false; } return true; } private static bool RequireInOrbit(PlayerControllerB p) { return !ShipInventory.Config.RequireInOrbit.Value || StartOfRound.Instance.inShipPhase; } private static bool HasFreeSpace(PlayerControllerB p) { return ItemManager.GetCount() < ShipInventory.Config.MaxItemCount.Value; } private static bool IsAllowed(PlayerControllerB p) { return !ItemManager.IsBlacklisted(p.currentlyHeldObjectServer.itemProperties); } private static bool IsValid(PlayerControllerB p) { GrabbableObject currentlyHeldObjectServer = p.currentlyHeldObjectServer; if (currentlyHeldObjectServer.itemUsedUp) { return false; } Item itemProperties = currentlyHeldObjectServer.itemProperties; if ((Object)(object)itemProperties.spawnPrefab == (Object)null) { return false; } RagdollGrabbableObject val = default(RagdollGrabbableObject); if (itemProperties.spawnPrefab.TryGetComponent<RagdollGrabbableObject>(ref val)) { return false; } return true; } } public static class ItemManager { private static List<ItemData> cachedItems = new List<ItemData>(); private static string? cacheKey; private static readonly HashSet<string> BLACKLIST = new HashSet<string>(); public static IEnumerable<ItemData> GetInstances(ItemData data, int count) { if (count == 1) { return cachedItems.Where((ItemData d) => d.Equals(data)).Take(1); } return cachedItems.Where((ItemData d) => d.ID == data.ID).Take(count); } public static ItemData[] GetItems() { return cachedItems.ToArray(); } internal static void UpdateCache(string? key, List<ItemData> items) { cacheKey = key; cachedItems = items; } internal static void ClearCache() { UpdateCache(null, new List<ItemData>()); } internal static ItemData[] FilterExtras(params ItemData[] items) { return items.Where((ItemData item) => cachedItems.Contains(item)).ToArray(); } internal static void AddItems(params ItemData[] items) { cachedItems.AddRange(items); NewKey(); } internal static void RemoveItems(params ItemData[] items) { foreach (ItemData item in items) { cachedItems.Remove(item); } NewKey(); } internal static void SetAllPersisted() { for (int i = 0; i < cachedItems.Count; i++) { ItemData value = cachedItems[i]; value.PERSISTED_THROUGH_ROUNDS = true; cachedItems[i] = value; } NewKey(); } public static int GetCount() { return cachedItems.Count; } public static bool HasItems() { return cachedItems.Count > 0; } public static int GetTotalValue(bool onlyScraps, bool onlyFromRound) { int num = 0; foreach (ItemData cachedItem in cachedItems) { if (!onlyFromRound || !cachedItem.PERSISTED_THROUGH_ROUNDS) { Item item = cachedItem.GetItem(); if (!((Object)(object)item == (Object)null) && (!onlyScraps || item.isScrap)) { num += cachedItem.SCRAP_VALUE; } } } return num; } public static string? GetKey() { return cacheKey; } private static void NewKey() { cacheKey = Guid.NewGuid().ToString(); } internal static void UpdateBlacklist(string blacklistString) { BLACKLIST.Clear(); string[] array = blacklistString.Split(',', StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { if (text != null) { BLACKLIST.Add("^" + text.Trim().ToLower() + "$"); } } } public static bool IsBlacklisted(Item item) { string name = item.itemName.ToLower(); return BLACKLIST.Any((string s) => Regex.IsMatch(name, s)); } } internal static class Lang { public const string DEFAULT_LANG = "en"; private static readonly Dictionary<string, string> tokens = new Dictionary<string, string>(); public static bool LoadLang(string lang) { string codeBase = Assembly.GetExecutingAssembly().CodeBase; UriBuilder uriBuilder = new UriBuilder(codeBase); string directoryName = Path.GetDirectoryName(Uri.UnescapeDataString(uriBuilder.Path)); if (directoryName == null) { return false; } string text = Path.Combine(directoryName, "lang-" + lang + ".json"); if (!File.Exists(text)) { Logger.Error("Could not find the file '" + text + "'."); return lang != "en" && LoadLang("en"); } JObject val = JObject.Parse(File.ReadAllText(text)); tokens.Clear(); foreach (var (text3, val3) in val) { tokens[text3] = ((object)val3)?.ToString() ?? text3; } Logger.Info("Language '" + lang + "' loaded!"); return true; } public static string Get(string id) { return tokens.GetValueOrDefault(id, id); } } internal static class Logger { private static ManualLogSource? log; public static void SetLogger(ManualLogSource logSource) { log = logSource; } private static void Log(LogLevel level, object? content) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ManualLogSource? obj = log; if (obj != null) { obj.Log(level, content ?? "null"); } } public static void Info(object? content) { Log((LogLevel)16, content); } public static void Debug(object? content) { Log((LogLevel)32, content); } public static void Error(object? content) { Log((LogLevel)2, content); } } internal static class NetworkPrefabUtils { private class PrefabData { public Action<GameObject>? onLoad; } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManager_Patches { [HarmonyPostfix] [HarmonyPatch("Start")] private static void AddPrefabsToNetwork(GameNetworkManager __instance) { foreach (var (name, data) in prefabs) { AddToNetwork(name, data); } } } private static readonly Dictionary<string, PrefabData> prefabs = new Dictionary<string, PrefabData>(); public static void Register(string name, Action<GameObject>? onLoad = null) { if (prefabs.ContainsKey(name)) { Logger.Error("Tried to register multiple prefabs with the name '" + name + "'."); return; } prefabs.Add(name, new PrefabData { onLoad = onLoad }); } private static void AddToNetwork(string name, PrefabData data) { GameObject val = Bundle.LoadAsset<GameObject>(name); if (val != null) { data.onLoad?.Invoke(val); NetworkManager.Singleton.AddNetworkPrefab(val); } } } } namespace ShipInventory.Compatibility { public static class CustomItemBehaviourLibraryCompatibility { public const string CUSTOM_ITEM_BEHAVIOUR_LIBRARY = "com.github.WhiteSpike.CustomItemBehaviourLibrary"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.github.WhiteSpike.CustomItemBehaviourLibrary"); _enabled = valueOrDefault; } return _enabled.Value; } } public static ItemData[]? ConvertContainer(GrabbableObject item) { return Enabled ? HandleContainer(item) : null; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static ItemData[]? HandleContainer(GrabbableObject item) { ContainerBehaviour val = (ContainerBehaviour)(object)((item is ContainerBehaviour) ? item : null); if (val == null) { return null; } ((Behaviour)val).enabled = false; List<ItemData> list = new List<ItemData>(); GrabbableObject[] componentsInChildren = ((Component)val).GetComponentsInChildren<GrabbableObject>(); for (int num = componentsInChildren.Length - 1; num >= 0; num--) { GrabbableObject val2 = componentsInChildren[num]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)val)) { list.AddRange(ConvertItemHelper.ConvertItem(val2)); } } list.Add(new ItemData((GrabbableObject)(object)val)); return list.ToArray(); } } public static class LethalConfigCompatibility { public const string LETHAL_CONFIG = "ainavt.lc.lethalconfig"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigs(Config config) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_004a: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008f: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00fc: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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 //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Expected O, but got Unknown //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Expected O, but got Unknown //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Expected O, but got Unknown //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Expected O, but got Unknown //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Expected O, but got Unknown //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Expected O, but got Unknown //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Expected O, but got Unknown //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Expected O, but got Unknown //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Expected O, but got Unknown //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Expected O, but got Unknown //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Expected O, but got Unknown //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Expected O, but got Unknown //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Expected O, but got Unknown //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Expected O, but got Unknown //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Expected O, but got Unknown //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Expected O, but got Unknown //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Expected O, but got Unknown //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Expected O, but got Unknown //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Expected O, but got Unknown //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Expected O, but got Unknown LethalConfigManager.SetModIcon(Bundle.LoadAsset<Sprite>("icon")); LethalConfigManager.SetModDescription("Adds an inventory to the ship, allowing it to store items and retrieve them."); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<Config.PermissionLevel>(config.ChutePermission.Entry, new EnumDropDownOptions { Name = Lang.Get("NAME_CHUTE_PERMISSION"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.RequireInOrbit.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_REQU