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 Rosies Stonks v1.0.1
BepInEx/plugins/TerminalAddMoney/TerminalAddMoney.dll
Decompiled 6 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("1.0.0.4")] [assembly: AssemblyInformationalVersion("1.0.0.4")] [assembly: AssemblyVersion("1.0.0.4")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TerminalAddMoney { [BepInPlugin("rosie.fun.terminaladdmoney", "Terminal Add Money", "1.0.0.4")] public sealed class Plugin : BaseUnityPlugin { internal static Plugin Instance; internal static ConfigEntry<bool> HostOnly; internal static ConfigEntry<bool> QuotaHostOnly; internal static ConfigEntry<bool> RerollHostOnly; private static ManualLogSource log; private void Awake() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) Instance = this; log = ((BaseUnityPlugin)this).Logger; HostOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Permissions", "AddMoneyHostOnly", false, "Restrict AddMoney/AddM to the host."); QuotaHostOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Permissions", "AddQuotaHostOnly", true, "Restrict AddQuota/AddQ to the host."); RerollHostOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Permissions", "RerollHostOnly", true, "Restrict Reroll/RR to the host."); new Harmony("rosie.fun.terminaladdmoney").PatchAll(typeof(CommandPatch)); MoneyNetwork.Ensure(); SceneManager.sceneLoaded += SceneLoaded; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Terminal Add Money 1.0.0.4 loaded. Commands: AddMoney <amount>, AddM <amount>, AddQuota <amount>, AddQ <amount>, Reroll, RR."); } private static void SceneLoaded(Scene scene, LoadSceneMode mode) { MoneyNetwork.Ensure(); } internal static void Log(string text) { ManualLogSource obj = log; if (obj != null) { obj.LogInfo((object)text); } } } internal static class Command { internal static bool Parse(string text, out int amount, out bool quota, out bool reroll) { amount = 0; quota = false; reroll = false; string[] array = text.Trim().Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0 || (!array[0].Equals("AddMoney", StringComparison.OrdinalIgnoreCase) && !array[0].Equals("AddM", StringComparison.OrdinalIgnoreCase) && !array[0].Equals("AddQuota", StringComparison.OrdinalIgnoreCase) && !array[0].Equals("AddQ", StringComparison.OrdinalIgnoreCase) && !array[0].Equals("Reroll", StringComparison.OrdinalIgnoreCase) && !array[0].Equals("RR", StringComparison.OrdinalIgnoreCase))) { return false; } quota = array[0].Equals("AddQuota", StringComparison.OrdinalIgnoreCase) || array[0].Equals("AddQ", StringComparison.OrdinalIgnoreCase); reroll = array[0].Equals("Reroll", StringComparison.OrdinalIgnoreCase) || array[0].Equals("RR", StringComparison.OrdinalIgnoreCase); if (reroll) { amount = ((array.Length == 1) ? 1 : 0); return true; } if (array.Length == 2 && int.TryParse(array[1], NumberStyles.None, CultureInfo.InvariantCulture, out var result) && result > 0) { amount = result; } return true; } } [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] internal static class CommandPatch { private static TerminalNode reply; internal static TerminalNode Reply(string text) { if ((Object)(object)reply == (Object)null) { reply = ScriptableObject.CreateInstance<TerminalNode>(); } reply.clearPreviousText = true; reply.displayText = text + "\n\n"; return reply; } [HarmonyPrefix] private static bool Prefix(Terminal __instance, ref TerminalNode __result) { string text = __instance.screenText.text; int num = Mathf.Clamp(__instance.textAdded, 0, text.Length); if (!Command.Parse(text.Substring(text.Length - num), out var amount, out var quota, out var reroll)) { return true; } string text2 = ((amount != 0) ? MoneyNetwork.Request(__instance, amount, quota, reroll) : (reroll ? "Usage: Reroll (alias: RR)." : (quota ? "Usage: AddQuota <positive whole number> (alias: AddQ)." : "Usage: AddMoney <positive whole number> (alias: AddM)."))); __result = Reply(text2); return false; } } internal sealed class MoneyNetwork : MonoBehaviour { private const string RequestChannel = "rosie.fun.addmoney.request.v2"; private const string ReplyChannel = "rosie.fun.addmoney.reply.v1"; private const string QuotaChannel = "rosie.fun.addmoney.quota.v1"; private const string QuotaStateRequest = "rosie.fun.addmoney.quota.state.v1"; private const string ShopChannel = "rosie.fun.addmoney.shop.v1"; private bool hasRerolled; private NetworkManager manager; private static MoneyNetwork instance; private Terminal pendingTerminal; private bool quotaRequested; internal static void Ensure() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown if ((Object)(object)instance != (Object)null) { if (!((Component)instance).gameObject.activeSelf) { ((Component)instance).gameObject.SetActive(true); } ((Behaviour)instance).enabled = true; return; } instance = Object.FindObjectOfType<MoneyNetwork>(); if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("TerminalAddMoney.Network") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); instance = val.AddComponent<MoneyNetwork>(); Plugin.Log("[Lifecycle] Money controller created."); } if ((Object)(object)instance != (Object)null) { instance.Register(); } } private void Awake() { instance = this; Plugin.Log("[Lifecycle] Money controller Awake."); } private void OnDestroy() { if (!((Object)(object)instance != (Object)(object)this)) { if ((Object)(object)manager != (Object)null && manager.CustomMessagingManager != null) { manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.request.v2"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.reply.v1"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.quota.v1"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.shop.v1"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.quota.state.v1"); } instance = null; Plugin.Log("[Lifecycle] Money controller destroyed; next scene or command will restore it."); } } private unsafe void Update() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) Register(); if (!((Object)(object)manager == (Object)null) && !manager.IsServer && manager.IsConnectedClient && !quotaRequested && !((Object)(object)TimeOfDay.Instance == (Object)null) && ((NetworkBehaviour)TimeOfDay.Instance).IsSpawned) { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1); try { manager.CustomMessagingManager.SendNamedMessage("rosie.fun.addmoney.quota.state.v1", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } quotaRequested = true; } } private void Register() { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown NetworkManager val = NetworkManager.Singleton; if ((Object)(object)val != (Object)null && !val.IsListening) { val = null; } if (!((Object)(object)manager == (Object)(object)val)) { if ((Object)(object)manager != (Object)null && manager.CustomMessagingManager != null) { manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.request.v2"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.reply.v1"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.quota.v1"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.shop.v1"); manager.CustomMessagingManager.UnregisterNamedMessageHandler("rosie.fun.addmoney.quota.state.v1"); } manager = val; quotaRequested = false; hasRerolled = false; pendingTerminal = null; if (!((Object)(object)manager == (Object)null)) { manager.CustomMessagingManager.RegisterNamedMessageHandler("rosie.fun.addmoney.request.v2", new HandleNamedMessageDelegate(Receive)); manager.CustomMessagingManager.RegisterNamedMessageHandler("rosie.fun.addmoney.reply.v1", new HandleNamedMessageDelegate(ReceiveReply)); manager.CustomMessagingManager.RegisterNamedMessageHandler("rosie.fun.addmoney.quota.v1", new HandleNamedMessageDelegate(ReceiveQuota)); manager.CustomMessagingManager.RegisterNamedMessageHandler("rosie.fun.addmoney.shop.v1", new HandleNamedMessageDelegate(ReceiveShop)); manager.CustomMessagingManager.RegisterNamedMessageHandler("rosie.fun.addmoney.quota.state.v1", new HandleNamedMessageDelegate(SendQuotaState)); Plugin.Log("[Network] Money handlers registered; server=" + manager.IsServer + "."); } } } internal unsafe static string Request(Terminal terminal, int amount, bool quota, bool reroll) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Ensure(); if ((Object)(object)instance == (Object)null) { return "Money controller could not be created; check the log."; } instance.Register(); if ((Object)(object)instance.manager == (Object)null || !((NetworkBehaviour)terminal).IsSpawned) { return "Start a game before adding credits."; } int command = (reroll ? 2 : (quota ? 1 : 0)); if (instance.manager.IsServer) { return instance.Execute(terminal, amount, command, host: true); } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(8, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref command, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref amount, default(ForPrimitives)); instance.pendingTerminal = terminal; instance.manager.CustomMessagingManager.SendNamedMessage("rosie.fun.addmoney.request.v2", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } return "Command request sent to host."; } private string Execute(Terminal terminal, int amount, int command, bool host) { if ((Object)(object)manager == (Object)null || !manager.IsServer) { return "Host is not ready."; } bool value; switch (command) { default: return "Unknown command."; case 2: value = Plugin.RerollHostOnly.Value; break; case 1: value = Plugin.QuotaHostOnly.Value; break; case 0: value = Plugin.HostOnly.Value; break; } bool flag = value; if (!host && flag) { return "Only the host may use " + command switch { 1 => "AddQuota/AddQ.", 0 => "AddMoney/AddM.", _ => "Reroll/RR.", }; } if ((Object)(object)terminal == (Object)null || !((NetworkBehaviour)terminal).IsSpawned) { return "Terminal is not ready."; } return command switch { 2 => Reroll(terminal), 1 => ApplyQuota(amount), _ => Apply(terminal, amount), }; } private static string Apply(Terminal terminal, int amount) { long num = (long)terminal.groupCredits + (long)amount; if (amount <= 0 || num > int.MaxValue || num < 0) { return "Amount exceeds the supported credit balance."; } terminal.groupCredits = (int)num; terminal.SyncGroupCreditsClientRpc((int)num, -1); Plugin.Log($"Added {amount} credits. Group balance: {num}."); return $"Added {amount} credits. Group balance: {num}."; } private unsafe void Receive(ulong sender, FastBufferReader reader) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)manager == (Object)null || !manager.IsServer || !((FastBufferReader)(ref reader)).TryBeginRead(8) || (Object)(object)StartOfRound.Instance == (Object)null) { return; } bool flag = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.actualClientId == sender && val.isPlayerControlled && !val.isPlayerDead) { flag = true; break; } } if (!flag) { return; } int command = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref command, default(ForPrimitives)); int amount = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref amount, default(ForPrimitives)); Terminal terminal = Object.FindObjectOfType<Terminal>(); string text = Execute(terminal, amount, command, host: false); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(512, (Allocator)2, -1); try { ((FastBufferWriter)(ref val2)).WriteValueSafe(text, false); manager.CustomMessagingManager.SendNamedMessage("rosie.fun.addmoney.reply.v1", sender, val2, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val2))/*cast due to .constrained prefix*/).Dispose(); } } private string ApplyQuota(int amount) { TimeOfDay val = TimeOfDay.Instance; if ((Object)(object)val == (Object)null || !((NetworkBehaviour)val).IsSpawned) { return "Quota is not ready."; } long num = (long)val.quotaFulfilled + (long)amount; if (amount <= 0 || num < 0 || num > int.MaxValue) { return "Amount exceeds the supported quota progress."; } val.quotaFulfilled = (int)num; val.UpdateProfitQuotaCurrentTime(); BroadcastQuota(); string text = $"Added {amount} to quota progress: {num}/{val.profitQuota}."; Plugin.Log(text); return text; } private unsafe void BroadcastQuota(ulong? recipient = null) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) TimeOfDay val = TimeOfDay.Instance; if ((Object)(object)manager == (Object)null || !manager.IsServer || (Object)(object)val == (Object)null || !((NetworkBehaviour)val).IsSpawned) { return; } FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(8, (Allocator)2, -1); try { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref val.quotaFulfilled, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(ref val.profitQuota, default(ForPrimitives)); if (recipient.HasValue) { manager.CustomMessagingManager.SendNamedMessage("rosie.fun.addmoney.quota.v1", recipient.Value, val2, (NetworkDelivery)3); } else { manager.CustomMessagingManager.SendNamedMessageToAll("rosie.fun.addmoney.quota.v1", val2, (NetworkDelivery)3); } } finally { ((IDisposable)(*(FastBufferWriter*)(&val2))/*cast due to .constrained prefix*/).Dispose(); } } private void SendQuotaState(ulong sender, FastBufferReader reader) { if ((Object)(object)manager != (Object)null && manager.IsServer && manager.ConnectedClients.ContainsKey(sender)) { BroadcastQuota(sender); if (hasRerolled) { BroadcastShop(Object.FindObjectOfType<Terminal>(), sender); } } } private void ReceiveQuota(ulong sender, FastBufferReader reader) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)manager == (Object)null) && !manager.IsServer && sender == 0L && ((FastBufferReader)(ref reader)).TryBeginRead(8)) { int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); int num2 = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num2, default(ForPrimitives)); if (num >= 0 && num2 >= 0 && !((Object)(object)TimeOfDay.Instance == (Object)null)) { TimeOfDay.Instance.quotaFulfilled = num; TimeOfDay.Instance.profitQuota = num2; TimeOfDay.Instance.UpdateProfitQuotaCurrentTime(); } } } private string Reroll(Terminal terminal) { StartOfRound val = StartOfRound.Instance; if ((Object)(object)val == (Object)null) { return "Store is not ready."; } int randomMapSeed = val.randomMapSeed; try { val.randomMapSeed = Guid.NewGuid().GetHashCode() & 0x7FFFFFFF; terminal.itemSalesPercentages = new int[terminal.buyableItemsList.Length + terminal.buyableVehicles.Length]; for (int i = 0; i < terminal.itemSalesPercentages.Length; i++) { terminal.itemSalesPercentages[i] = 100; } terminal.RotateShipDecorSelection(); terminal.SetItemSales(); } finally { val.randomMapSeed = randomMapSeed; } hasRerolled = true; BroadcastShop(terminal); Plugin.Log("Store rerolled by host: rotating decor and item/vehicle discounts."); return "Store rerolled. Type STORE to view the new selection and discounts."; } private unsafe void BroadcastShop(Terminal terminal, ulong? recipient = null) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)terminal == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { return; } List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables; List<int> list = new List<int>(); foreach (TerminalNode node in terminal.ShipDecorSelection) { int num = unlockables.FindIndex((UnlockableItem item) => (Object)(object)item.shopSelectionNode == (Object)(object)node); if (num >= 0) { list.Add(num); } } int[] array = terminal.itemSalesPercentages ?? new int[0]; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor((2 + list.Count + array.Length) * 4, (Allocator)2, -1); try { int count = list.Count; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref count, default(ForPrimitives)); foreach (int item in list) { int current = item; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref current, default(ForPrimitives)); } count = array.Length; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref count, default(ForPrimitives)); int[] array2 = array; for (count = 0; count < array2.Length; count++) { int num2 = array2[count]; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num2, default(ForPrimitives)); } if (recipient.HasValue) { manager.CustomMessagingManager.SendNamedMessage("rosie.fun.addmoney.shop.v1", recipient.Value, val, (NetworkDelivery)3); } else { manager.CustomMessagingManager.SendNamedMessageToAll("rosie.fun.addmoney.shop.v1", val, (NetworkDelivery)3); } } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private void ReceiveShop(ulong sender, FastBufferReader reader) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)manager == (Object)null || manager.IsServer || sender != 0L || !((FastBufferReader)(ref reader)).TryBeginRead(4)) { return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null || num < 0 || num > 4096 || !((FastBufferReader)(ref reader)).TryBeginRead((num + 1) * 4)) { return; } List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables; List<TerminalNode> list = new List<TerminalNode>(); int num2 = default(int); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num2, default(ForPrimitives)); if (num2 < 0 || num2 >= unlockables.Count || (Object)(object)unlockables[num2].shopSelectionNode == (Object)null) { return; } list.Add(unlockables[num2].shopSelectionNode); } int num3 = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num3, default(ForPrimitives)); if (num3 < 0 || num3 > 4096 || !((FastBufferReader)(ref reader)).TryBeginRead(num3 * 4)) { return; } int[] array = new int[num3]; for (int j = 0; j < num3; j++) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref array[j], default(ForPrimitives)); if (array[j] < 0 || array[j] > 100) { return; } } if (num3 == val.buyableItemsList.Length + val.buyableVehicles.Length) { val.ShipDecorSelection.Clear(); val.ShipDecorSelection.AddRange(list); val.itemSalesPercentages = array; } } private void ReceiveReply(ulong sender, FastBufferReader reader) { if (sender == 0L && !((Object)(object)manager == (Object)null) && !manager.IsServer) { string text = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); Plugin.Log(text); if ((Object)(object)pendingTerminal != (Object)null && pendingTerminal.terminalInUse && (Object)(object)pendingTerminal.currentNode != (Object)null && pendingTerminal.currentNode.displayText == "Command request sent to host.\n\n") { pendingTerminal.LoadNewNode(CommandPatch.Reply(text)); } pendingTerminal = null; } } } }