using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using GameNetcodeStuff; using Steamworks; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.UI; using UnityEngine.Video; public class Terminal : NetworkBehaviour { public Canvas terminalUIScreen; public PlayerActions playerActions; public bool terminalInUse; private InteractTrigger terminalTrigger; public RawImage terminalImage; public RectMask2D terminalImageMask; public RenderTexture videoTexture; public VideoPlayer videoPlayer; public TMP_InputField screenText; public int textAdded; public string currentText; public TerminalNode currentNode; public TerminalNodesList terminalNodes; [Space(3f)] public Animator terminalUIAnimator; public PlaceableShipObject placeableObject; private bool usedTerminalThisSession; private bool modifyingText; public int playerDefinedAmount; private RoundManager roundManager; public int groupCredits; private int totalCostOfItems; public AudioSource terminalAudio; public AudioClip[] keyboardClips; public AudioClip[] syncedAudios; private float timeSinceLastKeyboardPress; public bool useCreditsCooldown; private Coroutine loadImageCoroutine; private bool hasGottenNoun; private bool hasGottenVerb; [Space(7f)] private bool broadcastedCodeThisFrame; public Animator codeBroadcastAnimator; public AudioClip codeBroadcastSFX; [Space(5f)] public List scannedEnemyIDs = new List(); public List enemyFiles = new List(); public List newlyScannedEnemyIDs = new List(); [Space(3f)] public List unlockedStoryLogs = new List(); public List logEntryFiles = new List(); public List newlyUnlockedStoryLogs = new List(); [Space(7f)] public List ShipDecorSelection = new List(); private bool syncedTerminalValues; public int numberOfItemsInDropship; public Scrollbar scrollBarVertical; public TextMeshProUGUI inputFieldText; public CanvasGroup scrollBarCanvasGroup; public RenderTexture playerScreenTex; public RenderTexture playerScreenTexHighRes; public TextMeshProUGUI topRightText; public SelectableLevel[] moonsCatalogueList; [Header("Store-bought player items")] public Item[] buyableItemsList; public int[] itemSalesPercentages; [Space(3f)] public List orderedItemsFromTerminal; [Space(5f)] private Coroutine selectTextFieldCoroutine; public AudioClip enterTerminalSFX; public AudioClip leaveTerminalSFX; public Light terminalLight; private Coroutine forceScrollbarCoroutine; public bool displayingSteamKeyboard; public Texture displayingPersistentImage; private void Update() { if (HUDManager.Instance == null || GameNetworkManager.Instance == null || GameNetworkManager.Instance.localPlayerController == null) { return; } if (terminalInUse) { topRightText.text = $"${groupCredits}"; screenText.caretPosition = screenText.text.Length; HUDManager.Instance.playerScreenTexture.texture = playerScreenTexHighRes; GameNetworkManager.Instance.localPlayerController.gameplayCamera.targetTexture = playerScreenTexHighRes; if (Keyboard.current.anyKey.wasPressedThisFrame) { if (timeSinceLastKeyboardPress > 0.07f) { timeSinceLastKeyboardPress = 0f; RoundManager.PlayRandomClip(terminalAudio, keyboardClips); } if (scrollBarVertical.value != 0f) { scrollBarVertical.value = 0f; if (forceScrollbarCoroutine != null) { StopCoroutine(forceScrollbarCoroutine); } forceScrollbarCoroutine = StartCoroutine(forceScrollbarDown()); } } timeSinceLastKeyboardPress += Time.deltaTime; if (scrollBarVertical.value < 0.95f) { scrollBarCanvasGroup.alpha = Mathf.Lerp(scrollBarCanvasGroup.alpha, 1f, 10f * Time.deltaTime); } else { scrollBarCanvasGroup.alpha = 0f; } } else { HUDManager.Instance.playerScreenTexture.texture = playerScreenTex; GameNetworkManager.Instance.localPlayerController.gameplayCamera.targetTexture = playerScreenTex; } } private IEnumerator forceScrollbarDown() { for (int i = 0; i < 5; i++) { yield return null; scrollBarVertical.value = 0f; } } private IEnumerator forceScrollbarUp() { for (int i = 0; i < 5; i++) { yield return null; scrollBarVertical.value = 1f; } } public void LoadNewNode(TerminalNode node) { modifyingText = true; RunTerminalEvents(node); screenText.interactable = true; string text = ""; if (node.clearPreviousText) { text = "\n\n\n" + node.displayText.ToString(); } else { text = "\n\n" + screenText.text.ToString() + "\n\n" + node.displayText.ToString(); int value = text.Length - 250; text = text.Substring(Mathf.Clamp(value, 0, text.Length)).ToString(); } try { text = TextPostProcess(text, node); } catch (Exception arg) { Debug.LogError($"An error occured while post processing terminal text: {arg}"); } screenText.text = text; currentText = screenText.text; textAdded = 0; if (node.playSyncedClip != -1) { PlayTerminalAudioServerRpc(node.playSyncedClip); } else if (node.playClip != null) { terminalAudio.PlayOneShot(node.playClip); } LoadTerminalImage(node); currentNode = node; } [ServerRpc(RequireOwnership = false)] public void PlayTerminalAudioServerRpc(int clipIndex) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { if (__rpc_exec_stage != __RpcExecStage.Server && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams serverRpcParams = default(ServerRpcParams); FastBufferWriter bufferWriter = __beginSendServerRpc(1713627637u, serverRpcParams, RpcDelivery.Reliable); BytePacker.WriteValueBitPacked(bufferWriter, clipIndex); __endSendServerRpc(ref bufferWriter, 1713627637u, serverRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Server && (networkManager.IsServer || networkManager.IsHost)) { PlayTerminalAudioClientRpc(clipIndex); } } } [ClientRpc] public void PlayTerminalAudioClientRpc(int clipIndex) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { if (__rpc_exec_stage != __RpcExecStage.Client && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams clientRpcParams = default(ClientRpcParams); FastBufferWriter bufferWriter = __beginSendClientRpc(1118892272u, clientRpcParams, RpcDelivery.Reliable); BytePacker.WriteValueBitPacked(bufferWriter, clipIndex); __endSendClientRpc(ref bufferWriter, 1118892272u, clientRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Client && (networkManager.IsClient || networkManager.IsHost) && !(GameNetworkManager.Instance.localPlayerController == null)) { terminalAudio.PlayOneShot(syncedAudios[clipIndex]); } } } private IEnumerator loadTextAnimation() { screenText.textComponent.maxVisibleLines = 0; for (int i = 0; i < 30; i++) { screenText.textComponent.maxVisibleLines += 2; yield return null; } screenText.textComponent.maxVisibleLines = 100; } private string TextPostProcess(string modifiedDisplayText, TerminalNode node) { int num = modifiedDisplayText.Split("[planetTime]").Length - 1; if (num > 0) { Regex regex = new Regex(Regex.Escape("[planetTime]")); for (int i = 0; i < num && moonsCatalogueList.Length > i; i++) { Debug.Log($"isDemo:{GameNetworkManager.Instance.isDemo} ; {moonsCatalogueList[i].lockedForDemo}"); string replacement = ((GameNetworkManager.Instance.isDemo && moonsCatalogueList[i].lockedForDemo) ? "(Locked)" : ((moonsCatalogueList[i].currentWeather != LevelWeatherType.None) ? ("(" + moonsCatalogueList[i].currentWeather.ToString() + ")") : "")); modifiedDisplayText = regex.Replace(modifiedDisplayText, replacement, 1); } } try { if (node.displayPlanetInfo != -1) { string replacement = ((StartOfRound.Instance.levels[node.displayPlanetInfo].currentWeather != LevelWeatherType.None) ? (StartOfRound.Instance.levels[node.displayPlanetInfo].currentWeather.ToString().ToLower() ?? "") : "mild weather"); modifiedDisplayText = modifiedDisplayText.Replace("[currentPlanetTime]", replacement); } } catch { Debug.Log($"Exception occured on terminal while setting node planet info; current node displayPlanetInfo:{node.displayPlanetInfo}"); } if (modifiedDisplayText.Contains("[currentScannedEnemiesList]")) { if (scannedEnemyIDs == null || scannedEnemyIDs.Count <= 0) { modifiedDisplayText = modifiedDisplayText.Replace("[currentScannedEnemiesList]", "No data collected on wildlife. Scans are required."); } else { StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < scannedEnemyIDs.Count; j++) { Debug.Log($"scanID # {j}: {scannedEnemyIDs[j]}; {enemyFiles[scannedEnemyIDs[j]].creatureName}"); Debug.Log($"scanID # {j}: {scannedEnemyIDs[j]}"); stringBuilder.Append("\n" + enemyFiles[scannedEnemyIDs[j]].creatureName); if (newlyScannedEnemyIDs.Contains(scannedEnemyIDs[j])) { stringBuilder.Append(" (NEW)"); } } modifiedDisplayText = modifiedDisplayText.Replace("[currentScannedEnemiesList]", stringBuilder.ToString()); } } if (modifiedDisplayText.Contains("[buyableItemsList]")) { if (buyableItemsList == null || buyableItemsList.Length == 0) { modifiedDisplayText = modifiedDisplayText.Replace("[buyableItemsList]", "[No items in stock!]"); } else { StringBuilder stringBuilder2 = new StringBuilder(); for (int k = 0; k < buyableItemsList.Length; k++) { if (GameNetworkManager.Instance.isDemo && buyableItemsList[k].lockedInDemo) { stringBuilder2.Append("\n* " + buyableItemsList[k].itemName + " (Locked)"); } else { stringBuilder2.Append("\n* " + buyableItemsList[k].itemName + " // Price: $" + (float)buyableItemsList[k].creditsWorth * ((float)itemSalesPercentages[k] / 100f)); } if (itemSalesPercentages[k] != 100) { stringBuilder2.Append($" ({100 - itemSalesPercentages[k]}% OFF!)"); } } modifiedDisplayText = modifiedDisplayText.Replace("[buyableItemsList]", stringBuilder2.ToString()); } } if (modifiedDisplayText.Contains("[currentUnlockedLogsList]")) { if (unlockedStoryLogs == null || unlockedStoryLogs.Count <= 0) { modifiedDisplayText = modifiedDisplayText.Replace("[currentUnlockedLogsList]", "[ALL DATA HAS BEEN CORRUPTED OR OVERWRITTEN]"); } else { StringBuilder stringBuilder3 = new StringBuilder(); for (int l = 0; l < unlockedStoryLogs.Count; l++) { stringBuilder3.Append("\n" + logEntryFiles[unlockedStoryLogs[l]].creatureName); if (newlyUnlockedStoryLogs.Contains(unlockedStoryLogs[l])) { stringBuilder3.Append(" (NEW)"); } } modifiedDisplayText = modifiedDisplayText.Replace("[currentUnlockedLogsList]", stringBuilder3.ToString()); } } if (modifiedDisplayText.Contains("[unlockablesSelectionList]")) { if (ShipDecorSelection == null || ShipDecorSelection.Count <= 0) { modifiedDisplayText = modifiedDisplayText.Replace("[unlockablesSelectionList]", "[No items available]"); } else { StringBuilder stringBuilder4 = new StringBuilder(); for (int m = 0; m < ShipDecorSelection.Count; m++) { stringBuilder4.Append($"\n{ShipDecorSelection[m].creatureName} // ${ShipDecorSelection[m].itemCost}"); } modifiedDisplayText = modifiedDisplayText.Replace("[unlockablesSelectionList]", stringBuilder4.ToString()); } } if (modifiedDisplayText.Contains("[storedUnlockablesList]")) { StringBuilder stringBuilder5 = new StringBuilder(); bool flag = false; for (int n = 0; n < StartOfRound.Instance.unlockablesList.unlockables.Count; n++) { if (StartOfRound.Instance.unlockablesList.unlockables[n].inStorage) { flag = true; stringBuilder5.Append("\n" + StartOfRound.Instance.unlockablesList.unlockables[n].unlockableName); } } modifiedDisplayText = (flag ? modifiedDisplayText.Replace("[storedUnlockablesList]", stringBuilder5.ToString()) : modifiedDisplayText.Replace("[storedUnlockablesList]", "[No items stored. While moving an object with B, press X to store it.]")); } if (modifiedDisplayText.Contains("[scanForItems]")) { System.Random random = new System.Random(StartOfRound.Instance.randomMapSeed + 91); int num2 = 0; int num3 = 0; int num4 = 0; GrabbableObject[] array = UnityEngine.Object.FindObjectsOfType(); for (int num5 = 0; num5 < array.Length; num5++) { if (array[num5].itemProperties.isScrap && !array[num5].isInShipRoom && !array[num5].isInElevator) { num4 += array[num5].itemProperties.maxValue - array[num5].itemProperties.minValue; num3 += Mathf.Clamp(random.Next(array[num5].itemProperties.minValue, array[num5].itemProperties.maxValue), array[num5].scrapValue - 6 * num5, array[num5].scrapValue + 9 * num5); num2++; } } modifiedDisplayText = modifiedDisplayText.Replace("[scanForItems]", $"There are {num2} objects outside the ship, totalling at an approximate value of ${num3}."); } modifiedDisplayText = ((numberOfItemsInDropship > 0) ? modifiedDisplayText.Replace("[numberOfItemsOnRoute]", $"{numberOfItemsInDropship} purchased items on route.") : modifiedDisplayText.Replace("[numberOfItemsOnRoute]", "")); modifiedDisplayText = modifiedDisplayText.Replace("[currentDay]", DateTime.Now.DayOfWeek.ToString()); modifiedDisplayText = modifiedDisplayText.Replace("[variableAmount]", playerDefinedAmount.ToString()); modifiedDisplayText = modifiedDisplayText.Replace("[playerCredits]", "$" + groupCredits); modifiedDisplayText = modifiedDisplayText.Replace("[totalCost]", "$" + totalCostOfItems); modifiedDisplayText = modifiedDisplayText.Replace("[companyBuyingPercent]", $"{Mathf.RoundToInt(StartOfRound.Instance.companyBuyingRate * 100f)}%"); if ((bool)displayingPersistentImage) { modifiedDisplayText = "\n\n\n\n\n\n\n\n\n\n\n\n\n\nn\n\n\n\n\n\n" + modifiedDisplayText; } return modifiedDisplayText; } public void RunTerminalEvents(TerminalNode node) { if (!string.IsNullOrWhiteSpace(node.terminalEvent)) { if (node.terminalEvent == "setUpTerminal") { ES3.Save("HasUsedTerminal", value: true, "LCGeneralSaveData"); } if (node.terminalEvent == "cheat_ResetCredits" && (GameNetworkManager.Instance.localPlayerController.playerUsername == "Zeekerss" || GameNetworkManager.Instance.localPlayerController.playerUsername == "Blueray" || GameNetworkManager.Instance.localPlayerController.playerUsername == "Puffo") && GameNetworkManager.Instance.localPlayerController.IsServer) { useCreditsCooldown = true; groupCredits = 2500; SyncGroupCreditsServerRpc(groupCredits, numberOfItemsInDropship); } if (node.terminalEvent == "switchCamera") { StartOfRound.Instance.mapScreen.SwitchRadarTargetForward(callRPC: true); } } } public void LoadTerminalImage(TerminalNode node) { if ((bool)node.displayVideo) { terminalImage.enabled = true; terminalImage.texture = videoTexture; displayingPersistentImage = null; videoPlayer.clip = node.displayVideo; videoPlayer.enabled = true; if (node.loadImageSlowly) { if (loadImageCoroutine != null) { StopCoroutine(loadImageCoroutine); } loadImageCoroutine = StartCoroutine(loadImageSlowly()); } return; } videoPlayer.enabled = false; if (node.displayTexture != null) { terminalImage.enabled = true; terminalImage.texture = node.displayTexture; if (node.persistentImage) { if (StartOfRound.Instance.inShipPhase || displayingPersistentImage == node.displayTexture) { displayingPersistentImage = null; terminalImage.enabled = false; return; } displayingPersistentImage = node.displayTexture; } if (node.loadImageSlowly) { if (loadImageCoroutine != null) { StopCoroutine(loadImageCoroutine); } loadImageCoroutine = StartCoroutine(loadImageSlowly()); } } else if (!displayingPersistentImage) { terminalImage.enabled = false; } } private IEnumerator loadImageSlowly() { float paddingValue = 300f; while (paddingValue > 0f) { paddingValue -= Time.deltaTime * 100f * UnityEngine.Random.Range(0.3f, 1.7f); terminalImageMask.padding = new Vector4(0f, paddingValue, 0f, 0f); yield return null; } terminalImageMask.padding = Vector4.zero; } public void OnSubmit() { if (!terminalInUse) { return; } if (textAdded == 0) { screenText.ActivateInputField(); screenText.Select(); return; } if (currentNode != null && currentNode.acceptAnything) { LoadNewNode(currentNode.terminalOptions[0].result); } else { TerminalNode terminalNode = ParsePlayerSentence(); if (terminalNode != null) { if (terminalNode.itemCost != 0 || terminalNode.buyRerouteToMoon == -2) { totalCostOfItems = terminalNode.itemCost * playerDefinedAmount; } if (terminalNode.buyItemIndex != -1 || (terminalNode.buyRerouteToMoon != -1 && terminalNode.buyRerouteToMoon != -2) || terminalNode.shipUnlockableID != -1) { LoadNewNodeIfAffordable(terminalNode); } else if (terminalNode.creatureFileID != -1) { AttemptLoadCreatureFileNode(terminalNode); } else if (terminalNode.storyLogFileID != -1) { AttemptLoadStoryLogFileNode(terminalNode); } else { LoadNewNode(terminalNode); } } else { modifyingText = true; screenText.text = screenText.text.Substring(0, screenText.text.Length - textAdded); currentText = screenText.text; textAdded = 0; } } screenText.ActivateInputField(); screenText.Select(); if (forceScrollbarCoroutine != null) { StopCoroutine(forceScrollbarCoroutine); } forceScrollbarCoroutine = StartCoroutine(forceScrollbarUp()); } private void AttemptLoadCreatureFileNode(TerminalNode node) { if (scannedEnemyIDs.Contains(node.creatureFileID)) { newlyScannedEnemyIDs.Remove(node.creatureFileID); LoadNewNode(node); } else { LoadNewNode(terminalNodes.specialNodes[6]); } } private void AttemptLoadStoryLogFileNode(TerminalNode node) { if (unlockedStoryLogs.Contains(node.storyLogFileID)) { newlyUnlockedStoryLogs.Remove(node.storyLogFileID); LoadNewNode(node); } else { LoadNewNode(terminalNodes.specialNodes[9]); } } private void LoadNewNodeIfAffordable(TerminalNode node) { StartOfRound startOfRound = UnityEngine.Object.FindObjectOfType(); if (node.buyRerouteToMoon != -1 && node.buyRerouteToMoon != -2) { if (!startOfRound.inShipPhase || startOfRound.travellingToNewLevel) { LoadNewNode(terminalNodes.specialNodes[3]); return; } playerDefinedAmount = 1; } else if (node.shipUnlockableID != -1) { playerDefinedAmount = 1; } if (node.buyItemIndex != -1) { if (node.buyItemIndex != -7) { totalCostOfItems = (int)((float)buyableItemsList[node.buyItemIndex].creditsWorth * ((float)itemSalesPercentages[node.buyItemIndex] / 100f) * (float)playerDefinedAmount); } else { totalCostOfItems = (int)((float)node.itemCost * ((float)itemSalesPercentages[node.buyItemIndex] / 100f) * (float)playerDefinedAmount); } } else if (node.buyRerouteToMoon != -1) { totalCostOfItems = node.itemCost; } else if (node.shipUnlockableID != -1) { totalCostOfItems = node.itemCost; } float num = 0f; if (node.buyItemIndex != -1) { for (int i = 0; i < playerDefinedAmount; i++) { num = ((node.buyItemIndex != -7) ? (num + 1f) : (num + 9f)); } } if (useCreditsCooldown) { LoadNewNode(terminalNodes.specialNodes[5]); return; } if (node.shipUnlockableID != -1) { if (node.shipUnlockableID >= StartOfRound.Instance.unlockablesList.unlockables.Count) { LoadNewNode(terminalNodes.specialNodes[16]); return; } UnlockableItem unlockableItem = StartOfRound.Instance.unlockablesList.unlockables[node.shipUnlockableID]; Debug.Log($"Is unlockable '{unlockableItem.unlockableName} in storage?: {unlockableItem.inStorage}"); if (unlockableItem.inStorage && (unlockableItem.hasBeenUnlockedByPlayer || unlockableItem.alreadyUnlocked)) { Debug.Log("Moving object out of storage 1"); if (node.returnFromStorage || unlockableItem.maxNumber <= 1) { Debug.Log("Moving object out of storage 2"); startOfRound.ReturnUnlockableFromStorageServerRpc(node.shipUnlockableID); LoadNewNode(terminalNodes.specialNodes[17]); return; } } } if (groupCredits < totalCostOfItems) { LoadNewNode(terminalNodes.specialNodes[2]); return; } if (playerDefinedAmount > 12 || num + (float)numberOfItemsInDropship > 12f) { LoadNewNode(terminalNodes.specialNodes[4]); return; } if (node.buyRerouteToMoon != -1 && node.buyRerouteToMoon != -2) { if (StartOfRound.Instance.levels[node.buyRerouteToMoon] == StartOfRound.Instance.currentLevel) { LoadNewNode(terminalNodes.specialNodes[8]); return; } } else if (node.shipUnlockableID != -1) { UnlockableItem unlockableItem2 = StartOfRound.Instance.unlockablesList.unlockables[node.shipUnlockableID]; if ((!StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipHasLanded) || StartOfRound.Instance.shipAnimator.GetCurrentAnimatorStateInfo(0).tagHash != Animator.StringToHash("ShipIdle")) { LoadNewNode(terminalNodes.specialNodes[15]); return; } if (!ShipDecorSelection.Contains(node) && !unlockableItem2.alwaysInStock && (!node.buyUnlockable || unlockableItem2.shopSelectionNode == null)) { Debug.Log("Not in stock, node: " + node.name); LoadNewNode(terminalNodes.specialNodes[16]); return; } if (unlockableItem2.hasBeenUnlockedByPlayer || unlockableItem2.alreadyUnlocked) { Debug.Log("Already unlocked, node: " + node.name); LoadNewNode(terminalNodes.specialNodes[14]); return; } } if ((GameNetworkManager.Instance.isDemo && node.itemCost > 0 && node.lockedInDemo) || (node.buyItemIndex != -1 && buyableItemsList[node.buyItemIndex].lockedInDemo)) { LoadNewNode(terminalNodes.specialNodes[18]); return; } if (!node.isConfirmationNode) { if (node.shipUnlockableID != -1) { if (node.buyUnlockable) { groupCredits = Mathf.Clamp(groupCredits - totalCostOfItems, 0, 10000000); } } else { groupCredits = Mathf.Clamp(groupCredits - totalCostOfItems, 0, 10000000); } } if (!node.isConfirmationNode) { if (node.buyItemIndex != -1) { for (int j = 0; j < playerDefinedAmount; j++) { if (node.buyItemIndex == -7) { orderedItemsFromTerminal.Add(5); for (int k = 0; k < 4; k++) { orderedItemsFromTerminal.Add(1); } for (int l = 0; l < 4; l++) { orderedItemsFromTerminal.Add(6); } numberOfItemsInDropship += 9; } else { orderedItemsFromTerminal.Add(node.buyItemIndex); numberOfItemsInDropship++; } } if (!base.IsServer) { SyncBoughtItemsWithServer(orderedItemsFromTerminal.ToArray(), numberOfItemsInDropship); } else { SyncGroupCreditsClientRpc(groupCredits, numberOfItemsInDropship); } } else if (node.buyRerouteToMoon != -1 && node.buyRerouteToMoon != -2) { useCreditsCooldown = true; startOfRound.ChangeLevelServerRpc(node.buyRerouteToMoon, groupCredits); } else if (node.shipUnlockableID != -1 && node.buyUnlockable) { HUDManager.Instance.DisplayTip("Tip", "Press B to move and place objects in the ship, E to cancel.", isWarning: false, useSave: true, "LC_MoveObjectsTip"); startOfRound.BuyShipUnlockableServerRpc(node.shipUnlockableID, groupCredits); } } LoadNewNode(node); } private void SyncBoughtItemsWithServer(int[] boughtItems, int numItemsInShip) { if (!base.IsServer && boughtItems.Length <= 12) { useCreditsCooldown = true; BuyItemsServerRpc(boughtItems, groupCredits, numItemsInShip); orderedItemsFromTerminal.Clear(); } } [ServerRpc(RequireOwnership = false)] public void BuyItemsServerRpc(int[] boughtItems, int newGroupCredits, int numItemsInShip) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager == null || !networkManager.IsListening) { return; } if (__rpc_exec_stage != __RpcExecStage.Server && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams serverRpcParams = default(ServerRpcParams); FastBufferWriter bufferWriter = __beginSendServerRpc(4003509079u, serverRpcParams, RpcDelivery.Reliable); bool value = boughtItems != null; bufferWriter.WriteValueSafe(in value, default(FastBufferWriter.ForPrimitives)); if (value) { bufferWriter.WriteValueSafe(boughtItems, default(FastBufferWriter.ForPrimitives)); } BytePacker.WriteValueBitPacked(bufferWriter, newGroupCredits); BytePacker.WriteValueBitPacked(bufferWriter, numItemsInShip); __endSendServerRpc(ref bufferWriter, 4003509079u, serverRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Server && (networkManager.IsServer || networkManager.IsHost) && boughtItems.Length <= 12) { orderedItemsFromTerminal.AddRange(boughtItems.ToList()); groupCredits = newGroupCredits; SyncGroupCreditsClientRpc(newGroupCredits, numItemsInShip); } } [ServerRpc(RequireOwnership = false)] public void SyncGroupCreditsServerRpc(int newGroupCredits, int numItemsInShip) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager == null || !networkManager.IsListening) { return; } if (__rpc_exec_stage != __RpcExecStage.Server && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams serverRpcParams = default(ServerRpcParams); FastBufferWriter bufferWriter = __beginSendServerRpc(3085407145u, serverRpcParams, RpcDelivery.Reliable); BytePacker.WriteValueBitPacked(bufferWriter, newGroupCredits); BytePacker.WriteValueBitPacked(bufferWriter, numItemsInShip); __endSendServerRpc(ref bufferWriter, 3085407145u, serverRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Server && (networkManager.IsServer || networkManager.IsHost)) { if (newGroupCredits < 0) { newGroupCredits = groupCredits; } else { groupCredits = newGroupCredits; } SyncGroupCreditsClientRpc(newGroupCredits, numItemsInShip); } } [ClientRpc] public void SyncGroupCreditsClientRpc(int newGroupCredits, int numItemsInShip) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { if (__rpc_exec_stage != __RpcExecStage.Client && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams clientRpcParams = default(ClientRpcParams); FastBufferWriter bufferWriter = __beginSendClientRpc(2039928764u, clientRpcParams, RpcDelivery.Reliable); BytePacker.WriteValueBitPacked(bufferWriter, newGroupCredits); BytePacker.WriteValueBitPacked(bufferWriter, numItemsInShip); __endSendClientRpc(ref bufferWriter, 2039928764u, clientRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Client && (networkManager.IsClient || networkManager.IsHost)) { numberOfItemsInDropship = numItemsInShip; useCreditsCooldown = false; groupCredits = newGroupCredits; } } } private TerminalNode ParsePlayerSentence() { broadcastedCodeThisFrame = false; string s = screenText.text.Substring(screenText.text.Length - textAdded); s = RemovePunctuation(s); string[] array = s.Split(" ", StringSplitOptions.RemoveEmptyEntries); TerminalKeyword terminalKeyword = null; if (currentNode != null && currentNode.overrideOptions) { for (int i = 0; i < array.Length; i++) { TerminalNode terminalNode = ParseWordOverrideOptions(array[i], currentNode.terminalOptions); if (terminalNode != null) { return terminalNode; } } return null; } if (array.Length > 1) { string text = array[0]; if (!(text == "switch")) { if (text == "ping") { int num = CheckForPlayerNameCommand(array[0], array[1]); if (num != -1) { StartOfRound.Instance.mapScreen.PingRadarBooster(num); return terminalNodes.specialNodes[21]; } } } else { int num2 = CheckForPlayerNameCommand(array[0], array[1]); if (num2 != -1) { StartOfRound.Instance.mapScreen.SwitchRadarTargetAndSync(num2); return terminalNodes.specialNodes[20]; } } } terminalKeyword = CheckForExactSentences(s); if (terminalKeyword != null) { if (terminalKeyword.accessTerminalObjects) { CallFunctionInAccessibleTerminalObject(terminalKeyword.word); PlayBroadcastCodeEffect(); return null; } if (terminalKeyword.specialKeywordResult != null) { return terminalKeyword.specialKeywordResult; } } string value = Regex.Match(s, "\\d+").Value; if (!string.IsNullOrWhiteSpace(value)) { playerDefinedAmount = Mathf.Clamp(int.Parse(value), 0, 10); } else { playerDefinedAmount = 1; } if (array.Length > 5) { return null; } TerminalKeyword terminalKeyword2 = null; TerminalKeyword terminalKeyword3 = null; new List(); bool flag = false; hasGottenNoun = false; hasGottenVerb = false; for (int j = 0; j < array.Length; j++) { terminalKeyword = ParseWord(array[j]); if (terminalKeyword != null) { Debug.Log("Parsed word: " + array[j]); if (terminalKeyword.isVerb) { if (hasGottenVerb) { continue; } hasGottenVerb = true; terminalKeyword2 = terminalKeyword; } else { if (hasGottenNoun) { continue; } hasGottenNoun = true; terminalKeyword3 = terminalKeyword; if (terminalKeyword.accessTerminalObjects) { broadcastedCodeThisFrame = true; CallFunctionInAccessibleTerminalObject(terminalKeyword.word); flag = true; } } if (!flag && hasGottenNoun && hasGottenVerb) { break; } } else { Debug.Log("Could not parse word: " + array[j]); } } if (broadcastedCodeThisFrame) { PlayBroadcastCodeEffect(); return terminalNodes.specialNodes[19]; } hasGottenNoun = false; hasGottenVerb = false; if (terminalKeyword3 == null) { return terminalNodes.specialNodes[10]; } if (terminalKeyword2 == null) { if (!(terminalKeyword3.defaultVerb != null)) { return terminalNodes.specialNodes[11]; } terminalKeyword2 = terminalKeyword3.defaultVerb; } for (int k = 0; k < terminalKeyword2.compatibleNouns.Length; k++) { if (terminalKeyword2.compatibleNouns[k].noun == terminalKeyword3) { Debug.Log($"noun keyword: {terminalKeyword3.word} ; verb keyword: {terminalKeyword2.word} ; result null? : {terminalKeyword2.compatibleNouns[k].result == null}"); Debug.Log("result: " + terminalKeyword2.compatibleNouns[k].result.name); return terminalKeyword2.compatibleNouns[k].result; } } return terminalNodes.specialNodes[12]; } private int CheckForPlayerNameCommand(string firstWord, string secondWord) { if (firstWord == "radar") { return -1; } if (secondWord.Length <= 2) { return -1; } Debug.Log("first word: " + firstWord + "; second word: " + secondWord); List list = new List(); for (int i = 0; i < StartOfRound.Instance.mapScreen.radarTargets.Count; i++) { list.Add(StartOfRound.Instance.mapScreen.radarTargets[i].name); Debug.Log($"name {i}: {list[i]}"); } secondWord = secondWord.ToLower(); Debug.Log($"Target names length: {list.Count}"); for (int j = 0; j < list.Count; j++) { Debug.Log("A"); string text = list[j].ToLower(); Debug.Log($"Word #{j}: {text}; length: {text.Length}"); for (int num = secondWord.Length; num > 2; num--) { Debug.Log($"c: {num}"); Debug.Log(secondWord.Substring(0, num)); if (text.StartsWith(secondWord.Substring(0, num))) { return j; } } } return -1; } private TerminalKeyword CheckForExactSentences(string playerWord) { for (int i = 0; i < terminalNodes.allKeywords.Length; i++) { if (terminalNodes.allKeywords[i].word == playerWord) { return terminalNodes.allKeywords[i]; } } return null; } private TerminalKeyword ParseWord(string playerWord, int specificityRequired = 2) { if (playerWord.Length < specificityRequired) { return null; } TerminalKeyword terminalKeyword = null; for (int i = 0; i < terminalNodes.allKeywords.Length; i++) { if (terminalNodes.allKeywords[i].isVerb && hasGottenVerb) { continue; } _ = terminalNodes.allKeywords[i].accessTerminalObjects; if (terminalNodes.allKeywords[i].word == playerWord) { return terminalNodes.allKeywords[i]; } if (!(terminalKeyword == null)) { continue; } for (int num = playerWord.Length; num > specificityRequired; num--) { if (terminalNodes.allKeywords[i].word.StartsWith(playerWord.Substring(0, num))) { terminalKeyword = terminalNodes.allKeywords[i]; } } } return terminalKeyword; } private TerminalNode ParseWordOverrideOptions(string playerWord, CompatibleNoun[] options) { for (int i = 0; i < options.Length; i++) { for (int num = playerWord.Length; num > 0; num--) { if (options[i].noun.word.StartsWith(playerWord.Substring(0, num))) { return options[i].result; } } } return null; } public void TextChanged(string newText) { if (currentNode == null) { return; } if (modifyingText) { modifyingText = false; return; } textAdded += newText.Length - currentText.Length; if (textAdded < 0) { screenText.text = currentText; textAdded = 0; } else if (textAdded > currentNode.maxCharactersToType) { screenText.text = currentText; textAdded = currentNode.maxCharactersToType; } else { currentText = newText; } } private string RemovePunctuation(string s) { StringBuilder stringBuilder = new StringBuilder(); foreach (char c in s) { if (!char.IsPunctuation(c)) { stringBuilder.Append(c); } } return stringBuilder.ToString().ToLower(); } private void CallFunctionInAccessibleTerminalObject(string word) { TerminalAccessibleObject[] array = UnityEngine.Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if (array[i].objectCode == word) { Debug.Log("Found accessible terminal object with corresponding string, calling function"); broadcastedCodeThisFrame = true; array[i].CallFunctionFromTerminal(); } } } private void PlayBroadcastCodeEffect() { codeBroadcastAnimator.SetTrigger("display"); terminalAudio.PlayOneShot(codeBroadcastSFX, 1f); } private void Awake() { playerActions = new PlayerActions(); playerActions.Movement.Enable(); } private void Start() { InitializeItemSalesPercentages(); terminalTrigger = base.gameObject.GetComponent(); roundManager = UnityEngine.Object.FindObjectOfType(); if (base.IsServer) { syncedTerminalValues = true; int num = ES3.Load("Reimburse", GameNetworkManager.Instance.currentSaveFileName, 0); groupCredits = ES3.Load("GroupCredits", GameNetworkManager.Instance.currentSaveFileName, TimeOfDay.Instance.quotaVariables.startingCredits) + num; Debug.Log($"Group credits: {groupCredits}"); if (ES3.KeyExists("EnemyScans", GameNetworkManager.Instance.currentSaveFileName)) { scannedEnemyIDs = ES3.Load("EnemyScans", GameNetworkManager.Instance.currentSaveFileName).ToList(); } if (ES3.KeyExists("StoryLogs", GameNetworkManager.Instance.currentSaveFileName)) { unlockedStoryLogs = ES3.Load("StoryLogs", GameNetworkManager.Instance.currentSaveFileName).ToList(); } else { unlockedStoryLogs.Add(0); } if (num > 0) { StartCoroutine(displayReimbursedTipDelay()); } } StartCoroutine(waitUntilFrameEndToSetActive(active: false)); } private IEnumerator waitUntilFrameEndToSetActive(bool active) { yield return new WaitForEndOfFrame(); terminalUIScreen.gameObject.SetActive(active); } private IEnumerator displayReimbursedTipDelay() { yield return new WaitForSeconds(3.5f); QuickMenuManager quickMenu = UnityEngine.Object.FindObjectOfType(); yield return new WaitUntil(() => !quickMenu.isMenuOpen); HUDManager.Instance.DisplayTip("Welcome back!", "You have been reimbursed for your previously bought tools. If you want them back, you will have to buy them.", isWarning: false, useSave: true, "LCTip_Reimbursed"); } [ServerRpc(RequireOwnership = false)] public void SyncTerminalValuesServerRpc() { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager == null || !networkManager.IsListening) { return; } if (__rpc_exec_stage != __RpcExecStage.Server && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams serverRpcParams = default(ServerRpcParams); FastBufferWriter bufferWriter = __beginSendServerRpc(1261428289u, serverRpcParams, RpcDelivery.Reliable); __endSendServerRpc(ref bufferWriter, 1261428289u, serverRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Server && (networkManager.IsServer || networkManager.IsHost)) { if (scannedEnemyIDs.Count > 0) { SyncTerminalValuesClientRpc(groupCredits, numberOfItemsInDropship, scannedEnemyIDs.ToArray(), unlockedStoryLogs.ToArray()); } else { SyncTerminalValuesClientRpc(groupCredits, numberOfItemsInDropship); } } } [ClientRpc] public void SyncTerminalValuesClientRpc(int newGroupCredits = 0, int numItemsInDropship = 0, int[] scannedEnemies = null, int[] storyLogs = null) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager == null || !networkManager.IsListening) { return; } if (__rpc_exec_stage != __RpcExecStage.Client && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams clientRpcParams = default(ClientRpcParams); FastBufferWriter bufferWriter = __beginSendClientRpc(1148560877u, clientRpcParams, RpcDelivery.Reliable); BytePacker.WriteValueBitPacked(bufferWriter, newGroupCredits); BytePacker.WriteValueBitPacked(bufferWriter, numItemsInDropship); bool value = scannedEnemies != null; bufferWriter.WriteValueSafe(in value, default(FastBufferWriter.ForPrimitives)); if (value) { bufferWriter.WriteValueSafe(scannedEnemies, default(FastBufferWriter.ForPrimitives)); } bool value2 = storyLogs != null; bufferWriter.WriteValueSafe(in value2, default(FastBufferWriter.ForPrimitives)); if (value2) { bufferWriter.WriteValueSafe(storyLogs, default(FastBufferWriter.ForPrimitives)); } __endSendClientRpc(ref bufferWriter, 1148560877u, clientRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage != __RpcExecStage.Client || (!networkManager.IsClient && !networkManager.IsHost) || syncedTerminalValues) { return; } syncedTerminalValues = true; numberOfItemsInDropship = numItemsInDropship; groupCredits = newGroupCredits; if (base.IsServer) { return; } if (scannedEnemies != null) { for (int i = 0; i < scannedEnemies.Length; i++) { scannedEnemyIDs.Add(scannedEnemies[i]); Debug.Log("Syncing scanned enemies list with clients"); } } if (storyLogs != null) { for (int j = 0; j < storyLogs.Length; j++) { unlockedStoryLogs.Add(storyLogs[j]); } } } public void BeginUsingTerminal() { terminalInUse = true; try { StartCoroutine(waitUntilFrameEndToSetActive(active: true)); GameNetworkManager.Instance.localPlayerController.inTerminalMenu = true; if (selectTextFieldCoroutine != null) { StopCoroutine(selectTextFieldCoroutine); } selectTextFieldCoroutine = StartCoroutine(selectTextFieldDelayed()); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, 0f, 0.13f, 0.13f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.PlayerInfo, 0f, 0.13f, 0.13f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, 0f, 0.35f, 0.13f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Tooltips, 1f, 0f, 0.6f); inputFieldText.enableWordWrapping = true; if (!ES3.Load("HasUsedTerminal", "LCGeneralSaveData", defaultValue: false)) { LoadNewNode(terminalNodes.specialNodes[0]); } else if (!usedTerminalThisSession) { LoadNewNode(terminalNodes.specialNodes[1]); } else { LoadNewNode(terminalNodes.specialNodes[13]); } if (!usedTerminalThisSession) { usedTerminalThisSession = true; if (!syncedTerminalValues) { SyncTerminalValuesServerRpc(); } } SetTerminalInUseLocalClient(inUse: true); if (StartOfRound.Instance.localPlayerUsingController && !GameNetworkManager.Instance.disableSteam) { SteamUtils.ShowGamepadTextInput(GamepadTextInputMode.Normal, GamepadTextInputLineMode.SingleLine, "Type command", currentNode.maxCharactersToType); SteamUtils.OnGamepadTextInputDismissed += OnGamepadTextInputDismissed_t; displayingSteamKeyboard = true; } terminalAudio.PlayOneShot(enterTerminalSFX); if (StartOfRound.Instance.localPlayerUsingController) { HUDManager.Instance.ChangeControlTip(0, "Quit terminal : [Start]", clearAllOther: true); } else { HUDManager.Instance.ChangeControlTip(0, "Quit terminal : [TAB]", clearAllOther: true); } } catch (Exception arg) { Debug.Log($"Caught error while entering computer terminal. Exiting player from terminal. Error: {arg}"); QuitTerminal(); } } public void OnGamepadTextInputDismissed_t(bool submitted) { if (submitted) { int maxCharactersToType = currentNode.maxCharactersToType; string enteredGamepadText = SteamUtils.GetEnteredGamepadText(); if (string.IsNullOrEmpty(enteredGamepadText) || enteredGamepadText.Length <= maxCharactersToType) { screenText.text += textAdded; OnSubmit(); } } } private IEnumerator selectTextFieldDelayed() { screenText.ActivateInputField(); yield return new WaitForSeconds(1f); screenText.Select(); } public void QuitTerminal() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; terminalTrigger.StopSpecialAnimation(); terminalInUse = false; StartCoroutine(waitUntilFrameEndToSetActive(active: false)); localPlayerController.inTerminalMenu = false; if (selectTextFieldCoroutine != null) { StopCoroutine(selectTextFieldCoroutine); } screenText.ReleaseSelection(); screenText.DeactivateInputField(); if (EventSystem.current != null) { EventSystem.current.SetSelectedGameObject(null); } scrollBarVertical.value = 0f; HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, 0f, 0.5f, 0.5f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.PlayerInfo, 0f, 1f, 1f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, 0f, 1f, 1f); HUDManager.Instance.PingHUDElement(HUDManager.Instance.Tooltips, 0f, 1f, 1f); if (displayingSteamKeyboard) { SteamUtils.OnGamepadTextInputDismissed -= OnGamepadTextInputDismissed_t; } if (localPlayerController.isHoldingObject && localPlayerController.currentlyHeldObjectServer != null) { localPlayerController.currentlyHeldObjectServer.SetControlTipsForItem(); } else { HUDManager.Instance.ClearControlTips(); } SetTerminalInUseLocalClient(inUse: false); terminalAudio.PlayOneShot(leaveTerminalSFX); } private void OnEnable() { playerActions.Movement.OpenMenu.performed += PressESC; } private void OnDisable() { Debug.Log("Terminal disabled, disabling ESC key listener"); playerActions.Movement.OpenMenu.performed -= PressESC; } private void PressESC(InputAction.CallbackContext context) { if (context.performed && terminalInUse) { QuitTerminal(); } } public void RotateShipDecorSelection() { System.Random random = new System.Random(StartOfRound.Instance.randomMapSeed + 65); ShipDecorSelection.Clear(); List list = new List(); for (int i = 0; i < StartOfRound.Instance.unlockablesList.unlockables.Count; i++) { if (StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode != null && !StartOfRound.Instance.unlockablesList.unlockables[i].alwaysInStock) { list.Add(StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode); } } int num = random.Next(4, 6); for (int j = 0; j < num; j++) { if (list.Count <= 0) { break; } TerminalNode item = list[random.Next(0, list.Count)]; ShipDecorSelection.Add(item); list.Remove(item); } } private void InitializeItemSalesPercentages() { itemSalesPercentages = new int[buyableItemsList.Length]; for (int i = 0; i < itemSalesPercentages.Length; i++) { Debug.Log($"Item sales percentages #{i}: {itemSalesPercentages[i]}"); itemSalesPercentages[i] = 100; } } public void SetItemSales() { if (itemSalesPercentages == null || itemSalesPercentages.Length == 0) { InitializeItemSalesPercentages(); } System.Random random = new System.Random(StartOfRound.Instance.randomMapSeed + 90); int num = Mathf.Clamp(random.Next(-10, 5), 0, 5); if (num <= 0) { return; } List list = new List(); for (int i = 0; i < buyableItemsList.Length; i++) { list.Add(i); itemSalesPercentages[i] = 100; } for (int j = 0; j < num; j++) { if (list.Count <= 0) { break; } int num2 = random.Next(0, list.Count); int maxValue = Mathf.Clamp(buyableItemsList[num2].highestSalePercentage, 0, 90); int i2 = 100 - random.Next(0, maxValue); i2 = RoundToNearestTen(i2); itemSalesPercentages[num2] = i2; list.RemoveAt(num2); } } private int RoundToNearestTen(int i) { return (int)Math.Round((double)i / 10.0) * 10; } public void SetTerminalInUseLocalClient(bool inUse) { SetTerminalInUseServerRpc(inUse); } [ServerRpc(RequireOwnership = false)] public void SetTerminalInUseServerRpc(bool inUse) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { if (__rpc_exec_stage != __RpcExecStage.Server && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams serverRpcParams = default(ServerRpcParams); FastBufferWriter bufferWriter = __beginSendServerRpc(4047492032u, serverRpcParams, RpcDelivery.Reliable); bufferWriter.WriteValueSafe(in inUse, default(FastBufferWriter.ForPrimitives)); __endSendServerRpc(ref bufferWriter, 4047492032u, serverRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Server && (networkManager.IsServer || networkManager.IsHost)) { SetTerminalInUseClientRpc(inUse); } } } [ClientRpc] public void SetTerminalInUseClientRpc(bool inUse) { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { if (__rpc_exec_stage != __RpcExecStage.Client && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams clientRpcParams = default(ClientRpcParams); FastBufferWriter bufferWriter = __beginSendClientRpc(2420057819u, clientRpcParams, RpcDelivery.Reliable); bufferWriter.WriteValueSafe(in inUse, default(FastBufferWriter.ForPrimitives)); __endSendClientRpc(ref bufferWriter, 2420057819u, clientRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage == __RpcExecStage.Client && (networkManager.IsClient || networkManager.IsHost)) { placeableObject.inUse = inUse; terminalLight.enabled = inUse; } } } public void SetTerminalNoLongerInUse() { placeableObject.inUse = false; terminalLight.enabled = false; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Terminal() { NetworkManager.__rpc_func_table.Add(1713627637u, __rpc_handler_1713627637); NetworkManager.__rpc_func_table.Add(1118892272u, __rpc_handler_1118892272); NetworkManager.__rpc_func_table.Add(4003509079u, __rpc_handler_4003509079); NetworkManager.__rpc_func_table.Add(3085407145u, __rpc_handler_3085407145); NetworkManager.__rpc_func_table.Add(2039928764u, __rpc_handler_2039928764); NetworkManager.__rpc_func_table.Add(1261428289u, __rpc_handler_1261428289); NetworkManager.__rpc_func_table.Add(1148560877u, __rpc_handler_1148560877); NetworkManager.__rpc_func_table.Add(4047492032u, __rpc_handler_4047492032); NetworkManager.__rpc_func_table.Add(2420057819u, __rpc_handler_2420057819); } private static void __rpc_handler_1713627637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { ByteUnpacker.ReadValueBitPacked(reader, out int value); target.__rpc_exec_stage = __RpcExecStage.Server; ((Terminal)target).PlayTerminalAudioServerRpc(value); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_1118892272(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { ByteUnpacker.ReadValueBitPacked(reader, out int value); target.__rpc_exec_stage = __RpcExecStage.Client; ((Terminal)target).PlayTerminalAudioClientRpc(value); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_4003509079(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { reader.ReadValueSafe(out bool value, default(FastBufferWriter.ForPrimitives)); int[] value2 = null; if (value) { reader.ReadValueSafe(out value2, default(FastBufferWriter.ForPrimitives)); } ByteUnpacker.ReadValueBitPacked(reader, out int value3); ByteUnpacker.ReadValueBitPacked(reader, out int value4); target.__rpc_exec_stage = __RpcExecStage.Server; ((Terminal)target).BuyItemsServerRpc(value2, value3, value4); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_3085407145(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { ByteUnpacker.ReadValueBitPacked(reader, out int value); ByteUnpacker.ReadValueBitPacked(reader, out int value2); target.__rpc_exec_stage = __RpcExecStage.Server; ((Terminal)target).SyncGroupCreditsServerRpc(value, value2); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_2039928764(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { ByteUnpacker.ReadValueBitPacked(reader, out int value); ByteUnpacker.ReadValueBitPacked(reader, out int value2); target.__rpc_exec_stage = __RpcExecStage.Client; ((Terminal)target).SyncGroupCreditsClientRpc(value, value2); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_1261428289(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = __RpcExecStage.Server; ((Terminal)target).SyncTerminalValuesServerRpc(); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_1148560877(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { ByteUnpacker.ReadValueBitPacked(reader, out int value); ByteUnpacker.ReadValueBitPacked(reader, out int value2); reader.ReadValueSafe(out bool value3, default(FastBufferWriter.ForPrimitives)); int[] value4 = null; if (value3) { reader.ReadValueSafe(out value4, default(FastBufferWriter.ForPrimitives)); } reader.ReadValueSafe(out bool value5, default(FastBufferWriter.ForPrimitives)); int[] value6 = null; if (value5) { reader.ReadValueSafe(out value6, default(FastBufferWriter.ForPrimitives)); } target.__rpc_exec_stage = __RpcExecStage.Client; ((Terminal)target).SyncTerminalValuesClientRpc(value, value2, value4, value6); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_4047492032(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { reader.ReadValueSafe(out bool value, default(FastBufferWriter.ForPrimitives)); target.__rpc_exec_stage = __RpcExecStage.Server; ((Terminal)target).SetTerminalInUseServerRpc(value); target.__rpc_exec_stage = __RpcExecStage.None; } } private static void __rpc_handler_2420057819(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { NetworkManager networkManager = target.NetworkManager; if ((object)networkManager != null && networkManager.IsListening) { reader.ReadValueSafe(out bool value, default(FastBufferWriter.ForPrimitives)); target.__rpc_exec_stage = __RpcExecStage.Client; ((Terminal)target).SetTerminalInUseClientRpc(value); target.__rpc_exec_stage = __RpcExecStage.None; } } protected internal override string __getTypeName() { return "Terminal"; } }