Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TerminalItems v1.0.0
TerminalItems.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using TerminalApi; using TerminalApi.Classes; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("TerminalItem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TerminalItem")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("199bd885-0b53-4a4b-adac-b890f7754f95")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace TerminalItems; [BepInPlugin("qh3.TerminalItems", "TerminalItems", "1.0.0")] public class Plugin : BaseUnityPlugin { private List<string> buyItems; public static Plugin Instance; internal static ManualLogSource Log = Logger.CreateLogSource("qh3.TerminalItems"); private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Log.LogInfo((object)"Loading TerminalItems Mod"); Instance = this; TerminalApi.AddCommand("Items", new CommandInfo { DisplayTextSupplier = GetDungeonWeight }, (string)null, true); } private string GetDungeonWeight() { if ((Object)(object)StartOfRound.Instance != (Object)null) { StringBuilder stringBuilder = new StringBuilder(); Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val == (Object)null) { Log.LogInfo((object)"没有找到Terminal!!"); return "TerminalItems Error"; } buyItems = val.buyableItemsList.Select((Item x) => x.itemName).ToList(); GameObject val2 = GameObject.Find("/Environment/HangarShip"); GrabbableObject[] componentsInChildren = val2.GetComponentsInChildren<GrabbableObject>(); Dictionary<string, int> dictionary = new Dictionary<string, int>(); GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject val3 in array) { if (CkeckShip(val3)) { if (dictionary.TryGetValue(val3.itemProperties.itemName, out var value)) { dictionary[val3.itemProperties.itemName] = value + 1; } else { dictionary[val3.itemProperties.itemName] = 1; } } } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if (!val4.isPlayerControlled) { continue; } GrabbableObject[] itemSlots = val4.ItemSlots; foreach (GrabbableObject val5 in itemSlots) { if (CkeckPlayer(val5)) { if (dictionary.TryGetValue(val5.itemProperties.itemName, out var value2)) { dictionary[val5.itemProperties.itemName] = value2 + 1; } else { dictionary[val5.itemProperties.itemName] = 1; } } } } if (dictionary.Count == 0) { return "No Items"; } foreach (KeyValuePair<string, int> item in dictionary) { stringBuilder.Append("* "); stringBuilder.Append(item.Key); stringBuilder.Append(": "); stringBuilder.Append(item.Value); stringBuilder.AppendLine(); } return stringBuilder.ToString(); } return "TerminalItems Error"; } private bool CkeckShip(GrabbableObject obj) { if (obj.itemProperties.isScrap) { return false; } if (obj.isHeld) { return false; } if (obj.heldByPlayerOnServer) { return false; } if (!buyItems.Contains(obj.itemProperties.itemName)) { return false; } return true; } private bool CkeckPlayer(GrabbableObject obj) { if ((Object)(object)obj == (Object)null) { return false; } if (obj.itemProperties.isScrap) { return false; } if (!obj.isHeld) { return false; } if (!obj.heldByPlayerOnServer) { return false; } if (!buyItems.Contains(obj.itemProperties.itemName)) { return false; } return true; } }