Decompiled source of ShipInventoryUpdated v1.2.9
plugins/ShipInventoryUpdated.dll
Decompiled 11 hours 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.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.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.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("OpenMonitors")] [assembly: AssemblyCompany("LethalCompanyModding")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds an inventory to the ship, allowing it to store items and retrieve them.")] [assembly: AssemblyFileVersion("1.2.9.0")] [assembly: AssemblyInformationalVersion("1.2.9+603f8c2603ac3dc769cae94e55245ab321c5205f")] [assembly: AssemblyProduct("ShipInventoryUpdated")] [assembly: AssemblyTitle("ShipInventoryUpdated")] [assembly: AssemblyMetadata("RepositoryUrl", "__PROJECT_URL__")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.9.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal static class LCMPluginInfo { public const string PLUGIN_GUID = "ShipInventoryUpdated"; public const string PLUGIN_NAME = "ShipInventoryUpdated"; public const string PLUGIN_VERSION = "1.2.9"; } 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("ShipInventoryUpdated") { 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_0013: 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: Expected O, but got Unknown //IL_0033: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0060: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0091: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00c2: Expected O, but got Unknown //IL_00cf: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0121: 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_0013: 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: Expected O, but got Unknown //IL_0033: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0060: Expected O, but got Unknown //IL_006d: 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_008d: Expected O, but got Unknown //IL_008d: 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 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00ef: Expected O, but got Unknown //IL_00fc: 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_011c: Expected O, but got Unknown //IL_011c: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0149: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0064: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0091: Expected O, but got Unknown //IL_009e: 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("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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0064: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00bb: Expected O, but got Unknown //IL_00c8: 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: Expected O, but got Unknown //IL_00e8: 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_0013: 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: Expected O, but got Unknown //IL_0033: Expected O, but got Unknown //IL_0040: 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_0098: 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_00bc: Expected O, but got Unknown //IL_00bc: 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.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("ShipInventoryUpdated", "ShipInventoryUpdated", "1.2.9")] [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.bundle") && LoadFallbackItem() && PrepareRPCs()) { ApplyPatches(); InteractiveTerminalManager.RegisterApplication<ShipApplication>(Configuration.InventoryCommand.Value, true); Logger.Info("ShipInventoryUpdated v1.2.9 has loaded!"); } } private void ApplyPatches() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown Logger.Debug("Applying patches..."); if (_harmony == null) { _harmony = new Harmony("ShipInventoryUpdated"); } _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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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; } } } 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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!"); } } } public class ChuteInteract : NetworkBehaviour { public static ChuteInteract? Instance; private Transform itemRestorePoint; 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; 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 val = SpawnItemServer(data); if ((Object)(object)val != (Object)null) { SpawnItemClientRpc(NetworkObjectReference.op_Implicit(val), 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref networkObject)).TryGet(ref val, (NetworkManager)null)) { return; } try { ((Component)val).transform.SetParent(dropShipTransform, false); } catch { Logger.Warn("Failed to parent the object to the Drop Ship's transform."); ((Component)val).transform.SetParent(itemRestorePoint, false); } ((Component)val).transform.position = itemRestorePoint.position; ((Component)val).transform.rotation = itemRestorePoint.rotation; GrabbableObject val2 = default(GrabbableObject); if (((Component)val).TryGetComponent<GrabbableObject>(ref val2)) { if (val2.itemProperties.itemSpawnsOnGround) { ((Component)val).transform.localRotation = Quaternion.Euler(val2.itemProperties.restingRotation); } else { val2.OnHitGround(); } val2.scrapPersistedThroughRounds = data.PERSISTED_THROUGH_ROUNDS; if (val2 is BadItem badItem) { badItem.ID = data.ID; } Item item = data.GetItem(); if (item.isScrap) { val2.SetScrapValue(data.SCRAP_VALUE); } if (item.saveItemVariable) { val2.LoadItemSaveData(data.SAVE_DATA); } val2.isInShipRoom = true; val2.isInElevator = true; ((MonoBehaviour)val2).StartCoroutine(PlayDropSound(val2)); 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_0002: 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_002c: Unknown result type (might be due to invalid IL or missing references) 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) 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)) { 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)) { 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)) { StartNewCheck(); } private void UpdateTrigger() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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.Info("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(); } } } } 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) { string directoryName = Path.GetDirectoryName(typeof(Bundle).Assembly.Location); Logger.Info("Loading bundle: " + Path.Combine(directoryName, name)); Stream baseStream = new StreamReader(Path.Combine(directoryName, name)).BaseStream; if (baseStream == null) { Logger.Error("No bundle named '" + name + "'."); return false; } AssetBundle val = AssetBundle.LoadFromStream(baseStream); 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)) { 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) { if (p.isHoldingObject) { return (Object)(object)p.currentlyHeldObjectServer != (Object)null; } return false; } 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) { if (ShipInventory.Configuration.RequireInOrbit.Value) { return StartOfRound.Instance.inShipPhase; } return true; } 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 + "'."); if (lang != "en") { return LoadLang("en"); } return false; } 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_000a: 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) { if (!Enabled) { return null; } return HandleContainer(item); } [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_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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_01f9: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Expected O, but got Unknown //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: 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_0301: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Expected O, but got Unknown //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Expected O, but got Unknown //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: 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_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Expected O, but got Unknown //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Expected O, but got Unknown //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Expected O, but got Unknown //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Expected O, but got Unknown //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Expected O, but got Unknown //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Expected O, but got Unknown //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Expected O, but got Unknown //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Expected O, but got Unknown //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Expected O, but got Unknown //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Expected O, but got Unknown //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Expected O, but got Unknown //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Expected O, but got Unknown //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_055c: 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 BoolCheckBoxOptions { Name = Lang.Get("NAME_REQUIRES_IN_ORBIT"), RequiresRestart = false })); ConfigEntry<float> entry = config.TimeToStore.Entry; FloatInputFieldOptions val = new FloatInputFieldOptions { Name = Lang.Get("NAME_TIME_TO_STORE") }; ((BaseRangeOptions<float>)val).Min = 0f; ((BaseRangeOptions<float>)val).Max = float.MaxValue; ((BaseOptions)val).RequiresRestart = true; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(entry, val)); ConfigEntry<float> entry2 = config.TimeToRetrieve.Entry; FloatInputFieldOptions val2 = new FloatInputFieldOptions { Name = Lang.Get("NAME_TIME_TO_RETRIEVE") }; ((BaseRangeOptions<float>)val2).Min = 0f; ((BaseRangeOptions<float>)val2).Max = float.MaxValue; ((BaseOptions)val2).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(entry2, val2)); ConfigEntry<int> entry3 = config.StopAfter.Entry; IntSliderOptions val3 = new IntSliderOptions { Name = Lang.Get("NAME_STOP_AFTER") }; ((BaseRangeOptions<int>)val3).Min = 1; ((BaseRangeOptions<int>)val3).Max = 1000; ((BaseOptions)val3).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry3, val3)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(config.Blacklist.Entry, new TextInputFieldOptions { Name = Lang.Get("NAME_BLACKLIST"), TrimText = true, NumberOfLines = 10, RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<Configuration.PermissionLevel>(config.InventoryPermission.Entry, new EnumDropDownOptions { Name = Lang.Get("NAME_INVENTORY_PERMISSION"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ActAsSafe.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_AS_SAFE"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.PersistThroughFire.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_PERSIST_THROUGH_FIRE"), RequiresRestart = false })); ConfigEntry<int> entry4 = config.MaxItemCount.Entry; IntSliderOptions val4 = new IntSliderOptions { Name = Lang.Get("NAME_MAX_ITEM_COUNT") }; ((BaseRangeOptions<int>)val4).Min = 1; ((BaseRangeOptions<int>)val4).Max = 10000; ((BaseOptions)val4).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry4, val4)); ConfigEntry<float> entry5 = config.KeepRate.Entry; FloatSliderOptions val5 = new FloatSliderOptions { Name = Lang.Get("NAME_KEEP_RATE") }; ((BaseRangeOptions<float>)val5).Min = 0f; ((BaseRangeOptions<float>)val5).Max = 100f; ((BaseOptions)val5).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(entry5, val5)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<Configuration.SortOrder>(config.InventorySortOrder, new EnumDropDownOptions { Name = Lang.Get("NAME_INVENTORY_SORT_ORDER"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.KeepRemoveAll.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_KEEP_REMOVE_ALL"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(config.InventoryCommand, new TextInputFieldOptions { Name = Lang.Get("NAME_INVENTORY_COMMAND"), TrimText = true, NumberOfLines = 1, RequiresRestart = true })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.YesPlease, new BoolCheckBoxOptions { Name = Lang.Get("NAME_YES_PLEASE"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ShowConfirmation, new BoolCheckBoxOptions { Name = Lang.Get("NAME_SHOW_CONFIRMATION"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ShowTrademark, new BoolCheckBoxOptions { Name = Lang.Get("NAME_SHOW_TRADEMARK"), RequiresRestart = false })); ConfigEntry<float> entry6 = config.InventoryRefreshRate.Entry; FloatStepSliderOptions val6 = new FloatStepSliderOptions { Name = Lang.Get("NAME_INVENTORY_REFRESH_RATE"), Step = 0.2f }; ((BaseRangeOptions<float>)val6).Min = 0.2f; ((BaseRangeOptions<float>)val6).Max = 60f; ((BaseOptions)val6).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatStepSliderConfigItem(entry6, val6)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.InventoryUpdateCheckSilencer.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_INVENTORY_UPDATE_CHECK_SILENCER"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ForceUpdateUponAdding.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_FORCE_UPDATE_UPON_ADDING"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ForceUpdateUponRemoving.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_FORCE_UPDATE_UPON_REMOVING"), RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(config.ChuteIsUnlock.Entry, new BoolCheckBoxOptions { Name = Lang.Get("NAME_CHUTE_IS_UNLOCK"), RequiresRestart = false })); ConfigEntry<int> entry7 = config.ChuteUnlockCost.Entry; IntSliderOptions val7 = new IntSliderOptions { Name = Lang.Get("NAME_UNLOCK_COST") }; ((BaseRangeOptions<int>)val7).Min = 1; ((BaseRangeOptions<int>)val7).Max = 5000; ((BaseOptions)val7).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry7, val7)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(config.ChuteUnlockName.Entry, new TextInputFieldOptions { Name = Lang.Get("NAME_UNLOCK_NAME"), TrimText = true, NumberOfLines = 1, RequiresRestart = true })); LethalConfigManager.SkipAutoGenFor((ConfigEntryBase)(object)config.LangUsed); ConfigManager.Register<Configuration>((SyncedConfig2<Configuration>)(object)config); } } public static class LethalLib { private const string ID_FORMAT = "{0}/{1}"; private const string BAD_ITEM = "ShipInventory/BadItem"; private const string VANILLA_ITEM_MOD = "Vanilla"; private static Dictionary<string, Item>? _cachedModdedItems; private static string ID(this Item item, string mod = "Vanilla") { return $"{mod}/{item.itemName}"; } private static (string mod, string name) Extract(string id) { string[] array = id.Split('/', StringSplitOptions.RemoveEmptyEntries); if (array == null || array.Length < 2) { Logger.Error("The item with the ID '" + id + "' is invalid."); return ("Vanilla", id); } return (array[0], array[1]); } public static string GetID(Item item) { if ((Object)(object)item == (Object)(object)ItemManager.FALLBACK_ITEM) { return "ShipInventory/BadItem"; } return GetModdedID(item) ?? item.ID(); } public static Item? GetItem(string ID) { if (ID == "ShipInventory/BadItem") { return ItemManager.FALLBACK_ITEM; } var (text, name) = Extract(ID); if (!(text == "Vanilla")) { return GetModdedItem(ID); } return GetVanillaItem(name); } private static Item? GetVanillaItem(string name) { string name2 = name; return ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item item) => item.itemName == name2)); } private static void LoadModdedItems() { if (_cachedModdedItems != null) { return; } _cachedModdedItems = new Dictionary<string, Item>(); foreach (ScrapItem scrapItem in Items.scrapItems) { _cachedModdedItems.TryAdd(scrapItem.item.ID(scrapItem.modName), scrapItem.item); } foreach (ShopItem shopItem in Items.shopItems) { _cachedModdedItems.TryAdd(shopItem.item.ID(shopItem.modName), shopItem.item); } foreach (PlainItem plainItem in Items.plainItems) { _cachedModdedItems.TryAdd(plainItem.item.ID(plainItem.modName), plainItem.item); } } private static Item? GetModdedItem(string id) { LoadModdedItems(); return _cachedModdedItems.GetValueOrDefault(id); } private static string? GetModdedID(Item item) { LoadModdedItems(); if (_cachedModdedItems == null) { return null; } foreach (var (result, val2) in _cachedModdedItems) { if (!((Object)(object)val2 != (Object)(object)item)) { return result; } } return null; } } internal static class OpenMonitors { public const string GUID = "xxxstoner420bongmasterxxx.open_monitors"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("xxxstoner420bongmasterxxx.open_monitors"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchAll(Harmony harmony) { try { harmony.PatchAll(typeof(OpenMonitors_Patches)); } catch (Exception arg) { Logger.Error($"Failed to apply OpenMonitors patches. {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void UpdateMonitor() { LootMonitor.Instance.UpdateMonitor(); } } } namespace ShipInventory.Applications { public class ShipApplication : PageApplication { private readonly string INVENTORY_TITLE = Lang.Get("INVENTORY_TITLE"); private readonly string TRADEMARK = Lang.Get("TRADEMARK"); private readonly string HOME_MESSAGE = Lang.Get("HOME_MESSAGE"); private readonly string WELCOME_MESSAGE = Lang.Get("WELCOME_MESSAGE"); private readonly string POSITIVE_ANSWER = Lang.Get("POSITIVE_ANSWER"); private readonly string NEGATIVE_ANSWER = Lang.Get("NEGATIVE_ANSWER"); private readonly string BLOCKED_ANSWER = Lang.Get("BLOCKED_ANSWER"); private Action<CallbackContext>? LastExitPerformedAction; private readonly string CONFIRMATION_TITLE = Lang.Get("CONFIRMATION_TITLE"); private readonly string CONFIRMATION_MESSAGE = Lang.Get("CONFIRMATION_MESSAGE"); private readonly string PERMISSION_MISSING_TITLE = Lang.Get("PERMISSION_MISSING_TITLE"); private readonly string PERMISSION_MISSING_MESSAGE = Lang.Get("PERMISSION_MISSING_MESSAGE"); private Action? ConfirmExitCallback; private readonly string SHIP_INFO = Lang.Get("SHIP_INFO"); private readonly string STATUS_TITLE = Lang.Get("STATUS_TITLE"); private readonly string SHIP_INFO_TOTAL = Lang.Get("SHIP_INFO_TOTAL"); private readonly string SHIP_INFO_COUNT = Lang.Get("SHIP_INFO_COUNT"); private readonly string SHIP_INFO_KEEP_HEADER = Lang.Get("SHIP_INFO_KEEP_HEADER"); private readonly string SHIP_INFO_KEEP_ON_WIPE = Lang.Get("SHIP_INFO_KEEP_ON_WIPE"); private readonly string SHIP_INFO_KEEP_ON_FIRE = Lang.Get("SHIP_INFO_KEEP_ON_FIRE"); private readonly string SHIP_INFO_IN_ORBIT = Lang.Get("SHIP_INFO_IN_ORBIT"); private int getInfoIndex = -1; private readonly string LOCKED_MESSAGE = Lang.Get("LOCKED_MESSAGE"); private readonly string LOCKED_SUB_MESSAGE = Lang.Get("LOCKED_SUB_MESSAGE"); private readonly string SINGLE_RETRIEVE = Lang.Get("SINGLE_RETRIEVE"); private readonly string TEXT_SINGLE_RETRIEVE = Lang.Get("TEXT_SINGLE_RETRIEVE"); private readonly string SINGLE_RETRIEVE_MESSAGE = Lang.Get("SINGLE_RETRIEVE_MESSAGE"); private readonly string SINGLE_ITEM_FORMAT = Lang.Get("SINGLE_ITEM_FORMAT"); private int retrieveSingleIndex = -1; private readonly string TYPE_RETRIEVE = Lang.Get("TYPE_RETRIEVE"); private readonly string TEXT_TYPE_RETRIEVE = Lang.Get("TEXT_TYPE_RETRIEVE"); private readonly string TYPE_RETRIEVE_MESSAGE = Lang.Get("TYPE_RETRIEVE_MESSAGE"); private readonly string TYPE_ITEM_FORMAT = Lang.Get("TYPE_ITEM_FORMAT"); private int retrieveTypeIndex = -1; private readonly string RANDOM_RETRIEVE = Lang.Get("RANDOM_RETRIEVE"); private readonly string TEXT_RANDOM_RETRIEVE = Lang.Get("TEXT_RANDOM_RETRIEVE"); private int retrieveRandomIndex = -1; private readonly string ALL_RETRIEVE = Lang.Get("ALL_RETRIEVE"); private readonly string TEXT_ALL_RETRIEVE = Lang.Get("TEXT_ALL_RETRIEVE"); private int retrieveAllIndex = -1; public override void Initialization() { if ((Object)(object)ChuteInteract.Instance == (Object)null) { LockedScreen(); } else { MainScreen(0); } } protected override int GetEntriesPerPage<T>(T[] entries) { return 10; } private void MainScreen(int selectedIndex) { //IL_0062: 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_007c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0084: Expected O, but got Unknown PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; CursorElement[] array = (CursorElement[])(object)new CursorElement[5] { RetrieveSingleElement(), RetrieveTypeElement(), RetrieveRandomElement(), RetrieveAllElement(), InfoCursorElement() }; retrieveSingleIndex = 0; retrieveTypeIndex = 1; retrieveRandomIndex = 2; retrieveAllIndex = 3; getInfoIndex = 4; CursorMenu val = new CursorMenu(); ((BaseCursorMenu<CursorElement>)val).cursorIndex = (ItemManager.HasItems() ? selectedIndex : (array.Length - 1)); ((BaseCursorMenu<CursorElement>)val).elements = array; CursorMenu val2 = val; BoxedScreen val3 = CreateScreen(INVENTORY_TITLE, (ITextElement[])(object)new ITextElement[5] { (ITextElement)TextElement.Create(string.Format(WELCOME_MESSAGE, HUDManager.Instance.playerLevels[localPlayerController.playerLevelNumber].levelName, localPlayerController.playerUsername)), (ITextElement)TextElement.Create(" "), (ITextElement)TextElement.Create(HOME_MESSAGE), (ITextElement)TextElement.Create(" "), (ITextElement)val2 }); base.currentPage = PageCursorElement.Create(0, (IScreen[])(object)new IScreen[1] { (IScreen)val3 }, (CursorMenu[])(object)new CursorMenu[1] { val2 }); ((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen((IScreen)(object)val3, val2, true); } private string BoolToString(bool value) { if (!value) { return "<color=red>" + NEGATIVE_ANSWER + "</color>"; } return "<color=green>" + POSITIVE_ANSWER + "</color>"; } private static bool CanRetrieve() { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; switch (ShipInventory.Configuration.InventoryPermission.Value) { case Configuration.PermissionLevel.HOST_ONLY: if (((NetworkBehaviour)localPlayerController).IsHost) { break; } goto case Configuration.PermissionLevel.NO_ONE; case Configuration.PermissionLevel.CLIENTS_ONLY: if (!((NetworkBehaviour)localPlayerController).IsHost) { break; } goto case Configuration.PermissionLevel.NO_ONE; case Configuration.PermissionLevel.NO_ONE: return false; } return true; } private void RegisterExitAction(Action<CallbackContext> action) { UnregisterExitAction(); LastExitPerformedAction = action; InputUtils_Compat.CursorExitKey.performed -= ((TerminalApplication)this).OnScreenExit; InputUtils_Compat.CursorExitKey.performed += action; } private void UnregisterExitAction() { if (LastExitPerformedAction != null) { InputUtils_Compat.CursorExitKey.performed -= LastExitPerformedAction; LastExitPerformedAction = null; } InputUtils_Compat.CursorExitKey.performed -= ((TerminalApplication)this).OnScreenExit; InputUtils_Compat.CursorExitKey.performed += ((TerminalApplication)this).OnScreenExit; } private BoxedScreen CreateScreen(string title, ITextElement[] elements) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown UnregisterExitAction(); BoxedScreen val = new BoxedScreen(); val.Title = title; ITextElement[] array = (ITextElement[])((!ShipInventory.Configuration.ShowTrademark.Value) ? ((Array)Array.Empty<ITextElement>()) : ((Array)new ITextElement[2] { (ITextElement)TextElement.Create(" "), (ITextElement)TextElement.Create(TRADEMARK) })); int num = 0; ITextElement[] array2 = (ITextElement[])(object)new ITextElement[elements.Length + array.Length]; ReadOnlySpan<ITextElement> readOnlySpan = new ReadOnlySpan<ITextElement>(elements); readOnlySpan.CopyTo(new Span<ITextElement>(array2).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; ReadOnlySpan<ITextElement> readOnlySpan2 = new ReadOnlySpan<ITextElement>(array); readOnlySpan2.CopyTo(new Span<ITextElement>(array2).Slice(num, readOnlySpan2.Length)); num += readOnlySpan2.Length; val.elements = array2; return val; } private void ConfirmElement(string message, Action? confirmCallback, Action? declineCallback = null) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00fe: Expected O, but got Unknown Action declineCallback2 = declineCallback; Action confirmCallback2 = confirmCallback; if (!ShipInventory.Configuration.ShowConfirmation.Value) { confirmCallback2?.Invoke(); return; } ConfirmExitCallback = declineCallback2; bool flag = CanRetrieve(); int cursorIndex = 0; CursorElement[] elements; if (flag) { elements = (CursorElement[])(object)new CursorElement[2] { new CursorElement { Name = NEGATIVE_ANSWER, Action = delegate { if (declineCallback2 != null) { declineCallback2(); } else { MainScreen(0); } } }, new CursorElement { Name = POSITIVE_ANSWER, Action = delegate { confirmCallback2?.Invoke(); } } }; if (ShipInventory.Configuration.YesPlease.Value) { cursorIndex = 1; } } else { elements = (CursorElement[])(object)new CursorElement[1] { new CursorElement { Name = BLOCKED_ANSWER, Action = delegate { if (declineCallback2 != null) { declineCallback2(); } else { MainScreen(0); } } } }; } CursorMenu val = new CursorMenu(); ((BaseCursorMenu<CursorElement>)val).cursorIndex = cursorIndex; ((BaseCursorMenu<CursorElement>)val).elements = elements; CursorMenu val2 = val; BoxedScreen val3 = ((!flag) ? CreateScreen(PERMISSION_MISSING_TITLE, (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create(PERMISSION_MISSING_MESSAGE), (ITextElement)TextElement.Create(" "), (ITextElement)val2 }) : CreateScreen(CONFIRMATION_TITLE, (ITextElement[])(object)new ITextElement[5] { (ITextElement)TextElement.Create(message), (ITextElement)TextElement.Create(" "), (ITextElement)TextElement.Create(CONFIRMATION_MESSAGE), (ITextElement)TextElement.Create(" "), (ITextElement)val2 })); base.currentPage = PageCursorElement.Create(0, (IScreen[])(object)new IScreen[1] { (IScreen)val3 }, (CursorMenu[])(object)new CursorMenu[1] { val2 }); ((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen((IScreen)(object)val3, val2, true); RegisterExitAction(OnConfirmExit); } private void OnConfirmExit(CallbackContext context) { ConfirmExitCallback?.Invoke(); } private void CreateItemPages<T>(T[] items, int selectedIndex, string text, Func<T, int, bool, CursorElement> render, int returnIndex) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00ea: Expected O, but got Unknown int entriesPerPage = ((PageApplication)this).GetEntriesPerPage<int>(Array.Empty<int>()); int num = items.Length; ValueTuple<T[][], CursorMenu[], IScreen[]> pageEntries = ((PageApplication)this).GetPageEntries<T>(items); T[][] item = pageEntries.Item1; CursorMenu[] item2 = pageEntries.Item2; IScreen[] item3 = pageEntries.Item3; for (int i = 0; i < item.Length; i++) { CursorElement[] array = (CursorElement[])(object)new CursorElement[item[i].Length]; for (int j = 0; j < array.Length; j++) { T val = item[i][j]; if (val != null) { ref T reference = ref val; T val2 = default(T); if (val2 == null) { val2 = reference; reference = ref val2; } if (!reference.Equals(default(T))) { array[j] = render(val, i * entriesPerPage + j, num == 1); } } } int num2 = i; CursorMenu val3 = new CursorMenu(); ((BaseCursorMenu<CursorElement>)val3).cursorIndex = 0; ((BaseCursorMenu<CursorElement>)val3).elements = array; item2[num2] = val3; item3[i] = (IScreen)(object)CreateScreen(INVENTORY_TITLE, (ITextElement[])(object)new ITextElement[3] { (ITextElement)TextElement.Create(text), (ITextElement)TextElement.Create(" "), (ITextElement)item2[i] }); } selectedIndex = Math.Clamp(selectedIndex, 0, num - 1); int num3 = selectedIndex / entriesPerPage; int cursorIndex = selectedIndex % entriesPerPage; ((BaseCursorMenu<CursorElement>)(object)item2[num3]).cursorIndex = cursorIndex; base.currentPage = PageCursorElement.Create(num3, item3, item2); ((BaseInteractiveApplication<CursorMenu, CursorElement>)this).currentCursorMenu = base.currentPage.GetCurrentCursorMenu(); ((TerminalApplication)this).currentScreen = ((PageElement)base.currentPage).GetCurrentScreen(); RegisterExitAction(delegate { MainScreen(returnIndex); }); } private CursorElement InfoCursorElement() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown return new CursorElement { Name = SHIP_INFO, Action = GetInfo }; } private void GetInfo() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0018: Expected O, but got Unknown CursorMenu val = new CursorMenu(); ((BaseCursorMenu<CursorElement>)val).cursorIndex = 0; ((BaseCursorMenu<CursorElement>)val).elements = Array.Empty<CursorElement>(); CursorMenu val2 = val; BoxedScreen val3 = CreateScreen(STATUS_TITLE, (ITextElement[])(object)new ITextElement[8] { (ITextElement)TextElement.Create(string.Format(SHIP_INFO_TOTAL, ItemManager.GetTotalValue(onlyScraps: false, onlyFromRound: false))), (ITextElement)TextElement.Create(string.Format(SHIP_INFO_COUNT, ItemManager.GetItems().Count(), ShipInventory.Configuration.MaxItemCount.Value)), (ITextElement)TextElement.Create(" "), (ITextElement)TextElement.Create(string.Format(SHIP_INFO_IN_ORBIT, BoolToString(!ShipInventory.Configuration.RequireInOrbit.Value))), (ITextElement)TextElement.Create(" "), (ITextElement)TextElement.Create(SHIP_INFO_KEEP_HEADER), (ITextElement)TextElement.Create(string.Format(SHIP_INFO_KEEP_ON_WIPE, BoolToString(ShipInventory.Configuration.ActAsSafe.Value))), (ITextElement)TextElement.Create(string.Format(SHIP_INFO_KEEP_ON_FIRE, BoolToString(ShipInventory.Configuration.PersistThroughFire.Value))) }); base.currentPage = PageCursorElement.Create(0, (IScreen[])(object)new IScreen[1] { (IScreen)val3 }, (CursorMenu[])(object)new CursorMenu[1] { val2 }); ((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen((IScreen)(object)val3, val2, true); RegisterExitAction(delegate { MainScreen(getInfoIndex); }); } private void LockedScreen() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown CursorMenu val = new CursorMenu(); ((BaseCursorMenu<CursorElement>)(object)val).cursorIndex = 0; ((BaseCursorMenu<CursorElement>)(object)val).elements = (CursorElement[])(object)new CursorElement[1] { new CursorElement { Name = BLOCKED_ANSWER, Action = delegate { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((TerminalApplication)this).OnScreenExit(default(CallbackContext)); } } }; CursorMenu val2 = val; BoxedScreen val3 = CreateScreen(INVENTORY_TITLE, (ITextElement[])(object)new ITextElement[5] { (ITextElement)TextElement.Create(LOCKED_MESSAGE), (ITextElement)TextElement.Create(" "), (ITextElement)TextElement.Create(string.Format(LOCKED_SUB_MESSAGE, ShipInventory.Configuration.ChuteUnlockName.Value)), (ITextElement)TextElement.Create(" "), (ITextElement)val2 }); base.currentPage = PageCursorElement.Create(0, (IScreen[])(object)new IScreen[1] { (IScreen)val3 }, (CursorMenu[])(object)new CursorMenu[1] { val2 }); ((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen((IScreen)(object)val3, val2, true); } private CursorElement RetrieveSingleElement() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown return new CursorElement { Name = SINGLE_RETRIEVE, Active = (CursorElement _) => ItemManager.HasItems(), SelectInactive = false, Action = delegate { RetrieveSingle(); } }; } private Cu