Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ShipInventory v1.2.6
WarperSan-ShipInventory/ShipInventory.dll
Decompiled a year 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.Extensions; using ShipInventory.Helpers; using ShipInventory.Items; 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.6.0")] [assembly: AssemblyInformationalVersion("1.2.6+c9d7a1386cf9f5a8695d0f2db11a0b82554d2328")] [assembly: AssemblyProduct("ShipInventory")] [assembly: AssemblyTitle("ShipInventory")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.6.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 Configuration : SyncedConfig2<Configuration> { 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 SyncedEntry<PermissionLevel> ChutePermission; [SyncedEntryField] public SyncedEntry<bool> RequireInOrbit; [SyncedEntryField] public SyncedEntry<float> TimeToStore; [SyncedEntryField] public SyncedEntry<float> TimeToRetrieve; [SyncedEntryField] public SyncedEntry<int> StopAfter; [SyncedEntryField] public SyncedEntry<string> Blacklist; [SyncedEntryField] public SyncedEntry<PermissionLevel> InventoryPermission; [SyncedEntryField] public SyncedEntry<bool> ActAsSafe; [SyncedEntryField] public SyncedEntry<bool> PersistThroughFire; [SyncedEntryField] public SyncedEntry<int> MaxItemCount; [SyncedEntryField] public SyncedEntry<float> KeepRate; public ConfigEntry<SortOrder> InventorySortOrder; [SyncedEntryField] public SyncedEntry<bool> KeepRemoveAll; public ConfigEntry<string> InventoryCommand; public ConfigEntry<bool> YesPlease; public ConfigEntry<bool> ShowConfirmation; public ConfigEntry<bool> ShowTrademark; [SyncedEntryField] public SyncedEntry<float> InventoryRefreshRate; [SyncedEntryField] public SyncedEntry<bool> InventoryUpdateCheckSilencer; [SyncedEntryField] public SyncedEntry<bool> ForceUpdateUponAdding; [SyncedEntryField] public SyncedEntry<bool> ForceUpdateUponRemoving; [SyncedEntryField] public SyncedEntry<bool> ChuteIsUnlock; [SyncedEntryField] public SyncedEntry<int> ChuteUnlockCost; [SyncedEntryField] public SyncedEntry<string> ChuteUnlockName; public Configuration(ConfigFile cfg) : base("ShipInventory") { LangUsed = cfg.Bind<string>("Language", "Language", "en", (ConfigDescription)null); Lang.LoadLang(LangUsed.Value); LoadChuteConfig(cfg); LoadInventoryConfig(cfg); LoadTerminalConfig(cfg); LoadNetworkConfig(cfg); LoadUnlockConfig(cfg); if (LethalConfig.Enabled) { LethalConfig.AddConfigs(this); } } private void LoadChuteConfig(ConfigFile cfg) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0061: Expected O, but got Unknown //IL_006e: 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_0092: Expected O, but got Unknown //IL_0092: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00c3: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f1: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_0122: Expected O, but got Unknown 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); } private void LoadInventoryConfig(ConfigFile cfg) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0061: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_008e: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00bf: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f0: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_011d: Expected O, but got Unknown //IL_012a: 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_014a: Expected O, but got Unknown //IL_014a: Expected O, but got Unknown string text = Lang.Get("INVENTORY_SECTION"); InventoryPermission = SyncedBindingExtensions.BindSyncedEntry<PermissionLevel>(cfg, new ConfigDefinition(text, "InventoryPermission"), PermissionLevel.EVERYONE, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_PERMISSION"), (AcceptableValueBase)null, Array.Empty<object>())); ActAsSafe = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "ChuteSafe"), false, new ConfigDescription(Lang.Get("DESCRIPTION_AS_SAFE"), (AcceptableValueBase)null, Array.Empty<object>())); PersistThroughFire = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "PersistThroughFire"), false, new ConfigDescription(Lang.Get("DESCRIPTION_PERSIST_THROUGH_FIRE"), (AcceptableValueBase)null, Array.Empty<object>())); MaxItemCount = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, new ConfigDefinition(text, "MaxItemCount"), 5000, new ConfigDescription(Lang.Get("DESCRIPTION_MAX_ITEM_COUNT"), (AcceptableValueBase)null, Array.Empty<object>())); KeepRate = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, new ConfigDefinition(text, "KeepRate"), 0f, new ConfigDescription(Lang.Get("DESCRIPTION_KEEP_RATE"), (AcceptableValueBase)null, Array.Empty<object>())); InventorySortOrder = cfg.Bind<SortOrder>(new ConfigDefinition(text, "InventorySortOrder"), SortOrder.NAME_ASC, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_SORT_ORDER"), (AcceptableValueBase)null, Array.Empty<object>())); KeepRemoveAll = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "KeepRemoveAll"), true, new ConfigDescription(Lang.Get("DESCRIPTION_KEEP_REMOVE_ALL"), (AcceptableValueBase)null, Array.Empty<object>())); } private void LoadTerminalConfig(ConfigFile cfg) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0045: 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_0065: Expected O, but got Unknown //IL_0065: Expected O, but got Unknown //IL_0072: 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_0092: Expected O, but got Unknown //IL_0092: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00bf: Expected O, but got Unknown string text = Lang.Get("TERMINAL_SECTION"); InventoryCommand = cfg.Bind<string>(new ConfigDefinition(text, "InventoryCommand"), "ship", new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_COMMAND"), (AcceptableValueBase)null, Array.Empty<object>())); YesPlease = cfg.Bind<bool>(new ConfigDefinition(text, "YesPlease"), false, new ConfigDescription(Lang.Get("DESCRIPTION_YES_PLEASE"), (AcceptableValueBase)null, Array.Empty<object>())); ShowConfirmation = cfg.Bind<bool>(new ConfigDefinition(text, "ShowConfirmation"), true, new ConfigDescription(Lang.Get("DESCRIPTION_SHOW_CONFIRMATION"), (AcceptableValueBase)null, Array.Empty<object>())); ShowTrademark = cfg.Bind<bool>(new ConfigDefinition(text, "ShowTrademark"), true, new ConfigDescription(Lang.Get("DESCRIPTION_SHOW_TRADEMARK"), (AcceptableValueBase)null, Array.Empty<object>())); } private void LoadNetworkConfig(ConfigFile cfg) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Expected O, but got Unknown //IL_0045: 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_0065: Expected O, but got Unknown //IL_0065: Expected O, but got Unknown //IL_009d: 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_00bd: Expected O, but got Unknown //IL_00bd: Expected O, but got Unknown //IL_00ca: 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_00ea: Expected O, but got Unknown //IL_00ea: Expected O, but got Unknown string text = Lang.Get("NETWORK_SECTION"); InventoryRefreshRate = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, new ConfigDefinition(text, "InventoryRefreshRate"), 15f, new ConfigDescription(Lang.Get("DESCRIPTION_INVENTORY_REFRESH_RATE"), (AcceptableValueBase)null, Array.Empty<object>())); InventoryUpdateCheckSilencer = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "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(text, "ForceUpdateUponAdding"), true, new ConfigDescription(Lang.Get("DESCRIPTION_FORCE_UPDATE_UPON_ADDING"), (AcceptableValueBase)null, Array.Empty<object>())); ForceUpdateUponRemoving = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "ForceUpdateUponRemoving"), true, new ConfigDescription(Lang.Get("DESCRIPTION_FORCE_UPDATE_UPON_REMOVING"), (AcceptableValueBase)null, Array.Empty<object>())); } private void LoadUnlockConfig(ConfigFile cfg) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Expected O, but got Unknown //IL_0041: 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_0062: Expected O, but got Unknown //IL_0062: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00be: Expected O, but got Unknown string text = Lang.Get("UNLOCK_SECTION"); ChuteIsUnlock = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, new ConfigDefinition(text, "ChuteIsUnlock"), true, new ConfigDescription(Lang.Get("DESCRIPTION_CHUTE_IS_UNLOCK"), (AcceptableValueBase)null, Array.Empty<object>())); ChuteUnlockCost = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, new ConfigDefinition(text, "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(text, "ChuteUnlockName"), "ship inventory", new ConfigDescription(Lang.Get("DESCRIPTION_UNLOCK_NAME"), (AcceptableValueBase)null, Array.Empty<object>())); } } 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 CHUTE_PREFAB = "ChutePrefab"; public const string MOD_ICON = "icon"; public const string ERROR_ITEM_ASSET = "ErrorItem"; public const string INVENTORY_BUY_TERMINAL_NODE = "InventoryBuy"; public const string BUNDLE_MAIN = "ShipInventory.Resources.si-bundle"; 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.6")] [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 Configuration Configuration; private Harmony? _harmony; private void Awake() { Logger.SetLogger(((BaseUnityPlugin)this).Logger); Configuration = new Configuration(((BaseUnityPlugin)this).Config); if (Bundle.LoadBundle("ShipInventory.Resources.si-bundle") && LoadFallbackItem() && PrepareRPCs()) { ApplyPatches(); InteractiveTerminalManager.RegisterApplication<ShipApplication>(Configuration.InventoryCommand.Value, true); Logger.Info("ShipInventory v1.2.6 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)); if (OpenMonitors.Enabled) { OpenMonitors.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 bool PrepareRPCs() { try { 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); } } } } catch (Exception ex) { Logger.Error("Error while preparing RPCs: '" + ex.Message + "'"); return false; } return true; } private static bool LoadFallbackItem() { Item val = Bundle.LoadAsset<Item>("ErrorItem"); if ((Object)(object)val == (Object)null) { return false; } BadItem badItem = val.spawnPrefab.AddComponent<BadItem>(); ((GrabbableObject)badItem).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterItem(val); ItemManager.FALLBACK_ITEM = val; return true; } internal static bool LoadChute(out GameObject? prefab) { prefab = null; GameObject val = Bundle.LoadAsset<GameObject>("ChutePrefab"); if ((Object)(object)val == (Object)null) { return false; } val.AddComponent<ChuteInteract>(); AutoParentToShip component = val.GetComponent<AutoParentToShip>(); ChuteInteract.SetOffsets(component); component.overrideOffset = true; NetworkManager.Singleton.AddNetworkPrefab(val); prefab = val; return true; } internal static bool LoadTerminalNode(GameObject prefab) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0051: 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_006e: Expected O, but got Unknown TerminalNode val = Bundle.LoadAsset<TerminalNode>("InventoryBuy"); if ((Object)(object)val == (Object)null) { return false; } UnlockableItem val2 = new UnlockableItem { unlockableName = Configuration.ChuteUnlockName.Value, prefabObject = prefab, unlockableType = 1, shopSelectionNode = null, alwaysInStock = true, IsPlaceable = true, canBeStored = true, maxNumber = 1, spawnPrefab = true }; Unlockables.RegisterUnlockable(val2, (StoreType)1, (TerminalNode)null, (TerminalNode)null, val, Configuration.ChuteUnlockCost.Value); ChuteInteract.UnlockableItem = val2; return true; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ShipInventory"; public const string PLUGIN_NAME = "ShipInventory"; public const string PLUGIN_VERSION = "1.2.6"; } } namespace ShipInventory.Patches { [HarmonyPatch(typeof(GameNetworkManager))] public class GameNetworkManager_Patches { [HarmonyPostfix] [HarmonyPatch("Start")] private static void LoadRequiredAssets(GameNetworkManager __instance) { if (ShipInventory.LoadChute(out GameObject prefab) && !((Object)(object)prefab == (Object)null) && ShipInventory.LoadTerminalNode(prefab)) { } } [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); ItemsIO.SaveStoredItems(currentSaveFileName); ItemsIO.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.Configuration.ActAsSafe.Value ? 1f : (ShipInventory.Configuration.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; ItemsIO.LoadStoredItems(currentSaveFileName); ItemsIO.LoadKeys(currentSaveFileName); } [HarmonyPostfix] [HarmonyPatch("ResetShip")] private static void ResetInventory() { if (!ShipInventory.Configuration.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.Configuration.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; internal int _index; public override void Start() { ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).grabbableToEnemies = true; ((GrabbableObject)this).isInFactory = true; ((GrabbableObject)this).Start(); CheckForItem(); } public override int GetItemDataToSave() { return _index; } public override void LoadItemSaveData(int saveData) { _index = saveData; if (ItemsIO.GetItemKey(saveData, out _data) && _data.HasValue) { 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 = LethalLib.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!"); } } 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 Transform dropShipTransform; 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 (OpenMonitors.Enabled) { OpenMonitors.UpdateMonitor(); } } public void RetrieveItems(params ItemData[] items) { RetrieveItemsServerRpc(items, GetClientID()); } private IEnumerator SpawnCoroutine() { while (spawnQueue.Count > 0) { if (itemsInChute.Length >= ShipInventory.Configuration.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.Configuration.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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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_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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_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) 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(2826292124u, 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, 2826292124u, 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; } try { ((Component)val3).transform.SetParent(dropShipTransform, false); } catch { Logger.Warn("Failed to parent the object to the Drop Ship's transform."); ((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? obj2 = spawnParticles; if (obj2 != null) { obj2.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(934621826u, 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, 934621826u, 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.Configuration.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(4247918345u, 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, 4247918345u, 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.Configuration.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(1120862622u, 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, 1120862622u, 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.Configuration.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.Configuration.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.Configuration.TimeToStore.Value; itemRestorePoint = ((Component)this).transform.Find("DropNode"); spawnParticles = ((Component)this).GetComponentInChildren<ParticleSystem>(); dropShipTransform = GameObject.Find("/Environment/HangarShip").transform; Logger.Error("CHUTE CREATED"); Instance = this; StartNewCheck(); } private void Update() { UpdateTrigger(); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if (StartOfRound.Instance.firingPlayersCutsceneRunning && !ShipInventory.Configuration.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(2826292124u, new RpcReceiveHandler(__rpc_handler_2826292124)); NetworkManager.__rpc_func_table.Add(151875304u, new RpcReceiveHandler(__rpc_handler_151875304)); NetworkManager.__rpc_func_table.Add(934621826u, new RpcReceiveHandler(__rpc_handler_934621826)); NetworkManager.__rpc_func_table.Add(4247918345u, new RpcReceiveHandler(__rpc_handler_4247918345)); NetworkManager.__rpc_func_table.Add(1120862622u, new RpcReceiveHandler(__rpc_handler_1120862622)); 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_2826292124(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_934621826(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_4247918345(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_1120862622(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"; } } } namespace ShipInventory.Items { [Serializable] public struct ItemData : INetworkSerializable { 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 = LethalLib.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 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 class ItemManager { public static Item? FALLBACK_ITEM; 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 ItemsIO { private static ItemData[]? loadedKeys; 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!"); } public static void SaveKeys(string saveFileName) { 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 }); } } if (list.Count == 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)list), saveFileName); Logger.Debug($"Successfully saved {list.Count} keys!"); } } public static void LoadKeys(string saveFileName) { loadedKeys = 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; } loadedKeys = array; Logger.Debug($"Successfully loaded {array.Length} keys!"); } public static bool GetItemKey(int index, out ItemData? data) { data = null; if (loadedKeys == null) { return false; } if (index < 0 || loadedKeys.Length >= index) { return false; } data = loadedKeys[index]; return true; } } } 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; } AssetBundle val = AssetBundle.LoadFromStream(manifestResourceStream); if ((Object)(object)val == (Object)null) { Logger.Error("Failed to load the bundle '" + name + "'."); return false; } loadedBundle = val; return true; } public static T? LoadAsset<T>(string name) where T : Object { if ((Object)(object)loadedBundle == (Object)null) { Logger.Error("Tried to load '" + name + "', but the bundle was not loaded."); 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(CustomItemBehaviourLibrary.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.Configuration.ChutePermission.Value) { case Configuration.PermissionLevel.HOST_ONLY: if (((NetworkBehaviour)p).IsHost) { break; } goto case Configuration.PermissionLevel.NO_ONE; case Configuration.PermissionLevel.CLIENTS_ONLY: if (!((NetworkBehaviour)p).IsHost) { break; } goto case Configuration.PermissionLevel.NO_ONE; case Configuration.PermissionLevel.NO_ONE: return false; } return true; } private static bool RequireInOrbit(PlayerControllerB p) { return !ShipInventory.Configuration.RequireInOrbit.Value || StartOfRound.Instance.inShipPhase; } private static bool HasFreeSpace(PlayerControllerB p) { return ItemManager.GetCount() < ShipInventory.Configuration.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; } } 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 Trace(object? content) { Log((LogLevel)8, content); } public static void Debug(object? content) { Log((LogLevel)32, content); } public static void Info(object? content) { Log((LogLevel)16, content); } public static void Warn(object? content) { Log((LogLevel)4, content); } public static void Error(object? content) { Log((LogLevel)2, content); } } } namespace ShipInventory.Extensions { internal static class ItemDataExtensions { public static Item GetItem(this ItemData data) { Item val = LethalLib.GetItem(data.ID) ?? ItemManager.FALLBACK_ITEM; if ((Object)(object)val != (Object)null) { return val; } throw new NullReferenceException(); } public static string GetItemName(this ItemData data) { return data.GetItem().itemName; } } } namespace ShipInventory.Compatibility { internal static class CustomItemBehaviourLibrary { public const string GUID = "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(); } } internal static class LethalConfig { public const string GUID = "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(Configuration 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_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Expected O, but got Unknown //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Expected O, but got Unknown //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Expected O, but got Unknown //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Expected O, but got Unknown //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Expected O, but got Unknown //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Expected O, but got Unknown //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Expected O, but got Unknown //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Expected O, but got Unknown //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Expected O, but got Unknown //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Expected O, but got Unknown //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Expected O, but got Unknown //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Expected O, but got Unknown //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Expected O, but got Unknown //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Expected O, but got Unknown //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Expected O, but got Unknown //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Expected O, but got Unknown //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0599: 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_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Expected O, but got Unknown //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: 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<Configuration.PermissionLevel>(config.ChutePermission.Entry, new EnumDropDownOptions { Name = Lang.Get("NAME_CHUTE_PERMISSION"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.RequireInOrbit.Entry, new BoolCheckBoxOp